edu.umass.cs.sase.query
Class PredicateOptimized

java.lang.Object
  extended by edu.umass.cs.sase.query.PredicateOptimized

public class PredicateOptimized
extends java.lang.Object

This class represents a predicate of an edge. Assumption: no parentheses

Author:
haopeng

Constructor Summary
PredicateOptimized(java.lang.String pre)
          Default constructor
 
Method Summary
 void checkSingle()
          Checks if the predicate needs other events
 boolean evaluate(Event currentEvent, Event previousEvent)
          Evaluates an event against this predicate
 boolean evaluate(Event currentEvent, Run r, EventBuffer b)
          Evaluates an event against the predicate
 void formatPredicate()
          Format the description for evaluation
 Operand getAggregationOperand()
           
 java.lang.String getAttributeName()
           
 net.sourceforge.jeval.Evaluator getEvl()
           
 java.lang.String getFormatedPredicate()
           
 java.util.ArrayList<Operand> getLeftOperands()
           
 java.lang.String getLogicalOperator()
           
 java.lang.String getOperation()
           
 java.lang.String getPredicateDescription()
           
 java.lang.String getRelatedState()
           
 java.util.ArrayList<Operand> getRightOperands()
           
 java.lang.String getTempAttributeName()
           
 Operand getTempOperand()
           
 java.util.ArrayList<Operand> getVarOperands()
           
 boolean isSingleState()
           
 void linkAggregationOperand()
          Deals with the aggregation operand
 void parseLeftOperand(java.lang.String expression)
          Parses the operands on the left side of the logical operator
 void parseLeftRight(java.lang.String logicOperation)
          Parses left or right part of the predicate
 void parsePredicate()
          Parses the predicate
 void parseRightOperand(java.lang.String expression)
          Parses the operands on the right side of the operator
 void setAggregationOperand(Operand aggregationOperand)
           
 void setAttributeName(java.lang.String attributeName)
           
 void setEvl(net.sourceforge.jeval.Evaluator evl)
           
 void setFormatedPredicate(java.lang.String formatedPredicate)
           
 void setLeftOperands(java.util.ArrayList<Operand> leftOperands)
           
 void setLogicalOperator(java.lang.String logicalOperator)
           
 void setOperation(java.lang.String operation)
           
 void setPredicateDescription(java.lang.String predicateDescription)
           
 void setRelatedState(java.lang.String relatedState)
           
 void setRightOperands(java.util.ArrayList<Operand> rightOperands)
           
 void setSingleState(boolean isSingleState)
           
 void setTempAttributeName(java.lang.String tempAttributeName)
           
 void setTempOperand(Operand tempOperand)
           
 void setVarOperands(java.util.ArrayList<Operand> varOperands)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PredicateOptimized

public PredicateOptimized(java.lang.String pre)
Default constructor

Parameters:
pre - the description of a predicate
Method Detail

linkAggregationOperand

public void linkAggregationOperand()
Deals with the aggregation operand


checkSingle

public void checkSingle()
Checks if the predicate needs other events


formatPredicate

public void formatPredicate()
Format the description for evaluation


parsePredicate

public void parsePredicate()
Parses the predicate


parseLeftRight

public void parseLeftRight(java.lang.String logicOperation)
Parses left or right part of the predicate

Parameters:
logicOperation - the logic operator of this predicate

parseLeftOperand

public void parseLeftOperand(java.lang.String expression)
Parses the operands on the left side of the logical operator

Parameters:
expression -

parseRightOperand

public void parseRightOperand(java.lang.String expression)
Parses the operands on the right side of the operator

Parameters:
expression -

evaluate

public boolean evaluate(Event currentEvent,
                        Event previousEvent)
                 throws net.sourceforge.jeval.EvaluationException
Evaluates an event against this predicate

Parameters:
currentEvent - the current event
previousEvent - previous event in the same run
Returns:
the evaluation result
Throws:
net.sourceforge.jeval.EvaluationException

evaluate

public boolean evaluate(Event currentEvent,
                        Run r,
                        EventBuffer b)
                 throws net.sourceforge.jeval.EvaluationException
Evaluates an event against the predicate

Parameters:
currentEvent - the current event
r - the run
Returns:
the evaluation result
Throws:
net.sourceforge.jeval.EvaluationException

getPredicateDescription

public java.lang.String getPredicateDescription()
Returns:
the predicateDescription

setPredicateDescription

public void setPredicateDescription(java.lang.String predicateDescription)
Parameters:
predicateDescription - the predicateDescription to set

getFormatedPredicate

public java.lang.String getFormatedPredicate()
Returns:
the formatedPredicate

setFormatedPredicate

public void setFormatedPredicate(java.lang.String formatedPredicate)
Parameters:
formatedPredicate - the formatedPredicate to set

getLogicalOperator

public java.lang.String getLogicalOperator()
Returns:
the logicalOperator

setLogicalOperator

public void setLogicalOperator(java.lang.String logicalOperator)
Parameters:
logicalOperator - the logicalOperator to set

getLeftOperands

public java.util.ArrayList<Operand> getLeftOperands()
Returns:
the leftOperands

setLeftOperands

public void setLeftOperands(java.util.ArrayList<Operand> leftOperands)
Parameters:
leftOperands - the leftOperands to set

getRightOperands

public java.util.ArrayList<Operand> getRightOperands()
Returns:
the rightOperands

setRightOperands

public void setRightOperands(java.util.ArrayList<Operand> rightOperands)
Parameters:
rightOperands - the rightOperands to set

getEvl

public net.sourceforge.jeval.Evaluator getEvl()
Returns:
the evl

setEvl

public void setEvl(net.sourceforge.jeval.Evaluator evl)
Parameters:
evl - the evl to set

isSingleState

public boolean isSingleState()
Returns:
the isSingleState

setSingleState

public void setSingleState(boolean isSingleState)
Parameters:
isSingleState - the isSingleState to set

getVarOperands

public java.util.ArrayList<Operand> getVarOperands()
Returns:
the varOperands

setVarOperands

public void setVarOperands(java.util.ArrayList<Operand> varOperands)
Parameters:
varOperands - the varOperands to set

getAggregationOperand

public Operand getAggregationOperand()
Returns:
the aggregationOperand

setAggregationOperand

public void setAggregationOperand(Operand aggregationOperand)
Parameters:
aggregationOperand - the aggregationOperand to set

getRelatedState

public java.lang.String getRelatedState()
Returns:
the relatedState

setRelatedState

public void setRelatedState(java.lang.String relatedState)
Parameters:
relatedState - the relatedState to set

getOperation

public java.lang.String getOperation()
Returns:
the operation

setOperation

public void setOperation(java.lang.String operation)
Parameters:
operation - the operation to set

getAttributeName

public java.lang.String getAttributeName()
Returns:
the attributeName

setAttributeName

public void setAttributeName(java.lang.String attributeName)
Parameters:
attributeName - the attributeName to set

getTempOperand

public Operand getTempOperand()
Returns:
the tempOperand

setTempOperand

public void setTempOperand(Operand tempOperand)
Parameters:
tempOperand - the tempOperand to set

getTempAttributeName

public java.lang.String getTempAttributeName()
Returns:
the tempAttributeName

setTempAttributeName

public void setTempAttributeName(java.lang.String tempAttributeName)
Parameters:
tempAttributeName - the tempAttributeName to set