edu.jhu.ece.iacl.jist.pipeline.factory
Class ParamFactory

java.lang.Object
  extended by edu.jhu.ece.iacl.jist.pipeline.factory.ParamFactory
Direct Known Subclasses:
ParamBooleanFactory, ParamCollectionFactory, ParamColorFactory, ParamDoubleFactory, ParamFileCollectionFactory, ParamFileFactory, ParamFloatFactory, ParamHiddenFactory, ParamInformationFactory, ParamIntegerFactory, ParamLongFactory, ParamMatrixFactory, ParamMipavDialogFactory, ParamMultiOptionFactory, ParamNumberCollectionFactory, ParamOptionFactory, ParamPerformanceFactory, ParamPointDoubleFactory, ParamPointFloatFactory, ParamPointIntegerFactory, ParamStringFactory

public abstract class ParamFactory
extends java.lang.Object

Parameter Factory is responsible for manipulating Parameter Models, which allows the factory to be substituted for a different factory if a customized factory is required.

Author:
Blake Lucas

Field Summary
protected  ParamInputView inputView
          Input view for parameter.
protected  ParamOutputView outputView
          Output view for parameter.
 
Constructor Summary
ParamFactory()
           
 
Method Summary
abstract  void createMipavParameter(AlgorithmParameters scriptParams)
          Create Mipav parameter from MAPS parameter.
 javax.swing.tree.MutableTreeNode createTreeNode()
          Creates a new Param object.
static java.lang.String decodeName(java.lang.String name)
          Decode name.
static java.lang.String decodeValue(java.lang.String name)
          Decode value.
static java.lang.String encodeName(java.lang.String name)
          Encode name.
static java.lang.String encodeValue(java.lang.Object obj)
          Encode value.
 boolean equals(java.lang.Object obj)
           
static ParamModel fromXML(java.io.File f)
          Read parameter from XML file.
static ParamModel fromXML(java.lang.String str)
          Reconstruct parameter from XML string.
abstract  ParamInputView getInputView()
          Get the current input view.
abstract  ParamOutputView getOutputView()
          Get the current output view.
abstract  ParamModel getParameter()
          Get the parameter.
abstract  void importMipavParameter(ParameterTable paramTable)
          Import Mipav parameter into this parameter.
 boolean importParameter(ParamModel foreign)
          Import parameter into existing parameter as long as parameter is not more restrictive than this parameter.
 boolean isCompatible(ParamModel foreign)
          Import parameter into existing parameter as long as parameter is not more restrictive than this parameter.
 boolean loadResources(ParamModel foreignParam, javax.swing.ProgressMonitor monitor)
          Load external resources specified in foreign parameter into this parameter.
 boolean read(java.io.File f)
          Read parameter from XML file.
 boolean read(java.lang.String text, boolean loadResources)
          Read parameter from String.
 boolean saveResources(java.io.File dir, boolean saveSubDirectoryOverride)
          Save external resources to specified directory.
 void setInputView(ParamInputView view)
          Set the input view used to enter the parameter value.
 void setOutputView(ParamOutputView view)
          Set the output view used to display the parameter value.
 java.lang.String toXML()
          Serialize parameter as XML.
 boolean write(java.io.File f)
          Write parameter to file in XML.
 void write(java.io.ObjectOutputStream out)
          Write object to serialization stream.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inputView

protected ParamInputView inputView
Input view for parameter.


outputView

protected ParamOutputView outputView
Output view for parameter.

Constructor Detail

ParamFactory

public ParamFactory()
Method Detail

decodeName

public static java.lang.String decodeName(java.lang.String name)
Decode name.

Parameters:
name - the name
Returns:
the string

decodeValue

public static java.lang.String decodeValue(java.lang.String name)
Decode value.

Parameters:
name - the name
Returns:
the string

encodeName

public static java.lang.String encodeName(java.lang.String name)
Encode name.

Parameters:
name - the name
Returns:
the string

encodeValue

public static java.lang.String encodeValue(java.lang.Object obj)
Encode value.

Parameters:
obj - the obj
Returns:
the string

fromXML

public static ParamModel fromXML(java.io.File f)
Read parameter from XML file. This method also loads resources associated with parameter if they exist

Parameters:
f - file
Returns:
read parameter

fromXML

public static ParamModel fromXML(java.lang.String str)
Reconstruct parameter from XML string.

Parameters:
str - the str
Returns:
the param model

createMipavParameter

public abstract void createMipavParameter(AlgorithmParameters scriptParams)
                                   throws ParserException
Create Mipav parameter from MAPS parameter.

Parameters:
scriptParams - script parameters that will store this parameter
Throws:
ParserException - the parser exception

createTreeNode

public javax.swing.tree.MutableTreeNode createTreeNode()
Creates a new Param object.

Returns:
the mutable tree node

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getInputView

public abstract ParamInputView getInputView()
Get the current input view.

Returns:
the input view

getOutputView

public abstract ParamOutputView getOutputView()
Get the current output view.

Returns:
the output view

getParameter

public abstract ParamModel getParameter()
Get the parameter.

Returns:
the parameter

importMipavParameter

public abstract void importMipavParameter(ParameterTable paramTable)
                                   throws ParameterException
Import Mipav parameter into this parameter.

Parameters:
paramTable - the param table
Throws:
ParameterException - the parameter exception

importParameter

public boolean importParameter(ParamModel foreign)
Import parameter into existing parameter as long as parameter is not more restrictive than this parameter. This method copies value of foreign parameter into this parameter.

Parameters:
foreign - foreign parameter
Returns:
import successful

isCompatible

public boolean isCompatible(ParamModel foreign)
Import parameter into existing parameter as long as parameter is not more restrictive than this parameter. This method copies value of foreign parameter into this parameter.

Parameters:
foreign - foreign parameter
Returns:
import successful

loadResources

public boolean loadResources(ParamModel foreignParam,
                             javax.swing.ProgressMonitor monitor)
Load external resources specified in foreign parameter into this parameter.

Parameters:
foreignParam - foreign parameter
monitor - TODO
Returns:
true, if load resources

read

public boolean read(java.io.File f)
Read parameter from XML file. This method also loads resources associated with parameter if they exist

Parameters:
f - file
Returns:
read successful

read

public boolean read(java.lang.String text,
                    boolean loadResources)
Read parameter from String. This method also loads resources associated with parameter if they exist

Parameters:
text - string
loadResources - the load resources
Returns:
read successful

saveResources

public boolean saveResources(java.io.File dir,
                             boolean saveSubDirectoryOverride)
Save external resources to specified directory.

Parameters:
dir - directory
Returns:
true, if save resources

setInputView

public void setInputView(ParamInputView view)
Set the input view used to enter the parameter value.

Parameters:
view - the view

setOutputView

public void setOutputView(ParamOutputView view)
Set the output view used to display the parameter value.

Parameters:
view - the view

toXML

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

Returns:
string representation of class

write

public boolean write(java.io.File f)
Write parameter to file in XML.

Parameters:
f - file
Returns:
write successful

write

public void write(java.io.ObjectOutputStream out)
           throws java.io.IOException
Write object to serialization stream.

Parameters:
out - the out
Throws:
java.io.IOException - Signals that an I/O exception has occurred.