jelan.elan.expression
Class Expression

java.lang.Object
  extended by jelan.elan.GrammarElement
      extended by jelan.elan.expression.Expression
Direct Known Subclasses:
BinaryExpression, Number, UnaryExpression, Variable

public abstract class Expression
extends GrammarElement

The base class of all arithmetic expressions, the evaluate method uses the hook/template method value to return a Double value, the template method returns a double.

Author:
Owen Astrachan

Constructor Summary
Expression()
           
 
Method Summary
 java.lang.Double evaluate(Context c)
          Evaluate this language construct in some context.
abstract  double value(Context c)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Expression

public Expression()
Method Detail

evaluate

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

value

public abstract double value(Context c)