All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class edu.mit.ai.psg.jevaES.LeftAssociativeOperatorExpression

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

public abstract class LeftAssociativeOperatorExpression
extends ExpressionNode
Shared implementation for left associative operators.

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

Method Index

 o binaryCombine(Token, Object, Object)
binaryCombine -- combine two values, implemented in subclasses
 o binaryCombineTypes(Token, Class, Class)
binaryCombineTypes -- Class of result of combining two types; implemented in subclasses
 o computeIsConstant(IEnv)
 o computeType(IEnv)
 o eval(IEnv)

Methods

 o eval
 public Object eval(IEnv env) throws EvalException
Returns:
evaluated children combined leftAssociatively, using binaryCombine()
Throws: EvalException
.
Overrides:
eval in class ExpressionNode
 o binaryCombine
 public abstract Object binaryCombine(Token operator,
                                      Object accumResult,
                                      Object nextResult) throws ThrowException
binaryCombine -- combine two values, implemented in subclasses

Parameters:
operator - is the Token between expressions (e.g., +,-,*,/,...)
accumResult - is result of accumulating the expressions to the left of the operator.
nextResult - is result of evaluating the next expression to the right of the operator.
Returns:
result of the combining accumResult and nextResult with operator
Throws: ThrowException
wraps exception thrown by operator.
 o computeType
 public Class computeType(IEnv env) throws EvalException
Returns:
Class of result returned by this operator on these arguments.
Throws: EvalException
.
Overrides:
computeType in class ExpressionNode
 o binaryCombineTypes
 public abstract Class binaryCombineTypes(Token operator,
                                          Class accumType,
                                          Class nextType)
binaryCombineTypes -- Class of result of combining two types; implemented in subclasses

Parameters:
operator - is the Token between expressions (e.g., +,-,*,/,...)
accumResult - is result of accumulating the expressions to the left of the operator.
nextResult - is result of evaluating the next expression to the right of the operator.
Returns:
Class of result of the combining accumResult and nextResult with operator.
 o computeIsConstant
 public boolean computeIsConstant(IEnv env) throws EvalException
Returns:
true if result of this expression is constant. Default is true if all subexpressions are constant, but subclasses may override this behavior.
Throws: EvalException
.
Overrides:
computeIsConstant in class ExpressionNode

All Packages  Class Hierarchy  This Package  Previous  Next  Index