Packageflare.query
Classpublic class ExpressionIterator

The ExpressionIterator simplifies the process of traversing an expression tree.



Public Properties
 PropertyDefined by
  current : Expression
[read-only] The expression at this iterator's current position.
ExpressionIterator
  depth : int
[read-only] The depth of this iterator's current position in the expression tree.
ExpressionIterator
  expression : Expression
The expression being traversed.
ExpressionIterator
  parent : Expression
[read-only] The parent expression of the iterator's current position.
ExpressionIterator
  path : Array
[read-only] An array of expressions from the root expression down to this iterator's current position.
ExpressionIterator
Public Methods
 MethodDefined by
  
Creates a new ExpressionIterator.
ExpressionIterator
  
down(idx:int = 0):Expression
Moves the iterator one level down the expression tree.
ExpressionIterator
  
Moves the iterator to the next sibling expression in the expression tree.
ExpressionIterator
  
Moves the iterator to the previous sibling expression in the expression tree.
ExpressionIterator
  
reset():void
Resets this iterator to the root of the expression tree.
ExpressionIterator
  
Moves the iterator one level up the expression tree.
ExpressionIterator
Property detail
currentproperty
current:Expression  [read-only]

The expression at this iterator's current position.

Implementation
    public function get current():Expression
depthproperty 
depth:int  [read-only]

The depth of this iterator's current position in the expression tree.

Implementation
    public function get depth():int
expressionproperty 
expression:Expression  [read-write]

The expression being traversed.

Implementation
    public function get expression():Expression
    public function set expression(value:Expression):void
parentproperty 
parent:Expression  [read-only]

The parent expression of the iterator's current position.

Implementation
    public function get parent():Expression
pathproperty 
path:Array  [read-only]

An array of expressions from the root expression down to this iterator's current position.

Implementation
    public function get path():Array
Constructor detail
ExpressionIterator()constructor
public function ExpressionIterator(expr:Expression = null)

Creates a new ExpressionIterator.

Parameters
expr:Expression (default = null) — the expression to iterate over
Method detail
down()method
public function down(idx:int = 0):Expression

Moves the iterator one level down the expression tree. By default, the iterator moves to the left-most child of the previous position.

Parameters
idx:int (default = 0) — the index of the child expression this iterator should move down to

Returns
Expression — the new current expression, or null if the iterator could not move any further down the tree
next()method 
public function next():Expression

Moves the iterator to the next sibling expression in the expression tree.

Returns
Expression — the new current expression, or null if the current position has no next sibling.
prev()method 
public function prev():Expression

Moves the iterator to the previous sibling expression in the expression tree.

Returns
Expression — the new current expression, or null if the current position has no previous sibling.
reset()method 
public function reset():void

Resets this iterator to the root of the expression tree.

up()method 
public function up():Expression

Moves the iterator one level up the expression tree.

Returns
Expression — the new current expression, or null if the iterator could not move any further up the tree