public final class TaskIterator extends Object implements Iterator<Task>
Task
s. Task
s provided by TaskIterator
can be executed by calling a TaskManager
's execute() method.Module: work-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>work-api</artifactId> </dependency>
Constructor and Description |
---|
TaskIterator(int expectedNumTasks,
Task... initialTasks)
Constructs an iterator that will yield Tasks in the order that they were passed into
this constructor.
|
TaskIterator(Task... initialTasks)
Constructs an iterator that will yield Tasks in the order that they were passed into
this constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
append(Task task)
Adds the given task to the end of this iterator.
|
void |
append(TaskIterator taskIterator)
Adds the tasks in the given TaskIterator to the end of this iterator.
|
int |
getNumTasks()
Returns the current total number of tasks in the iterator.
|
boolean |
hasNext()
Returns true if a call to next() would return another Task, otherwise false.
|
void |
insertTasksAfter(Task referenceTask,
Task... newTasks)
Inserts "newTasks" immediately after "referenceTask".
|
void |
insertTasksAfter(Task referenceTask,
TaskIterator newTasks)
Inserts "newTasks" immediately after "referenceTask".
|
Task |
next()
Returns the next Task in order if the TaskIterator can still yield more Tasks, otherwise throws
an exception.
|
void |
remove()
Unsupported -> always throws an exception!
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
public TaskIterator(int expectedNumTasks, Task... initialTasks)
expectedNumTasks
- The total number of tasks that the initialTasks are likely to spawn.initialTasks
- the Tasks to place into the iterator.public TaskIterator(Task... initialTasks)
initialTasks
- the Tasks to place into the iterator.public void insertTasksAfter(Task referenceTask, Task... newTasks) throws IllegalStateException
referenceTask
- task to insert newTasks after.newTasks
- tasks to insert after referenceTask.IllegalStateException
- if "referenceTask" is not known to the iterator.public void insertTasksAfter(Task referenceTask, TaskIterator newTasks) throws IllegalStateException
referenceTask
- the Task
to insert "newTasks" after.newTasks
- the TaskIterator
the tasks to insert.IllegalStateException
- if "referenceTask" is not known to the iterator.public boolean hasNext()
public Task next()
public void remove()
remove
in interface Iterator<Task>
UnsupportedOperationException
public int getNumTasks()
public void append(Task task)
task
- task to insertpublic void append(TaskIterator taskIterator)
taskIterator
- the tasks to insertCopyright 2011-2015 Cytoscape Consortium. All rights reserved.