All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class edu.mit.ai.psg.jevaES.ExpressionNode

java.lang.Object
   |
   +----edu.mit.ai.psg.jevaES.SimpleNode
           |
           +----edu.mit.ai.psg.jevaES.ExpressionNode

public class ExpressionNode
extends SimpleNode
ExpressionNode is the root class for all Expressions.

Author:
CarlManning, caroma@ai.mit.edu
Copyright (c) 1997 Massachusetts Institute of Technology

Constructor Index

 o ExpressionNode(int)
Creates an ExpressionNode with the given JevaESParseTreeConstants ID

Method Index

 o computeIsConstant(IEnv)
Compute whether this expression is a constant.
 o computeType(IEnv)
Compute the static type of the expression.
 o eval(IEnv)
Evaluate this Expression.
 o getType(IEnv)
Return the static type of the expression.
 o getValue(IEnv)
Get the value of this node, evaluating the node if it's not a constant or it hasn't been evaluated yet.
 o isConstant(IEnv)
Is this a constant expression? Computed only once, then value cached.

Constructors

 o ExpressionNode
 public ExpressionNode(int id)
Creates an ExpressionNode with the given JevaESParseTreeConstants ID

Methods

 o getValue
 public Object getValue(IEnv env) throws EvalException
Get the value of this node, evaluating the node if it's not a constant or it hasn't been evaluated yet. Use EvalMethods.eval(node, env) to simplify all the possible exceptions into an EvalException. Expressions don't override this directly, they override eval instead.

Parameters:
env - is ignored in JevaE.
Throws: EvalException
.
See Also:
eval
 o eval
 public Object eval(IEnv env) throws EvalException
Evaluate this Expression. Don't call this directly, use getValue() or EvalMethods.eval(). Every expression needs to implement an eval method.

Parameters:
env - is ignored in JevaE.
Throws: EvalException
.
See Also:
eval
 o isConstant
 public boolean isConstant(IEnv env) throws EvalException
Is this a constant expression? Computed only once, then value cached. This predicate is sometimes required for determining type (see [JavaLangSpec sec 15.27, 5.2, 15.24, 14.9]) Expressions don't override this directly, they override computeIsConstant instead.

Parameters:
env - is ignored in JevaE. [will be required for looking up local constants (final).]
Throws: EvalException
.
See Also:
isConstant
 o computeIsConstant
 public boolean computeIsConstant(IEnv env) throws EvalException
Compute whether this expression is a constant. Don't call this directly, use isConstant() or EvalMethods.isConstant(). Every expression needs to implement an isConstant method.

Parameters:
env - is ignored in JevaE. but will be required for looking up local constants (final).
Throws: EvalException
.
See Also:
isConstant
 o getType
 public Class getType(IEnv env) throws EvalException
Return the static type of the expression. Computed once, then cached. Expressions don't override this directly, they override computeType instead.

Parameters:
env - is ignored in JevaE.
Returns:
s the Class of the static type.
Throws: EvalException
.
See Also:
getType
 o computeType
 public Class computeType(IEnv env) throws EvalException
Compute the static type of the expression. Don't call this directly, use getType() or EvalMethods.getType(). Every expression needs to implement a computeType method.

Parameters:
env - is ignored in JevaE.
Returns:
s the Class of the static type.
Throws: EvalException
.
See Also:
getType

All Packages  Class Hierarchy  This Package  Previous  Next  Index