public final class ParameterUtils extends Object
parameters
and parameter descriptors
.Modifier and Type | Method and Description |
---|---|
static <T> boolean |
addFieldIfAbsentToParameterDescriptors(Collection<ParameterDescriptor> descriptors,
FieldDescriptor<T> fieldDescriptor,
T fieldValue)
Adds a given field descriptor to multiple parameter descriptors and maps it to the specified
value (existing values are overwritten when the field descriptor is already associated with a
parameter descriptor; parameter descriptors which are not currently mutable are ignored).
|
static <T> boolean |
addFieldIfAbsentToParameters(Collection<Parameter> parameters,
FieldDescriptor<T> fieldDescriptor,
T fieldValue)
Adds a given field descriptor to multiple parameters and maps it to the specified value
(existing values are overwritten when the field descriptor is already associated with a
parameter; parameter descriptors which are not currently mutable are ignored).
|
static <T> boolean |
addFieldIfAbsentToParameters(IParameterizable parameterizable,
FieldDescriptor<T> fieldDescriptor,
T fieldValue)
Adds a given field descriptor to the parameters of a parameterizable object and maps it to
the specified value (existing values are overwritten when the field descriptor is already
associated with a parameter; parameter descriptors which are not currently mutable are
ignored).
|
static <T> boolean |
addFieldToParameterDescriptors(Collection<ParameterDescriptor> descriptors,
FieldDescriptor<T> fieldDescriptor,
T fieldValue)
Adds a given field descriptor to multiple parameter descriptors and maps it to the specified
value (existing values are overwritten when the field descriptor is already associated with a
parameter descriptor; parameter descriptors which are not currently mutable are ignored).
|
static <T> boolean |
addFieldToParameters(Collection<Parameter> parameters,
FieldDescriptor<T> fieldDescriptor,
T fieldValue)
Adds a given field descriptor to multiple parameters and maps it to the specified value
(existing values are overwritten when the field descriptor is already associated with a
parameter; parameter descriptors which are not currently mutable are ignored).
|
static <T> boolean |
addFieldToParameters(IParameterizable parameterizable,
FieldDescriptor<T> fieldDescriptor,
T fieldValue)
Adds a given field descriptor to the parameters of a parameterizable object and maps it to
the specified value (existing values are overwritten when the field descriptor is already
associated with a parameter; parameter descriptors which are not currently mutable are
ignored).
|
static List<ParameterDescriptor> |
buildDefaultParameterDescriptors(int n)
Build a list of N parameter descriptors, each one associated with a single
PARAMETER_NAME descriptor mapped to the
string "p" + i, where i is the ith element (starting from 0). |
static List<ParameterDescriptor> |
buildDefaultParameterDescriptors(int n,
int startIndex)
Build a list of N parameter descriptors, each one associated with a single
PARAMETER_NAME descriptor mapped to the
string "p" + k, where k is the index of the ith element (starting from 0) shifted
by the specified start index. |
static List<ParameterDescriptor> |
buildOrbitalParameterDescriptors(OrbitType orbitType,
PositionAngle positionAngle)
Builds the parameter descriptors associated with a given orbit type and position angle type,
each representing one of the orbital coordinates.
|
static List<Parameter> |
buildOrbitalParameters(OrbitType orbitType,
PositionAngle positionAngle)
Builds the parameters associated with a given orbit type and position angle type, each one
representing one of the orbital coordinates.
|
static String |
concatenateParameterDescriptorNames(Collection<ParameterDescriptor> descriptors,
String nameSeparator,
String fieldSeparator,
boolean reverseOrder)
Concatenates the names of multiple parameter descriptors.
|
static String |
concatenateParameterNames(Collection<Parameter> parameters,
String nameSeparator,
String fieldSeparator,
boolean reverseOrder)
Concatenates the names of multiple parameters.
|
static List<ParameterDescriptor> |
extractParameterDescriptors(Collection<Parameter> parameters)
Extracts the parameter descriptors from all the provided parameters and returns them into a
new list.
|
static List<ParameterDescriptor> |
extractParameterDescriptors(Collection<ParameterDescriptor> parameterDescriptors,
FieldDescriptor<?> fieldDescriptor)
Extracts the parameter descriptors associated with a given field descriptor.
|
static <T> List<ParameterDescriptor> |
extractParameterDescriptors(Collection<ParameterDescriptor> descriptors,
FieldDescriptor<T> fieldDescriptor,
Predicate<T> fieldFilter)
Extracts the parameter descriptors associated with a given field descriptor if the mapped
value matches the specified predicate.
|
static List<Parameter> |
extractParameters(Collection<Parameter> parameters,
FieldDescriptor<?> fieldDescriptor)
Extracts the parameters associated with a given field descriptor.
|
static <T> List<Parameter> |
extractParameters(Collection<Parameter> parameters,
FieldDescriptor<T> fieldDescriptor,
Predicate<T> fieldFilter)
Extracts the parameters associated with a given field descriptor if the mapped value matches
the specified predicate.
|
static void |
removeFieldFromParameters(Collection<Parameter> parameters,
FieldDescriptor<?> fieldDescriptor)
Removes a given field descriptor from multiple parameters.
|
static void |
removeFieldFromParameters(IParameterizable parameterizable,
FieldDescriptor<?> fieldDescriptor)
Removes a given field descriptor from the parameters of a parameterizable object.
|
public static <T> boolean addFieldToParameters(IParameterizable parameterizable, FieldDescriptor<T> fieldDescriptor, T fieldValue)
Note that this method will not have any effect if getParameters() provides a copy of the parameters stored by the class implementing the IParameterizable interface (instead of a direct access to their reference).
T
- the type associated with the field descriptorparameterizable
- the parameterizable object whose parameters are to be updatedfieldDescriptor
- the field descriptor to addfieldValue
- the value to be mapped to the field descriptortrue
if at least one field has replaced an existing field value, false
otherwisepublic static <T> boolean addFieldToParameters(Collection<Parameter> parameters, FieldDescriptor<T> fieldDescriptor, T fieldValue)
T
- the type associated with the field descriptorparameters
- the parameters whose parameter descriptor is to be updatedfieldDescriptor
- the field descriptor to addfieldValue
- the value to be mapped to the field descriptortrue
if at least one field has replaced an existing field value, false
otherwisepublic static <T> boolean addFieldToParameterDescriptors(Collection<ParameterDescriptor> descriptors, FieldDescriptor<T> fieldDescriptor, T fieldValue)
T
- the type associated with the field descriptordescriptors
- the parameters descriptors to be updatedfieldDescriptor
- the field descriptor to addfieldValue
- the value to be mapped to the field descriptortrue
if at least one field has replaced an existing field value, false
otherwisepublic static <T> boolean addFieldIfAbsentToParameters(IParameterizable parameterizable, FieldDescriptor<T> fieldDescriptor, T fieldValue)
Note that this method will not have any effect if getParameters() provides a copy of the parameters stored by the class implementing the IParameterizable interface (instead of a direct access to their reference).
Note: This method only adds the fields when the associated field descriptors aren't already initialized in the map.
T
- the type associated with the field descriptorparameterizable
- the parameterizable object whose parameters are to be updatedfieldDescriptor
- the field descriptor to addfieldValue
- the value to be mapped to the field descriptortrue
if at least one field couldn't have been updated as it was already existing, false
if all the fields
have been initialized for the first timepublic static <T> boolean addFieldIfAbsentToParameters(Collection<Parameter> parameters, FieldDescriptor<T> fieldDescriptor, T fieldValue)
Note: This method only adds the fields when the associated field descriptors aren't already initialized in the map.
T
- the type associated with the field descriptorparameters
- the parameters whose parameter descriptor is to be updatedfieldDescriptor
- the field descriptor to addfieldValue
- the value to be mapped to the field descriptortrue
if at least one field couldn't have been updated as it was already existing, false
if all the fields
have been initialized for the first timepublic static <T> boolean addFieldIfAbsentToParameterDescriptors(Collection<ParameterDescriptor> descriptors, FieldDescriptor<T> fieldDescriptor, T fieldValue)
Note: This method only adds the fields when the associated field descriptors aren't already initialized in the map.
T
- the type associated with the field descriptordescriptors
- the parameters descriptors to be updatedfieldDescriptor
- the field descriptor to addfieldValue
- the value to be mapped to the field descriptortrue
if at least one field couldn't have been updated as it was already existing, false
if all the fields
have been initialized for the first timepublic static void removeFieldFromParameters(IParameterizable parameterizable, FieldDescriptor<?> fieldDescriptor)
Note that this method will not have any effect if getParameters() provides a copy of the parameters stored by the class implementing the IParameterizable interface (instead of a direct access to their reference).
parameterizable
- the parameterizable object whose parameters are to be updatedfieldDescriptor
- the field descriptor to be removedpublic static void removeFieldFromParameters(Collection<Parameter> parameters, FieldDescriptor<?> fieldDescriptor)
parameters
- the parameters whose parameter descriptor is to be updatedfieldDescriptor
- the field descriptor to be removedpublic static List<ParameterDescriptor> buildDefaultParameterDescriptors(int n)
PARAMETER_NAME
descriptor mapped to the
string "p" + i, where i is the ith element (starting from 0).n
- the number N of parameter descriptors to buildpublic static List<ParameterDescriptor> buildDefaultParameterDescriptors(int n, int startIndex)
PARAMETER_NAME
descriptor mapped to the
string "p" + k, where k is the index of the ith element (starting from 0) shifted
by the specified start index. For example, if the start index is 3, then k is 3 for the first
element, 4, for the second element, etc.n
- the number N of parameter descriptors to buildstartIndex
- the start indexpublic static List<ParameterDescriptor> buildOrbitalParameterDescriptors(OrbitType orbitType, PositionAngle positionAngle)
The method always returns six parameter descriptors, each one associated with a single orbital coordinate descriptor mapped to the described coordinate (for example, X, Y, Z, VX, VY, VZ if the orbit type is CARTESIAN).
orbitType
- the orbit typepositionAngle
- the position angle typepublic static List<Parameter> buildOrbitalParameters(OrbitType orbitType, PositionAngle positionAngle)
The method always returns six parameters, each one with associated with a single orbital coordinate descriptor mapped to the described coordinate (for example, X, Y, Z, VX, VY, VZ if the orbit type is CARTESIAN). The parameter value is set to zero by default.
orbitType
- the orbit typepositionAngle
- the position angle typepublic static String concatenateParameterNames(Collection<Parameter> parameters, String nameSeparator, String fieldSeparator, boolean reverseOrder)
parameters
- the parameters whose names are to be concatenatednameSeparator
- the string used as a separator between namesfieldSeparator
- the string used as a separator between the field values of a parameter descriptorreverseOrder
- whether or not the field values of each parameter descriptor should be printed in
reverse orderpublic static String concatenateParameterDescriptorNames(Collection<ParameterDescriptor> descriptors, String nameSeparator, String fieldSeparator, boolean reverseOrder)
descriptors
- the parameter descriptors whose names are to be concatenatednameSeparator
- the string used as a separator between namesfieldSeparator
- the string used as a separator between the field values of a parameter descriptorreverseOrder
- whether or not the field values of each parameter descriptor should be printed in
reverse orderpublic static List<Parameter> extractParameters(Collection<Parameter> parameters, FieldDescriptor<?> fieldDescriptor)
parameters
- the parameters to checkfieldDescriptor
- the field descriptor which must be associated to the parameterspublic static <T> List<Parameter> extractParameters(Collection<Parameter> parameters, FieldDescriptor<T> fieldDescriptor, Predicate<T> fieldFilter)
T
- the type of fields associated with the provided field descriptorparameters
- the parameters to checkfieldDescriptor
- the field descriptor which must be associated to the parametersfieldFilter
- the predicate on the field value mapped to the specified field descriptorpublic static List<ParameterDescriptor> extractParameterDescriptors(Collection<Parameter> parameters)
parameters
- the parameters from which to extract the parameter descriptorpublic static List<ParameterDescriptor> extractParameterDescriptors(Collection<ParameterDescriptor> parameterDescriptors, FieldDescriptor<?> fieldDescriptor)
parameterDescriptors
- the parameter descriptors to checkfieldDescriptor
- the field descriptor which must be associated to the parameterspublic static <T> List<ParameterDescriptor> extractParameterDescriptors(Collection<ParameterDescriptor> descriptors, FieldDescriptor<T> fieldDescriptor, Predicate<T> fieldFilter)
T
- the type of fields associated with the provided field descriptordescriptors
- the parameter descriptors to checkfieldDescriptor
- the field descriptor which must be associated to the parametersfieldFilter
- the predicate on the field value mapped to the specified field descriptorCopyright © 2023 CNES. All rights reserved.