Package org.cytoscape.work
Interface TaskFactory
- All Known Subinterfaces:
ExportSelectedNetworkTaskFactory
,ExportSelectedTableTaskFactory
,ExportVizmapTaskFactory
,LoadMultipleNetworkFilesTaskFactory
,LoadNetworkFileTaskFactory
,LoadNetworkURLTaskFactory
,LoadTableFileTaskFactory
,LoadTableURLTaskFactory
,LoadVizmapFileTaskFactory
,MergeTablesTaskFactory
,NetworkSearchTaskFactory
,NewSessionTaskFactory
,OpenSessionTaskFactory
,SaveSessionAsTaskFactory
,SaveSessionTaskFactory
- All Known Implementing Classes:
AbstractNetworkSearchTaskFactory
,AbstractTaskFactory
public interface TaskFactory
Returns an instance of a
Let's say you'd like to do some kind of processing, let's call it "X". Then you would create a class called XTask, where the processing would be taking place in XTask's run() method. Assuming X needs to have two types of data, let's call them Y and Z, in order to control its behavior. This would imply that XTask's constructor should take an Y and a Z as parameters. The XTaskFactory should either be constructed with classes that provide access to Y and Z, or XTaskFactory should be specialized with a different createTaskIterator(Y y, Z z) method. The createTaskIterator method should always be able to fully construct a
TaskIterator
. Intended to be
provided and used as an OSGi service. A TaskFactory is a singleton, although each type of
Task
gets its own TaskFactory. For instance, a "load network from file" task will
have one TaskFactory and an "apply preferred layout" task will have a different TaskFactory.
Let's say you'd like to do some kind of processing, let's call it "X". Then you would create a class called XTask, where the processing would be taking place in XTask's run() method. Assuming X needs to have two types of data, let's call them Y and Z, in order to control its behavior. This would imply that XTask's constructor should take an Y and a Z as parameters. The XTaskFactory should either be constructed with classes that provide access to Y and Z, or XTaskFactory should be specialized with a different createTaskIterator(Y y, Z z) method. The createTaskIterator method should always be able to fully construct a
TaskIterator
without relying on any other mutable state within the TaskFactory.Cytoscape Backwards Compatibility (SPI Interface): We expect that this interface will be implemented. Therefore to maintain backwards compatibility this interface will only be modified 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>
-
Method Summary
Modifier and TypeMethodDescriptionReturns an iterator containing a sequence ofTask
s.default boolean
isOn()
Returnstrue
if the function provided by the factory's implementation is on andfalse
if it is off.boolean
isReady()
Returns true if the TaskFactory has all necessary preconditions needed to generate a task that will execute properly, false otherwise.
-
Method Details
-
createTaskIterator
TaskIterator createTaskIterator()Returns an iterator containing a sequence ofTask
s.- Returns:
- an iterator containing a sequence of
Task
s.
-
isReady
boolean isReady()Returns true if the TaskFactory has all necessary preconditions needed to generate a task that will execute properly, false otherwise.- Returns:
- true if the TaskFactory has all necessary preconditions needed to generate a task that will execute properly, false otherwise.
-
isOn
default boolean isOn()Returnstrue
if the function provided by the factory's implementation is on andfalse
if it is off. This method is only called by Cytoscape if the factory also implements theTogglable
interface.- Returns:
-