edu.jhu.ece.iacl.jist.pipeline.parameter
Class ParamCollection

java.lang.Object
  extended by edu.jhu.ece.iacl.jist.pipeline.PipePort<T>
      extended by edu.jhu.ece.iacl.jist.pipeline.parameter.ParamModel<java.util.Vector<ParamModel>>
          extended by edu.jhu.ece.iacl.jist.pipeline.parameter.ParamCollection
All Implemented Interfaces:
JISTInternalParam, ObjectCollection, java.lang.Cloneable, java.lang.Comparable<ParamModel>

public class ParamCollection
extends ParamModel<java.util.Vector<ParamModel>>
implements ObjectCollection, JISTInternalParam

Parameter Collection.

Author:
Blake Lucas

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.jhu.ece.iacl.jist.pipeline.PipePort
PipePort.PortListener, PipePort.type
 
Field Summary
protected  java.lang.String category
          The Category
protected  java.lang.String pkg
          The Category
 
Fields inherited from class edu.jhu.ece.iacl.jist.pipeline.parameter.ParamModel
cliTag, description, factory, hidden, label, loadAndSaveOnValidate, mandatory, shortLabel
 
Fields inherited from class edu.jhu.ece.iacl.jist.pipeline.PipePort
connectible, gport, incomingConnectors, listeners, maxIncoming, maxOutgoing, outgoingConnectors, owner, portType, useWire
 
Constructor Summary
ParamCollection()
          Construct parameter collection.
ParamCollection(java.lang.String name)
          Construct parameter collection.
 
Method Summary
 void add(java.lang.Object val)
          Add object.
 void add(ParamModel model)
          Add parameter to children.
 void clean()
          Clean collection and its children.
 void clear()
          Clear children.
 ParamCollection clone()
          Clone collections.
 int compareTo(ParamModel model)
          Compare the names of two collections to see if they are the same.
 boolean equals(ParamModel<java.util.Vector<ParamModel>> collection)
           
protected  java.util.Vector<ParamModel> getAllDescedants(boolean acceptHidden)
          Get all descendants.
 java.util.Vector<ParamModel> getAllDescendants()
          Get all children, including hidden ones.
 java.util.LinkedList<ParamModel> getAllDescendantsByClass(java.lang.Class cls)
          Get all descendants by class.
protected  void getAllDescendantsByClass(java.lang.Class cls, java.util.List<ParamModel> list)
          Get all descendants and append them to the list.
 java.util.Vector<ParamModel> getAllVisibleDescendants()
          Get all visible descendants.
 java.lang.String getCategory()
           
 CompatibilityChecker getChecker()
          Get compatibility checker.
 java.util.Vector<ParamModel> getChildren()
          Get child parameters.
 java.util.Hashtable<java.lang.String,ParamModel> getChildrenHash()
          Get hash that maps parameter names to parameters.
 java.util.Hashtable<java.lang.String,ParamModel> getDescendantChildrenHash()
          Get hash that maps parameter names to parameters.
 ParamModel getFirstChildByClass(java.lang.Class cls)
          Get first child that is of the specified class type.
 ParamModel getFirstChildByLabel(java.lang.String name)
          Get first child that has the specified label.
 ParamModel getFirstChildByName(java.lang.String name)
          Get first child that has the specified name.
 ParamHeader getHeader()
           
 java.lang.String getHumanReadableDataType()
           
 java.util.ArrayList<java.lang.String> getLabels()
          Get all children labels.
 int getNumberOfAddedConnections()
           
 java.lang.String getPackage()
           
 java.util.Vector<ParamModel> getValue()
          Get the parameter's children.
 ParamModel getValue(int i)
          Get child value.
 java.lang.String getXMLValue()
           
 void init()
          Initialize parameter.
 boolean isCompatible(PipePort model)
          Check for compatibility between parameters.
 java.lang.String probeDefaultValue()
           
 boolean remove(ParamModel model)
          Add parameter to children.
 void replacePath(java.io.File originalPath, java.io.File replacePath)
          Replace path in all file type objects with this path.
 void set(int i, java.lang.Object val)
          Set item value in list
 void setCategory(java.lang.String category)
           
 void setChecker(CompatibilityChecker checker)
          Set compatibility checker.
 void setCollection(int index, ObjectCollection src)
          Set item value in list to the first element of the colleciton.
 void setPackage(java.lang.String pkg)
           
 void setValue(java.util.Vector<ParamModel> obj)
          Set the parameter value.
 void setXMLValue(java.lang.String arg)
           
 int size()
          Get size of collection.
 java.lang.String toString()
          Get description of parameters.
 void validate()
          Validate the collection my validating all the children.
 
Methods inherited from class edu.jhu.ece.iacl.jist.pipeline.parameter.ParamModel
createMipavParameter, createTreeNode, dispose, getCliTag, getDescription, getFactory, getInputView, getLabel, getName, getOutputView, getShortLabel, getView, hide, importMipavParameter, importParameter, isConnectible, isHidden, isMandatory, loadResources, loadResources, read, read, saveResources, setCliTag, setDescription, setFactory, setHidden, setInputView, setLabel, setLoadAndSaveOnValidate, setMandatory, setName, setOutputView, setShortLabel, toXML, write, write, writeAndFreeNow
 
Methods inherited from class edu.jhu.ece.iacl.jist.pipeline.PipePort
addListener, disconnect, disconnect, disconnect, disconnect, getGraphPort, getIncomingConnector, getIncomingConnectors, getIncomingPorts, getListeners, getMaxIncoming, getMaxOutgoing, getOutgoingConnector, getOutgoingConnectors, getOutgoingPorts, getOwner, getPortType, isConnected, isConnectedTo, isInputPort, isOutputPort, notifyListenersOfConnection, notifyListenersOfDisconnection, removeAllListeners, removeListener, setConnectable, setGraphPort, setMaxIncoming, setMaxOutgoing, setOwner, setPortType, setUseConnector, usingConnector
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

category

protected java.lang.String category
The Category


pkg

protected java.lang.String pkg
The Category

Constructor Detail

ParamCollection

public ParamCollection()
Construct parameter collection.


ParamCollection

public ParamCollection(java.lang.String name)
Construct parameter collection.

Parameters:
name - parameter name
Method Detail

getCategory

public java.lang.String getCategory()

setCategory

public void setCategory(java.lang.String category)

getPackage

public java.lang.String getPackage()

setPackage

public void setPackage(java.lang.String pkg)

getHeader

public ParamHeader getHeader()

add

public void add(java.lang.Object val)
Add object.

Specified by:
add in interface ObjectCollection
Parameters:
val - the val

add

public void add(ParamModel model)
Add parameter to children.

Parameters:
model - the model

clear

public void clear()
Clear children.

Specified by:
clear in interface ObjectCollection

clone

public ParamCollection clone()
Clone collections.

Specified by:
clone in class ParamModel<java.util.Vector<ParamModel>>
Returns:
the param collection

compareTo

public int compareTo(ParamModel model)
Compare the names of two collections to see if they are the same.

Specified by:
compareTo in interface java.lang.Comparable<ParamModel>
Overrides:
compareTo in class ParamModel<java.util.Vector<ParamModel>>
Parameters:
model - the model
Returns:
the int

clean

public void clean()
Clean collection and its children.

Overrides:
clean in class ParamModel<java.util.Vector<ParamModel>>

replacePath

public void replacePath(java.io.File originalPath,
                        java.io.File replacePath)
Description copied from class: ParamModel
Replace path in all file type objects with this path. This is used for JUnit testing

Overrides:
replacePath in class ParamModel<java.util.Vector<ParamModel>>

getAllDescedants

protected java.util.Vector<ParamModel> getAllDescedants(boolean acceptHidden)
Get all descendants.

Parameters:
acceptHidden - true indicates hidden children will be added to the list
Returns:
list of children parameters

getAllDescendants

public java.util.Vector<ParamModel> getAllDescendants()
Get all children, including hidden ones.

Returns:
descendants

getAllDescendantsByClass

protected void getAllDescendantsByClass(java.lang.Class cls,
                                        java.util.List<ParamModel> list)
Get all descendants and append them to the list.

Parameters:
cls - class
list - list

getAllDescendantsByClass

public java.util.LinkedList<ParamModel> getAllDescendantsByClass(java.lang.Class cls)
Get all descendants by class.

Parameters:
cls - class
Returns:
all children that are from a particular class

getAllVisibleDescendants

public java.util.Vector<ParamModel> getAllVisibleDescendants()
Get all visible descendants.

Returns:
descendants

getChecker

public CompatibilityChecker getChecker()
Get compatibility checker.

Returns:
the checker

getChildren

public java.util.Vector<ParamModel> getChildren()
Get child parameters.

Returns:
the children

getChildrenHash

public java.util.Hashtable<java.lang.String,ParamModel> getChildrenHash()
Get hash that maps parameter names to parameters. This should only be created once.

Returns:
the children hash

getDescendantChildrenHash

public java.util.Hashtable<java.lang.String,ParamModel> getDescendantChildrenHash()
Get hash that maps parameter names to parameters. This should only be created once.

Returns:
the descendant children hash

getFirstChildByClass

public ParamModel getFirstChildByClass(java.lang.Class cls)
Get first child that is of the specified class type.

Parameters:
cls - class
Returns:
parameter

getFirstChildByLabel

public ParamModel getFirstChildByLabel(java.lang.String name)
Get first child that has the specified label.

Parameters:
name - label
Returns:
parameter

getFirstChildByName

public ParamModel getFirstChildByName(java.lang.String name)
Get first child that has the specified name.

Parameters:
name - child name
Returns:
parameter

getLabels

public java.util.ArrayList<java.lang.String> getLabels()
Get all children labels.

Returns:
labels

getValue

public java.util.Vector<ParamModel> getValue()
Get the parameter's children.

Specified by:
getValue in class ParamModel<java.util.Vector<ParamModel>>
Returns:
list of child parameters

getValue

public ParamModel getValue(int i)
Get child value.

Specified by:
getValue in interface ObjectCollection
Parameters:
i - the i
Returns:
the value

init

public void init()
Initialize parameter.

Specified by:
init in class PipePort<java.util.Vector<ParamModel>>

isCompatible

public boolean isCompatible(PipePort model)
Check for compatibility between parameters.

Overrides:
isCompatible in class ParamModel<java.util.Vector<ParamModel>>
Parameters:
model - foreign parameter
Returns:
true if compatible

remove

public boolean remove(ParamModel model)
Add parameter to children.

Parameters:
model - the model
Returns:
true, if removes the

setChecker

public void setChecker(CompatibilityChecker checker)
Set compatibility checker.

Parameters:
checker - the checker

setValue

public void setValue(java.util.Vector<ParamModel> obj)
Description copied from class: ParamModel
Set the parameter value. A parameter maybe able to support more than one type of value

Specified by:
setValue in class ParamModel<java.util.Vector<ParamModel>>
Parameters:
obj - the value

size

public int size()
Get size of collection.

Specified by:
size in interface ObjectCollection
Returns:
the int

getNumberOfAddedConnections

public int getNumberOfAddedConnections()
Returns:
number of times add has been called

toString

public java.lang.String toString()
Get description of parameters.

Specified by:
toString in class ParamModel<java.util.Vector<ParamModel>>
Returns:
the string

validate

public void validate()
              throws InvalidParameterException
Validate the collection my validating all the children.

Specified by:
validate in class ParamModel<java.util.Vector<ParamModel>>
Throws:
InvalidParameterException - parameter does not meet value restrictions

set

public void set(int i,
                java.lang.Object val)
Description copied from interface: ObjectCollection
Set item value in list

Specified by:
set in interface ObjectCollection
Parameters:
i - the index
val - the val

setCollection

public void setCollection(int index,
                          ObjectCollection src)
Description copied from interface: ObjectCollection
Set item value in list to the first element of the colleciton. Safely adds all remaining elements

Specified by:
setCollection in interface ObjectCollection

equals

public boolean equals(ParamModel<java.util.Vector<ParamModel>> collection)
Overrides:
equals in class ParamModel<java.util.Vector<ParamModel>>

getHumanReadableDataType

public java.lang.String getHumanReadableDataType()
Specified by:
getHumanReadableDataType in class ParamModel<java.util.Vector<ParamModel>>

getXMLValue

public java.lang.String getXMLValue()
Specified by:
getXMLValue in class ParamModel<java.util.Vector<ParamModel>>

setXMLValue

public void setXMLValue(java.lang.String arg)
Specified by:
setXMLValue in class ParamModel<java.util.Vector<ParamModel>>

probeDefaultValue

public java.lang.String probeDefaultValue()
Specified by:
probeDefaultValue in class ParamModel<java.util.Vector<ParamModel>>