slogo.parser
Class SLogoContext
java.lang.Object
slogo.parser.SLogoContext
- All Implemented Interfaces:
- Context
public class SLogoContext
- extends java.lang.Object
- implements Context
Method Summary |
void |
add(java.lang.String name,
java.lang.Object o)
Adds variable/name to current context |
java.lang.Object |
getValue(java.lang.String name)
Looks in the current context and then on up the chain |
void |
popContext()
|
void |
pushNewContext()
|
java.lang.Object |
value(java.lang.String name)
If there are local/global variables, a variable might have a different
value depending on the Context, so Contexts should support determining
the value of an identifier (this method may be superfluous). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
contextList
private java.util.Stack<State> contextList
contextID
private int contextID
SLogoContext
public SLogoContext()
value
public java.lang.Object value(java.lang.String name)
- Description copied from interface:
Context
- If there are local/global variables, a variable might have a different
value depending on the Context, so Contexts should support determining
the value of an identifier (this method may be superfluous).
- Specified by:
value
in interface Context
- Parameters:
name
- identifier being evaluated in this Context
- Returns:
- the value of the identifier in this Context
getValue
public java.lang.Object getValue(java.lang.String name)
- Looks in the current context and then on up the chain
- Parameters:
name
- the name of the Object
- Returns:
- the Object with that name
add
public void add(java.lang.String name,
java.lang.Object o)
- Adds variable/name to current context
- Parameters:
name
- o
-
pushNewContext
public void pushNewContext()
popContext
public void popContext()