slogo.instruction
Class Instruction

java.lang.Object
  extended by slogo.language.GrammarElement
      extended by slogo.instruction.Instruction
Direct Known Subclasses:
Assignment, Clean, ClearScreen, ConditionalInstruction, HideTurtle, Home, If, IsPenDown, NumericInstruction, OneParameterInstruction, PenDown, PenUp, Repeat, SetXY, ShowTurtle, StrictInstructionList, Subroutine, To, Towards, UnaryExpression

public abstract class Instruction
extends GrammarElement

Represents an instruction in the SLogo language


Field Summary
 
Fields inherited from class slogo.language.GrammarElement
gelementsToValue
 
Constructor Summary
Instruction()
           
 
Method Summary
 java.lang.Object evaluate(Context c)
          Evaluate this language construct in some context.
static int evaluateNumericExpression(GrammarElement elem, Context c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Instruction

public Instruction()
Method Detail

evaluate

public java.lang.Object evaluate(Context c)
Description copied from class: GrammarElement
Evaluate this language construct in some context. The evaluation may have side-effects, e.g., moving a turtle.

Specified by:
evaluate in class GrammarElement
Parameters:
c - context in which the evaluation takes place
Returns:
the result of evaluating the construct

evaluateNumericExpression

public static int evaluateNumericExpression(GrammarElement elem,
                                            Context c)
Parameters:
elem -
c - Context of the element
Returns:
the value of the element in the given context