edu.jhu.ece.iacl.jist.pipeline
Class PipeModule

java.lang.Object
  extended by edu.jhu.ece.iacl.jist.pipeline.PipeModule
All Implemented Interfaces:
PipePort.PortListener, ParamViewObserver
Direct Known Subclasses:
PipeAlgorithm, PipeDestination, PipeLogic, PipeSource

public abstract class PipeModule
extends java.lang.Object
implements PipePort.PortListener, ParamViewObserver

A Pipe Module is the generic class for graph objects. All modules can have input and output ports to provide connections to other modules.

Author:
Blake Lucas

Nested Class Summary
static interface PipeModule.PipeListener
          Listener class to monitor for updates to pipe modules.
 
Field Summary
protected  java.awt.geom.Rectangle2D bounds
          Size of module in graph.
protected  PipeModuleCell cell
          Module cell to render on graph.
protected  ExecutionContext currentContext
          Execution context that represents this module.
protected  java.util.Hashtable<java.lang.String,ParamModel> inputHash
          Input hash representing map from child parameter name to parameter.
protected  ParamCollection inputParams
          Input parameters, some of which may not be visible.
protected  java.util.Vector<PipePort> inputPorts
          Input and output ports for module.
protected  java.lang.String label
          Label to display for this parameter.
protected  java.util.Vector<PipeModule.PipeListener> listeners
          Listeners that listen for changes to this module, including input/output ports.
protected  java.lang.String name
          Unique name to identify this parameter.
protected  java.util.Hashtable<java.lang.String,ParamModel> outputHash
          Output hash representing map from child parameter name to parameter.
protected  ParamCollection outputParams
          Output parameters, some of which may not be visible.
protected  java.util.Vector<PipePort> outputPorts
          Input and output ports for module.
 
Constructor Summary
PipeModule()
          Default constructor.
 
Method Summary
 void addListener(PipeModule.PipeListener listener)
          Add listener for this module.
 void connectAction(PipePort owner)
          Listen for connection event to occur on a port.
abstract  PipeModuleCell createModuleCell()
          Create default graph cell representing this module.
 void disconnect()
          Disconnect all incoming and outgoing ports for this module.
 void disconnectAction(PipePort owner, PipePort child, PipeConnector wire)
          Listen for disconnect event to occur on a port.
static void forward(PipePort src, PipePort dest)
          Forward information from the source port to destination port.
 java.util.Vector<PipeModule> getAncestors()
          Get all modules that may effect the input parameters to this module.
protected  void getAncestors(java.util.Vector<PipeModule> list)
          Get all ancestor modules and append them to the list.
 java.awt.geom.Rectangle2D getBounds()
          Rectangular bounds for graphical representation.
 java.util.Vector<PipeModule> getChildren()
          Get Pipe Modules that receive data from this module.
 ExecutionContext getCurrentContext()
          Get current context used to execute this module.
 java.util.Vector<PipeModule> getDescendants()
          Get all modules that are effected by information outputted by this module.
protected  void getDescendants(java.util.Vector<PipeModule> list)
          Get all descendant modules and append them to the list.
 java.util.Hashtable<java.lang.String,ParamModel> getInputHash()
          Get input hash representing map from child parameter name to parameter.
 ParamCollection getInputParams()
          Get input parameters for this module.
 java.util.Vector<PipePort> getInputPorts()
          Get output parameters for this module.
 java.lang.String getLabel()
          Get display label for this module.
 java.util.Vector<PipeModule.PipeListener> getListeners()
          Get all listeners for this module.
 PipeModuleCell getModuleCell()
          Get graph cell representing this module.
 java.lang.String getName()
          Get unique name that identifies this parameter.
 java.util.Hashtable<java.lang.String,ParamModel> getOutputHash()
          Get output hash representing map from child parameter name to parameter.
 ParamCollection getOutputParams()
          Get input ports.
 java.util.Vector<PipePort> getOutputPorts()
          Get output ports.
 java.util.Vector<PipeModule> getParents()
          Get modules that provide information to this module.
abstract  PipeModuleCell init(PipeJGraph graph)
          Initialize all transient data that could not be deserialized.
 boolean isAncestorOf(PipeModule child)
          Returns true if this is an ancestor of the specified module.
 boolean isDescendantOf(PipeModule parent)
          Returns true if this is a descendant of the specified module.
 boolean isRoot()
          Returns true if this module has no incoming connections.
 boolean push()
          Forward information from output ports to all child input ports.
 void removeAllListeners()
          Remove all listeners for this module.
 void removeListener(PipeModule.PipeListener listener)
          Remove listener for this module.
 void setBounds(java.awt.geom.Rectangle2D bounds)
          Set dimensions for graph cell.
 void setCurrentContext(ExecutionContext context)
          Set current context used to execute this module.
 void setLabel(java.lang.String label)
          Set display label for this module.
 void setModuleCell(PipeModuleCell cell)
          Set graph cell representing this module.
 void setName(java.lang.String name)
          Set unique name that identifies this parameter.
 void update(ParamModel model, ParamInputView view)
          Refresh the graph frame and indicate that the layout has changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

label

protected java.lang.String label
Label to display for this parameter.


name

protected java.lang.String name
Unique name to identify this parameter.


bounds

protected java.awt.geom.Rectangle2D bounds
Size of module in graph.


inputPorts

protected java.util.Vector<PipePort> inputPorts
Input and output ports for module.


outputPorts

protected java.util.Vector<PipePort> outputPorts
Input and output ports for module.


inputParams

protected ParamCollection inputParams
Input parameters, some of which may not be visible.


outputParams

protected ParamCollection outputParams
Output parameters, some of which may not be visible.


cell

protected transient PipeModuleCell cell
Module cell to render on graph.


listeners

protected transient java.util.Vector<PipeModule.PipeListener> listeners
Listeners that listen for changes to this module, including input/output ports.


currentContext

protected transient ExecutionContext currentContext
Execution context that represents this module.


inputHash

protected transient java.util.Hashtable<java.lang.String,ParamModel> inputHash
Input hash representing map from child parameter name to parameter.


outputHash

protected transient java.util.Hashtable<java.lang.String,ParamModel> outputHash
Output hash representing map from child parameter name to parameter.

Constructor Detail

PipeModule

public PipeModule()
Default constructor.

Method Detail

forward

public static void forward(PipePort src,
                           PipePort dest)
Forward information from the source port to destination port. This method avoids loading external resources to forward information.

Parameters:
src - source port
dest - destination port

addListener

public void addListener(PipeModule.PipeListener listener)
Add listener for this module.

Parameters:
listener - module listener

connectAction

public void connectAction(PipePort owner)
Listen for connection event to occur on a port.

Specified by:
connectAction in interface PipePort.PortListener
Parameters:
owner - the owner

createModuleCell

public abstract PipeModuleCell createModuleCell()
Create default graph cell representing this module.

Returns:
graph cell

disconnect

public void disconnect()
Disconnect all incoming and outgoing ports for this module.


disconnectAction

public void disconnectAction(PipePort owner,
                             PipePort child,
                             PipeConnector wire)
Listen for disconnect event to occur on a port.

Specified by:
disconnectAction in interface PipePort.PortListener
Parameters:
owner - the owner
child - the child
wire - the wire

getAncestors

public java.util.Vector<PipeModule> getAncestors()
Get all modules that may effect the input parameters to this module.

Returns:
ancestor list

getAncestors

protected void getAncestors(java.util.Vector<PipeModule> list)
Get all ancestor modules and append them to the list.

Parameters:
list - list to append ancestors

getBounds

public java.awt.geom.Rectangle2D getBounds()
Rectangular bounds for graphical representation. This information is serialized.

Returns:
the bounds

getChildren

public java.util.Vector<PipeModule> getChildren()
Get Pipe Modules that receive data from this module.

Returns:
the children

getCurrentContext

public ExecutionContext getCurrentContext()
Get current context used to execute this module.

Returns:
current context representing this module

getDescendants

public java.util.Vector<PipeModule> getDescendants()
Get all modules that are effected by information outputted by this module.

Returns:
the descendants

getDescendants

protected void getDescendants(java.util.Vector<PipeModule> list)
Get all descendant modules and append them to the list.

Parameters:
list - list to append parameters

getInputHash

public java.util.Hashtable<java.lang.String,ParamModel> getInputHash()
Get input hash representing map from child parameter name to parameter.

Returns:
input hash

getInputParams

public ParamCollection getInputParams()
Get input parameters for this module.

Returns:
module input parameters

getInputPorts

public java.util.Vector<PipePort> getInputPorts()
Get output parameters for this module.

Returns:
output module output parameters

getLabel

public java.lang.String getLabel()
Get display label for this module.

Returns:
label name

getListeners

public java.util.Vector<PipeModule.PipeListener> getListeners()
Get all listeners for this module.

Returns:
module listeners

getModuleCell

public PipeModuleCell getModuleCell()
Get graph cell representing this module.

Returns:
graph cell

getName

public java.lang.String getName()
Get unique name that identifies this parameter.

Returns:
unique name

getOutputHash

public java.util.Hashtable<java.lang.String,ParamModel> getOutputHash()
Get output hash representing map from child parameter name to parameter.

Returns:
input hash

getOutputParams

public ParamCollection getOutputParams()
Get input ports.

Returns:
input ports

getOutputPorts

public java.util.Vector<PipePort> getOutputPorts()
Get output ports.

Returns:
output ports

getParents

public java.util.Vector<PipeModule> getParents()
Get modules that provide information to this module.

Returns:
the parents

init

public abstract PipeModuleCell init(PipeJGraph graph)
Initialize all transient data that could not be deserialized.

Parameters:
graph - the graph
Returns:
the pipe module cell

isAncestorOf

public boolean isAncestorOf(PipeModule child)
Returns true if this is an ancestor of the specified module.

Parameters:
child - the child
Returns:
true, if checks if is ancestor of

isDescendantOf

public boolean isDescendantOf(PipeModule parent)
Returns true if this is a descendant of the specified module.

Parameters:
parent - module
Returns:
true, if checks if is descendant of

isRoot

public boolean isRoot()
Returns true if this module has no incoming connections.

Returns:
true, if checks if is root

push

public boolean push()
Forward information from output ports to all child input ports.

Returns:
true, if push

removeAllListeners

public void removeAllListeners()
Remove all listeners for this module.


removeListener

public void removeListener(PipeModule.PipeListener listener)
Remove listener for this module.

Parameters:
listener - module listener

setBounds

public void setBounds(java.awt.geom.Rectangle2D bounds)
Set dimensions for graph cell.

Parameters:
bounds - cell dimensions

setCurrentContext

public void setCurrentContext(ExecutionContext context)
Set current context used to execute this module.

Parameters:
context - the context

setLabel

public void setLabel(java.lang.String label)
Set display label for this module.

Parameters:
label - name

setModuleCell

public void setModuleCell(PipeModuleCell cell)
Set graph cell representing this module.

Parameters:
cell - graph cell

setName

public void setName(java.lang.String name)
Set unique name that identifies this parameter.

Parameters:
name - unique name

update

public void update(ParamModel model,
                   ParamInputView view)
Refresh the graph frame and indicate that the layout has changed.

Specified by:
update in interface ParamViewObserver
Parameters:
model - the model
view - the view