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 longSerial number for inter-operability with different versions.private Object[]The parameter values.Fields inherited from class org.apache.sis.referencing.AbstractIdentifiedObject
DEPRECATED_KEY, LOCALE_KEYFields 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.ParameterValueGroupAlways throws an exception since this group does not contain subgroups.private static voidaddValues(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.ParameterValueGroupclone()Returns a clone of this group.private static Object[]Clones the given array of parameters.protected longInvoked byAbstractIdentifiedObject.hashCode()for computing the hash code when first needed.org.opengis.parameter.ParameterValueGroupReturns a new group initialized to default values.org.opengis.parameter.GeneralParameterDescriptordescriptor(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.booleanequals(Object object, ComparisonMode mode) Compares this object with the specified one for equality.protected StringFormats this group as a pseudo-Well Known Text element.org.opengis.parameter.ParameterDescriptorGroupReturns 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 booleanisOmitted(org.opengis.parameter.ParameterValue<?> parameter) Returnstrueif 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 voidsetMatrix(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.MatrixtoMatrix()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, toStringMethods inherited from class org.apache.sis.referencing.AbstractIdentifiedObject
castOrCopy, equals, formatTo, getAlias, getDescription, getIdentifiers, getName, getRemarks, hashCode, isDeprecated, isHeuristicMatchForNameMethods inherited from class org.apache.sis.io.wkt.FormattableObject
toString, toWKTMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opengis.parameter.GeneralParameterDescriptor
getMaximumOccurs, getMinimumOccursMethods 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 ofParameterDescriptors, even if it does not implement any standard collection API. -
dimensions
The parameter for the number of row, columns and other dimensions in the tensor. -
values
The parameter values. Each array element is itself anParameterValuearray, and so on until we have nestedTensorParameters.rank()arrays.Will be constructed only when first requested. May be resized at any moment if a
dimensionsparameter 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. Ifcloneis true, the new group will be a clone of the given group. Ifcloneis 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:
createValuein interfaceorg.opengis.parameter.GeneralParameterDescriptor- Specified by:
createValuein 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:
getDescriptorin interfaceorg.opengis.parameter.GeneralParameterValue- Specified by:
getDescriptorin 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:
descriptorsin 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:
descriptorin 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:
parameterin 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:
valuesin 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) Returnstrueif 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:
groupsin 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:
addGroupin interfaceorg.opengis.parameter.ParameterValueGroup- Throws:
org.opengis.parameter.ParameterNotFoundExceptionIllegalStateException
-
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,valueswill 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:
equalsin interfaceLenientComparable- Overrides:
equalsin classAbstractParameterDescriptor- Parameters:
object- the object to compare tothis.mode- the strictness level of the comparison.- Returns:
trueif 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:
computeHashCodein 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:
formatToin classAbstractParameterDescriptor- Parameters:
formatter- the formatter where to format the inner content of this WKT element.- Returns:
"ParameterGroup".- See Also:
-