Packageflare.query
Classpublic class Expression
ImplementsIEvaluable, IPredicate
SubclassesAggregateExpression, BinaryExpression, CompositeExpression, If, IsA, Literal, Not, Variable

Base class for query expression operators. Expressions are organized into a tree of operators that perform data processing or predicate testing on input Object instances.



Public Properties
 PropertyDefined by
  numChildren : int
[read-only] The number of sub-expressions that are children of this expression.
Expression
Public Methods
 MethodDefined by
  
Creates a cloned copy of the expression.
Expression
  
eval(o:Object = null):*
Evaluates this expression with the given input object.
Expression
  
[static] Utility method that maps an input value into an Expression.
Expression
  
Returns the sub-expression at the given index.
Expression
  
predicate(o:Object):Boolean
Boolean predicate that tests the output of evaluating this expression.
Expression
  
setChildAt(idx:int, expr:Expression):Boolean
Set the sub-expression at the given index.
Expression
  
toString():String
Returns a string representation of the expression.
Expression
  
visit(f:Function):Boolean
Sequentially invokes the input function on this expression and all sub-expressions.
Expression
Property detail
numChildrenproperty
numChildren:int  [read-only]

The number of sub-expressions that are children of this expression.

Implementation
    public function get numChildren():int
Method detail
clone()method
public function clone():Expression

Creates a cloned copy of the expression. Recursively clones any sub-expressions.

Returns
Expression — the cloned expression.
eval()method 
public function eval(o:Object = null):*

Evaluates this expression with the given input object.

Parameters
o:Object (default = null) — the input object to this expression

Returns
* — the result of evaluating the expression
expr()method 
public static function expr(o:*):Expression

Utility method that maps an input value into an Expression. If the input value is already an Expression, it is simply returned. If the input value is a String, it is interpreted as either a variable or string literal. If the first and last characters of the string are single quotes (') or double quotes ("), the characters between the quotes will be used as a string Literal. If there are no quotes, or if the string is enclosed by curly braces ({}), the string value (sans braces) will be used as the property name of a new Variable. In all other cases (Numbers, Dates, etc), a new Literal expression for the input value is returned.

Parameters
o:* — the input value

Returns
Expression — an Expression corresponding to the input value
getChildAt()method 
public function getChildAt(idx:int):Expression

Returns the sub-expression at the given index.

Parameters
idx:int — the index of the child sub-expression

Returns
Expression — the requested sub-expression.
predicate()method 
public function predicate(o:Object):Boolean

Boolean predicate that tests the output of evaluating this expression. Returns true if the expression evaluates to true, or a non-null or non-zero value. Returns false if the expression evaluates to false, or a null or zero value.

Parameters
o:Object — the input object to this expression

Returns
Boolean — the Boolean result of evaluating the expression
setChildAt()method 
public function setChildAt(idx:int, expr:Expression):Boolean

Set the sub-expression at the given index.

Parameters
idx:int — the index of the child sub-expression
 
expr:Expression — the sub-expression to set

Returns
Boolean — true if the the sub-expression was successfully set, false otherwise
toString()method 
public function toString():String

Returns a string representation of the expression.

Returns
String — this expression as a string value
visit()method 
public function visit(f:Function):Boolean

Sequentially invokes the input function on this expression and all sub-expressions. Complete either when all expressions have been visited or the input function returns true, thereby signalling an early exit.

Parameters
f:Function — the visiting function to invoke on this expression

Returns
Boolean — true if the input function signalled an early exit