Packageorg.flexunit.internals.runners.statements
Classpublic class StatementSequencer
InheritanceStatementSequencer Inheritance AsyncStatementBase Inheritance Object
Implements IAsyncStatement
Subclasses ChildRunnerSequencer, SequencerWithDecoration

The StatementSequencer is a class that is responsible for the execution of IAsyncStatements. These statements can be provided to the StatementSequencer as an array during instantiation or added using the #addStep method. The list of statements can be executed using the #evaluate method and any errors encountered during execution will be noted and reported. Each statement will be run in sequence, meaning the next will not start to be executed until the current statement has finished.



Protected Properties
 PropertyDefined By
  errors : Array
An array of errors that have been encountered during the execution of statements.
StatementSequencer
 InheritedmyToken : AsyncTestToken
The AsyncTestToken for the current statment.
AsyncStatementBase
 InheritedparentToken : AsyncTestToken
The AsyncTestToken for the parent of the current statment.
AsyncStatementBase
  queue : Array
An array of queued statements to run.
StatementSequencer
Public Methods
 MethodDefined By
  
StatementSequencer(queue:Array = null)
Constructor.
StatementSequencer
  
Adds a child that implements IAsyncStatement to the end of the queue of statments to execute by the sequencer.
StatementSequencer
  
evaluate(parentToken:AsyncTestToken):void
Starts evaluating the queue of statements that was provided to the sequencer.
StatementSequencer
  
Determine if any errors were encountered for a potential statement that has just run and returned the provided result.
StatementSequencer
  
toString():String
[override] Returns the current queue of statements that are in the sequence.
StatementSequencer
Protected Methods
 MethodDefined By
  
executeStep(child:*):void
Evaluates the provided child if the child is an IAsyncStatement.
StatementSequencer
  
sendComplete(error:Error = null):void
[override] If an error is provided, it will be added to the list of errors encountered during the execution of the statements.
StatementSequencer
Property Detail
errorsproperty
protected var errors:Array

An array of errors that have been encountered during the execution of statements.

queueproperty 
protected var queue:Array

An array of queued statements to run.

Constructor Detail
StatementSequencer()Constructor
public function StatementSequencer(queue:Array = null)

Constructor.

Parameters
queue:Array (default = null) — An array containing objects that implement IAsyncStatment that are to be evaluated by the sequencer.
Method Detail
addStep()method
public function addStep(child:IAsyncStatement):void

Adds a child that implements IAsyncStatement to the end of the queue of statments to execute by the sequencer.

Parameters

child:IAsyncStatement — The object that implements IAsyncStatement to add.

evaluate()method 
public function evaluate(parentToken:AsyncTestToken):void

Starts evaluating the queue of statements that was provided to the sequencer.

Parameters

parentToken:AsyncTestToken — The token to be notified when all statements have finished running.

executeStep()method 
protected function executeStep(child:*):void

Evaluates the provided child if the child is an IAsyncStatement.

Parameters

child:* — The child object to be evaluated.

handleChildExecuteComplete()method 
public function handleChildExecuteComplete(result:ChildResult):void

Determine if any errors were encountered for a potential statement that has just run and returned the provided result. If an error was encountered during the last statement, add that error to a list of errors encountered in every statement in the sequencer. If there are still statements that need to be evaluated, execute the first unexecuted step in the sequence. Otherwise, if all statements have finished running, the StatementSequencer has finished and will report any errors that have been encoutnred.

Parameters

result:ChildResult — A potential ChildResult that was encountered during the execution of the previous statement.

sendComplete()method 
override protected function sendComplete(error:Error = null):void

If an error is provided, it will be added to the list of errors encountered during the execution of the statements. If the error list contains more than one error, a MultipleFailureException will be created an given the corresponding errors. The parentToken will then be notified of any error encountered during execution of the statements. If the parentToken has not already been alerted that the statement has completed, alert the parent token that the current statement has finished.

Parameters

error:Error (default = null) — The Error to send to the parentToken.

toString()method 
override public function toString():String

Returns the current queue of statements that are in the sequence.

Returns
String — a string representing the sequence queue.