Class ParameterFactory


  • public class ParameterFactory
    extends java.lang.Object
    Factory methods for the creation of various types of Parameters.
    See Also:
    Parameter
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static ParameterBoolean newBoolean​(java.lang.String label, boolean value)
      Creates a new boolean parameter with a given label and value.
      static ParameterDouble newDouble​(java.lang.String label, double value)
      Creates a new double precision parameter with a given label and value.
      protected static ParameterExternalImage newExternalImage​(java.lang.String label, java.lang.String value)
      Creates a new externally-specified image placeholder variable parameter with a given label and value (e.g., '$image1').
      static ParameterFile newFile​(java.lang.String label, java.lang.String value)
      Creates a new file parameter with a given label and value.
      static ParameterFloat newFloat​(java.lang.String label, float value)
      Creates a new floating point parameter with a given label and value.
      protected static ParameterImage newImage​(java.lang.String label, java.lang.String value)
      Creates a new image placeholder variable parameter with a given label and value (e.g., '$image1').
      static ParameterImage newImage​(java.lang.String label, java.lang.String value, boolean isExternalImage)
      Creates a new image placeholder variable parameter with a given label and value (e.g., '$image1').
      static ParameterInt newInt​(java.lang.String label, int value)
      Creates a new integer parameter with a given label and value.
      static ParameterLong newLong​(java.lang.String label, long value)
      Creates a new long integer parameter with a given label and value.
      static Parameter newNonListParameter​(java.lang.String label, int type, java.lang.String value)
      Creates a new parameter with a given label and value.
      static Parameter newParameter​(java.lang.String label, boolean value)
      Creates a new boolean parameter with a given label and value.
      static Parameter newParameter​(java.lang.String label, boolean[] values)
      Creates a new ParameterList of ParameterBooleans from an array of booleans.
      static Parameter newParameter​(java.lang.String label, double value)
      Creates a new double precision parameter with a given label and value.
      static Parameter newParameter​(java.lang.String label, double[] values)
      Creates a new ParameterList of ParameterFloats from an array of doubles.
      static Parameter newParameter​(java.lang.String label, float value)
      Creates a new floating point parameter with a given label and value.
      static Parameter newParameter​(java.lang.String label, float[] values)
      Creates a new ParameterList of ParameterFloats from an array of floats.
      static Parameter newParameter​(java.lang.String label, int value)
      Creates a new integer parameter with a given label and value.
      static Parameter newParameter​(java.lang.String label, int[] values)
      Creates a new ParameterList of ParameterInts from an array of ints.
      static Parameter newParameter​(java.lang.String label, long value)
      Creates a new long integer parameter with a given label and value.
      static Parameter newParameter​(java.lang.String label, short value)
      Creates a new signed short parameter with a given label and value.
      static Parameter newParameter​(java.lang.String label, java.lang.Object value)
      Creates a new parameter with a given label and value.
      static Parameter newParameter​(java.lang.String label, java.lang.Object[] value_arr)
      Creates a new parameter with a given label and value.
      static Parameter newParameter​(java.lang.String label, java.lang.String value)
      Creates a new string parameter with a given label and value.
      static ParameterShort newShort​(java.lang.String label, short value)
      Creates a new signed short parameter with a given label and value.
      static ParameterString newString​(java.lang.String label, java.lang.String value)
      Creates a new string parameter with a given label and value.
      static ParameterUShort newUShort​(java.lang.String label, short value)
      Creates a new unsigned short parameter with a given label and value.
      static Parameter parseParameter​(java.lang.String label, java.lang.String type, java.lang.String value)
      Creates a new parameter with a given label and value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ParameterFactory

        public ParameterFactory()
    • Method Detail

      • newBoolean

        public static final ParameterBoolean newBoolean​(java.lang.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​(java.lang.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​(java.lang.String label,
                                                  java.lang.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​(java.lang.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​(java.lang.String label,
                                                    java.lang.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​(java.lang.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​(java.lang.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​(java.lang.String label,
                                                          int type,
                                                          java.lang.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:
        parseParameter(String, String, String)
      • newParameter

        public static final Parameter newParameter​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.String label,
                                                   java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.String label,
                                                   java.lang.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​(java.lang.String label,
                                                   java.lang.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​(java.lang.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​(java.lang.String label,
                                                      java.lang.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​(java.lang.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​(java.lang.String label,
                                                     java.lang.String type,
                                                     java.lang.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:
        newNonListParameter(String, int, String)
      • newExternalImage

        protected static final ParameterExternalImage newExternalImage​(java.lang.String label,
                                                                       java.lang.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​(java.lang.String label,
                                                       java.lang.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.