slogo.language
Class SLogoContext
java.lang.Object
slogo.language.SLogoContext
- All Implemented Interfaces:
- Context
public class SLogoContext
- extends java.lang.Object
- implements Context
Class that implements the Context interface. To users
SlogoContext is like a map from a name to an object
that will need to be accessed by the instructions. The
only context created (in the constructor) is a map that
gives a turtle which will be the turtle we are using in
the GUI. So context allows us to get access to the turtle.
- Author:
- tshishikub
Field Summary |
protected static java.util.Map<java.lang.String,java.lang.Object> |
nameToObject
|
Method Summary |
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 |
nameToObject
protected static java.util.Map<java.lang.String,java.lang.Object> nameToObject
SLogoContext
public SLogoContext(Turtle turtle)
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