| Package | gugga.tasks.containers.taskManager |
| Class | public class TaskManager |
| Inheritance | TaskManager flash.events.EventDispatcher |
| Implements | ITask |
TaskManager is a facade encapsulating the complexity in a
certain web of tasks. The relationships between tasks could be very comlpex,
especially if there are subsets of asynchronous tasks, waiting for
completed or other kinds of events fired from other
tasks, that could be also asynchronous.
Behind the scenes TaskManager is a container for
TaskManagerItem items and a list of final preconditions that
should be met in order to fire the completed event.
TaskManager completes right after its start, when no final
tasks or final preconditions were specified.
See also
| Property | Defined by | ||
|---|---|---|---|
| ImmediatelyInterruptable : Boolean [read-only]
| TaskManager | ||
| MarkedTasks : Dictionary
[read-only]
| TaskManager | ||
| Tasks : Array [read-only]
| TaskManager | ||
| Method | Defined by | ||
|---|---|---|---|
|
TaskManager(aAccepting:Boolean = true)
We can set the accepting state of the
TaskManager through this constructor. | TaskManager | ||
|
acceptAll():void
Every
TaskManagerItem will accept for all of the
preconditions that are associated with it. | TaskManager | ||
|
acceptEventSource(aEventSource:IEventDispatcher):void
Every
TaskManagerItem will accept for all of the
preconditions comming from the specified event source. | TaskManager | ||
|
acceptPrecondition(aPrecondition:EventDescriptor):void
Every
TaskManagerItem will accept for the specified
precondition. | TaskManager | ||
|
addFinalPrecondition(aPrecondition:EventDescriptor):void
Adds precondition to the final preconditions list.
| TaskManager | ||
|
addFinalPreconditions(aPreconditions:Array):void
Adds preconditions to the final preconditions list.
| TaskManager | ||
|
addStartingTask(aTask:ITask):void
addStartingTasks(aTask : ITask) will create and add new
TaskManagerItem item to the TaskManager and
exception will be raised if the specified task is already associated
with existing TaskManagerItem. | TaskManager | ||
|
addStartingTasks(aTasks:Array):void
addStartingTasks(aTasks : Array) will create and add new
TaskManagerItem items to the TaskManager and
exception will be raised if any of the specified tasks is already
associated with existing TaskManagerItem. | TaskManager | ||
|
Adds the specified precondition to the associated with the specified
task
TaskManagerItem. | TaskManager | ||
|
addTaskPreconditions(aTask:ITask, aPreconditions:Array):void
Adds the specified preconditions to the associated with the specified
task
TaskManagerItem. | TaskManager | ||
|
Analogous to the
addTaskWithPredecessor() method. | TaskManager | ||
|
addTaskPredecessors(aTask:ITask, aPredecessors:Array):void
Analogous to the
addTaskWithPredecessors() method. | TaskManager | ||
|
If no
TaskManagerItem is associated with the specified
task, the method will add new TaskManagerItem to the
TaskManager. | TaskManager | ||
|
addTaskWithPreconditions(aTask:ITask, aPreconditions:Array):void
If no
TaskManagerItem is associated with the specified
task, the method will add a new TaskManagerItem to the
TaskManager. | TaskManager | ||
|
If no
TaskManagerItem is associated with the specified
task, the method will add a new TaskManagerItem to the
TaskManager. | TaskManager | ||
|
addTaskWithPredecessors(aTask:ITask, aPredecessors:Array):void
If no
TaskManagerItem is associated with the specified
task, the method will add a new TaskManagerItem to the
TaskManager. | TaskManager | ||
|
getMarkedTask(aMarker:String):ITask
| TaskManager | ||
|
getTaskMarker(aTask:ITask):String
| TaskManager | ||
|
ignoreAll():void
Every
TaskManagerItem will ignore all of the preconditions
that are associated with it. | TaskManager | ||
|
ignoreEventSource(aEventSource:IEventDispatcher):void
Every
TaskManagerItem will ignore all of the
preconditions comming from the specified event source. | TaskManager | ||
|
ignorePrecondition(aPrecondition:EventDescriptor):void
Every
TaskManagerItem will ignore the specified
precondition. | TaskManager | ||
|
interrupt():void
interrupt() method will interrupt all of the
TaskManagerItem items. | TaskManager | ||
|
isImmediatelyInterruptable():Boolean
isImmediatelyInterruptable() checks for each
TaskManagerItem behind the facade whether it is immediately
interruptable. | TaskManager | ||
|
isRunning():Boolean
| TaskManager | ||
| TaskManager | |||
|
removeFinalPrecondition(aPrecondition:EventDescriptor):void
Removes the specified precondition from the final preconditions list.
| TaskManager | ||
|
removeTask(aTask:ITask):void
If
TaskManagerItem is associated with the specified task,
it will remove this item and all preconditions in the
TaskManager associated with the specified task. | TaskManager | ||
|
Removes the specified precondition if there is an associated
TaskManagerItem with the specified task. | TaskManager | ||
|
Removes for the specified task the preconditon that will be met when the
specified predecessor task is completed.
| TaskManager | ||
|
If
TaskManagerItem is associated with the specified task,
it will replase its scheduled task with the new one. | TaskManager | ||
|
reset():void
Resets every
TaskManagerItem
| TaskManager | ||
|
revokeFinalTask(aTask:ITask):void
Removes the precondition that should be met, when the specified task is
completed.
| TaskManager | ||
|
revokeStartingTask(aTask:ITask):void
Checks whether there is an associated
TaskManagerItem with
the specified task. | TaskManager | ||
|
setFinalTask(aTask:ITask):void
Adds a precondition to the final preconditions list.
| TaskManager | ||
|
setStartingTask(aTask:ITask):void
Checks whether there is an associated
TaskManagerItem with
the specified task. | TaskManager | ||
|
start():void
The
start() method is responsible for the following actions:
| TaskManager | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
| TaskManager | ||||
| TaskManager | ||||
| TaskManager | ||||
| ImmediatelyInterruptable | property |
ImmediatelyInterruptable:Boolean [read-only]Implementation
public function get ImmediatelyInterruptable():Boolean
| MarkedTasks | property |
| Tasks | property |
Tasks:Array [read-only]Implementation
public function get Tasks():Array
| TaskManager | () | constructor |
public function TaskManager(aAccepting:Boolean = true)
We can set the accepting state of the
TaskManager through this constructor.
The constructor will create an accepting
TaskManager by default if no argument is specified.
Parameters
aAccepting:Boolean (default = true) — accepting state(accepting or unaccepting)
|
See also
| acceptAll | () | method |
public function acceptAll():void
Every TaskManagerItem will accept for all of the
preconditions that are associated with it.
| acceptEventSource | () | method |
public function acceptEventSource(aEventSource:IEventDispatcher):void
Every TaskManagerItem will accept for all of the
preconditions comming from the specified event source.
aEventSource:IEventDispatcher — event source for preconditions, that will be accepted
|
| acceptPrecondition | () | method |
public function acceptPrecondition(aPrecondition:EventDescriptor):void
Every TaskManagerItem will accept for the specified
precondition.
aPrecondition:EventDescriptor — precondition that will be accepted
|
| addFinalPrecondition | () | method |
public function addFinalPrecondition(aPrecondition:EventDescriptor):void
Adds precondition to the final preconditions list.
TaskManager completes right after its start, when no final
tasks or final preconditions were specified.
aPrecondition:EventDescriptor |
| addFinalPreconditions | () | method |
public function addFinalPreconditions(aPreconditions:Array):void
Adds preconditions to the final preconditions list.
TaskManager completes right after its start, when no final
tasks or final preconditions were specified.
aPreconditions:Array — array of preconditions
|
| addStartingTask | () | method |
public function addStartingTask(aTask:ITask):void
addStartingTasks(aTask : ITask) will create and add new
TaskManagerItem item to the TaskManager and
exception will be raised if the specified task is already associated
with existing TaskManagerItem. It will also add a
precondition to wait for start event from the
TaskManager task, in order to start the
TaskManagerItem item's execution. The associated
TaskManagerItem items will start only if the
TaskManager task is started, and never before it.
aTask:ITask — new starting task
|
| addStartingTasks | () | method |
public function addStartingTasks(aTasks:Array):void
addStartingTasks(aTasks : Array) will create and add new
TaskManagerItem items to the TaskManager and
exception will be raised if any of the specified tasks is already
associated with existing TaskManagerItem. It will also add
a precondition to wait for start event from the
TaskManager task, in order to start the
TaskManagerItem item's execution. The associated
TaskManagerItem items will start only if the
TaskManager task is started, and never before it.
aTasks:Array — array of ITask items, that we want to be starting tasks
|
| addTaskPrecondition | () | method |
public function addTaskPrecondition(aTask:ITask, aPrecondition:EventDescriptor):void
Adds the specified precondition to the associated with the specified
task TaskManagerItem. If no TaskManagerItem is
associated with the specified task, the method will raise an exception.
aTask:ITask — task already associated with a TaskManagerItem
|
|
aPrecondition:EventDescriptor — precondition
|
| addTaskPreconditions | () | method |
public function addTaskPreconditions(aTask:ITask, aPreconditions:Array):void
Adds the specified preconditions to the associated with the specified
task TaskManagerItem. If no TaskManagerItem is
associated with the specified task, the method will raise an exception.
aTask:ITask — task already associated with a TaskManagerItem
|
|
aPreconditions:Array — preconditions
|
| addTaskPredecessor | () | method |
public function addTaskPredecessor(aTask:ITask, aPredecessor:ITask):void
Analogous to the addTaskWithPredecessor() method. The only
difference is that addTaskPredecessor() will not add a new
TaskManagerItem if there is no associated
TaskManagerItem with the specified task. On the contrary,
it will raise an exception - the specified task does not exist.
aTask:ITask — task already associated with a TaskManagerItem
|
|
aPredecessor:ITask — array of predecessor tasks, that should complete in order to start the specified task
|
See also
| addTaskPredecessors | () | method |
public function addTaskPredecessors(aTask:ITask, aPredecessors:Array):void
Analogous to the addTaskWithPredecessors() method. The only
difference is that addTaskPredecessors() will not add a new
TaskManagerItem if there is no associated
TaskManagerItem with the specified task. On the contrary,
it will raise an exception - the specified task does not exist.
aTask:ITask — task already associated with a TaskManagerItem
|
|
aPredecessors:Array — array of predecessor tasks, that should complete in order to start the specified task
|
See also
| addTaskWithPrecondition | () | method |
public function addTaskWithPrecondition(aTask:ITask, aPrecondition:EventDescriptor):void
If no TaskManagerItem is associated with the specified
task, the method will add new TaskManagerItem to the
TaskManager. Then the specified precondition is added to
the new TaskManagerItem.
An exception will be raised if there is an existing
TaskManagerItem associated with the specified task.
Parameters
aTask:ITask — new task or a task already associated with a TaskManagerItem
|
|
aPrecondition:EventDescriptor — array of preconditions, that should be met
|
| addTaskWithPreconditions | () | method |
public function addTaskWithPreconditions(aTask:ITask, aPreconditions:Array):void
If no TaskManagerItem is associated with the specified
task, the method will add a new TaskManagerItem to the
TaskManager. Then the preconditions in the specified array
are added to the new TaskManagerItem.
An exception will be raised if there is an existing
TaskManagerItem associated with the specified task.
Parameters
aTask:ITask — new task or a task already associated with a TaskManagerItem
|
|
aPreconditions:Array — array of preconditions, that should be met
|
| addTaskWithPredecessor | () | method |
public function addTaskWithPredecessor(aTask:ITask, aPredecessor:ITask):void
If no TaskManagerItem is associated with the specified
task, the method will add a new TaskManagerItem to the
TaskManager. It will add to the new
TaskManagerItem a precondition waiting for
completed event, comming from the specified predecessor
task.
aTask:ITask — new task or a task already associated with a TaskManagerItem
|
|
aPredecessor:ITask — predecessor, that should complete in order to start the specified task
|
| addTaskWithPredecessors | () | method |
public function addTaskWithPredecessors(aTask:ITask, aPredecessors:Array):void
If no TaskManagerItem is associated with the specified
task, the method will add a new TaskManagerItem to the
TaskManager. For each predecessor task in the specified
Array of predecessors creates a precondition waiting for
completed event, comming from this predecessor task. Then
these newly created preconditions are added to the associated
TaskManagerItem
aTask:ITask — new task or a task already associated with a TaskManagerItem
|
|
aPredecessors:Array — array of predecessor tasks, that should complete in order to start the specified task
|
| getMarkedTask | () | method |
| getTaskMarker | () | method |
| ignoreAll | () | method |
public function ignoreAll():void
Every TaskManagerItem will ignore all of the preconditions
that are associated with it.
| ignoreEventSource | () | method |
public function ignoreEventSource(aEventSource:IEventDispatcher):void
Every TaskManagerItem will ignore all of the
preconditions comming from the specified event source.
aEventSource:IEventDispatcher — event source for preconditions, that will be ignored
|
| ignorePrecondition | () | method |
public function ignorePrecondition(aPrecondition:EventDescriptor):void
Every TaskManagerItem will ignore the specified
precondition.
aPrecondition:EventDescriptor — precondition that will be ignored
|
| interrupt | () | method |
public function interrupt():void
interrupt() method will interrupt all of the
TaskManagerItem items.
It will check for each TaskManagerItem items whether they
are immediately interruptable and for those that are not it creates a
PreconditionsTask that will complete, only if all of those
items raise the interrupted event.
TaskManager will fire the interrupted event
when all of its items are interrupted, but it will wait the
forementioned PreconditionsTask to complete, if any of the
items are not immediately interruptable.
| isImmediatelyInterruptable | () | method |
public function isImmediatelyInterruptable():Boolean
isImmediatelyInterruptable() checks for each
TaskManagerItem behind the facade whether it is immediately
interruptable. isImmediatelyInterruptable() will return
true only if all of the items are immediately interuptable,
and will return false if any of these items are not
immediately interruptable.
Boolean — whether the TaskManager task is immediately interruptable
|
| isRunning | () | method |
public function isRunning():Boolean
Returns
Boolean |
| markTask | () | method |
| removeFinalPrecondition | () | method |
public function removeFinalPrecondition(aPrecondition:EventDescriptor):voidRemoves the specified precondition from the final preconditions list.
ParametersaPrecondition:EventDescriptor — precondition
|
| removeTask | () | method |
public function removeTask(aTask:ITask):void
If TaskManagerItem is associated with the specified task,
it will remove this item and all preconditions in the
TaskManager associated with the specified task.
aTask:ITask — task that will be no longer tracked in the TaskManager
|
| removeTaskPrecondition | () | method |
public function removeTaskPrecondition(aTask:ITask, aPrecondition:EventDescriptor):void
Removes the specified precondition if there is an associated
TaskManagerItem with the specified task.
aTask:ITask — task already associated with a TaskManagerItem
|
|
aPrecondition:EventDescriptor — precondition
|
| removeTaskPredecessor | () | method |
public function removeTaskPredecessor(aTask:ITask, aPredecessor:ITask):voidRemoves for the specified task the preconditon that will be met when the specified predecessor task is completed. The specified task will no longer wait the completion of the predecessor.
ParametersaTask:ITask — the task that will no longer wait for the predecessor's completion
|
|
aPredecessor:ITask — the predecessor task
|
| replaceTask | () | method |
public function replaceTask(aTask:ITask, aNewTask:ITask):void
If TaskManagerItem is associated with the specified task,
it will replase its scheduled task with the new one. It will also
replace the event sources of the preconditions that are listening for
events comming from the old task. The new task will be the new source
for them.
aTask:ITask — old task
|
|
aNewTask:ITask — new task
|
| reset | () | method |
public function reset():void
Resets every TaskManagerItem
| revokeFinalTask | () | method |
public function revokeFinalTask(aTask:ITask):voidRemoves the precondition that should be met, when the specified task is completed. This precondition will be no longer in the final preconditions list.
ParametersaTask:ITask |
| revokeStartingTask | () | method |
public function revokeStartingTask(aTask:ITask):void
Checks whether there is an associated TaskManagerItem with
the specified task. If true, it removes from the associated
TaskManagerItem the precondition to wait for
start event from the TaskManager task, in
order to start its execution too. But if the check fails it will raise
an exception - the specified task is not associated with any
TaskManagerItem items.
The associated TaskManagerItem item will no longer wait
TaskManager task's start, in order to start its execution.
Parameters
aTask:ITask — existing task
|
| setFinalTask | () | method |
public function setFinalTask(aTask:ITask):void
Adds a precondition to the final preconditions list. The new
precondition will be met, when the specified task is completed.
TaskManager completes right after its start, when no final
tasks or final preconditions were specified.
aTask:ITask — task, that should complete in order to meet one of the final preconditions for the TaskManager task
|
| setStartingTask | () | method |
public function setStartingTask(aTask:ITask):void
Checks whether there is an associated TaskManagerItem with
the specified task. If true, it adds to the associated
TaskManagerItem a precondition to wait for
start event from the TaskManager task, in
order to start its execution too. But if the check fails it will raise
an exception - the specified task is not associated with any
TaskManagerItem items.
The associated TaskManagerItem item will start only if the
TaskManager task is started, and never before it.
Parameters
aTask:ITask — existing task
|
| start | () | method |
public function start():void
The start() method is responsible for the following actions:
TaskManager taskTaskManagerItemPreconditionsTask| completed | event |
| interrupted | event |
| start | event |