java.lang.Object
esa.opensf.osfi.Parameter
Parameter.
Represents a model's parameter described in a configuration file.
Represents a model's parameter described in a configuration file.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents the type of a structured parameter.static enumRepresents the element type of a Parameter object. -
Constructor Summary
ConstructorsConstructorDescriptionParameter(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.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.Constructor for scalar values. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddOtherAttribute(String key, String val) Set an the value of a non-standard parameter attribute.boolean[][]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].booleangetDims()Returns the envelope of the parameter dimensions.doublestatic StringgetFileFormattedValue(String fileName) Ensures that the argument does not contain invalid characters for a path.intboolean[][]double[][]String[][]int[][]String[][]TimeValue[][]getMax()getMin()getName()Deprecated.intgetNdims()getOtherAttribute(String key) getPath()Specific method for Array types.getType()Gets the element data type of the parameter, as a string.getUnits()getValue()Deprecated.Ambiguously-named function to be removed, usegetRawValue()instead.boolean[]double[]String[]int[]String[]booleanisArray()voidSets the parameter unparsed (raw) value.voidwrite()Prints a textual description of the parameter to the OSFI log as an Info message.
-
Constructor Details
-
Parameter
Constructor for scalar values.- Parameters:
name- Full path of the parameterdescription- Optional descriptiontype- Unparsed form of the element type, as read from the XML. SeeParameter.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 parameterdescription- Optional descriptiontype- Element data type.complexType- Structural type. Must not beParameter.ParamComplexType.ARRAYfor 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 formmax- Declared maximum value (for types where it makes sense) in unparsed formdims- 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 parameterdescription- Optional descriptiontype- Element data type.complexType- Structural type. Must beParameter.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 formmax- Declared maximum value (for types where it makes sense) in unparsed formdims- 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.Ambiguously-named function to be removed, usegetRawValue()instead.- Returns:
- The unparsed parameter value, as read from the XML.
-
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
- Returns:
- Parameter value parsed as a timecode, valid only for scalars.
-
getStringValue
- Returns:
- Parameter value parsed as a string, valid only for scalars.
-
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
- Returns:
- Parameter value parsed as a Java array of timecodes.
-
getVectorString
- Returns:
- Parameter value parsed as a Java array of strings.
-
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
- 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
- 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
- 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
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".
- 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:
- For a scalar, the returned value is a 1x1 matrix, with the result in item
-
getFileFormattedValue
Ensures that the argument does not contain invalid characters for a path. If it is relative, also resolves it according to the configuredbase 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
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
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.Ambiguous function, instead usegetLocalName()orgetPath().- Returns:
- The parameter full path.
-
getLocalName
- Returns:
- The "local" part of the parameter path, that is, the part after the last "."
-
getPath
- Returns:
- The full path of the parameter, including parent groups.
-
getDescription
- Returns:
- a brief description of the parameter, as provided in the XML.
-
getUnits
- Returns:
- units of measurement of the parameter, as provided in the XML.
-
getMax
- Returns:
- Maximum value (unparsed).
-
getMin
- Returns:
- Minimum value (unparsed).
-
getType
Gets the element data type of the parameter, as a string.- Returns:
- String with the type of the parameter.
- See Also:
-
getElementType
- Returns:
- the element data type of the parameter.
-
getComplexType
- Returns:
- The complex type of the parameter, or empty for a non-structured parameter.
-
addOtherAttribute
Set an the value of a non-standard parameter attribute.- Parameters:
key- attribute nameval- attribute value
-
getOtherAttributes
- Returns:
- a copy of the map of non-standard attributes and their values.
-
getOtherAttribute
- Parameters:
key- attribute name- Returns:
- the value of the given non-standard attribute, or null if not present.
-
getLocalName()orgetPath().