Class ParameterFactory

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

public class ParameterFactory extends Object
Factory methods for the creation of various types of Parameters.
See Also:
  • Constructor Details

    • ParameterFactory

      public ParameterFactory()
  • Method Details

    • newBoolean

      public static final ParameterBoolean newBoolean(String label, boolean value) throws ParserException
      Creates a new boolean parameter with a given label and value.
      Parameters:
      label - The label/name of the new parameter.
      value - The value to assign to the new parameter.
      Returns:
      A new boolean parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newDouble

      public static final ParameterDouble newDouble(String label, double value) throws ParserException
      Creates a new double precision parameter with a given label and value.
      Parameters:
      label - The label/name of the new parameter.
      value - The value to assign to the new parameter.
      Returns:
      A new double parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newFile

      public static final ParameterFile newFile(String label, String value) throws ParserException
      Creates a new file parameter with a given label and value.
      Parameters:
      label - The label/name of the new parameter.
      value - The value to assign to the new parameter.
      Returns:
      A new file parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newFloat

      public static final ParameterFloat newFloat(String label, float value) throws ParserException
      Creates a new floating point parameter with a given label and value.
      Parameters:
      label - The label/name of the new parameter.
      value - The value to assign to the new parameter.
      Returns:
      A new float parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newImage

      public static final ParameterImage newImage(String label, String value, boolean isExternalImage) throws ParserException
      Creates a new image placeholder variable parameter with a given label and value (e.g., '$image1').
      Parameters:
      label - The label/name of the new parameter.
      value - The value to assign to the new parameter (e.g., '$image1').
      isExternalImage - Whether the new image needs to be externally-specified (as opposed to generated from within the script).
      Returns:
      A new image placeholder variable parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newInt

      public static final ParameterInt newInt(String label, int value) throws ParserException
      Creates a new integer parameter with a given label and value.
      Parameters:
      label - The label/name of the new parameter.
      value - The value to assign to the new parameter.
      Returns:
      A new integer parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newLong

      public static final ParameterLong newLong(String label, long value) throws ParserException
      Creates a new long integer parameter with a given label and value.
      Parameters:
      label - The label/name of the new parameter.
      value - The value to assign to the new parameter.
      Returns:
      A new long parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newNonListParameter

      public static final Parameter newNonListParameter(String label, int type, String value) throws ParserException
      Creates a new parameter with a given label and value. The type of parameter returned is determined by the type given. List parameters are not supported by this method.
      Parameters:
      label - The label/name of the new parameter.
      type - The type of parameter to create (PARAM_LIST is not supported through this method, use the other newParameter()).
      value - The value to assign to the new parameter in String form (to be parsed according to the parameter type).
      Returns:
      A new parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
      See Also:
    • newParameter

      public static final Parameter newParameter(String label, double value) throws ParserException
      Creates a new double precision parameter with a given label and value.
      Parameters:
      label - The label/name of the new parameter.
      value - The value to assign to the new parameter.
      Returns:
      A new double parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newParameter

      public static final Parameter newParameter(String label, float value) throws ParserException
      Creates a new floating point parameter with a given label and value.
      Parameters:
      label - The label/name of the new parameter.
      value - The value to assign to the new parameter.
      Returns:
      A new float parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newParameter

      public static final Parameter newParameter(String label, long value) throws ParserException
      Creates a new long integer parameter with a given label and value.
      Parameters:
      label - The label/name of the new parameter.
      value - The value to assign to the new parameter.
      Returns:
      A new long parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newParameter

      public static final Parameter newParameter(String label, int value) throws ParserException
      Creates a new integer parameter with a given label and value.
      Parameters:
      label - The label/name of the new parameter.
      value - The value to assign to the new parameter.
      Returns:
      A new integer parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newParameter

      public static final Parameter newParameter(String label, short value) throws ParserException
      Creates a new signed short parameter with a given label and value.
      Parameters:
      label - The label/name of the new parameter.
      value - The value to assign to the new parameter.
      Returns:
      A new short parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newParameter

      public static final Parameter newParameter(String label, boolean value) throws ParserException
      Creates a new boolean parameter with a given label and value.
      Parameters:
      label - The label/name of the new parameter.
      value - The value to assign to the new parameter.
      Returns:
      A new boolean parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newParameter

      public static final Parameter newParameter(String label, String value) throws ParserException
      Creates a new string parameter with a given label and value.
      Parameters:
      label - The label/name of the new parameter.
      value - The value to assign to the new parameter.
      Returns:
      A new string parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newParameter

      public static final Parameter newParameter(String label, boolean[] values) throws ParserException
      Creates a new ParameterList of ParameterBooleans from an array of booleans.
      Parameters:
      label - The label/name of the new parameter.
      values - The array of booleans to put into the parameter list.
      Returns:
      A new list parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newParameter

      public static final Parameter newParameter(String label, float[] values) throws ParserException
      Creates a new ParameterList of ParameterFloats from an array of floats.
      Parameters:
      label - The label/name of the new parameter.
      values - The array of floats to put into the parameter list.
      Returns:
      A new list parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newParameter

      public static final Parameter newParameter(String label, int[] values) throws ParserException
      Creates a new ParameterList of ParameterInts from an array of ints.
      Parameters:
      label - The label/name of the new parameter.
      values - The array of ints to put into the parameter list.
      Returns:
      A new list parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newParameter

      public static final Parameter newParameter(String label, double[] values) throws ParserException
      Creates a new ParameterList of ParameterFloats from an array of doubles.
      Parameters:
      label - The label/name of the new parameter.
      values - The array of doubles to put into the parameter list.
      Returns:
      A new list parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newParameter

      public static final Parameter newParameter(String label, Object[] value_arr) throws ParserException
      Creates a new parameter with a given label and value. The parameter type is determined by the type of the value passed in.
      Parameters:
      label - The label/name of the new parameter.
      value_arr - The array of values to assign to the new parameter. Must be an array of boxed primitive types or Strings
      Returns:
      A new parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newParameter

      public static final Parameter newParameter(String label, Object value) throws ParserException
      Creates a new parameter with a given label and value. The parameter type is determined by the type of the value passed in.
      Parameters:
      label - The label/name of the new parameter.
      value - The value to assign to the new parameter. Should be the of the type object associated with a primitive type, or String.
      Returns:
      A new parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newShort

      public static final ParameterShort newShort(String label, short value) throws ParserException
      Creates a new signed short parameter with a given label and value.
      Parameters:
      label - The label/name of the new parameter.
      value - The value to assign to the new parameter.
      Returns:
      A new short parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newString

      public static final ParameterString newString(String label, String value) throws ParserException
      Creates a new string parameter with a given label and value.
      Parameters:
      label - The label/name of the new parameter.
      value - The value to assign to the new parameter.
      Returns:
      A new string parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newUShort

      public static final ParameterUShort newUShort(String label, short value) throws ParserException
      Creates a new unsigned short parameter with a given label and value.
      Parameters:
      label - The label/name of the new parameter.
      value - The value to assign to the new parameter.
      Returns:
      A new unsigned short parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • parseParameter

      public static final Parameter parseParameter(String label, String type, String value) throws ParserException
      Creates a new parameter with a given label and value. This method is used to create parameters from the strings read in as part of a script line.
      Parameters:
      label - The label/name of the new parameter.
      type - A String indicating the type of the new parameter to create.
      value - The value to assign to the new parameter in String form (to be parsed according to the parameter type).
      Returns:
      A new parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
      See Also:
    • newExternalImage

      protected static final ParameterExternalImage newExternalImage(String label, String value) throws ParserException
      Creates a new externally-specified image placeholder variable parameter with a given label and value (e.g., '$image1').
      Parameters:
      label - The label/name of the new parameter.
      value - The value to assign to the new parameter.
      Returns:
      A new image placeholder variable parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.
    • newImage

      protected static final ParameterImage newImage(String label, String value) throws ParserException
      Creates a new image placeholder variable parameter with a given label and value (e.g., '$image1').
      Parameters:
      label - The label/name of the new parameter.
      value - The value to assign to the new parameter.
      Returns:
      A new image placeholder variable parameter.
      Throws:
      ParserException - If there is a problem creating the new parameter.