|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpivot.util.concurrent.Task<java.lang.Void>
pivot.util.concurrent.TaskSequence<V>
public class TaskSequence<V>
Class that runs a sequence of tasks in series and notifies listeners
when all tasks are complete. Callers can retrieve task results or faults by
calling Task.getResult()
and Task.getFault()
,
respectively.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface pivot.collections.Sequence |
---|
Sequence.Search, Sequence.Sort, Sequence.Tree |
Field Summary |
---|
Fields inherited from class pivot.util.concurrent.Task |
---|
abort, timeout |
Constructor Summary | |
---|---|
TaskSequence()
|
|
TaskSequence(Dispatcher dispatcher)
|
Method Summary | |
---|---|
int |
add(Task<V> task)
Adds an item to the sequence. |
java.lang.Void |
execute()
Synchronously executes the task. |
Task<V> |
get(int index)
Retrieves the item at the given index. |
int |
getLength()
Returns the length of the sequence. |
int |
indexOf(Task<V> task)
Returns the index of an item in the sequence. |
void |
insert(Task<V> task,
int index)
Inserts an item into the sequence at a specific index. |
java.util.Iterator<Task<V>> |
iterator()
|
Sequence<Task<V>> |
remove(int index,
int count)
Removes one or more items from the sequence. |
int |
remove(Task<V> task)
Removes the first occurrence of the given item from the sequence. |
Task<V> |
update(int index,
Task<V> task)
Updates the item at the given index. |
Methods inherited from class pivot.util.concurrent.Task |
---|
abort, execute, getDispatcher, getFault, getResult, getTimeout, isPending, setTimeout |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TaskSequence()
public TaskSequence(Dispatcher dispatcher)
Method Detail |
---|
public java.lang.Void execute() throws TaskExecutionException
Task
execute
in class Task<java.lang.Void>
TaskExecutionException
- If an error occurs while executing the task.public int add(Task<V> task)
Sequence
add
in interface Sequence<Task<V>>
task
- The item to be added to the sequence.
public void insert(Task<V> task, int index)
Sequence
insert
in interface Sequence<Task<V>>
task
- The item to be added to the sequence.index
- The index at which the item should be inserted. Must be a value between
0 and getLength().public Task<V> update(int index, Task<V> task)
Sequence
update
in interface Sequence<Task<V>>
index
- The index of the item to update.task
- The item that will replace any existing value at the given index.
public int remove(Task<V> task)
Sequence
remove
in interface Sequence<Task<V>>
task
- The item to remove.
Sequence.remove(int, int)
public Sequence<Task<V>> remove(int index, int count)
Sequence
remove
in interface Sequence<Task<V>>
index
- The starting index to remove.count
- The number of items to remove, beginning with index.
public Task<V> get(int index)
Sequence
get
in interface Sequence<Task<V>>
index
- The index of the item to retrieve.public int indexOf(Task<V> task)
Sequence
indexOf
in interface Sequence<Task<V>>
task
- The item to locate.
public int getLength()
Sequence
getLength
in interface Sequence<Task<V>>
public java.util.Iterator<Task<V>> iterator()
iterator
in interface java.lang.Iterable<Task<V>>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |