edu.iu.cnets.klatsch.expression
Class Expression

java.lang.Object
  extended by edu.iu.cnets.klatsch.expression.Expression
Direct Known Subclasses:
EAdd, EAnd, EAssign, EBlock, ECall, ECallMethod, EDictionary, EDivide, EDo, EFor, EIf, EList, ELValue, EModulus, EMultiply, ENegate, ENot, ENumber, EOr, EParen, EPower, EProcedure, ERelational, EString, ESubtract, EWhile

public abstract class Expression
extends java.lang.Object

This is the base class of every variety of expression.


Constructor Summary
Expression()
           
 
Method Summary
abstract  Value evaluate(Runtime rt)
           
 Value evaluateToClass(Runtime rt, java.lang.Class<?> type)
          The method is used to require that the expression evaluate to a particular data type.
abstract  java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Expression

public Expression()
Method Detail

evaluate

public abstract Value evaluate(Runtime rt)
                        throws EvaluationException
Throws:
EvaluationException

toString

public abstract java.lang.String toString()
Overrides:
toString in class java.lang.Object

evaluateToClass

public Value evaluateToClass(Runtime rt,
                             java.lang.Class<?> type)
                      throws EvaluationException
The method is used to require that the expression evaluate to a particular data type.

Parameters:
rt - the current runtime environment
type - the class required
Returns:
the expression value
Throws:
EvaluationException - if evaluation doesn't produce the right class