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

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.ParamFileCollection
All Implemented Interfaces:
ObjectCollection<java.io.File>, java.lang.Cloneable, java.lang.Comparable<ParamModel>
Direct Known Subclasses:
ParamSurfaceLocationCollection, ParamVolumeCollection

public class ParamFileCollection
extends ParamModel<java.util.List>
implements ObjectCollection<java.io.File>

File collection stores a collection of files. The restrictions on the files are set to be the same as the 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  FileExtensionFilter extensionFilter
          The extension filter.
protected  java.util.Vector<ParamFile> fileParams
          The file params.
protected  boolean mandatory
          The mandatory.
protected  FileReaderWriter readerWriter
          The reader writer.
 
Fields inherited from class edu.jhu.ece.iacl.jist.pipeline.parameter.ParamModel
cliTag, description, factory, hidden, label, loadAndSaveOnValidate, shortLabel
 
Fields inherited from class edu.jhu.ece.iacl.jist.pipeline.PipePort
connectible, gport, incomingConnectors, listeners, maxIncoming, maxOutgoing, outgoingConnectors, owner, portType, useWire
 
Constructor Summary
ParamFileCollection()
          Default constructor.
ParamFileCollection(java.lang.String name)
          Default constructor.
ParamFileCollection(java.lang.String name, FileExtensionFilter filter)
          Constructor.
ParamFileCollection(java.lang.String name, FileReaderWriter readerWriter)
          Constructor.
 
Method Summary
 void add(java.io.File val)
          Add file to collection.
 ParamFile add(java.lang.Object value)
          Add a new value to the collection.
 void clean()
          Clean resources that maybe out-of-date with the system
 void clear()
          Remove all files from collection.
 ParamFileCollection clone()
          Clone object.
 int compareTo(ParamModel model)
          Compare restriction of one file collection to another.
protected  ParamFile create(java.lang.Object value)
          Create a new ParamFile with the same restrictions as the collection and the specified value.
 FileExtensionFilter getExtensionFilter()
          Get extension filter.
 java.lang.String getHumanReadableDataType()
           
 java.util.List<ParamFile> getParameters()
          Get list of parameter files.
 FileReaderWriter getReaderWriter()
          Get File reader writer.
 java.util.List<java.io.File> getValue()
          Get the value stored in the parameter.
 java.io.File 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()
          File field is mandatory.
 java.lang.String probeDefaultValue()
           
 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.io.File val)
          Set item value in list
 ParamFile set(int i, java.lang.Object value)
           
 void setCollection(int index, ObjectCollection src)
          Set item value in list to the first element of the colleciton.
 void setExtensionFilter(FileExtensionFilter filter)
          Set extension filter.
 void setMandatory(boolean mandatory)
          Set the mandatory field.
 void setReaderWriter(FileReaderWriter readerWriter)
          Set extension filter.
 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 volumes.
 void validate()
          Validate that the files meet all restrictions.
 
Methods inherited from class edu.jhu.ece.iacl.jist.pipeline.parameter.ParamModel
createMipavParameter, createTreeNode, dispose, equals, getCliTag, getDescription, getFactory, getInputView, getLabel, getName, getOutputView, getShortLabel, getView, hide, importMipavParameter, importParameter, isConnectible, isHidden, loadResources, loadResources, read, read, 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

fileParams

protected java.util.Vector<ParamFile> fileParams
The file params.


readerWriter

protected FileReaderWriter readerWriter
The reader writer.


mandatory

protected boolean mandatory
The mandatory.


extensionFilter

protected FileExtensionFilter extensionFilter
The extension filter.

Constructor Detail

ParamFileCollection

public ParamFileCollection()
Default constructor.


ParamFileCollection

public ParamFileCollection(java.lang.String name)
Default constructor.

Parameters:
name - collection name

ParamFileCollection

public ParamFileCollection(java.lang.String name,
                           FileExtensionFilter filter)
Constructor.

Parameters:
name - name
filter - extension filter

ParamFileCollection

public ParamFileCollection(java.lang.String name,
                           FileReaderWriter readerWriter)
Constructor.

Parameters:
name - name
readerWriter - the reader writer
Method Detail

add

public void add(java.io.File val)
Add file to collection.

Specified by:
add in interface ObjectCollection<java.io.File>
Parameters:
val - the val

set

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

Specified by:
set in interface ObjectCollection<java.io.File>
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<java.io.File>

set

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

add

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

Parameters:
value - the value
Returns:
the param file

clear

public void clear()
Remove all files from collection.

Specified by:
clear in interface ObjectCollection<java.io.File>

clone

public ParamFileCollection clone()
Clone object.

Specified by:
clone in class ParamModel<java.util.List>
Returns:
the param file 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 ParamFile create(java.lang.Object value)
Create a new ParamFile with the same restrictions as the collection and the specified value.

Parameters:
value - the value
Returns:
the param file

getExtensionFilter

public FileExtensionFilter getExtensionFilter()
Get extension filter.

Returns:
filter

getParameters

public java.util.List<ParamFile> getParameters()
Get list of parameter files.

Returns:
the parameters

getReaderWriter

public FileReaderWriter getReaderWriter()
Get File reader writer.

Returns:
the reader writer

getValue

public java.util.List<java.io.File> 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.io.File getValue(int i)
Description copied from interface: ObjectCollection
Get value at specified index.

Specified by:
getValue in interface ObjectCollection<java.io.File>
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()
File field is mandatory.

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

setExtensionFilter

public void setExtensionFilter(FileExtensionFilter filter)
Set extension filter.

Parameters:
filter - filter

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

setReaderWriter

public void setReaderWriter(FileReaderWriter readerWriter)
Set extension filter. This adds an extra restriction to the file parameter

Parameters:
readerWriter - the reader writer

setValue

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

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.io.File>
Returns:
size

toString

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

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

validate

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

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

clean

public void clean()
Description copied from class: ParamModel
Clean resources that maybe out-of-date with the system

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

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.List>

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>