Class GenericSortedViewIterator<T>
- java.lang.Object
-
- org.apache.datasketches.quantilescommon.SortedViewIterator
-
- org.apache.datasketches.quantilescommon.GenericSortedViewIterator<T>
-
- Type Parameters:
T
- The generic item class type
public class GenericSortedViewIterator<T> extends SortedViewIterator
Iterator over quantile sketches of generic type.
-
-
Field Summary
-
Fields inherited from class org.apache.datasketches.quantilescommon.SortedViewIterator
cumWeights, index, totalN
-
-
Constructor Summary
Constructors Constructor Description GenericSortedViewIterator(T[] quantiles, long[] cumWeights)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
getQuantile()
Gets the quantile at the current index This is equivalent to getQuantile(INCLUSIVE).T
getQuantile(QuantileSearchCriteria searchCrit)
Gets the quantile at the current index (or previous index) based on the chosen search criterion.-
Methods inherited from class org.apache.datasketches.quantilescommon.SortedViewIterator
getN, getNaturalRank, getNaturalRank, getNormalizedRank, getNormalizedRank, getWeight, next
-
-
-
-
Constructor Detail
-
GenericSortedViewIterator
public GenericSortedViewIterator(T[] quantiles, long[] cumWeights)
Constructor- Parameters:
quantiles
- the given array of quantilescumWeights
- the array of cumulative weights, corresponding to the array of quantiles, starting with the value one and the end value must equal N, the total number of items input to the sketch.
-
-
Method Detail
-
getQuantile
public T getQuantile()
Gets the quantile at the current index This is equivalent to getQuantile(INCLUSIVE).Don't call this before calling next() for the first time or after getting false from next().
- Returns:
- the quantile at the current index.
-
getQuantile
public T getQuantile(QuantileSearchCriteria searchCrit)
Gets the quantile at the current index (or previous index) based on the chosen search criterion.Don't call this before calling next() for the first time or after getting false from next().
- Parameters:
searchCrit
- if INCLUSIVE, includes the quantile at the current index. Otherwise, returns the quantile of the previous index.- Returns:
- the quantile at the current index (or previous index) based on the chosen search criterion. If the chosen search criterion is EXCLUSIVE and the current index is at zero, this will return null.
-
-