|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pivot.util.concurrent.Task<Void>
org.apache.pivot.util.concurrent.TaskSequence
public class TaskSequence
Task
that runs a sequence of tasks in series and notifies listeners
when all tasks are complete.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Sequence |
---|
Sequence.Tree<T> |
Field Summary |
---|
Fields inherited from class org.apache.pivot.util.concurrent.Task |
---|
abort, DEFAULT_EXECUTOR_SERVICE, timeout |
Constructor Summary | |
---|---|
TaskSequence()
|
|
TaskSequence(ExecutorService executorService)
|
Method Summary | |
---|---|
int |
add(Task<?> task)
Adds an item to the sequence. |
Void |
execute()
Synchronously executes the task. |
Task<?> |
get(int index)
Retrieves the item at the given index. |
int |
getLength()
Returns the length of the sequence. |
int |
indexOf(Task<?> task)
Returns the index of an item in the sequence. |
void |
insert(Task<?> task,
int index)
Inserts an item into the sequence at a specific index. |
Iterator<Task<?>> |
iterator()
|
Sequence<Task<?>> |
remove(int index,
int count)
Removes one or more items from the sequence. |
int |
remove(Task<?> task)
Removes the first occurrence of the given item from the sequence. |
Task<?> |
update(int index,
Task<?> task)
Updates the item at the given index. |
Methods inherited from class org.apache.pivot.util.concurrent.Task |
---|
abort, execute, execute, getExecutorService, 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(ExecutorService executorService)
Method Detail |
---|
public Void execute() throws TaskExecutionException
Task
execute
in class Task<Void>
TaskExecutionException
- If an error occurs while executing the task.public int add(Task<?> task)
Sequence
add
in interface Sequence<Task<?>>
task
- The item to be added to the sequence.
public void insert(Task<?> task, int index)
Sequence
insert
in interface Sequence<Task<?>>
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<?> update(int index, Task<?> task)
Sequence
update
in interface Sequence<Task<?>>
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<?> task)
Sequence
remove
in interface Sequence<Task<?>>
task
- The item to remove.
Sequence.remove(int, int)
public Sequence<Task<?>> remove(int index, int count)
Sequence
remove
in interface Sequence<Task<?>>
index
- The starting index to remove.count
- The number of items to remove, beginning with index.
public Task<?> get(int index)
Sequence
get
in interface Sequence<Task<?>>
index
- The index of the item to retrieve.public int indexOf(Task<?> task)
Sequence
indexOf
in interface Sequence<Task<?>>
task
- The item to locate.
public int getLength()
Sequence
getLength
in interface Sequence<Task<?>>
public Iterator<Task<?>> iterator()
iterator
in interface Iterable<Task<?>>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |