Class DimensionSelector

java.lang.Object
org.apache.sis.storage.aggregate.DimensionSelector
All Implemented Interfaces:
Comparable<DimensionSelector>

final class DimensionSelector extends Object implements Comparable<DimensionSelector>
A helper class for choosing the dimension on which to perform aggregation.
Since:
1.3
Version:
1.3
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) final int
    The dimension examined by this selector.
    private long
    Difference between minimal and maximal increment.
    (package private) boolean
    true if all positions values are the same.
    private final long[]
    Grid coordinate in a single dimension of the grid extent, one value for each slice.
    private double
    Increment in unit of the extent size.
    private BigInteger
    Sum of grid extent size of each slice.
  • Constructor Summary

    Constructors
    Constructor
    Description
    DimensionSelector(int dim, int n)
    Prepares a new selector for a single dimension.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Compares for order of "probability" that a dimension is the one to aggregate.
    (package private) final void
    Computes the #increment between slices after all positions have been specified.
    (package private) final void
    setSliceExtent(int i, long pos, long size)
    Sets the extent of a single slice.
    Returns a string representation for debugging purposes.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • dimension

      final int dimension
      The dimension examined by this selector.
    • positions

      private final long[] positions
      Grid coordinate in a single dimension of the grid extent, one value for each slice. It may be the grid low, mid or high value, it does not matter for this class as long as they are consistent.
    • sumOfSize

      private BigInteger sumOfSize
      Sum of grid extent size of each slice. This is updated for each new slice added to this selector.
    • relativeIncrement

      private double relativeIncrement
      Increment in unit of the extent size. This calculation is based on mean values only. It is computed after the positions array has been completed with data from all slices.
    • incrementRange

      private long incrementRange
      Difference between minimal and maximal increment. This is computed after the positions array has been completed with data from all slices.
    • isConstantPosition

      boolean isConstantPosition
      true if all positions values are the same. This field is valid only after finish() call.
  • Constructor Details

    • DimensionSelector

      DimensionSelector(int dim, int n)
      Prepares a new selector for a single dimension.
      Parameters:
      dim - the dimension examined by this selector.
      n - number of slices.
  • Method Details

    • setSliceExtent

      final void setSliceExtent(int i, long pos, long size)
      Sets the extent of a single slice.
      Parameters:
      i - index of the slice.
      pos - position of the slice. Could be low, mid or high index, as long as the choice is kept consistent.
      size - size of the extent, in number of cells.
    • finish

      final void finish()
      Computes the #increment between slices after all positions have been specified. This method is invoked in parallel (on different instances) for each dimension.
    • compareTo

      public int compareTo(DimensionSelector other)
      Compares for order of "probability" that a dimension is the one to aggregate. After using this comparator, dimensions that are more likely to be the ones to aggregate are sorted last. Because the order is defined that way, sorting the DimensionSelector array will have no effect in the most typical cases where the dimensions to aggregate are the last ones.
      Specified by:
      compareTo in interface Comparable<DimensionSelector>
    • toString

      public String toString()
      Returns a string representation for debugging purposes.
      Overrides:
      toString in class Object