Package org.cytoscape.work
Class TaskIterator
- java.lang.Object
-
- org.cytoscape.work.TaskIterator
-
public final class TaskIterator extends Object implements Iterator<Task>
A TaskIterator provides the functionality of sequencingTask
s.Task
s provided by TaskIterator can be executed by calling aTaskManager
'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>
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.
-
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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!-
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 Detail
-
TaskIterator
public TaskIterator(int expectedNumTasks, Task... initialTasks)
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
public TaskIterator(Task... initialTasks)
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 Detail
-
insertTasksAfter
public void insertTasksAfter(Task referenceTask, Task... newTasks) throws IllegalStateException
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
public Task 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
public void append(Task task)
Adds the given task to the end of this iterator.- Parameters:
task
- task to insert
-
append
public void append(TaskIterator taskIterator)
Adds the tasks in the given TaskIterator to the end of this iterator.- Parameters:
taskIterator
- the tasks to insert
-
-