Package org.apache.sis.storage.aggregate
Class DimensionSelector
java.lang.Object
org.apache.sis.storage.aggregate.DimensionSelector
- All Implemented Interfaces:
Comparable<DimensionSelector>
A helper class for choosing the dimension on which to perform aggregation.
- Since:
- 1.3
- Version:
- 1.3
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final int
The dimension examined by this selector.private long
Difference between minimal and maximal increment.(package private) boolean
true
if allpositions
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
ConstructorsConstructorDescriptionDimensionSelector
(int dim, int n) Prepares a new selector for a single dimension. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(DimensionSelector other) Compares for order of "probability" that a dimension is the one to aggregate.(package private) final void
finish()
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.toString()
Returns a string representation for debugging purposes.
-
Field Details
-
dimension
final int dimensionThe dimension examined by this selector. -
positions
private final long[] positionsGrid 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
Sum of grid extent size of each slice. This is updated for each new slice added to this selector. -
relativeIncrement
private double relativeIncrementIncrement in unit of the extent size. This calculation is based on mean values only. It is computed after thepositions
array has been completed with data from all slices. -
incrementRange
private long incrementRangeDifference between minimal and maximal increment. This is computed after thepositions
array has been completed with data from all slices. -
isConstantPosition
boolean isConstantPosition
-
-
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
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 theDimensionSelector
array will have no effect in the most typical cases where the dimensions to aggregate are the last ones.- Specified by:
compareTo
in interfaceComparable<DimensionSelector>
-
toString
Returns a string representation for debugging purposes.
-