public abstract class ExprAggregateNodeBase extends ExprNodeBase implements ExprEvaluator, ExprAggregateNode
In terms of validation each concrete aggregation node must implement it's own validation.
In terms of evaluation this base class will ask the assigned AggregationResultFuture
for the current state,
using a column number assigned to the node.
Concrete subclasses must supply an aggregation state prototype node AggregationMethod
that reflects
each group's (there may be group-by critera) current aggregation state.
Modifier and Type | Method and Description |
---|---|
boolean |
equalsNode(ExprNode node)
Return true if a expression node semantically equals the current node, or false if not.
|
java.lang.Object |
evaluate(EventBean[] events,
boolean isNewData,
ExprEvaluatorContext exprEvaluatorContext)
Evaluate event tuple and return result.
|
ExprEvaluator |
getExprEvaluator() |
AggregationMethodFactory |
getFactory()
Returns the aggregation state factory for use in grouping aggregation states per group-by keys.
|
ExprPrecedenceEnum |
getPrecedence()
Returns precedence.
|
java.lang.Class |
getType()
Returns the type that the node's evaluate method returns an instance of.
|
boolean |
isConstantResult()
Returns true if the expression node's evaluation value doesn't depend on any events data,
as must be determined at validation time, which is bottom-up and therefore
reliably allows each node to determine constant value.
|
boolean |
isDistinct()
Returns true if the aggregation node is only aggregatig distinct values, or false if
aggregating all values.
|
void |
setAggregationResultFuture(AggregationResultFuture aggregationResultFuture,
int column)
Assigns to the node the future which can be queried for the current aggregation state at evaluation time.
|
void |
toPrecedenceFreeEPL(java.io.StringWriter writer) |
void |
validate(ExprValidationContext validationContext) |
void |
validateFilter(ExprEvaluator filterEvaluator) |
accept, accept, acceptChildnodes, addChildNode, addChildNodes, addChildNodeToFront, getChildNodes, replaceUnlistedChildNode, setChildNode, setChildNodes, toEPL
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
accept, accept, acceptChildnodes, addChildNode, addChildNodes, getChildNodes, replaceUnlistedChildNode, setChildNode, setChildNodes, toEPL
public ExprEvaluator getExprEvaluator()
getExprEvaluator
in interface ExprNode
public boolean isConstantResult()
ExprNode
isConstantResult
in interface ExprNode
public void validate(ExprValidationContext validationContext) throws ExprValidationException
validate
in interface ExprValidator
ExprValidationException
public java.lang.Class getType()
ExprEvaluator
getType
in interface ExprEvaluator
public AggregationMethodFactory getFactory()
getFactory
in interface ExprAggregateNode
public void setAggregationResultFuture(AggregationResultFuture aggregationResultFuture, int column)
setAggregationResultFuture
in interface ExprAggregateNode
aggregationResultFuture
- - future containing statecolumn
- - column to hand to future for easy accesspublic final java.lang.Object evaluate(EventBean[] events, boolean isNewData, ExprEvaluatorContext exprEvaluatorContext)
ExprEvaluator
evaluate
in interface ExprEvaluator
events
- - event tupleisNewData
- - indicates whether we are dealing with new data (istream) or old data (rstream)exprEvaluatorContext
- context for expression evaluationpublic boolean isDistinct()
isDistinct
in interface ExprAggregateNode
public final boolean equalsNode(ExprNode node)
ExprNode
Concrete implementations should compare the type and any additional information that impact the evaluation of a node.
equalsNode
in interface ExprNode
node
- to compare topublic void toPrecedenceFreeEPL(java.io.StringWriter writer)
toPrecedenceFreeEPL
in class ExprNodeBase
public ExprPrecedenceEnum getPrecedence()
ExprNode
getPrecedence
in interface ExprNode
public void validateFilter(ExprEvaluator filterEvaluator) throws ExprValidationException
ExprValidationException