tenua.symbol
Class Value
java.lang.Object
tenua.symbol.Symbol
tenua.symbol.Value
- Direct Known Subclasses:
- Variable
public class Value
- extends Symbol
A Symbol that has a value that can be pushed onto the stack
- Author:
- Daniel Wachsstock
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ZERO
public static final Value ZERO
eval
public void eval(DoubleStack s,
VariableMemento v)
- push the value onto the stack
- Specified by:
eval in class Symbol
- Parameters:
s - the stack to push ontov - ignored
getValue
public double getValue(VariableMemento v)
- get the value
- Parameters:
v - ignored
- Returns:
- the value
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
toString
public void toString(java.util.Stack stringStack,
java.util.Stack precedenceStack,
SymbolTable st)
- Description copied from class:
Symbol
- pushes a StringBuffer that reflects this Symbol, with all its arguments
- Overrides:
toString in class Symbol
- Parameters:
stringStack - the stack of StringBuffer from which to pop arguments
and to which to push resultsprecedenceStack - a stack to be push'ed and pop'ed in parallel with
stringStack that contains Integers, corresponding to the precedence of
the arguments onstringStack. This is used to determine placement of
parentheses. Anything other than a binary operation should push
Symbol.maxPrecedencest - the SymbolTable to get Symbol names from
Note: the name is a misnomer; it uses StringBuffer's, not String's