Class ParameterTable
- java.lang.Object
-
- gov.nih.mipav.model.scripting.parameters.ParameterTable
-
public class ParameterTable extends java.lang.Object
A lookup table containing Parameters keyed by a label/name. Can be filled by the parser with Parameters for a script action execution, or filled by a scriptable dialog and used to record the parameters in a script.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.Map<java.lang.String,Parameter>
paramTable
The parameter table.
-
Constructor Summary
Constructors Constructor Description ParameterTable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Removes all parameters from the table.boolean
containsParameter(java.lang.String paramLabel)
Checks to see if there is an entry in the parameter table for a particular label.java.lang.String
convertToDPString(ImageVariableTable table)
java.lang.String
convertToString()
Converts all of the parameters in the table into a comma delimited list of parameters, suitable for inclusion in a script.java.util.Set<java.util.Map.Entry<java.lang.String,Parameter>>
entrySet()
Returns the set of parameter entries.boolean
getBoolean(java.lang.String paramLabel)
Return the boolean value of one of the parameters from the table.double
getDouble(java.lang.String paramLabel)
Return the double value of one of the parameters from the table.java.lang.String
getFile(java.lang.String paramLabel)
Return the file value of one of the parameters from the table.float
getFloat(java.lang.String paramLabel)
Return the float value of one of the parameters from the table.ModelImage
getImage(java.lang.String paramLabel)
Return the model image assigned to one of the image parameters from the table.ParameterImage
getImageParameter(java.lang.String paramLabel)
Return one of the image parameters from the table.int
getInt(java.lang.String paramLabel)
Return the integer value of one of the parameters from the table.ParameterList
getList(java.lang.String paramLabel)
Return the one of the parameters from the table (cast as a ParameterList).long
getLong(java.lang.String paramLabel)
Return the long value of one of the parameters from the table.Parameter
getParameter(java.lang.String paramLabel)
Return the Object value of one of the parameters from the table.Parameter[]
getParameters()
Get an array containing all of the parameters in the parameter table.short
getShort(java.lang.String paramLabel)
Return the signed short value of one of the parameters from the table.java.lang.String
getString(java.lang.String paramLabel)
Return the string value of one of the parameters from the table.short
getUShort(java.lang.String paramLabel)
Return the unsigned short value of one of the parameters from the table.protected Parameter
getWithOverride(java.lang.String paramLabel, int paramType)
Returns a parameter from the table, possibly overriding it with a value stored in the global VariableTable.java.util.Set<java.lang.String>
keySet()
Returns the set of parameter names.void
put(Parameter param)
Add a parameter to a table.void
put(java.lang.String paramLabel, Parameter param)
Add a parameter to the table.void
remove(java.lang.String paramLabel)
Remove a parameter from the table.int
size()
Returns the number of parameters contained in the table.
-
-
-
Field Detail
-
paramTable
java.util.Map<java.lang.String,Parameter> paramTable
The parameter table. The keys are parameter labels/names, the values are various Parameter subclasses.
-
-
Method Detail
-
clear
public void clear()
Removes all parameters from the table.
-
containsParameter
public boolean containsParameter(java.lang.String paramLabel)
Checks to see if there is an entry in the parameter table for a particular label. It also checks to see if a value for the parameter has been set in the global VariableTable.- Parameters:
paramLabel
- The label/name of the variable parameter to check for.- Returns:
True
if there is an entry in the table with the given label,false
otherwise.
-
convertToString
public java.lang.String convertToString()
Converts all of the parameters in the table into a comma delimited list of parameters, suitable for inclusion in a script. No command line overriding is performed.- Returns:
- The information on the parameters in the table in string form.
-
convertToDPString
public java.lang.String convertToDPString(ImageVariableTable table)
-
getBoolean
public boolean getBoolean(java.lang.String paramLabel)
Return the boolean value of one of the parameters from the table.- Parameters:
paramLabel
- The label/name of the boolean parameter to retrieve.- Returns:
- The requested parameter's value.
- Throws:
ParameterException
- DOCUMENT ME!
-
getDouble
public double getDouble(java.lang.String paramLabel)
Return the double value of one of the parameters from the table.- Parameters:
paramLabel
- The label/name of the double parameter to retrieve.- Returns:
- The requested parameter's value.
- Throws:
ParameterException
- DOCUMENT ME!
-
getFile
public java.lang.String getFile(java.lang.String paramLabel)
Return the file value of one of the parameters from the table.- Parameters:
paramLabel
- The label/name of the double parameter to retrieve.- Returns:
- The requested parameter's value.
- Throws:
ParameterException
- DOCUMENT ME!
-
getFloat
public float getFloat(java.lang.String paramLabel)
Return the float value of one of the parameters from the table.- Parameters:
paramLabel
- The label/name of the float parameter to retrieve.- Returns:
- The requested parameter's value.
- Throws:
ParameterException
- DOCUMENT ME!
-
getImage
public ModelImage getImage(java.lang.String paramLabel)
Return the model image assigned to one of the image parameters from the table. No overriding from the VariableTable is allowed.- Parameters:
paramLabel
- The label/name of the image variable parameter to retrieve.- Returns:
- The requested parameter's value.
- Throws:
ParameterException
- DOCUMENT ME!
-
getImageParameter
public ParameterImage getImageParameter(java.lang.String paramLabel)
Return one of the image parameters from the table. No overriding from the VariableTable is allowed.- Parameters:
paramLabel
- The label/name of the image variable parameter to retrieve.- Returns:
- The requested parameter.
- Throws:
ParameterException
- DOCUMENT ME!
-
getInt
public int getInt(java.lang.String paramLabel)
Return the integer value of one of the parameters from the table.- Parameters:
paramLabel
- The label/name of the integer parameter to retrieve.- Returns:
- The requested parameter's value.
- Throws:
ParameterException
- DOCUMENT ME!
-
getList
public ParameterList getList(java.lang.String paramLabel)
Return the one of the parameters from the table (cast as a ParameterList).- Parameters:
paramLabel
- The label/name of the list parameter to retrieve.- Returns:
- The requested parameter's value.
- Throws:
ParameterException
- DOCUMENT ME!
-
getLong
public long getLong(java.lang.String paramLabel)
Return the long value of one of the parameters from the table.- Parameters:
paramLabel
- The label/name of the long parameter to retrieve.- Returns:
- The requested parameter's value.
- Throws:
ParameterException
- DOCUMENT ME!
-
getParameter
public Parameter getParameter(java.lang.String paramLabel)
Return the Object value of one of the parameters from the table.- Parameters:
paramLabel
- The label/name of the long parameter to retrieve.- Returns:
- The requested parameter.
- Throws:
ParameterException
- DOCUMENT ME!
-
getParameters
public Parameter[] getParameters()
Get an array containing all of the parameters in the parameter table. No command line overriding is performed.- Returns:
- The parameters in the table, in no particular order.
-
getShort
public short getShort(java.lang.String paramLabel)
Return the signed short value of one of the parameters from the table.- Parameters:
paramLabel
- The label/name of the signed short parameter to retrieve.- Returns:
- The requested parameter's value.
- Throws:
ParameterException
- DOCUMENT ME!
-
getString
public java.lang.String getString(java.lang.String paramLabel)
Return the string value of one of the parameters from the table.- Parameters:
paramLabel
- The label/name of the string parameter to retrieve.- Returns:
- The requested parameter's value.
- Throws:
ParameterException
- DOCUMENT ME!
-
getUShort
public short getUShort(java.lang.String paramLabel)
Return the unsigned short value of one of the parameters from the table.- Parameters:
paramLabel
- The label/name of the unsigned short parameter to retrieve.- Returns:
- The requested parameter's value.
- Throws:
ParameterException
- DOCUMENT ME!
-
put
public void put(Parameter param)
Add a parameter to a table.- Parameters:
param
- The parameter to add.
-
put
public void put(java.lang.String paramLabel, Parameter param)
Add a parameter to the table.- Parameters:
paramLabel
- The label/name of the parameter to add (does not have to beparam.getLabel()
.param
- The parameter to add.
-
remove
public void remove(java.lang.String paramLabel)
Remove a parameter from the table.- Parameters:
paramLabel
- The label/name of the parameter to remove.
-
size
public int size()
Returns the number of parameters contained in the table.- Returns:
- The number of parameters in the table.
-
getWithOverride
protected Parameter getWithOverride(java.lang.String paramLabel, int paramType)
Returns a parameter from the table, possibly overriding it with a value stored in the global VariableTable.- Parameters:
paramLabel
- The label of the parameter to return.paramType
- The type of the parameter we want returned, or -1 to use type from table.- Returns:
- The requested parameter from the table.
- Throws:
ParameterException
- DOCUMENT ME!
-
keySet
public java.util.Set<java.lang.String> keySet()
Returns the set of parameter names.
-
entrySet
public java.util.Set<java.util.Map.Entry<java.lang.String,Parameter>> entrySet()
Returns the set of parameter entries.
-
-