Class ParameterTable

java.lang.Object
gov.nih.mipav.model.scripting.parameters.ParameterTable

public class ParameterTable extends 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 Details

    • paramTable

      Map<String,Parameter> paramTable
      The parameter table. The keys are parameter labels/names, the values are various Parameter subclasses.
  • Constructor Details

    • ParameterTable

      public ParameterTable()
  • Method Details

    • clear

      public void clear()
      Removes all parameters from the table.
    • containsParameter

      public boolean containsParameter(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 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 String convertToDPString(ImageVariableTable table)
    • getBoolean

      public boolean getBoolean(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(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 String getFile(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(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(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(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(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(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(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(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(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 String getString(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(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(String paramLabel, Parameter param)
      Add a parameter to the table.
      Parameters:
      paramLabel - The label/name of the parameter to add (does not have to be param.getLabel().
      param - The parameter to add.
    • remove

      public void remove(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(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 Set<String> keySet()
      Returns the set of parameter names.
    • entrySet

      public Set<Map.Entry<String,Parameter>> entrySet()
      Returns the set of parameter entries.