org.knime.core.node.workflow
Class Workflow

java.lang.Object
  extended by org.knime.core.node.workflow.Workflow

 class Workflow
extends Object

Container class wrapping wrapping the network of nodes forming a workflow together with some of the basic functionality, especially traversal methods.

Author:
M. Berthold, University of Konstanz

Field Summary
(package private)  TreeMap<NodeID,NodeContainer> m_nodes
          mapping from NodeID to Nodes.
 
Constructor Summary
Workflow(NodeID id)
          Constructor - initialize sets for meta node in/out connections.
 
Method Summary
(package private)  Set<Integer> connectedInPorts(int outPortIx)
          Determine inports which are connected (directly or indirectly) to the given outport in this workflow.
(package private)  Set<Integer> connectedOutPorts(int inPortIx)
          Determine outports which are connected (directly or indirectly) to the given inport in this workflow.
(package private)  boolean containsNodeKey(NodeID id)
           
(package private)  LinkedHashMap<NodeID,Set<Integer>> createBackwardsBreadthFirstSortedList(Set<Integer> outportIndices)
          Return map of node ids to set of port indices based on list of output ports.
(package private)  LinkedHashMap<NodeID,Set<Integer>> createBreadthFirstSortedList(Set<NodeID> ids, boolean skipWFM)
          Return map of node ids to set of port indices based on argument list of node ids.
(package private)  LinkedHashMap<NodeID,Set<Integer>> getBreadthFirstListOfNodeAndSuccessors(NodeID id, boolean skipWFM)
          Return map of node ids connected to the given node sorted in breadth first order mapped to a set of portIDs.
(package private)  Set<ConnectionContainer> getConnectionsByDest(NodeID id)
          Return all connections having the same destination.
(package private)  Set<ConnectionContainer> getConnectionsBySource(NodeID id)
          Return all connections having the same destination.
(package private)  Collection<Set<ConnectionContainer>> getConnectionsBySourceValues()
           
(package private)  NodeID getID()
           
(package private)  NodeContainer getNode(NodeID id)
          Return NodeContainer for a given id.
(package private)  Set<NodeID> getNodeIDs()
           
(package private)  Collection<NodeContainer> getNodeValues()
           
(package private)  int getNrNodes()
           
(package private)  void putNode(NodeID id, NodeContainer nc)
          Store NodeContainer with a given id.
(package private)  NodeContainer removeNode(NodeID id)
          Remove given node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_nodes

final TreeMap<NodeID,NodeContainer> m_nodes
mapping from NodeID to Nodes.

Constructor Detail

Workflow

Workflow(NodeID id)
Constructor - initialize sets for meta node in/out connections.

Parameters:
id - of workflow
Method Detail

getID

NodeID getID()
Returns:
id of this workflow

getNode

NodeContainer getNode(NodeID id)
Return NodeContainer for a given id.

Parameters:
id - of the node
Returns:
node with that id

putNode

void putNode(NodeID id,
             NodeContainer nc)
Store NodeContainer with a given id.

Parameters:
id - of NC
nc - NodeContainer itself

removeNode

NodeContainer removeNode(NodeID id)
Remove given node.

Parameters:
id - of NodeContainer to be removed.
Returns:
removed NodeContainer

getNodeValues

Collection<NodeContainer> getNodeValues()
Returns:
collection of all NodeContainers that are part of this workflow.

getNodeIDs

Set<NodeID> getNodeIDs()
Returns:
collection of all NodeIDs that are part of this workflow.

getNrNodes

int getNrNodes()
Returns:
number of nodes

containsNodeKey

boolean containsNodeKey(NodeID id)
Parameters:
id - of node.
Returns:
true of a node with this key already exists.

getConnectionsByDest

Set<ConnectionContainer> getConnectionsByDest(NodeID id)
Return all connections having the same destination.

Parameters:
id - of destination node
Returns:
set as described above

getConnectionsBySource

Set<ConnectionContainer> getConnectionsBySource(NodeID id)
Return all connections having the same destination.

Parameters:
id - of destination node
Returns:
set as described above

getConnectionsBySourceValues

Collection<Set<ConnectionContainer>> getConnectionsBySourceValues()
Returns:
a collection of sets of ConnectionContainers, grouped by source node ID.

getBreadthFirstListOfNodeAndSuccessors

LinkedHashMap<NodeID,Set<Integer>> getBreadthFirstListOfNodeAndSuccessors(NodeID id,
                                                                          boolean skipWFM)
Return map of node ids connected to the given node sorted in breadth first order mapped to a set of portIDs. Note that also nodes which have another predecessors not contained in this list may be included as long as at least one input node is connected to a node in this list! The set of integers represents the indices of input ports which are actually used within the graph covered in the result list.

Parameters:
id - of node
skipWFM - if true, do not include WFM in the list
Returns:
map as described above.

createBreadthFirstSortedList

LinkedHashMap<NodeID,Set<Integer>> createBreadthFirstSortedList(Set<NodeID> ids,
                                                                boolean skipWFM)
Return map of node ids to set of port indices based on argument list of node ids. The map is sorted by traversing the graph breadth first, the set of port indices represents the input ports actually used within the graph covered.

Parameters:
ids - of interest, for example m_workflow.m_nodes.keySet()
skipWFM - if true, do not include WFM in the list
Returns:
BF sorted list of node ids

connectedOutPorts

Set<Integer> connectedOutPorts(int inPortIx)
Determine outports which are connected (directly or indirectly) to the given inport in this workflow.

Parameters:
inPortIx - index of inport
Returns:
set of outport indices

connectedInPorts

Set<Integer> connectedInPorts(int outPortIx)
Determine inports which are connected (directly or indirectly) to the given outport in this workflow.

Parameters:
outPortIx - index of outport
Returns:
set of inport indices

createBackwardsBreadthFirstSortedList

LinkedHashMap<NodeID,Set<Integer>> createBackwardsBreadthFirstSortedList(Set<Integer> outportIndices)
Return map of node ids to set of port indices based on list of output ports. The map's iterator returns the elements sorted by traversing the graph backwards, breadth first, the set of port indices represents the input ports actually used within the graph covered. Include this WFM if any incoming ports are connected.

Parameters:
outportIndices - set of integers indicating the ports of interest
Returns:
BF sorted list of node ids


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.