uk.org.ogsadai.expression.arithmetic
Interface ArithmeticExpression

All Known Implementing Classes:
BinaryExpression, Constant, Div, ExecutableFunctionExpression, Minus, Mult, Plus, Star, TableColumn

public interface ArithmeticExpression

An arithmetic expression.

Author:
The OGSA-DAI Project Team.

Method Summary
 void accept(ArithmeticExpressionVisitor visitor)
          Accept an arithmetic expression visitor.
 void configure(TupleMetadata metadata)
          Configures the expression with the metadata.
 void configure(TupleMetadata metadata, java.util.Set<Attribute> correlatedAttributes)
          Configures the expression with the metadata.
 void evaluate(Tuple tuple)
          Evaluates the arithmetic expression on the given input tuple.
 ArithmeticExpression[] getChildren()
          Returns the children of this arithmetic expression.
 ColumnMetadata getMetadata()
          Get the result type that is returned when evaluating this expression with tuples of the given type.
 java.lang.Object getResult()
          Returns the result of the evaluation.
 void resetType()
          Reset type to original.
 void setContextType(int type)
          Set context type for an expression.
 

Method Detail

evaluate

void evaluate(Tuple tuple)
              throws ExpressionEvaluationException
Evaluates the arithmetic expression on the given input tuple.

Parameters:
tuple - input tuple
Throws:
ExpressionEvaluationException - if expression can not be evaluated

getResult

java.lang.Object getResult()
Returns the result of the evaluation. In the expression is an aggregation function the result is aggregated from all input tuples up to this point.

Returns:
result of the evaluation

configure

void configure(TupleMetadata metadata)
               throws TypeMismatchException
Configures the expression with the metadata. This method must be called before evaluating the expression or calling getMetadata(). This method is also used for type validation.

Parameters:
metadata - tuple metadata
Throws:
TypeMismatchException - when the operand types are incompatible

configure

void configure(TupleMetadata metadata,
               java.util.Set<Attribute> correlatedAttributes)
               throws TypeMismatchException
Configures the expression with the metadata. This method must be called before evaluating the expression or calling getMetadata(). This method is also used for type validation. A set of correlated attributes can be passed in to support type validation of correlated attributes.

Parameters:
metadata - tuple metadata
correlatedAttributes - set of correlated attributes, containing their types.
Throws:
TypeMismatchException - when the operand types are incompatible

getMetadata

ColumnMetadata getMetadata()
Get the result type that is returned when evaluating this expression with tuples of the given type.

Returns:
result type

getChildren

ArithmeticExpression[] getChildren()
Returns the children of this arithmetic expression.

Returns:
child expressions

accept

void accept(ArithmeticExpressionVisitor visitor)
Accept an arithmetic expression visitor.

Parameters:
visitor -

setContextType

void setContextType(int type)
Set context type for an expression.

Parameters:
type - context tuple type

resetType

void resetType()
Reset type to original.