|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectslogo.jelan.GrammarElement
slogo.jelan.instructions.Instruction
slogo.jelan.instructions.Assignment
public class Assignment
An assignment instruction assigns an expression to a variable, updating the global state to reflect the assignment.
Executing the assignment instruction causes the expression to be evaluated and assigned to the variable, until the assignment instruction executes, the expression isn't evaluated.
Constructor Summary | |
---|---|
Assignment(Variable v,
Expression e)
Construct an Assignment instruction from a variable and an expression, e.g., X = expression. |
Method Summary | |
---|---|
java.lang.Double |
evaluate(Context c)
Evaluate the expression that's part of this instruction and update a global map/store to record the assignment of the expression to the variable. |
java.lang.String |
toString()
Returns a String for this instruction. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Assignment(Variable v, Expression e)
e
- expression being assignedv
- variable to which the expression is assignedMethod Detail |
---|
public java.lang.Double evaluate(Context c)
evaluate
in class Instruction
c
- is the Context in which the evaluation takes place
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |