agg.attribute.handler
Interface HandlerExpr

All Superinterfaces:
java.lang.Cloneable, java.io.Serializable

public interface HandlerExpr
extends java.io.Serializable, java.lang.Cloneable

This interface is implemented by Attribute Handlers; provides services for the Attribute Manager. It is used in the "SymbolTable".

See Also:
SymbolTable

Field Summary
static long serialVersionUID
           
 
Method Summary
 void check(SymbolTable symTab)
          Type-check the expression under a given symbol table with declarations.
 boolean equals(HandlerExpr testObject)
           
 void evaluate(SymbolTable symTab)
          Evaluate the expression under a given symbol table containing variable declarations and (hopefully) also the assignments.
 void getAllVariables(java.util.Vector<java.lang.String> v)
          fills the vector with the names of all variables which occur in this expression
 Node getAST()
          Returns the abstract syntax tree which represents the expression
 HandlerExpr getCopy()
          Obtaining a copy of the message receiving expression.
 java.lang.String getString()
          returns the string representation of an expression
 java.lang.Object getValue()
          Obtaining the value.
 boolean isComplex()
          Checks if the expression is a complex one (like x+1).
 boolean isConstant()
          Checks if the expression is constant.
 boolean isUnifiableWith(HandlerExpr expr, SymbolTable symTab)
          Checks if the recipient can be "matched", "unified" with the first parameter under a certain variable assignment.
 boolean isVariable()
          Checks if the expression is a single Variable.
 java.lang.String toString()
           
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values
Method Detail

toString

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

getValue

java.lang.Object getValue()
Obtaining the value.

Returns:
The value as an Object instance.

getCopy

HandlerExpr getCopy()
Obtaining a copy of the message receiving expression.

Returns:
The copy.

check

void check(SymbolTable symTab)
           throws AttrHandlerException
Type-check the expression under a given symbol table with declarations.

Parameters:
symTab - the declaration Table to use for the checking
Throws:
AttrHandlerException - if the checking yields an inconsitency. An exception is preferred over a return value as it is a ready-to-use propagation mechanism with specific information easily attached.

evaluate

void evaluate(SymbolTable symTab)
              throws AttrHandlerException
Evaluate the expression under a given symbol table containing variable declarations and (hopefully) also the assignments.

Parameters:
symTab - the declaration Table to use for the evaluation
Throws:
AttrHandlerException - if the evaluation yields an error (a missing value for a variable etc.)

getString

java.lang.String getString()
returns the string representation of an expression


isConstant

boolean isConstant()
Checks if the expression is constant. Needed for keeping users from giving expressions that are not allowed in a context.

Returns:
'true' if constant, 'false' sonst.

isVariable

boolean isVariable()
Checks if the expression is a single Variable. Needed for keeping users from giving expressions that are not allowed in a context.

Returns:
'true' if a variable, 'false' sonst.

isComplex

boolean isComplex()
Checks if the expression is a complex one (like x+1). Needed for keeping users from giving expressions that are not allowed in a context.

Returns:
'true' if is complex, 'false' sonst.

equals

boolean equals(HandlerExpr testObject)

isUnifiableWith

boolean isUnifiableWith(HandlerExpr expr,
                        SymbolTable symTab)
Checks if the recipient can be "matched", "unified" with the first parameter under a certain variable assignment.

Parameters:
expr - The expression to check if unifiable with;
symTab - Contains the variable assignments under which to perform the test.
Returns:
'true' if the two expressions ar matching, 'false' sonst.

getAST

Node getAST()
Returns the abstract syntax tree which represents the expression


getAllVariables

void getAllVariables(java.util.Vector<java.lang.String> v)
fills the vector with the names of all variables which occur in this expression