Packageflare.query
Classpublic class If
InheritanceIf Inheritance Expression

Expression operator for an if statement that performs conditional execution.



Public Properties
 PropertyDefined by
  els : Expression
Sub-expression evaluated if the test condition is false.
If
  numChildren : int
[read-only] The number of sub-expressions that are children of this expression.
If
  test : Expression
The conditional clause of the if statement.
If
  then : Expression
Sub-expression evaluated if the test condition is true.
If
Public Methods
 MethodDefined by
  
If(test:*, thenExpr:*, elseExpr:*)
Create a new IfExpression.
If
  
Creates a cloned copy of the expression.
If
  
eval(o:Object = null):*
Evaluates this expression with the given input object.
If
 Inherited
[static] Utility method that maps an input value into an Expression.
Expression
  
Returns the sub-expression at the given index.
If
 Inherited
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.
If
  
toString():String
Returns a string representation of the expression.
If
 Inherited
visit(f:Function):Boolean
Sequentially invokes the input function on this expression and all sub-expressions.
Expression
Property detail
elsproperty
els:Expression  [read-write]

Sub-expression evaluated if the test condition is false.

Implementation
    public function get els():Expression
    public function set els(value:Expression):void
numChildrenproperty 
numChildren:int  [read-only]

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

Implementation
    public function get numChildren():int
testproperty 
test:Expression  [read-write]

The conditional clause of the if statement.

Implementation
    public function get test():Expression
    public function set test(value:Expression):void
thenproperty 
then:Expression  [read-write]

Sub-expression evaluated if the test condition is true.

Implementation
    public function get then():Expression
    public function set then(value:Expression):void
Constructor detail
If()constructor
public function If(test:*, thenExpr:*, elseExpr:*)

Create a new IfExpression.

Parameters
test:* — the test expression for the if statement
 
thenExpr:* — the expression to evaluate if the test predicate evaluates to true
 
elseExpr:* — the expression to evaluate if the test predicate evaluates to false
Method detail
clone()method
public override function clone():Expression

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

Returns
Expression — the cloned expression.
eval()method 
public override 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
getChildAt()method 
public override 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.
setChildAt()method 
public override 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 override function toString():String

Returns a string representation of the expression.

Returns
String — this expression as a string value