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

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

public class PipeAlgorithm
extends PipeModule
implements java.lang.Cloneable

A pipe module for processing algorithms.

Author:
Blake Lucas

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.jhu.ece.iacl.jist.pipeline.PipeModule
PipeModule.PipeListener
 
Field Summary
protected  ProcessingAlgorithm algo
          processing algorithm.
protected  PipeAlgorithmFactory.AlgorithmCell lastCell
          graph cell to represent algorithm.
protected  java.io.File mapFile
          file that stores this module definition.
protected  PipeAlgorithmGroup parent
          parent graph cell if this algorithm is in a group.
 
Fields inherited from class edu.jhu.ece.iacl.jist.pipeline.PipeModule
bounds, cell, currentContext, inputHash, inputParams, inputPorts, label, listeners, name, outputHash, outputParams, outputPorts
 
Constructor Summary
PipeAlgorithm()
          Default constructor.
PipeAlgorithm(ProcessingAlgorithm algo)
          The Constructor.
 
Method Summary
 PipeAlgorithm clone()
          Clone algorithm by serializing and deserializing module.
protected  ProcessingAlgorithm createAlgorithm()
          Create Processing Algorithm from the algorithm class.
 PipeAlgorithmFactory.AlgorithmCell createModuleCell()
          Create cell to render this module.
static PipeAlgorithm fromXML(java.lang.String str)
          Reconstruct algorithm from string.
 ProcessingAlgorithm getAlgorithm()
          Get Processing Algorithm wrapped by this pipe module.
 java.lang.Class getAlgorithmClass()
          Get the Processing Algorithm class from the input parameters.
 java.lang.String getCategory()
          Gets the category.
 java.util.Vector<ExecutionContext> getCurrentParentContexts()
          Gets the current parent contexts.
 java.lang.String[] getDefaultJVMArgs()
          Gets the default jvm args for the algorithm unit that is encapsulated by this class
 java.io.File getMapFile()
          Get file that stores this algorithm.
 java.lang.String getPackage()
          Gets the package.
 PipeAlgorithmGroup getParentGroup()
          Get parent module if this is a member of a group.
 PipeModuleCell init(PipeJGraph graph)
          Initialize transient fields that could not be deserialized.
 boolean isRoot()
          Return true if this module doesn't have any parents who are Processing Algorithms.
static PipeAlgorithm open(java.awt.Component parent)
          Open file from user specified location.
static PipeAlgorithm read(java.io.File f)
          Read algorithm from file.
 boolean saveAs()
          Save algorithm in specified user location.
 boolean saveInputParams(java.io.File f)
          Write input parameters to file.
 boolean saveOutputParams(java.io.File f)
          Write output parameters to file.
protected  java.io.File selectSaveFile()
          Select location to save algorithm.
 void setAlgorithm(ProcessingAlgorithm algo)
          Automatically creates all the input and output ports using the input and output parameters in the Processing Algorithm.
 void setMapFile(java.io.File mapFile)
          Set file that stores this algorithm.
 void setParentGroup(PipeAlgorithmGroup parent)
          Set parent module.
 java.lang.String toString()
          Returns algorithm label.
 java.lang.String toXML()
          Serialize class as XML.
 boolean write(java.io.File f)
          Write algorithm to file.
 
Methods inherited from class edu.jhu.ece.iacl.jist.pipeline.PipeModule
addListener, connectAction, disconnect, disconnectAction, forward, getAncestors, getAncestors, getBounds, getChildren, getCurrentContext, getDescendants, getDescendants, getInputHash, getInputParams, getInputPorts, getLabel, getListeners, getModuleCell, getName, getOutputHash, getOutputParams, getOutputPorts, getParents, isAncestorOf, isDescendantOf, push, removeAllListeners, removeListener, setBounds, setCurrentContext, setLabel, setModuleCell, setName, update
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

algo

protected transient ProcessingAlgorithm algo
processing algorithm.


lastCell

protected transient PipeAlgorithmFactory.AlgorithmCell lastCell
graph cell to represent algorithm.


parent

protected transient PipeAlgorithmGroup parent
parent graph cell if this algorithm is in a group.


mapFile

protected transient java.io.File mapFile
file that stores this module definition.

Constructor Detail

PipeAlgorithm

public PipeAlgorithm()
Default constructor.


PipeAlgorithm

public PipeAlgorithm(ProcessingAlgorithm algo)
The Constructor.

Parameters:
algo - Processing Algorithm to wrap with this pipe module
Method Detail

fromXML

public static PipeAlgorithm fromXML(java.lang.String str)
Reconstruct algorithm from string.

Parameters:
str - the string
Returns:
the pipe algorithm

open

public static PipeAlgorithm open(java.awt.Component parent)
Open file from user specified location.

Parameters:
parent - parent component
Returns:
algorithm

read

public static PipeAlgorithm read(java.io.File f)
Read algorithm from file.

Parameters:
f - the file
Returns:
the pipe algorithm

getDefaultJVMArgs

public java.lang.String[] getDefaultJVMArgs()
Gets the default jvm args for the algorithm unit that is encapsulated by this class

Returns:
the default jvm args, null if no-specific requests.

getCategory

public java.lang.String getCategory()
Gets the category.

Returns:
the category

getPackage

public java.lang.String getPackage()
Gets the package.

Returns:
the package

clone

public PipeAlgorithm clone()
                    throws java.lang.CloneNotSupportedException
Clone algorithm by serializing and deserializing module.

Overrides:
clone in class java.lang.Object
Returns:
the pipe algorithm
Throws:
java.lang.CloneNotSupportedException - the clone not supported exception

createAlgorithm

protected ProcessingAlgorithm createAlgorithm()
Create Processing Algorithm from the algorithm class.

Returns:
Null if unable to create processing algorithm

createModuleCell

public PipeAlgorithmFactory.AlgorithmCell createModuleCell()
Create cell to render this module.

Specified by:
createModuleCell in class PipeModule
Returns:
the algorithm cell

getAlgorithm

public ProcessingAlgorithm getAlgorithm()
Get Processing Algorithm wrapped by this pipe module.

Returns:
the algorithm

getAlgorithmClass

public java.lang.Class getAlgorithmClass()
Get the Processing Algorithm class from the input parameters.

Returns:
the algorithm class

getCurrentParentContexts

public java.util.Vector<ExecutionContext> getCurrentParentContexts()
Gets the current parent contexts.

Returns:
the current parent contexts

getMapFile

public java.io.File getMapFile()
Get file that stores this algorithm.

Returns:
map file

getParentGroup

public PipeAlgorithmGroup getParentGroup()
Get parent module if this is a member of a group.

Returns:
parent group module

init

public PipeModuleCell init(PipeJGraph graph)
Initialize transient fields that could not be deserialized.

Specified by:
init in class PipeModule
Parameters:
graph - the graph
Returns:
the pipe module cell

isRoot

public boolean isRoot()
Return true if this module doesn't have any parents who are Processing Algorithms.

Overrides:
isRoot in class PipeModule
Returns:
true, if checks if is root

saveAs

public boolean saveAs()
Save algorithm in specified user location.

Returns:
true, if save as

saveInputParams

public boolean saveInputParams(java.io.File f)
Write input parameters to file.

Parameters:
f - the file
Returns:
true if successful

saveOutputParams

public boolean saveOutputParams(java.io.File f)
Write output parameters to file.

Parameters:
f - the file
Returns:
true if successful

selectSaveFile

protected java.io.File selectSaveFile()
Select location to save algorithm.

Returns:
file location

setAlgorithm

public void setAlgorithm(ProcessingAlgorithm algo)
Automatically creates all the input and output ports using the input and output parameters in the Processing Algorithm.

Parameters:
algo - the algorithm

setMapFile

public void setMapFile(java.io.File mapFile)
Set file that stores this algorithm.

Parameters:
mapFile - map file

setParentGroup

public void setParentGroup(PipeAlgorithmGroup parent)
Set parent module.

Parameters:
parent - parent module

toString

public java.lang.String toString()
Returns algorithm label.

Overrides:
toString in class java.lang.Object
Returns:
the string

toXML

public java.lang.String toXML()
Serialize class as XML.

Returns:
the string

write

public boolean write(java.io.File f)
Write algorithm to file.

Parameters:
f - output file
Returns:
true, if write