Cytoscape 3.0.1 API

org.cytoscape.work
Class TaskIterator

java.lang.Object
  extended by org.cytoscape.work.TaskIterator
All Implemented Interfaces:
Iterator<Task>

public final class TaskIterator
extends Object
implements Iterator<Task>

A TaskIterator provides the functionality of sequencing Tasks. Tasks 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.

Constructor Summary
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
 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
 

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 - the Task to insert "newTasks" after.
newTasks - the TaskIterator 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.

Specified by:
hasNext in interface Iterator<Task>
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.

Specified by:
next in interface Iterator<Task>
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 interface Iterator<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

Cytoscape 3.0.1 API

Copyright 2011 Cytoscape Consortium. All rights reserved.