net.esper.eql.parse
Class ASTFilterSpecHelper

java.lang.Object
  extended by net.esper.eql.parse.ASTFilterSpecHelper
All Implemented Interfaces:
EqlTokenTypes

public class ASTFilterSpecHelper
extends java.lang.Object
implements EqlTokenTypes

Builds a filter specification from filter AST nodes.


Field Summary
 
Fields inherited from interface net.esper.eql.generated.EqlTokenTypes
ALL, AND_EXPR, ARRAY_PARAM_LIST, AS, ASC, AVEDEV, AVG, BAND, BAND_ASSIGN, BNOT, BOOL_TYPE, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, BY, CASE, CASE2, CLASS_IDENT, COALESCE, COLON, COMMA, CONCAT, COUNT, DEC, DESC, DISTINCT, DIV, DIV_ASSIGN, DOT, DOUBLE_TYPE, ELSE, END, EOF, EQUAL, EQUALS, ESC, EVAL_AND_EXPR, EVAL_BITWISE_EXPR, EVAL_EQUALS_EXPR, EVAL_IDENT, EVAL_NOTEQUALS_EXPR, EVAL_OR_EXPR, EVENT_FILTER_EXPR, EVENT_FILTER_IDENT, EVENT_FILTER_NAME_TAG, EVENT_FILTER_PARAM, EVENT_LIMIT_EXPR, EVENT_PROP_EXPR, EVENT_PROP_INDEXED, EVENT_PROP_MAPPED, EVENT_PROP_SIMPLE, EVENTS, EVERY_EXPR, EXPONENT, FIRST, FLOAT_SUFFIX, FLOAT_TYPE, FOLLOWED_BY, FOLLOWED_BY_EXPR, FROM, FULL, FULL_OUTERJOIN_EXPR, GE, GROUP, GROUP_BY_EXPR, GT, GUARD_EXPR, HAVING, HAVING_EXPR, HEX_DIGIT, IDENT, IN, INC, INSERT, INSERTINTO_EXPR, INSERTINTO_EXPRCOL, INT_TYPE, INTO, IS, ISTREAM, JOIN, LAND, LAST, LBRACK, LCURLY, LE, LEFT, LEFT_OUTERJOIN_EXPR, LIB_FUNCTION, LITERAL_false, LITERAL_null, LITERAL_true, LNOT, LONG_TYPE, LOR, LPAREN, LT, MAX, MEDIAN, MIN, MIN_LIMIT_EXPR, MINUS, MINUS_ASSIGN, MINUTES, ML_COMMENT, MOD, MOD_ASSIGN, NOT_EQUAL, NOT_EXPR, NULL_TREE_LOOKAHEAD, NULL_TYPE, NUM_DOUBLE, NUM_FLOAT, NUM_INT, NUM_LONG, NUMERIC_PARAM_FREQUENCY, NUMERIC_PARAM_LIST, NUMERIC_PARAM_RANGE, OBSERVER_EXPR, ON, OR_EXPR, ORDER, ORDER_BY_EXPR, ORDER_ELEMENT_EXPR, OUTER, OUTERJOIN_EXPR, OUTPUT, PATTERN, PATTERN_INCL_EXPR, PLUS, PLUS_ASSIGN, QUESTION, QUOTED_STRING_LITERAL, RBRACK, RCURLY, RIGHT, RIGHT_OUTERJOIN_EXPR, RPAREN, RSTREAM, SEC_LIMIT_EXPR, SECONDS, SELECT, SELECTION_ELEMENT_EXPR, SELECTION_EXPR, SEMI, SL, SL_ASSIGN, SL_COMMENT, SQL_NE, SR, SR_ASSIGN, STAR, STAR_ASSIGN, STDDEV, STREAM_EXPR, STRING_LITERAL, STRING_TYPE, SUM, THEN, UNARY_MINUS, VIEW_EXPR, WHEN, WHERE, WHERE_EXPR, WS
 
Constructor Summary
ASTFilterSpecHelper()
           
 
Method Summary
static FilterSpec buildSpec(antlr.collections.AST filterAST, java.util.Map<java.lang.String,EventType> optionalTaggedEventTypes, EventAdapterService eventAdapterService)
          Creates a filter specification for the AST representing the filter expression.
static java.lang.String getEventNameTag(antlr.collections.AST filterAST)
          Returns the name tag for the event in the filter spec, if any, else null.
protected static java.lang.String getPropertyName(antlr.collections.AST propertyNameExprChildNode)
          Return the generated property name that is defined by the AST child node and it's siblings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ASTFilterSpecHelper

public ASTFilterSpecHelper()
Method Detail

getEventNameTag

public static java.lang.String getEventNameTag(antlr.collections.AST filterAST)
Returns the name tag for the event in the filter spec, if any, else null.

Parameters:
filterAST -
Returns:
event name tag or null if none specified

buildSpec

public static FilterSpec buildSpec(antlr.collections.AST filterAST,
                                   java.util.Map<java.lang.String,EventType> optionalTaggedEventTypes,
                                   EventAdapterService eventAdapterService)
                            throws ASTFilterSpecValidationException
Creates a filter specification for the AST representing the filter expression.

Parameters:
filterAST - - root filter AST node
optionalTaggedEventTypes - - event type for each named event if named events are allowed in filter
eventAdapterService - - service for resolving event names to known event types
Returns:
filter spec
Throws:
ASTFilterSpecValidationException - if the filter spec cannot be validate

getPropertyName

protected static java.lang.String getPropertyName(antlr.collections.AST propertyNameExprChildNode)
Return the generated property name that is defined by the AST child node and it's siblings.

Parameters:
propertyNameExprChildNode - is the child node from which to start putting the property name together
Returns:
property name, ie. indexed[1] or mapped('key') or nested.nested or a combination or just 'simple'.