Package org.cytoscape.work
Class TaskIterator
java.lang.Object
org.cytoscape.work.TaskIterator
A TaskIterator provides the functionality of sequencing
Task
s. Task
s provided by TaskIterator
can be executed by calling a TaskManager
's execute() method.Cytoscape Backwards Compatibility (Final Class): This class is final and therefore can't be extended by users. This means that we may add methods for minor version updates. Methods will only be removed for major version updates.
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 Summary
ConstructorDescriptionTaskIterator
(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. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
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".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!Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
TaskIterator
Constructs an iterator that will yield Tasks in the order that they were passed into this constructor.- Parameters:
expectedNumTasks
- The total number of tasks that the initialTasks are likely to spawn.initialTasks
- the Tasks to place into the iterator.
-
TaskIterator
Constructs an iterator that will yield Tasks in the order that they were passed into this constructor.- Parameters:
initialTasks
- the Tasks to place into the iterator.
-
-
Method Details
-
insertTasksAfter
Inserts "newTasks" immediately after "referenceTask".- Parameters:
referenceTask
- task to insert newTasks after.newTasks
- tasks to insert after referenceTask.- Throws:
IllegalStateException
- if "referenceTask" is not known to the iterator.
-
insertTasksAfter
public void insertTasksAfter(Task referenceTask, TaskIterator newTasks) throws IllegalStateException Inserts "newTasks" immediately after "referenceTask".- Parameters:
referenceTask
- theTask
to insert "newTasks" after.newTasks
- theTaskIterator
the tasks to insert.- Throws:
IllegalStateException
- if "referenceTask" is not known to the iterator.
-
hasNext
public boolean hasNext()Returns true if a call to next() would return another Task, otherwise false. -
next
Returns the next Task in order if the TaskIterator can still yield more Tasks, otherwise throws an exception. -
remove
public void remove()Unsupported -> always throws an exception!- Specified by:
remove
in interfaceIterator<Task>
- Throws:
UnsupportedOperationException
-
getNumTasks
public int getNumTasks()Returns the current total number of tasks in the iterator. As tasks get added to the iterator, this number will change, so this should not be viewed as a fixed or final value!- Returns:
- the current total number of tasks in the iterator.
-
append
Adds the given task to the end of this iterator.- Parameters:
task
- task to insert
-
append
Adds the tasks in the given TaskIterator to the end of this iterator.- Parameters:
taskIterator
- the tasks to insert
-