|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecttenua.symbol.Symbol
tenua.symbol.Value
tenua.symbol.Variable
public class Variable
A Symbol that has a value that can be pushed onto the stack
and can be changed. To allow for different states of the symbol table,
a Variable has a default value but can pull its value from a
VariableMemento.
| Field Summary |
|---|
| Fields inherited from class tenua.symbol.Value |
|---|
ZERO |
| Fields inherited from class tenua.symbol.Symbol |
|---|
CLEAR_STACK, maxPrecedence |
| Method Summary | |
|---|---|
void |
assign(double d,
VariableMemento v)
assign a new value |
void |
eval(DoubleStack s,
VariableMemento v)
get the value |
double |
getValue(VariableMemento v)
get the value |
void |
reset(VariableMemento v)
set the value for this variable in a memento to the default |
java.lang.String |
toString()
|
void |
toString(java.util.Stack stringStack,
java.util.Stack precedenceStack,
SymbolTable st)
pushes a StringBuffer that reflects this Symbol, with all its arguments |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public void eval(DoubleStack s,
VariableMemento v)
eval in class Values - the stack to push ontov - the memento to use. If v == null, use the default valuepublic double getValue(VariableMemento v)
getValue in class Valuev - the memento to use. If v==null, use the default value
public void assign(double d,
VariableMemento v)
d - the new valuev - the memento to use. if v == null, assign to the default valuepublic void reset(VariableMemento v)
v - the memento. If v == null, does nothingpublic java.lang.String toString()
toString in class Value
public void toString(java.util.Stack stringStack,
java.util.Stack precedenceStack,
SymbolTable st)
Symbol
toString in class ValuestringStack - 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
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||