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

java.lang.Object
  extended by edu.jhu.ece.iacl.jist.pipeline.PipePort<T>
      extended by edu.jhu.ece.iacl.jist.pipeline.parameter.ParamModel<java.lang.String>
          extended by edu.jhu.ece.iacl.jist.pipeline.parameter.ParamOption
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable<ParamModel>

public class ParamOption
extends ParamModel<java.lang.String>

Option Parameter to select between different text options.

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  int index
          The index.
protected  java.util.List<java.lang.String> options
          The options.
 
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
ParamOption(java.util.List<java.lang.String> options)
          Construct a list of possible options.
ParamOption(java.lang.String[] options)
          Construct a list of possible options.
ParamOption(java.lang.String name, java.util.List<java.lang.String> options)
          Construct a list of possible options.
ParamOption(java.lang.String name, java.lang.String[] options)
          Construct a list of possible options.
 
Method Summary
 void add(java.lang.String opt)
          Add option to list.
 ParamOption clone()
          Clone object.
 int compareTo(ParamModel model)
          Compare the options of one parameter to another to determine which list of options is more restrictive.
 java.lang.String getHumanReadableDataType()
           
 int getIndex()
          Get selected option index.
 java.util.List<java.lang.String> getOptions()
          Get list of possible options.
 java.lang.String getValue()
          Get selected option name.
 java.lang.String getXMLValue()
           
 void init()
          Initialize parameter.
 java.lang.String probeDefaultValue()
           
 void setOptions(java.util.List<java.lang.String> options)
          Set list of options.
 void setValue(java.lang.Integer value)
          Set the selected option.
 void setValue(java.lang.String value)
          Set the parameter value.
 void setXMLValue(java.lang.String arg)
           
 java.lang.String toString()
          Get description of selected option.
 void validate()
          Validate that the selected index corresponds to a possible option.
 
Methods inherited from class edu.jhu.ece.iacl.jist.pipeline.parameter.ParamModel
clean, createMipavParameter, createTreeNode, dispose, equals, getCliTag, getDescription, getFactory, getInputView, getLabel, getName, getOutputView, getShortLabel, getView, hide, importMipavParameter, importParameter, isCompatible, isConnectible, isHidden, isMandatory, loadResources, loadResources, read, read, replacePath, 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

options

protected java.util.List<java.lang.String> options
The options.


index

protected int index
The index.

Constructor Detail

ParamOption

public ParamOption(java.util.List<java.lang.String> options)
Construct a list of possible options.

Parameters:
options - the options

ParamOption

public ParamOption(java.lang.String name,
                   java.util.List<java.lang.String> options)
Construct a list of possible options.

Parameters:
name - parameter name
options - the options

ParamOption

public ParamOption(java.lang.String name,
                   java.lang.String[] options)
Construct a list of possible options.

Parameters:
name - parameter name
options - the options

ParamOption

public ParamOption(java.lang.String[] options)
Construct a list of possible options.

Parameters:
options - the options
Method Detail

add

public void add(java.lang.String opt)
Add option to list.

Parameters:
opt - option name

clone

public ParamOption clone()
Clone object.

Specified by:
clone in class ParamModel<java.lang.String>
Returns:
the param option

compareTo

public int compareTo(ParamModel model)
Compare the options of one parameter to another to determine which list of options is more restrictive.

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

getIndex

public int getIndex()
Get selected option index.

Returns:
the index

getOptions

public java.util.List<java.lang.String> getOptions()
Get list of possible options.

Returns:
the options

getValue

public java.lang.String getValue()
Get selected option name.

Specified by:
getValue in class ParamModel<java.lang.String>
Returns:
selected option string

init

public void init()
Initialize parameter.

Specified by:
init in class PipePort<java.lang.String>

setOptions

public void setOptions(java.util.List<java.lang.String> options)
Set list of options.

Parameters:
options - options

setValue

public void setValue(java.lang.Integer value)
Set the selected option. This method will accept the string representation of the option or an integer index into the option array.

Parameters:
value - parameter value

setValue

public void setValue(java.lang.String value)
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.lang.String>
Parameters:
value - the value

toString

public java.lang.String toString()
Get description of selected option.

Specified by:
toString in class ParamModel<java.lang.String>
Returns:
the string

validate

public void validate()
              throws InvalidParameterException
Validate that the selected index corresponds to a possible option.

Specified by:
validate in class ParamModel<java.lang.String>
Throws:
InvalidParameterException - parameter does not meet value restriction

getHumanReadableDataType

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

getXMLValue

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

setXMLValue

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

probeDefaultValue

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