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

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.List>
          extended by edu.jhu.ece.iacl.jist.pipeline.parameter.ParamNumberCollection
All Implemented Interfaces:
ObjectCollection<java.lang.Number>, java.lang.Cloneable, java.lang.Comparable<ParamModel>

public class ParamNumberCollection
extends ParamModel<java.util.List>
implements ObjectCollection<java.lang.Number>

Number collection stores a collection of numbers. The restrictions on the numbers are set to be the same as the collection. Note: The type of number in the collection is defined by the type of the maximum range. By default this is a double. As of 12/23/2008, the min/max are not updated until the module library is completely rebuilt (new library directory).

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.Number max
          The max.
protected  java.lang.Number min
          The min.
protected  java.util.Vector<ParamNumber> numParams
          The num params.
 
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
ParamNumberCollection()
          Construct double parameter with no restrictions on value.
ParamNumberCollection(java.lang.Number min, java.lang.Number max)
          Construct double parameter with restrictions on min and max value.
ParamNumberCollection(java.lang.String name)
          Construct double parameter with no restrictions on value.
ParamNumberCollection(java.lang.String name, java.lang.Number min, java.lang.Number max)
          Construct double parameter with restrictions on min and max value.
 
Method Summary
 void add(java.lang.Number val)
          Add file to collection.
 ParamNumber add(java.lang.Object value)
          Add a new value to the collection.
 void clear()
          Remove all numbers from collection.
 ParamNumberCollection clone()
          Clone object.
 int compareTo(ParamModel model)
          Compare restriction of one file collection to another.
protected  ParamNumber create(java.lang.Object value)
          Create a new ParamNumber with the same restrictions as the collection and the specified value.
 java.lang.String getHumanReadableDataType()
           
 java.lang.Number getMax()
          Gets the max.
 java.lang.Number getMin()
          Gets the min.
 java.util.List<ParamNumber> getParameterList()
          Get list of parameter numbers.
 java.util.List<java.lang.Number> getValue()
          Get the value stored in the parameter.
 java.lang.Number getValue(int i)
          Get value at specified index.
 java.lang.String getXMLValue()
           
 void init()
          Initialize parameter.
 boolean isCompatible(PipePort model)
          Returns true if port is compatible with this parameter's extension filter.
 boolean isMandatory()
          Number field is mandatory.
 java.lang.String probeDefaultValue()
           
 void set(int i, java.lang.Number val)
          Set item value in list
 ParamNumber set(int i, java.lang.Object value)
          Set value
 void setCollection(int index, ObjectCollection src)
          Set item value in list to the first element of the colleciton.
 void setMandatory(boolean mandatory)
          Set the mandatory field.
 void setMax(java.lang.Number max)
          Sets the max.
 void setMin(java.lang.Number min)
          Sets the min.
 void setValue(java.util.List value)
          Set the file collection.
 void setXMLValue(java.lang.String arg)
           
 int size()
          Returns size of collection.
 java.lang.String toString()
          Get description of numbers.
 void validate()
          Validate that the numbers meet all restrictions.
 
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, isConnectible, isHidden, loadResources, loadResources, read, read, replacePath, saveResources, setCliTag, setDescription, setFactory, setHidden, setInputView, setLabel, setLoadAndSaveOnValidate, 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

numParams

protected java.util.Vector<ParamNumber> numParams
The num params.


min

protected java.lang.Number min
The min.


max

protected java.lang.Number max
The max.

Constructor Detail

ParamNumberCollection

public ParamNumberCollection()
Construct double parameter with no restrictions on value.


ParamNumberCollection

public ParamNumberCollection(java.lang.Number min,
                             java.lang.Number max)
Construct double parameter with restrictions on min and max value.

Parameters:
min - minimum value restriction
max - maximum value restriction

ParamNumberCollection

public ParamNumberCollection(java.lang.String name)
Construct double parameter with no restrictions on value.

Parameters:
name - parameter name

ParamNumberCollection

public ParamNumberCollection(java.lang.String name,
                             java.lang.Number min,
                             java.lang.Number max)
Construct double parameter with restrictions on min and max value.

Parameters:
name - parameter name
min - minimum value restriction
max - maximum value restriction
Method Detail

add

public void add(java.lang.Number val)
Add file to collection.

Specified by:
add in interface ObjectCollection<java.lang.Number>
Parameters:
val - the val

set

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

Specified by:
set in interface ObjectCollection<java.lang.Number>
Parameters:
i - the index
val - the val

set

public ParamNumber set(int i,
                       java.lang.Object value)
Set value

Parameters:
i - index
value - value
Returns:

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<java.lang.Number>

add

public ParamNumber add(java.lang.Object value)
Add a new value to the collection.

Parameters:
value - the value
Returns:
the param number

clear

public void clear()
Remove all numbers from collection.

Specified by:
clear in interface ObjectCollection<java.lang.Number>

clone

public ParamNumberCollection clone()
Clone object.

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

compareTo

public int compareTo(ParamModel model)
Compare restriction of one file collection to another.

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

create

protected ParamNumber create(java.lang.Object value)
Create a new ParamNumber with the same restrictions as the collection and the specified value.

Parameters:
value - the value
Returns:
the param number

getParameterList

public java.util.List<ParamNumber> getParameterList()
Get list of parameter numbers.

Returns:
the parameters

getValue

public java.util.List<java.lang.Number> getValue()
Description copied from class: ParamModel
Get the value stored in the parameter.

Specified by:
getValue in class ParamModel<java.util.List>
Returns:
this the default value stored by the parameter. Although, parameters could potentially store more than one type of value.

getValue

public java.lang.Number getValue(int i)
Description copied from interface: ObjectCollection
Get value at specified index.

Specified by:
getValue in interface ObjectCollection<java.lang.Number>
Parameters:
i - index
Returns:
value

init

public void init()
Initialize parameter.

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

isCompatible

public boolean isCompatible(PipePort model)
Returns true if port is compatible with this parameter's extension filter.

Overrides:
isCompatible in class ParamModel<java.util.List>
Parameters:
model - the model
Returns:
true, if checks if is compatible

isMandatory

public boolean isMandatory()
Number field is mandatory.

Overrides:
isMandatory in class ParamModel<java.util.List>
Returns:
true, if checks if is mandatory

setMandatory

public void setMandatory(boolean mandatory)
Set the mandatory field. The default is true.

Overrides:
setMandatory in class ParamModel<java.util.List>
Parameters:
mandatory - the mandatory

setValue

public void setValue(java.util.List value)
Set the file collection. This method accepts ArrayLists with any of the valid types of ParamNumber

Specified by:
setValue in class ParamModel<java.util.List>
Parameters:
value - parameter value

size

public int size()
Description copied from interface: ObjectCollection
Returns size of collection.

Specified by:
size in interface ObjectCollection<java.lang.Number>
Returns:
size

toString

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

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

validate

public void validate()
              throws InvalidParameterException
Validate that the numbers meet all restrictions.

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

getMin

public java.lang.Number getMin()
Gets the min.

Returns:
the min

setMin

public void setMin(java.lang.Number min)
Sets the min.

Parameters:
min - the new min

getMax

public java.lang.Number getMax()
Gets the max.

Returns:
the max

setMax

public void setMax(java.lang.Number max)
Sets the max.

Parameters:
max - the new max

getHumanReadableDataType

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

getXMLValue

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

setXMLValue

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

probeDefaultValue

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