com.espertech.esper.filter
Class FilterSpecCompiler

java.lang.Object
  extended by com.espertech.esper.filter.FilterSpecCompiler

public final class FilterSpecCompiler
extends Object

Helper to compile (validate and optimize) filter expressions as used in pattern and filter-based streams.


Field Summary
static String PROPERTY_NAME_BOOLEAN_EXPRESSION
          Assigned for filter parameters that are based on boolean expression and not on any particular property name.
 
Constructor Summary
FilterSpecCompiler()
           
 
Method Summary
protected static FilterSpecParam makeFilterParam(ExprNode constituent)
          For a given expression determine if this is optimizable and create the filter parameter representing the expression, or null if not optimizable.
static FilterSpecCompiled makeFilterSpec(EventType eventType, String eventTypeAlias, List<ExprNode> filterExpessions, LinkedHashMap<String,Pair<EventType,String>> taggedEventTypes, StreamTypeService streamTypeService, MethodResolutionService methodResolutionService, TimeProvider timeProvider, VariableService variableService)
          Factory method for compiling filter expressions into a filter specification for use with filter service.
static List<ExprNode> validateDisallowSubquery(List<ExprNode> exprNodes, StreamTypeService streamTypeService, MethodResolutionService methodResolutionService, TimeProvider timeProvider, VariableService variableService)
          Validates expression nodes and returns a list of validated nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_NAME_BOOLEAN_EXPRESSION

public static final String PROPERTY_NAME_BOOLEAN_EXPRESSION
Assigned for filter parameters that are based on boolean expression and not on any particular property name.

Keeping this artificial property name is a simplification as optimized filter parameters generally keep a property name.

See Also:
Constant Field Values
Constructor Detail

FilterSpecCompiler

public FilterSpecCompiler()
Method Detail

makeFilterSpec

public static FilterSpecCompiled makeFilterSpec(EventType eventType,
                                                String eventTypeAlias,
                                                List<ExprNode> filterExpessions,
                                                LinkedHashMap<String,Pair<EventType,String>> taggedEventTypes,
                                                StreamTypeService streamTypeService,
                                                MethodResolutionService methodResolutionService,
                                                TimeProvider timeProvider,
                                                VariableService variableService)
                                         throws ExprValidationException
Factory method for compiling filter expressions into a filter specification for use with filter service.

Parameters:
eventType - is the filtered-out event type
eventTypeAlias - is the alias name of the event type
filterExpessions - is a list of filter expressions
taggedEventTypes - is a map of stream names (tags) and event types available
streamTypeService - is used to set rules for resolving properties
methodResolutionService - resolved imports for static methods and such
timeProvider - - provides engine current time
variableService - - provides access to variables
Returns:
compiled filter specification
Throws:
ExprValidationException - if the expression or type validations failed

validateDisallowSubquery

public static List<ExprNode> validateDisallowSubquery(List<ExprNode> exprNodes,
                                                      StreamTypeService streamTypeService,
                                                      MethodResolutionService methodResolutionService,
                                                      TimeProvider timeProvider,
                                                      VariableService variableService)
                                               throws ExprValidationException
Validates expression nodes and returns a list of validated nodes.

Parameters:
exprNodes - is the nodes to validate
streamTypeService - is provding type information for each stream
methodResolutionService - for resolving functions
timeProvider - for providing current time
variableService - provides access to variables
Returns:
list of validated expression nodes
Throws:
ExprValidationException - for validation errors

makeFilterParam

protected static FilterSpecParam makeFilterParam(ExprNode constituent)
                                          throws ExprValidationException
For a given expression determine if this is optimizable and create the filter parameter representing the expression, or null if not optimizable.

Parameters:
constituent - is the expression to look at
Returns:
filter parameter representing the expression, or null
Throws:
ExprValidationException - if the expression is invalid

© 2007 EsperTech Inc.
All rights reserved.
Visit us at espertech.com