|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractList
|
+--java.util.Vector
|
+--java.util.Stack
|
+--com.rubecula.jquantity.Mill
This class is responsible for evaluating operations on Presentable objects. It is named in honor of Charles Babbage, and not forgetting the early days of computing, especially in the United Kingdom, and paricularly for Maurice Wilkes.
| Nested Class Summary |
| Nested classes inherited from class java.util.AbstractList |
|
| Field Summary | |
protected static java.util.HashMap |
CONSTANTS
The system defined (constant) memory for this mill. |
protected static java.lang.String |
K__1
|
protected static java.lang.String |
K_0
|
protected static java.lang.String |
K_1
|
protected static java.lang.String |
K_10
|
protected static java.lang.String |
K_2
|
protected static java.lang.String |
K_3
|
protected static java.lang.String |
K_E
|
protected static java.lang.String |
K_MEM
|
protected static java.lang.String |
K_PI
|
protected static java.lang.String |
OP_2ATAN
|
protected static java.lang.String |
OP_AUDIT
|
protected static java.lang.String |
OP_CHS
|
protected static java.lang.String |
OP_COPY
|
protected static java.lang.String |
OP_DIFFERENCE
|
protected static java.lang.String |
OP_E
|
protected static java.lang.String |
OP_EXP
|
protected static java.lang.String |
OP_INV
|
protected static java.lang.String |
OP_LOG
|
protected static java.lang.String |
OP_NOOP
|
protected static java.lang.String |
OP_PI
|
protected static java.lang.String |
OP_POWER
|
protected static java.lang.String |
OP_PRODUCT
|
protected static java.lang.String |
OP_QUOTIENT
|
protected static java.lang.String |
OP_SUM
|
protected static java.lang.String |
OP_SWAP
|
protected static java.lang.String |
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)
Principal constructor for a new Mill. |
|
| Method Summary | |
java.lang.String |
audit()
Method to return a detailed (unlabeled) string from an object for debugging purposes. |
void |
audit(java.io.PrintStream out,
java.lang.String label)
Method to output detailed string from an object for debugging purposes. |
java.lang.String |
audit(java.lang.String label)
Method to return a detailed string from an object for debugging purposes. |
int |
getAdy(java.lang.String operator)
This method returns the number of presentables needed to popped off the stack for an operation. |
java.lang.String |
getIdentifier()
Method to get the specific identifier for an object. |
AlphabeticalMap |
getOperations()
Method to get a map which represents the supported functions of this Mill. |
Presentable |
getValue(java.lang.String key)
Method to get a memory presentable defined by key. |
void |
help(java.io.PrintStream output)
This method outputs help information listing and describing the various operations supported by the mill. |
java.lang.String |
lookupOperator(java.lang.String description)
This method returns the name of an operator whose description matches the string description in some way. |
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. |
void |
push(Presentable operand)
Mutating method to push operand onto the top of the Mill stack. |
void |
setValue(java.lang.String key,
Presentable value)
Method to set a value which can later be retrieved using the name given (using the method defined by the Lookupable interface). |
| 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 |
| Field Detail |
protected static final java.util.HashMap CONSTANTS
protected static final java.lang.String OP_SUM
protected static final java.lang.String OP_DIFFERENCE
protected static final java.lang.String OP_PRODUCT
protected static final java.lang.String OP_QUOTIENT
protected static final java.lang.String OP_POWER
protected static final java.lang.String OP_2ATAN
protected static final java.lang.String OP_TANHALF
protected static final java.lang.String OP_EXP
protected static final java.lang.String OP_LOG
protected static final java.lang.String OP_CHS
protected static final java.lang.String OP_INV
protected static final java.lang.String OP_PI
protected static final java.lang.String OP_E
protected static final java.lang.String OP_COPY
protected static final java.lang.String OP_AUDIT
protected static final java.lang.String OP_SWAP
protected static final java.lang.String OP_NOOP
protected static final java.lang.String K_PI
protected static final java.lang.String K_E
protected static final java.lang.String K__1
protected static final java.lang.String K_0
protected static final java.lang.String K_1
protected static final java.lang.String K_2
protected static final java.lang.String K_3
protected static final java.lang.String K_10
protected static final java.lang.String K_MEM
| Constructor Detail |
public Mill(java.lang.String name)
name - by which this Mill will be referred to.| Method Detail |
public void push(Presentable operand)
throws MillException
push in interface MillInterfaceoperand - a presentable object which will displace the former top
of the stack to the second position and itself become the top object.
MillException - operand not a BaseNumber.
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.
operate in interface MillInterfaceoperator - the name for the operation.
The following operators ONLY are supported by this Mill:
java.util.EmptyStackException
MillExceptionpublic Presentable getValue(java.lang.String key)
getValue in interface Lookupablekey - the name of the memory object, without any preceding "$".
public void setValue(java.lang.String key,
Presentable value)
throws MillException
setValue in interface MillInterfacekey - the name or key by which this value can be retrieved
(without any preceding "$").value - a Presentable value which is lookupable.
MillException - if memory slot name cannot be set to value,
because the name is already in use (or an attempt to remove a constant).public AlphabeticalMap getOperations()
getOperations in interface MillInterface
public java.lang.String lookupOperator(java.lang.String description)
throws MillException
lookupOperator in interface MillInterfacedescription - the mathematical name or description of the operator.
MillException - more than one operator matched.public void help(java.io.PrintStream output)
help in interface MillInterfaceoutput - an output stream.public java.lang.String getIdentifier()
getIdentifier in interface Identifiablepublic java.lang.String audit(java.lang.String label)
audit in interface Auditablelabel - the label to associate with the data.
If label is non-null, a more detailed audit will be returned (this
normally occurs only at the top level).
public java.lang.String audit()
audit in interface Auditable
public void audit(java.io.PrintStream out,
java.lang.String label)
audit in interface Auditableout - the output stream.label - the label to attach to the output (may be null).
public int getAdy(java.lang.String operator)
throws MillException
getAdy in interface MillInterfaceoperator - the name (abbreviation) of the operator.
MillException - operator is not supported.public static void main(java.lang.String[] args)
args - String[] : the command line options.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||