com.rubecula.math
Class Mill

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.Vector
                    |
                    +--java.util.Stack
                          |
                          +--com.rubecula.jquantity.Mill
                                |
                                +--com.rubecula.math.Mill
All Implemented Interfaces:
Auditable, java.lang.Cloneable, java.util.Collection, Identifiable, java.util.List, Lookupable, MillInterface, java.util.RandomAccess, java.io.Serializable

public class Mill
extends Mill

This class extends the JQuantity Mill to be useful for general mathematical functions.

Since:
V_0_2
Version:
$Revision: 1.8 $
Author:
Robin Hillyard
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.util.AbstractList
 
Field Summary
 
Fields inherited from class com.rubecula.jquantity.Mill
CONSTANTS, K__1, K_0, K_1, K_10, K_2, K_3, K_E, K_MEM, K_PI, OP_2ATAN, OP_AUDIT, OP_CHS, OP_COPY, OP_DIFFERENCE, OP_E, OP_EXP, OP_INV, OP_LOG, OP_NOOP, OP_PI, OP_POWER, OP_PRODUCT, OP_QUOTIENT, OP_SUM, OP_SWAP, OP_TANHALF
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
Mill(java.lang.String name)
           
 
Method Summary
 void addMacro(java.lang.String name, java.lang.String expansion)
           
 AlphabeticalMap getOperations()
          Method to get a map which represents the supported functions of this Mill.
static void main(java.lang.String[] args)
          Main method for testing this class.
 void operate(java.lang.String operator)
          Mutating method to apply the operation operator to the stack.
 
Methods inherited from class com.rubecula.jquantity.Mill
audit, audit, audit, getAdy, getIdentifier, getValue, help, lookupOperator, push, setValue
 
Methods inherited from class java.util.Stack
empty, peek, pop, push, search
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.rubecula.util.MillInterface
pop, size
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

Mill

public Mill(java.lang.String name)
Method Detail

operate

public void operate(java.lang.String operator)
             throws java.util.EmptyStackException,
                    MillException

Mutating method to apply the operation operator to the stack. The number of items required on the stack prior to the operation and the number of items left on the stack afterwards depends upon the operation.

Specified by:
operate in interface MillInterface
Overrides:
operate in class Mill
Parameters:
operator - the name for the operation. For the operators supported by the superclass, see com.rubecula.jquantity.Mill#operator(String). The following operators are additionally supported by this Mill:
cos
Pop the stack and push its cosine.
sin
Pop the stack and push its sine.
tan
Pop the stack and push its tangent.
cot
Pop the stack and push its cotangent.
sec
Pop the stack and push its secant.
csc
Pop the stack and push its cosecant.
cosh
Pop the stack and push its hyperbolic cosine.
sinh
Pop the stack and push its hyperbolic sine.
tanh
Pop the stack and push its hyperbolic tangent.
sech
Pop the stack and push its hyperbolic secant.
csch
Pop the stack and push its hyperbolic cosecant.
coth
Pop the stack and push its hyperbolic cotangent.
log10
Pop the stack and push its Napierian logarithm (log to base 10).
Throws:
java.util.EmptyStackException
MillException

addMacro

public void addMacro(java.lang.String name,
                     java.lang.String expansion)
              throws MillException
MillException

getOperations

public AlphabeticalMap getOperations()
Method to get a map which represents the supported functions of this Mill. The keys are the operators (typically abbreviations, all lower case) and the entries are the full mathematical function names (all lower case).

Specified by:
getOperations in interface MillInterface
Overrides:
getOperations in class Mill
Returns:
a map of the abbreviation-function mappings for the supported operations of this mill.

main

public static void main(java.lang.String[] args)
Description copied from class: Mill
Main method for testing this class.

Parameters:
args - String[] : the command line options.