slogo.instruction.conditional
Class ConditionalInstruction

java.lang.Object
  extended by slogo.language.GrammarElement
      extended by slogo.instruction.Instruction
          extended by slogo.instruction.conditional.ConditionalInstruction
Direct Known Subclasses:
Equal, Greater, Less, NotEqual

public abstract class ConditionalInstruction
extends Instruction


Field Summary
protected  GrammarElement e1
           
protected  GrammarElement e2
           
 
Fields inherited from class slogo.language.GrammarElement
gelementsToValue
 
Constructor Summary
ConditionalInstruction(GrammarElement e1, GrammarElement e2)
           
 
Method Summary
abstract  java.lang.Integer evaluate(Context c)
          Evaluate this language construct in some context.
 int firstValue(Context c)
           
 int secondValue(Context c)
           
 
Methods inherited from class slogo.instruction.Instruction
evaluateNumericExpression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

e1

protected GrammarElement e1

e2

protected GrammarElement e2
Constructor Detail

ConditionalInstruction

public ConditionalInstruction(GrammarElement e1,
                              GrammarElement e2)
Method Detail

firstValue

public int firstValue(Context c)
Returns:
the result of evaluating the first subexpression

secondValue

public int secondValue(Context c)
Returns:
the result of evaluating the second subexpression

evaluate

public abstract java.lang.Integer 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.

Overrides:
evaluate in class Instruction
Parameters:
c - context in which the evaluation takes place
Returns:
false