Interface SortedViewIterator
-
- All Known Subinterfaces:
DoublesSortedViewIterator
,FloatsSortedViewIterator
- All Known Implementing Classes:
DoublesSketchSortedViewIterator
,GenericSortedViewIterator
,ItemsSketchSortedView.ItemsSketchSortedViewIterator
,KllDoublesSketchSortedViewIterator
,KllFloatsSketchSortedViewIterator
,KllItemsSketchSortedView.KllItemsSketchSortedViewIterator
,ReqSketchSortedViewIterator
public interface SortedViewIterator
This is the base interface for the SortedViewIterator hierarchy used with a SortedView obtained from a quantile-type sketch. This provides an ordered iterator over the retained quantiles of the associated quantile-type sketch.Prototype example of the recommended iteration loop:
SortedViewIterator itr = sketch.getSortedView().iterator(); while (itr.next()) { long weight = itr.getWeight(); ... }
- Author:
- Alexander Saydakov, Lee Rhodes
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
getCumulativeWeight(QuantileSearchCriteria searchCrit)
Gets the cumulative weight at the current index (or previous index) based on the chosen search criterion.long
getN()
Gets the total count of all items presented to the sketch.double
getNormalizedRank(QuantileSearchCriteria searchCrit)
Gets the normalized rank at the current index (or previous index) based on the chosen search criterion.long
getWeight()
Gets the natural weight at the current index.boolean
next()
Advances the index and checks if it is valid.
-
-
-
Method Detail
-
getCumulativeWeight
long getCumulativeWeight(QuantileSearchCriteria searchCrit)
Gets the cumulative weight at the current index (or previous index) based on the chosen search criterion. This is also referred to as the "Natural Rank".Don't call this before calling next() for the first time or after getting false from next().
- Parameters:
searchCrit
- if INCLUSIVE, includes the weight at the current index in the cumulative sum. Otherwise, it will return the cumulative weight of the previous index.- Returns:
- cumulative weight at the current index on the chosen search criterion.
-
getN
long getN()
Gets the total count of all items presented to the sketch.- Returns:
- the total count of all items presented to the sketch.
-
getNormalizedRank
double getNormalizedRank(QuantileSearchCriteria searchCrit)
Gets the normalized rank 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 normalized rank at the current index. Otherwise, returns the normalized rank of the previous index.- Returns:
- the normalized rank at the current index (or previous index) based on the chosen search criterion.
-
getWeight
long getWeight()
Gets the natural weight at the current index.Don't call this before calling next() for the first time or after getting false from next().
- Returns:
- the natural weight at the current index.
-
next
boolean next()
Advances the index and checks if it is valid. The state of this iterator is undefined before the first call of this method.- Returns:
- true if the next index is valid.
-
-