Class 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

    Fields
    Modifier and Type
    Field
    Description
    private 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

    Constructors
    Constructor
    Description
    TensorValues(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 Type
    Method
    Description
    org.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 of values() which adds parameter values to the given list.
    org.opengis.parameter.ParameterValueGroup
    Returns a clone of this group.
    private static Object[]
    clone(Object[] values)
    Clones the given array of parameters.
    protected long
    Invoked by AbstractIdentifiedObject.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
    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
    formatTo(Formatter formatter)
    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>
    groups(String name)
    Always throws an exception since this group does not contain subgroups.
    private static boolean
    isOmitted(org.opengis.parameter.ParameterValue<?> parameter)
    Returns true 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[]
    Returns the current tensor size for each dimensions.
    (package private) final org.opengis.referencing.operation.Matrix
    Creates a matrix from this group of parameters.
    List<org.opengis.parameter.GeneralParameterValue>
    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.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

  • 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. If clone is true, the new group will be a clone of the given group. If clone is false, the new group will be initialized to default values.
  • Method Details

    • clone

      private static Object[] clone(Object[] values)
      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.
      Specified by:
      clone in interface org.opengis.parameter.GeneralParameterValue
      Specified by:
      clone in interface org.opengis.parameter.ParameterValueGroup
      Overrides:
      clone in class Object
    • createValue

      public org.opengis.parameter.ParameterValueGroup createValue()
      Returns a new group initialized to default values.
      Specified by:
      createValue in interface org.opengis.parameter.GeneralParameterDescriptor
      Specified by:
      createValue in interface org.opengis.parameter.ParameterDescriptorGroup
    • getDescriptor

      public org.opengis.parameter.ParameterDescriptorGroup getDescriptor()
      Returns a description of this parameter value group. Returns always this, since the description depends on "num_row" and "num_col" parameter values.
      Specified by:
      getDescriptor in interface org.opengis.parameter.GeneralParameterValue
      Specified by:
      getDescriptor in interface org.opengis.parameter.ParameterValueGroup
    • descriptors

      public List<org.opengis.parameter.GeneralParameterDescriptor> 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 interface org.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 interface org.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 interface org.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

      private org.opengis.parameter.ParameterValue<E> parameter(int[] indices, int[] actualSize)
      Returns the tensor element at the given indices.
    • values

      public List<org.opengis.parameter.GeneralParameterValue> 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 of parameter(…) methods. Never requested elements are left to their default value and omitted from the returned array.
      Specified by:
      values in interface org.opengis.parameter.ParameterValueGroup
    • addValues

      private static void addValues(Object[] values, int[] actualSize, int j, List<org.opengis.parameter.GeneralParameterValue> addTo)
      Implementation of values() which adds parameter values to the given list. This method invokes itself recursively.
    • isOmitted

      private static boolean isOmitted(org.opengis.parameter.ParameterValue<?> parameter)
      Returns true 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 interface org.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 interface org.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

      public boolean equals(Object object, ComparisonMode mode)
      Compares this object with the specified one for equality.
      Specified by:
      equals in interface LenientComparable
      Overrides:
      equals in class AbstractParameterDescriptor
      Parameters:
      object - the object to compare to this.
      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 by AbstractIdentifiedObject.hashCode() for computing the hash code when first needed.
      Overrides:
      computeHashCode in class AbstractIdentifiedObject
      Returns:
      the hash code value. This value may change in any future Apache SIS version.
    • formatTo

      protected String formatTo(Formatter formatter)
      Formats this group as a pseudo-Well Known Text element.
      Overrides:
      formatTo in class AbstractParameterDescriptor
      Parameters:
      formatter - the formatter where to format the inner content of this WKT element.
      Returns:
      "ParameterGroup".
      See Also: