net.esper.eql.expression
Class ExprIdentNode

java.lang.Object
  extended by net.esper.eql.expression.ExprNode
      extended by net.esper.eql.expression.ExprIdentNode
All Implemented Interfaces:
ExprEvaluator, ExprValidator

public class ExprIdentNode
extends ExprNode

Represents an stream property identifier in a filter expressiun tree.


Constructor Summary
ExprIdentNode(String unresolvedPropertyName)
          Ctor.
ExprIdentNode(String unresolvedPropertyName, String streamOrPropertyName)
          Ctor.
 
Method Summary
 boolean equalsNode(ExprNode node)
          Return true if a expression node semantically equals the current node, or false if not.
 Object evaluate(EventBean[] eventsPerStream, boolean isNewData)
          Evaluate event tuple and return result.
 String getResolvedPropertyName()
          Return property name as resolved by lookup in streams.
 String getResolvedStreamName()
          Returns stream name as resolved by lookup of property in streams.
 int getStreamId()
          Returns stream id supplying the property value.
 String getStreamOrPropertyName()
          For unit testing, returns stream or property name candidate.
 Class getType()
          Returns the type that the node's evaluate method returns an instance of.
protected static Pair<PropertyResolutionDescriptor,String> getTypeFromStream(StreamTypeService streamTypeService, String unresolvedPropertyName, String streamOrPropertyName)
          Determine stream id and property type given an unresolved property name and a stream name that may also be part of the property name.
 String getUnresolvedPropertyName()
          For unit testing, returns unresolved property name.
 String toExpressionString()
          Returns the expression node rendered as a string.
 String toString()
           
 void validate(StreamTypeService streamTypeService, AutoImportService autoImportService, ViewResourceDelegate viewResourceDelegate)
          Validate node.
 
Methods inherited from class net.esper.eql.expression.ExprNode
accept, addChildNode, deepEquals, dumpDebug, getChildNodes, getValidatedSubtree
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExprIdentNode

public ExprIdentNode(String unresolvedPropertyName)
Ctor.

Parameters:
unresolvedPropertyName - is the event property name in unresolved form, ie. unvalidated against streams

ExprIdentNode

public ExprIdentNode(String unresolvedPropertyName,
                     String streamOrPropertyName)
Ctor.

Parameters:
unresolvedPropertyName - is the event property name in unresolved form, ie. unvalidated against streams
streamOrPropertyName - is the stream name, or if not a valid stream name a possible nested property name in one of the streams.
Method Detail

getUnresolvedPropertyName

public String getUnresolvedPropertyName()
For unit testing, returns unresolved property name.

Returns:
property name

getStreamOrPropertyName

public String getStreamOrPropertyName()
For unit testing, returns stream or property name candidate.

Returns:
stream name, or property name of a nested property of one of the streams

validate

public void validate(StreamTypeService streamTypeService,
                     AutoImportService autoImportService,
                     ViewResourceDelegate viewResourceDelegate)
              throws ExprValidationException
Description copied from interface: ExprValidator
Validate node.

Parameters:
streamTypeService - serves stream event type info
autoImportService - - for resolving class names in library method invocations
viewResourceDelegate - - delegates for view resources to expression nodes
Throws:
ExprValidationException - thrown when validation failed

getType

public Class getType()
              throws ExprValidationException
Description copied from interface: ExprValidator
Returns the type that the node's evaluate method returns an instance of.

Returns:
type returned when evaluated
Throws:
ExprValidationException - thrown when validation failed

getStreamId

public int getStreamId()
Returns stream id supplying the property value.

Returns:
stream number

getResolvedStreamName

public String getResolvedStreamName()
Returns stream name as resolved by lookup of property in streams.

Returns:
stream name

getResolvedPropertyName

public String getResolvedPropertyName()
Return property name as resolved by lookup in streams.

Returns:
property name

getTypeFromStream

protected static Pair<PropertyResolutionDescriptor,String> getTypeFromStream(StreamTypeService streamTypeService,
                                                                             String unresolvedPropertyName,
                                                                             String streamOrPropertyName)
                                                                      throws ExprValidationException
Determine stream id and property type given an unresolved property name and a stream name that may also be part of the property name.

For example: select s0.p1 from... p1 is the property name, s0 the stream name, however this could also be a nested property

Parameters:
streamTypeService - - service for type infos
unresolvedPropertyName - - property name
streamOrPropertyName - - stream name, this can also be the first part of the property name
Returns:
pair of stream number and property type
Throws:
ExprValidationException - if no such property exists

toString

public String toString()
Overrides:
toString in class Object

evaluate

public Object evaluate(EventBean[] eventsPerStream,
                       boolean isNewData)
Description copied from interface: ExprEvaluator
Evaluate event tuple and return result.

Parameters:
eventsPerStream - - event tuple
isNewData - - indicates whether we are dealing with new data (istream) or old data (rstream)
Returns:
evaluation result, a boolean value for OR/AND-type evalution nodes.

toExpressionString

public String toExpressionString()
Description copied from class: ExprNode
Returns the expression node rendered as a string.

Specified by:
toExpressionString in class ExprNode
Returns:
string rendering of expression

equalsNode

public boolean equalsNode(ExprNode node)
Description copied from class: ExprNode
Return true if a expression node semantically equals the current node, or false if not.

Concrete implementations should compare the type and any additional information that impact the evaluation of a node.

Specified by:
equalsNode in class ExprNode
Parameters:
node - to compare to
Returns:
true if semantically equal, or false if not equals