GODPAPER | All Packages | All Classes | Index | Frames No Frames |
Task

Package | com.adobe.cairngorm.task
Class | public class Task
Inheritance | Task flash.events.EventDispatcher
Implements | ITask
Subclasses | ChessTaskBase, TaskGroup, UpdateChessPiecesTask, UpdatePiecesBitboardTask, UpdatePiecesOmenVoTask, UpdatePiecesPositionTask, UpdateZobristKeysTask

Base-class for a tasks that perform some processing and can be placed inside task groups.

The abstract `performTask()` method must be implemented by concrete sub-classes, and the `complete()` or `fault()` methods invoked to indicate that the processing has completed or failed.

The `progress` method may optionally be invoked to provide fine-grained progress updates. The base-class will dispatch an initial and final progress event for 0% complete and 100% complete, assuming the task completes successfully.

Public Properties

| Property | Defined By
--- | --- | ---
|  | currentState : String [read-only] | Task
|  | enabled : Boolean | Task
|  | label : String | Task

Public Methods

| Method | Defined By
--- | --- | ---
|  | start():void | Task

Protected Methods

| Method | Defined By
--- | --- | ---
|  | complete():void This should be called by a concrete sub-class to indicate that the task has been completed. | Task
|  | fault(message:String = null):void This should be called by a concrete sub-class to indicate that the task has been halted due to a fault. | Task
|  | performTask():void This abstract template method must be implemented by a concrete sub-class to perform the task associated with the task. | Task

Events

| Event | Summary | Defined By
--- | --- | --- | ---
|  | currentStateChange |  | Task
|  | taskComplete |  | Task
|  | taskFault |  | Task
|  | taskStart |  | Task

Property Detail

currentState | property

`currentState:String` [read-only]

Implementation
`public function get currentState():String`

enabled | property |

`enabled:Boolean`

Implementation
`public function get enabled():Boolean`
`public function set enabled(value:Boolean):void`

label | property |

`label:String`

Implementation
`public function get label():String`
`public function set label(value:String):void`
Method Detail

complete | () | method

`protected function complete():void`

This should be called by a concrete sub-class to indicate that the task has been completed. It should only be called once and subsequent calls are ignored.

fault | () | method |

`protected function fault(message:String = null):void`

This should be called by a concrete sub-class to indicate that the task has been halted due to a fault. It should only be called once and subsequent calls are ignored.

Parameters

| `message:String` (default = `null`)`` — an optional message describing the cause of the fault

performTask | () | method |

`protected function performTask():void`

This abstract template method must be implemented by a concrete sub-class to perform the task associated with the task. The task may be synchronous or asynchronous. When the task is completed, the `complete()` method must be called, unless a fault has occurred, in which case the `fault()` method must be called instead.

start | () | method |

`public function start():void`

Event Detail

currentStateChange | Event

Event Object Type: `mx.events.StateChangeEvent`

taskComplete | Event |

Event Object Type: `com.adobe.cairngorm.task.TaskEvent`

taskFault | Event |

Event Object Type: `com.adobe.cairngorm.task.TaskEvent`

taskStart | Event |

Event Object Type: `com.adobe.cairngorm.task.TaskEvent`

Thu Jan 16 2014, 01:11 PM +08:00