API Documentation | All Packages | All Classes | Index | Frames No Frames |
StatementSequencer

Package | org.flexunit.internals.runners.statements
Class | public class StatementSequencer
Inheritance | StatementSequencer AsyncStatementBase Object
Implements | IAsyncStatement
Subclasses | ChildRunnerSequencer, SequencerWithDecoration

The `StatementSequencer` is a class that is responsible for the execution of `IAsyncStatement`s. 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
Hide Inherited Protected Properties
Show Inherited Protected Properties

| Property | Defined By
--- | --- | ---
|  | errors : Array An array of errors that have been encountered during the execution of statements. | StatementSequencer
|  | myToken : AsyncTestToken The AsyncTestToken for the current statment. | AsyncStatementBase
|  | parentToken : AsyncTestToken The AsyncTestToken for the parent of the current statment. | AsyncStatementBase
|  | queue : Array An array of queued statements to run. | StatementSequencer

Public Methods

| Method | Defined By
--- | --- | ---
|  | StatementSequencer(queue:Array = null) Constructor. | StatementSequencer
|  | addStep(child:IAsyncStatement):void 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
|  | handleChildExecuteComplete(result:ChildResult):void 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

| Method | Defined 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

errors | property

`protected var errors:Array`

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

queue | property |

`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.

Thu Apr 10 2014, 08:07 AM +10:00