Class Parameter

java.lang.Object
esa.opensf.osfi.Parameter

public final class Parameter extends Object
Parameter.
Represents a model's parameter described in a configuration file.
  • Constructor Details

    • Parameter

      public Parameter(String name, String description, String type, String value)
      Constructor for scalar values.
      Parameters:
      name - Full path of the parameter
      description - Optional description
      type - Unparsed form of the element type, as read from the XML. See Parameter.ParamType.
      value - Unparsed form of the value, as read from the XML.
    • Parameter

      public Parameter(String name, String description, Parameter.ParamType type, Parameter.ParamComplexType complexType, String value, String units, String min, String max, List<Integer> dims)
      Constructor for non-array parameters.
      Parameters:
      name - Full path of the parameter
      description - Optional description
      type - Element data type.
      complexType - Structural type. Must not be Parameter.ParamComplexType.ARRAY for this call.
      value - Unparsed form of the value, as read from the XML.
      units - Declared units of measurement, or empty.
      min - Declared minimum value (for types where it makes sense) in unparsed form
      max - Declared maximum value (for types where it makes sense) in unparsed form
      dims - Expected dimensions. Empty for a scalar, 1/2 elements for a vector/matrix resp.
    • Parameter

      public Parameter(String name, String description, Parameter.ParamType type, Parameter.ParamComplexType complexType, ArrayNode.Raw rootNode, String units, String min, String max, List<Integer> dims)
      Constructor for ARRAY parameters.
      Parameters:
      name - Full path of the parameter
      description - Optional description
      type - Element data type.
      complexType - Structural type. Must be Parameter.ParamComplexType.ARRAY.
      rootNode - Tree structure containing the unparsed data.
      units - Declared units of measurement, or empty.
      min - Declared minimum value (for types where it makes sense) in unparsed form
      max - Declared maximum value (for types where it makes sense) in unparsed form
      dims - Expected dimensions. Empty for a scalar, 1/2 elements for a vector/matrix resp.
  • Method Details

    • write

      public void write()
      Prints a textual description of the parameter to the OSFI log as an Info message.
    • isArray

      public boolean isArray()
      Returns:
      true if this parameter is of structured type ARRAY.
      See Also:
    • getValue

      @Deprecated(since="3.5.0") public String getValue()
      Deprecated.
      Ambiguously-named function to be removed, use getRawValue() instead.
      Returns:
      The unparsed parameter value, as read from the XML.
    • getRawValue

      public String getRawValue()
      Returns:
      Parameter value, unparsed. If an ARRAY-type parameter, returns a structural description of the parameter with the unparsed values.
    • getIntValue

      public int getIntValue()
      Returns:
      Parameter value parsed as an integer, valid only for scalars.
    • getDoubleValue

      public double getDoubleValue()
      Returns:
      Parameter value parsed as a floating point number, valid only for scalars.
    • getBooleanValue

      public boolean getBooleanValue()
      Returns:
      Parameter value parsed as a boolean, valid only for scalars.
    • getTimeValue

      public TimeValue getTimeValue()
      Returns:
      Parameter value parsed as a timecode, valid only for scalars.
    • getStringValue

      public String getStringValue()
      Returns:
      Parameter value parsed as a string, valid only for scalars.
    • getFileValue

      public String getFileValue()
      Returns:
      Parameter value parsed as a path to a file or folder, valid only for scalars..
      See Also:
    • getVectorInt

      public int[] getVectorInt()
      Returns:
      Parameter value parsed as a Java array of integers.
    • getVectorDouble

      public double[] getVectorDouble()
      Returns:
      Parameter value parsed as a Java array of doubles.
    • getVectorBoolean

      public boolean[] getVectorBoolean()
      Returns:
      Parameter value parsed as a Java array of booleans.
    • getVectorTime

      public TimeValue[] getVectorTime()
      Returns:
      Parameter value parsed as a Java array of timecodes.
    • getVectorString

      public String[] getVectorString()
      Returns:
      Parameter value parsed as a Java array of strings.
    • getVectorFile

      public String[] getVectorFile()
      Returns:
      Parameter value parsed as a Java array of files.
      See Also:
    • getMatrixInt

      public int[][] getMatrixInt()
      Returns:
      Parameter parsed value as a matrix (rectangular array-of-arrays) of integers. Not valid if the parameter is not a matrix; in that case an 0x0 matrix is returned.
    • getMatrixDouble

      public double[][] getMatrixDouble()
      Returns:
      Parameter parsed value as a matrix (rectangular array-of-arrays) of doubles. Not valid if the parameter is not a matrix; in that case an 0x0 matrix is returned.
    • getMatrixBoolean

      public boolean[][] getMatrixBoolean()
      Returns:
      Parameter parsed value as a matrix (rectangular array-of-arrays) of booleans. Not valid if the parameter is not a matrix; in that case an 0x0 matrix is returned.
    • getMatrixTime

      public TimeValue[][] getMatrixTime()
      Returns:
      Parameter parsed value as a matrix (rectangular array-of-arrays) of timecodes. Not valid if the parameter is not a matrix; in that case an 0x0 matrix is returned.
    • getMatrixString

      public String[][] getMatrixString()
      Returns:
      Parameter parsed value as a matrix (rectangular array-of-arrays) of strings. Not valid if the parameter is not a matrix; in that case an 0x0 matrix is returned.
    • getMatrixFile

      public String[][] getMatrixFile()
      Returns:
      Parameter parsed value as a matrix (rectangular array-of-arrays) of file paths. Not valid if the parameter is not a matrix; in that case an 0x0 matrix is returned.
      See Also:
    • getRootNode

      public ArrayNode.Raw getRootNode()
      Specific method for Array types. Returns a tree-like structure where each node consists of either some data elements or a list of subnodes. They can be parsed individually or in bulk (by depth-first flattening of the tree) into typed values.
      Returns:
      the root node of the values tree.
      See Also:
    • fileExist

      public boolean[][] fileExist()
      Checks the existence of the files specified within a FILE parameter.
      • For a scalar, the returned value is a 1x1 matrix, with the result in item [0][0].
      • For a vector, the returned value is a 1xN matrix, with the result in the first "row".
      Not valid for ARRAY parameters.
      Returns:
      A matrix with a boolean for each slot in this parameter. A true value indicates that the corresponding path is an existing file, while false means that either the path does not exist, or it is not a file.
      See Also:
    • getFileFormattedValue

      public static String getFileFormattedValue(String fileName)
      Ensures that the argument does not contain invalid characters for a path. If it is relative, also resolves it according to the configured base directory.
      Parameters:
      fileName - Raw value of a single element of a FILE or FOLDER parameter.
      Returns:
      Path to the file or folder.
      Throws:
      InvalidPathException - if the path is not valid.
    • setValue

      public void setValue(String value)
      Sets the parameter unparsed (raw) value. Not valid for ARRAY parameters.
      Parameters:
      value - Parameter value.
    • getNdims

      public int getNdims()
      Returns:
      Number of declared dimensions e.g. 0 for a scalar or 2 for a matrix.
    • getDims

      public List<Integer> getDims()
      Returns the envelope of the parameter dimensions. As described in the E2E-ICD, matrix sizes are represented as [nCol, nRow].
      Returns:
      The size of each dimension. For a scalar, an empty list.
    • getName

      @Deprecated(since="3.9.0") public String getName()
      Deprecated.
      Ambiguous function, instead use getLocalName() or getPath().
      Returns:
      The parameter full path.
    • getLocalName

      public String getLocalName()
      Returns:
      The "local" part of the parameter path, that is, the part after the last "."
    • getPath

      public String getPath()
      Returns:
      The full path of the parameter, including parent groups.
    • getDescription

      public String getDescription()
      Returns:
      a brief description of the parameter, as provided in the XML.
    • getUnits

      public String getUnits()
      Returns:
      units of measurement of the parameter, as provided in the XML.
    • getMax

      public String getMax()
      Returns:
      Maximum value (unparsed).
    • getMin

      public String getMin()
      Returns:
      Minimum value (unparsed).
    • getType

      public String getType()
      Gets the element data type of the parameter, as a string.
      Returns:
      String with the type of the parameter.
      See Also:
    • getElementType

      public Parameter.ParamType getElementType()
      Returns:
      the element data type of the parameter.
    • getComplexType

      public String getComplexType()
      Returns:
      The complex type of the parameter, or empty for a non-structured parameter.
    • addOtherAttribute

      public void addOtherAttribute(String key, String val)
      Set an the value of a non-standard parameter attribute.
      Parameters:
      key - attribute name
      val - attribute value
    • getOtherAttributes

      public Map<String,String> getOtherAttributes()
      Returns:
      a copy of the map of non-standard attributes and their values.
    • getOtherAttribute

      public String getOtherAttribute(String key)
      Parameters:
      key - attribute name
      Returns:
      the value of the given non-standard attribute, or null if not present.