Package org.yamcs.utils
Class AggregateUtil
java.lang.Object
org.yamcs.utils.AggregateUtil
operations to aggregates or arrays
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AggregateParameterTypecreateParameterType(String name, AggregateValue v) static <T extends RawEngValue>
TextractMember(T rev, PathElement[] path) Create a parameter value with a member from the passed parameter value as found following the path.static intfinds the first occurrence of . or [ after the last /static ParameterTypegetMemberType(ParameterType parameterType, PathElement[] path) static ValuegetMemberValue(Value value, PathElement[] path) This function is used to retrieve values from hierarchical aggregates.static PathElement[]parseReference(String name) Parses a reference of shapestatic StringtoString(PathElement[] path) static voidupdateMember(ParameterValue pv, PartialParameterValue patch) Patches a parameter value with a new value for one member of an aggregate or array Currently this does not extend an arraystatic booleanverifyPath(ParameterType parameterType, PathElement[] path) Verify that the path exists in the parameter type
-
Constructor Details
-
AggregateUtil
public AggregateUtil()
-
-
Method Details
-
findSeparator
finds the first occurrence of . or [ after the last /- Parameters:
s-- Returns:
- the position of the first occurrence of . or [ after the last slash; returns -1 if not found
-
parseReference
Parses a reference of shape/a/b/c/x.y[3][4].z
into an array of PathElement: {"a/b/c/x", "y"[3,4], "z"}- Parameters:
name-- Returns:
-
verifyPath
Verify that the path exists in the parameter type- Parameters:
parameterType-path-- Returns:
-
getMemberType
-
extractMember
Create a parameter value with a member from the passed parameter value as found following the path. Returns null if there is no such member.- Parameters:
rev-path-- Returns:
-
updateMember
Patches a parameter value with a new value for one member of an aggregate or array Currently this does not extend an array- Parameters:
pv-patch-- Throws:
IllegalArgumentException- if the member to be updated or the array element does not exist
-
getMemberValue
This function is used to retrieve values from hierarchical aggregates. It is equivalent with a chain of getMemberValue() calls:getMemberValue(getMemberValue(getMemberValue(value, path[0]),path[1])...,path[n])
It returns null if the path does not lead to a valid aggregate member.- Parameters:
path- - the path to be traversed, can be empty.- Returns:
- the member value found by traversing the path or null if no such member exists. In case the path is empty, this value itself will be returned.
-
toString
-
createParameterType
-