Package org.apache.sis.parameter
Class TensorValues<E>
java.lang.Object
org.apache.sis.io.wkt.FormattableObject
org.apache.sis.referencing.AbstractIdentifiedObject
org.apache.sis.parameter.AbstractParameterDescriptor
org.apache.sis.parameter.TensorValues<E>
- Type Parameters:
E
- the type of tensor element values.
- All Implemented Interfaces:
Serializable
,Cloneable
,Formattable
,Deprecable
,LenientComparable
,org.opengis.parameter.GeneralParameterDescriptor
,org.opengis.parameter.GeneralParameterValue
,org.opengis.parameter.ParameterDescriptorGroup
,org.opengis.parameter.ParameterValueGroup
,org.opengis.referencing.IdentifiedObject
final class TensorValues<E>
extends AbstractParameterDescriptor
implements org.opengis.parameter.ParameterDescriptorGroup, org.opengis.parameter.ParameterValueGroup, Cloneable
The values for a group of tensor parameters. This value group is extensible, i.e. the number of
"elt_row_col"
parameters depends on the "num_row"
and
"num_col"
parameter values. Consequently, this ParameterValueGroup
is also its own
mutable ParameterDescriptorGroup
.- Since:
- 0.4
- Version:
- 0.6
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TensorParameters
<E> A provider of descriptors for matrix parameters.private final org.opengis.parameter.ParameterValue<Integer>[]
The parameter for the number of row, columns and other dimensions in the tensor.private static final long
Serial number for inter-operability with different versions.private Object[]
The parameter values.Fields inherited from class org.apache.sis.referencing.AbstractIdentifiedObject
DEPRECATED_KEY, LOCALE_KEY
Fields inherited from interface org.opengis.referencing.IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
-
Constructor Summary
ConstructorsConstructorDescriptionTensorValues
(Map<String, ?> properties, TensorParameters<E> descriptors) Constructs a new group of tensor parameters for the given properties.TensorValues
(TensorValues<E> other, boolean clone) Constructs a copy of the given matrix parameters. -
Method Summary
Modifier and TypeMethodDescriptionorg.opengis.parameter.ParameterValueGroup
Always throws an exception since this group does not contain subgroups.private static void
addValues
(Object[] values, int[] actualSize, int j, List<org.opengis.parameter.GeneralParameterValue> addTo) Implementation ofvalues()
which adds parameter values to the given list.org.opengis.parameter.ParameterValueGroup
clone()
Returns a clone of this group.private static Object[]
Clones the given array of parameters.protected long
Invoked byAbstractIdentifiedObject.hashCode()
for computing the hash code when first needed.org.opengis.parameter.ParameterValueGroup
Returns a new group initialized to default values.org.opengis.parameter.GeneralParameterDescriptor
descriptor
(String name) Returns the parameter descriptor in this group for the specified name.List
<org.opengis.parameter.GeneralParameterDescriptor> Returns the parameters descriptors in this group.boolean
equals
(Object object, ComparisonMode mode) Compares this object with the specified one for equality.protected String
Formats this group as a pseudo-Well Known Text element.org.opengis.parameter.ParameterDescriptorGroup
Returns a description of this parameter value group.List
<org.opengis.parameter.ParameterValueGroup> Always throws an exception since this group does not contain subgroups.private static boolean
isOmitted
(org.opengis.parameter.ParameterValue<?> parameter) Returnstrue
if the given parameter can be omitted.private org.opengis.parameter.ParameterValue
<E> parameter
(int[] indices, int[] actualSize) Returns the tensor element at the given indices.org.opengis.parameter.ParameterValue
<?> Returns the parameter value in this group for the specified name.(package private) final void
setMatrix
(org.opengis.referencing.operation.Matrix matrix) Sets all parameter values to the element value in the specified matrix.private int[]
size()
Returns the current tensor size for each dimensions.(package private) final org.opengis.referencing.operation.Matrix
toMatrix()
Creates a matrix from this group of parameters.List
<org.opengis.parameter.GeneralParameterValue> values()
Returns the parameter values in this group.Methods inherited from class org.apache.sis.parameter.AbstractParameterDescriptor
getInterface, getMaximumOccurs, getMinimumOccurs, print, toString
Methods inherited from class org.apache.sis.referencing.AbstractIdentifiedObject
castOrCopy, equals, formatTo, getAlias, getDescription, getIdentifiers, getName, getRemarks, hashCode, isDeprecated, isHeuristicMatchForName
Methods inherited from class org.apache.sis.io.wkt.FormattableObject
toString, toWKT
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opengis.parameter.GeneralParameterDescriptor
getMaximumOccurs, getMinimumOccurs
Methods inherited from interface org.opengis.referencing.IdentifiedObject
getAlias, getIdentifiers, getName, getRemarks, toWKT
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerial number for inter-operability with different versions.- See Also:
-
descriptors
A provider of descriptors for matrix parameters. This object is used like a collection ofParameterDescriptor
s, even if it does not implement any standard collection API.- See Also:
-
dimensions
The parameter for the number of row, columns and other dimensions in the tensor. -
values
The parameter values. Each array element is itself anParameterValue
array, and so on until we have nestedTensorParameters.rank()
arrays.Will be constructed only when first requested. May be resized at any moment if a
dimensions
parameter value change.
-
-
Constructor Details
-
TensorValues
TensorValues(Map<String, ?> properties, TensorParameters<E> descriptors) Constructs a new group of tensor parameters for the given properties. -
TensorValues
TensorValues(TensorValues<E> other, boolean clone) Constructs a copy of the given matrix parameters. Ifclone
is true, the new group will be a clone of the given group. Ifclone
is false, the new group will be initialized to default values.
-
-
Method Details
-
clone
Clones the given array of parameters. This method invokes itself for cloning sub-arrays. -
clone
public org.opengis.parameter.ParameterValueGroup clone()Returns a clone of this group. -
createValue
public org.opengis.parameter.ParameterValueGroup createValue()Returns a new group initialized to default values.- Specified by:
createValue
in interfaceorg.opengis.parameter.GeneralParameterDescriptor
- Specified by:
createValue
in interfaceorg.opengis.parameter.ParameterDescriptorGroup
-
getDescriptor
public org.opengis.parameter.ParameterDescriptorGroup getDescriptor()Returns a description of this parameter value group. Returns alwaysthis
, since the description depends on"num_row"
and"num_col"
parameter values.- Specified by:
getDescriptor
in interfaceorg.opengis.parameter.GeneralParameterValue
- Specified by:
getDescriptor
in interfaceorg.opengis.parameter.ParameterValueGroup
-
descriptors
Returns the parameters descriptors in this group. The amount of parameters depends on the value of"num_row"
and"num_col"
parameters.- Specified by:
descriptors
in interfaceorg.opengis.parameter.ParameterDescriptorGroup
-
size
private int[] size()Returns the current tensor size for each dimensions. -
descriptor
public org.opengis.parameter.GeneralParameterDescriptor descriptor(String name) throws org.opengis.parameter.ParameterNotFoundException Returns the parameter descriptor in this group for the specified name.- Specified by:
descriptor
in interfaceorg.opengis.parameter.ParameterDescriptorGroup
- Parameters:
name
- the name of the parameter to search for.- Returns:
- the parameter descriptor for the given name.
- Throws:
org.opengis.parameter.ParameterNotFoundException
- if there is no parameter for the given name.
-
parameter
public org.opengis.parameter.ParameterValue<?> parameter(String name) throws org.opengis.parameter.ParameterNotFoundException Returns the parameter value in this group for the specified name.- Specified by:
parameter
in interfaceorg.opengis.parameter.ParameterValueGroup
- Parameters:
name
- the name of the parameter to search for.- Returns:
- the parameter value for the given name.
- Throws:
org.opengis.parameter.ParameterNotFoundException
- if there is no parameter for the given name.
-
parameter
Returns the tensor element at the given indices. -
values
Returns the parameter values in this group. The amount of parameters depends on the value of"num_row"
and"num_col"
parameters. The parameter array will contain only matrix elements which have been requested at least once by one ofparameter(…)
methods. Never requested elements are left to their default value and omitted from the returned array.- Specified by:
values
in interfaceorg.opengis.parameter.ParameterValueGroup
-
addValues
private static void addValues(Object[] values, int[] actualSize, int j, List<org.opengis.parameter.GeneralParameterValue> addTo) Implementation ofvalues()
which adds parameter values to the given list. This method invokes itself recursively. -
isOmitted
private static boolean isOmitted(org.opengis.parameter.ParameterValue<?> parameter) Returnstrue
if the given parameter can be omitted. A parameter can be omitted if it is not mandatory and has a value equals to the default value. -
groups
public List<org.opengis.parameter.ParameterValueGroup> groups(String name) throws org.opengis.parameter.ParameterNotFoundException Always throws an exception since this group does not contain subgroups.- Specified by:
groups
in interfaceorg.opengis.parameter.ParameterValueGroup
- Throws:
org.opengis.parameter.ParameterNotFoundException
-
addGroup
public org.opengis.parameter.ParameterValueGroup addGroup(String name) throws org.opengis.parameter.ParameterNotFoundException, IllegalStateException Always throws an exception since this group does not contain subgroups.- Specified by:
addGroup
in interfaceorg.opengis.parameter.ParameterValueGroup
- Throws:
org.opengis.parameter.ParameterNotFoundException
IllegalStateException
-
toMatrix
final org.opengis.referencing.operation.Matrix toMatrix()Creates a matrix from this group of parameters. This operation is allowed only for tensors of rank 2.- Returns:
- a matrix created from this group of parameters.
-
setMatrix
final void setMatrix(org.opengis.referencing.operation.Matrix matrix) Sets all parameter values to the element value in the specified matrix. After this method call,values
will returns only the elements different from the default value.- Parameters:
matrix
- the matrix to copy in this group of parameters.
-
equals
Compares this object with the specified one for equality.- Specified by:
equals
in interfaceLenientComparable
- Overrides:
equals
in classAbstractParameterDescriptor
- Parameters:
object
- the object to compare tothis
.mode
- the strictness level of the comparison.- Returns:
true
if both objects are equal according the given comparison mode.- See Also:
-
computeHashCode
protected long computeHashCode()Invoked byAbstractIdentifiedObject.hashCode()
for computing the hash code when first needed.- Overrides:
computeHashCode
in classAbstractIdentifiedObject
- Returns:
- the hash code value. This value may change in any future Apache SIS version.
-
formatTo
Formats this group as a pseudo-Well Known Text element.- Overrides:
formatTo
in classAbstractParameterDescriptor
- Parameters:
formatter
- the formatter where to format the inner content of this WKT element.- Returns:
"ParameterGroup"
.- See Also:
-