Packagecom.rosettastone.library.taskmanager
Classpublic class AbstractCompositeTask
InheritanceAbstractCompositeTask Inheritance Task Inheritance flash.events.EventDispatcher
Subclasses CompositeTask, InterruptibleCompositeTask

This is an abstract class and should not be instantiated directly. Instead use one of the following sub-classes: CompositeTask, InterruptibleCompositeTask



Public Properties
 PropertyDefined By
 Inheriteddata : *
[read-only] Optional data parameter passed to the Task complete/error/interruption method.
Task
  errorDatas : Array
[read-only] Error datas from all inner Tasks that failed during execution.
AbstractCompositeTask
  erroredTasks : Array
[read-only] Tasks that errored during execution.
AbstractCompositeTask
  errorMessages : Array
[read-only] Unique error messages from all inner Tasks that failed during execution.
AbstractCompositeTask
 Inheritedid : Number
[read-only]
Task
  interruptible : Boolean
[override] [read-only] The current Task can be interrupted.
AbstractCompositeTask
 InheritedinterruptingTask : ITask
[read-only] The Task currently interrupting the composite Task's execution (or NULL if no such Task exists).
Task
 InheritedisComplete : Boolean
[read-only] The current task has successfully completed execution.
Task
 InheritedisErrored : Boolean
[read-only] The current task failed.
Task
 InheritedisInterrupted : Boolean
[read-only]
Task
 InheritedisRunning : Boolean
[read-only] The task is currently running.
Task
 Inheritedmessage : String
[read-only] Optional message parameter passed to the task complete/error/interruption method.
Task
  numCompletedTasks : int
[read-only] Number of inner Tasks that have successfully completed.
AbstractCompositeTask
  numInternalOperations : int
[override] [read-only] Number of internal operations conducted by this task.
AbstractCompositeTask
  numInternalOperationsCompleted : int
[override] [read-only] Number of internal operations that have completed.
AbstractCompositeTask
 InheritednumInternalOperationsPending : int
[read-only] Number of internal operations not yet completed.
Task
  numPendingTasks : int
[read-only] Number of inner Tasks that have been started and have not yet completed.
AbstractCompositeTask
  numTasks : int
[read-only] Number of inner Tasks.
AbstractCompositeTask
 InheritednumTimesCompleted : int
[read-only] Number of times this task has completed.
Task
 InheritednumTimesErrored : int
[read-only] Number of times this task has errored.
Task
 InheritednumTimesInterrupted : int
[read-only] Number of times this task has been interrupted.
Task
 InheritednumTimesReset : int
[read-only] Number of times this task has been reset.
Task
 InheritednumTimesStarted : int
[read-only] Number of times this task has been started.
Task
  pendingTasks : Array
[read-only] Tasks currently in the process of being executed.
AbstractCompositeTask
 Inheritedrunning : Boolean
[read-only] The task is currently running.
Task
  synchronous : Boolean
[override] [read-only] The current task can be executed synchronously.
AbstractCompositeTask
 InheritedtaskIdentifier : String
(Optional) human-readable label for task.
Task
 InheriteduniqueID : Number
[read-only] Unique ID for a task.
Task
Protected Properties
 PropertyDefined By
  _addTasksBeforeRunInvoked : Boolean
AbstractCompositeTask
  allTasksAreCompleted : Boolean
[read-only] No incomplete Tasks remain in the queue.
AbstractCompositeTask
  currentSerialTask : ITask
[read-only] References the Task that is currently running (if this CompositeTask has been told to execute in serial).
AbstractCompositeTask
  _erroredTasks : Array
AbstractCompositeTask
  _executeTaskInParallel : Boolean
AbstractCompositeTask
  _flushTaskQueueLock : Boolean
AbstractCompositeTask
  _interruptedTask : ITask
AbstractCompositeTask
 Inheritedlogger : ILogger
[read-only] Instance of ILogger to be used for any custom Task logging.
Task
  _taskQueue : Array
AbstractCompositeTask
  _taskQueueIndex : int
AbstractCompositeTask
Public Methods
 MethodDefined By
  
addFunction(closure:Function, closureIdentifier:String = null):TaskWithClosure
Adds a function to the queue of Tasks by wrapping it inside of a TaskWithClosure.
AbstractCompositeTask
  
addMultiple(... tasksOrFunctions):void
Adds multiple Tasks or Functions to the internal set.
AbstractCompositeTask
 Inherited
and(... chainedTasks):ITask
Executes the specified tasks when the current task is executed.
Task
 Inherited
Task
  
interrupt():Boolean
[override] Interruptible tasks should override interrupt() and get interruptible() if they are interruptible.
AbstractCompositeTask
 Inherited
interruptForTask(interruptingTask:ITask):Boolean
Interrupts the current Task to wait on the Task specified.
Task
 Inherited
or(... chainedTasks):ITask
Executes the specified tasks if the current task fails.
Task
  
Removes a function from the queue of Tasks by locating its corresponding TaskWithClosure.
AbstractCompositeTask
  
removeMultiple(... tasksOrFunctions):void
Removes multiple Tasks or Functions from the internal set.
AbstractCompositeTask
  
removeTask(task:ITask):void
Removes a task from the internal set that this class will execute.
AbstractCompositeTask
 Inherited
reset():void
Resets the task to it's pre-run state.
Task
 Inherited
Starts a task.
Task
 Inherited
then(... chainedTasks):ITask
Executes the specified tasks once the current task has completed successfully.
Task
 Inherited
withCompleteHandler(completeHandler:Function):ITask
Although tasks dispatch TaskEvents to indicate completion, this method may also be used for notification purposes.
Task
 Inherited
withErrorHandler(errorHandler:Function):ITask
Although tasks dispatch TaskEvents to indicate failure, this method may also be used for notification purposes.
Task
 Inherited
withFinalHandler(finalHandler:Function):ITask
This handler is invoked upon either success or failure of the Task.
Task
 Inherited
withInterruptionHandler(interruptionHandler:Function):ITask
Task
 Inherited
withStartedHandler(startedHandler:Function):ITask
Although tasks dispatch TaskEvents to indicate starting, this method may also be used for notification purposes.
Task
Protected Methods
 MethodDefined By
  
Convenience method for adding TaskEvent listeners to a Task.
AbstractCompositeTask
  
addTaskHelper(task:ITask):void
Adds another task to the internal set that this class will execute.
AbstractCompositeTask
  
Sub-classes may override this method to J.I.T.
AbstractCompositeTask
  
AbstractCompositeTask
  
[override] Override this method to perform any custom reset operations.
AbstractCompositeTask
  
customRun():void
[override] Override this method to give your Task functionality.
AbstractCompositeTask
 Inherited
Task
  
flushTaskQueue(forcefullyPreventTaskFromCompleting:Boolean = false):void
Remove all Tasks from the queue.
AbstractCompositeTask
 Inherited
getLoggerString(string:String):String
Returns a string for logging the specified task-state event.
Task
  
Convenience method for handling a completed Task and executing the next.
AbstractCompositeTask
  
Override this method to be notified when individual Tasks have successfully completed.
AbstractCompositeTask
  
Override this method to be notified when individual Tasks are started.
AbstractCompositeTask
  
Convenience method for removing TaskEvent listeners from a Task.
AbstractCompositeTask
 Inherited
taskComplete(message:String, data:* = null):void
This method should be called upon Task completion.
Task
 Inherited
taskError(message:String, data:* = null):void
This method should be called upon Task failure.
Task
 Inherited
taskInterrupted(message:String, data:* = null):void
Call this method to interrupt the currently running Task.
Task
 Inherited
Task
Events
 Event Summary Defined By
 InheritedTask
 InheritedTask
 InheritedTask
 InheritedTask
 InheritedTask
 InheritedTask
Property Detail
_addTasksBeforeRunInvokedproperty
protected var _addTasksBeforeRunInvoked:Boolean

_erroredTasksproperty 
protected var _erroredTasks:Array

_executeTaskInParallelproperty 
protected var _executeTaskInParallel:Boolean

_flushTaskQueueLockproperty 
protected var _flushTaskQueueLock:Boolean

_interruptedTaskproperty 
protected var _interruptedTask:ITask

_taskQueueproperty 
protected var _taskQueue:Array

_taskQueueIndexproperty 
protected var _taskQueueIndex:int

allTasksAreCompletedproperty 
allTasksAreCompleted:Boolean  [read-only]

No incomplete Tasks remain in the queue.


Implementation
    protected function get allTasksAreCompleted():Boolean
currentSerialTaskproperty 
currentSerialTask:ITask  [read-only]

References the Task that is currently running (if this CompositeTask has been told to execute in serial).


Implementation
    protected function get currentSerialTask():ITask
errorDatasproperty 
errorDatas:Array  [read-only]

Error datas from all inner Tasks that failed during execution. This value is valid after during execution of the CompositeTask as well as upon completion (or failure).


Implementation
    public function get errorDatas():Array
erroredTasksproperty 
erroredTasks:Array  [read-only]

Tasks that errored during execution. This value is valid after during execution of the CompositeTask as well as upon completion (or failure).


Implementation
    public function get erroredTasks():Array
errorMessagesproperty 
errorMessages:Array  [read-only]

Unique error messages from all inner Tasks that failed during execution. This value is valid after during execution of the CompositeTask as well as upon completion (or failure).


Implementation
    public function get errorMessages():Array
interruptibleproperty 
interruptible:Boolean  [read-only] [override]

The current Task can be interrupted. Invoking interrupt() for a Task that is not marked as interruptible may result in an error.


Implementation
    public function get interruptible():Boolean
numCompletedTasksproperty 
numCompletedTasks:int  [read-only]

Number of inner Tasks that have successfully completed. This value is only valid while the CompositeTask is running. Upon completion (or failure) of the CompositeTask this value will be reset to 0.


Implementation
    public function get numCompletedTasks():int
numInternalOperationsproperty 
numInternalOperations:int  [read-only] [override]

Number of internal operations conducted by this task. Sub-classes should override this method if containing a value > 1; If value > 1, task should dispatch ProgressEvent.PROGRESS events manually to indicate changes in numInternalOperationsCompleted. If value == 1, task will automatically dispatching ProgressEvent.PROGRESS events.


Implementation
    public function get numInternalOperations():int
numInternalOperationsCompletedproperty 
numInternalOperationsCompleted:int  [read-only] [override]

Number of internal operations that have completed. Sub-classes should override this method if containing a value > 1;


Implementation
    public function get numInternalOperationsCompleted():int
numPendingTasksproperty 
numPendingTasks:int  [read-only]

Number of inner Tasks that have been started and have not yet completed. This value is only valid while the CompositeTask is running (or before it has been started). Upon completion (or failure) of the CompositeTask this value will be reset to 0.


Implementation
    public function get numPendingTasks():int
numTasksproperty 
numTasks:int  [read-only]

Number of inner Tasks. This value is only valid while the CompositeTask is running (or before it has been started). Upon completion (or failure) of the CompositeTask this value will be reset to 0.


Implementation
    public function get numTasks():int
pendingTasksproperty 
pendingTasks:Array  [read-only]

Tasks currently in the process of being executed. This value is only valid while the CompositeTask is running (or before it has been started). Upon completion (or failure) of the CompositeTask this value will be reset to 0.


Implementation
    public function get pendingTasks():Array
synchronousproperty 
synchronous:Boolean  [read-only] [override]

The current task can be executed synchronously.


Implementation
    public function get synchronous():Boolean
taskQueueproperty 
taskQueue:Array  [read-only]


Implementation
    TaskPrivateNamespace function get taskQueue():Array
taskQueueIndexproperty 
taskQueueIndex:int  [read-only]


Implementation
    TaskPrivateNamespace function get taskQueueIndex():int
Method Detail
addFunction()method
public function addFunction(closure:Function, closureIdentifier:String = null):TaskWithClosure

Adds a function to the queue of Tasks by wrapping it inside of a TaskWithClosure. Functions added this way must be synchronous. This method is simply a convenience method for creating a TaskWithClosure and calling addTask().

Parameters

closure:Function — Function to be executed
 
closureIdentifier:String (default = null) — Unique identifier for function (and its TaskWithClosure)

Returns
TaskWithClosure — Newly created TaskWithClosure
addMultiple()method 
public function addMultiple(... tasksOrFunctions):void

Adds multiple Tasks or Functions to the internal set. This method is a convenience mehtod for calling addTask() or addFunction() multiple times.

Parameters

... tasksOrFunctions — Task or Function objects


Throws
Error — if any of the specified parameters is not a Task or a Function
addTaskEventListeners()method 
protected function addTaskEventListeners(task:ITask):void

Convenience method for adding TaskEvent listeners to a Task.

Parameters

task:ITask

addTaskHelper()method 
protected function addTaskHelper(task:ITask):void

Adds another task to the internal set that this class will execute. Additional tasks may be safely at any time (including while the CompositeTask is executing). Tasks are added to the end, so in serial tasks, tasks added later will not be run if an earlier one fails.

Parameters

task:ITask

addTasksBeforeRun()method 
protected function addTasksBeforeRun():void

Sub-classes may override this method to J.I.T. add child Tasks before the composite Task is run.

checkForTaskCompletion()method 
protected function checkForTaskCompletion():void

customReset()method 
override protected function customReset():void

Override this method to perform any custom reset operations.

customRun()method 
override protected function customRun():void

Override this method to give your Task functionality.

flushTaskQueue()method 
protected function flushTaskQueue(forcefullyPreventTaskFromCompleting:Boolean = false):void

Remove all Tasks from the queue.

Parameters

forcefullyPreventTaskFromCompleting:Boolean (default = false) — Prevent CompositeTask from completing after queue has been cleared

handleTaskCompletedOrRemoved()method 
protected function handleTaskCompletedOrRemoved(task:ITask):void

Convenience method for handling a completed Task and executing the next.

Parameters

task:ITask

individualTaskComplete()method 
protected function individualTaskComplete(task:ITask):void

Override this method to be notified when individual Tasks have successfully completed.

Parameters

task:ITask

individualTaskStarted()method 
protected function individualTaskStarted(task:ITask):void

Override this method to be notified when individual Tasks are started.

Parameters

task:ITask

interrupt()method 
override public function interrupt():Boolean

Interruptible tasks should override interrupt() and get interruptible() if they are interruptible. If they are, they should fire a TaskEvent.INTERRUPTED to indicate successful interruption of the task. If the interrupting fails at runtime, this method returns false

Returns
Boolean
removeFunction()method 
public function removeFunction(closure:Function):TaskWithClosure

Removes a function from the queue of Tasks by locating its corresponding TaskWithClosure. This method is simply a convenience method for locating the matching Task and calling removeTask().

Parameters

closure:Function — Function to be executed

Returns
TaskWithClosure — TaskWithClosure (if one found)
removeMultiple()method 
public function removeMultiple(... tasksOrFunctions):void

Removes multiple Tasks or Functions from the internal set. This method is a convenience mehtod for calling removeTask() or removeFunction() multiple times.

Parameters

... tasksOrFunctions — Task or Function objects


Throws
Error — if any of the specified parameters is not a Task or a Function
removeTask()method 
public function removeTask(task:ITask):void

Removes a task from the internal set that this class will execute. If the specified Task has not been executed before it is removed it will not be executed by the CompositeTask.

Parameters

task:ITask

removeTaskEventListeners()method 
protected function removeTaskEventListeners(task:ITask):void

Convenience method for removing TaskEvent listeners from a Task.

Parameters

task:ITask