T
- The sketch data typepublic class ItemsSketchSortedView<T> extends Object implements GenericSortedView<T>
Constructor and Description |
---|
ItemsSketchSortedView(T[] quantiles,
long[] cumWeights,
QuantilesGenericAPI<T> sk)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Comparator<? super T> |
getComparator()
Gets the Comparator for this generic type.
|
long[] |
getCumulativeWeights()
Returns the array of cumulative weights from the sketch.
|
T |
getMaxItem()
Returns the maximum item of the stream.
|
int |
getMaxPartitions()
Gets the maximum number of partitions this sketch will support based on the configured size K
and the number of retained values of this sketch.
|
T |
getMinItem()
Returns the minimum item of the stream.
|
long |
getN()
Gets the length of the input stream offered to the sketch..
|
int |
getNumRetained()
Gets the number of quantiles retained by this sorted view.
|
GenericPartitionBoundaries<T> |
getPartitionBoundariesFromNumParts(int numEquallySizedParts,
QuantileSearchCriteria searchCrit)
This method returns an instance of
GenericPartitionBoundaries which provides
sufficient information for the user to create the given number of equally sized partitions, where "equally sized"
refers to an approximately equal number of items per partition. |
GenericPartitionBoundaries<T> |
getPartitionBoundariesFromPartSize(long nominalPartitionSize,
QuantileSearchCriteria searchCrit)
This method returns an instance of
GenericPartitionBoundaries which provides
sufficient information for the user to create the given number of equally sized partitions, where "equally sized"
refers to an approximately equal number of items per partition. |
T |
getQuantile(double rank,
QuantileSearchCriteria searchCrit)
Gets the approximate quantile of the given normalized rank and the given search criterion.
|
T[] |
getQuantiles()
Returns the full array of quantiles.
|
T[] |
getQuantiles(double[] ranks,
QuantileSearchCriteria searchCrit)
Gets an array of quantiles corresponding to the given array of ranks.
|
double |
getRank(T quantile,
QuantileSearchCriteria searchCrit)
Gets the normalized rank corresponding to the given a quantile.
|
boolean |
isEmpty()
Returns true if this sorted view is empty.
|
GenericSortedViewIterator<T> |
iterator()
Returns an iterator for this Sorted View.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCDF, getPMF, validateItems
getPartitionBoundariesFromNumParts, getPartitionBoundariesFromPartSize
getMinPartitionSizeItems
public ItemsSketchSortedView(T[] quantiles, long[] cumWeights, QuantilesGenericAPI<T> sk)
quantiles
- the given array of quantiles, which must be ordered.cumWeights
- the given array of cumulative weights, which must be ordered, start with the value one, and
the last value must be equal to N, the total number of items updated to the sketch.sk
- the underlying quantile sketch.public Comparator<? super T> getComparator()
GenericSortedView
getComparator
in interface GenericSortedView<T>
public long[] getCumulativeWeights()
SortedView
getCumulativeWeights
in interface SortedView
public T getMaxItem()
GenericSortedView
getMaxItem
in interface GenericSortedView<T>
public T getMinItem()
GenericSortedView
getMinItem
in interface GenericSortedView<T>
public long getN()
SketchPartitionLimits
getN
in interface SketchPartitionLimits
getN
in interface SortedView
public int getNumRetained()
SortedView
getNumRetained
in interface SortedView
public int getMaxPartitions()
SketchPartitionLimits
getMaxPartitions
in interface SketchPartitionLimits
public GenericPartitionBoundaries<T> getPartitionBoundariesFromPartSize(long nominalPartitionSize, QuantileSearchCriteria searchCrit)
PartitioningFeature
GenericPartitionBoundaries
which provides
sufficient information for the user to create the given number of equally sized partitions, where "equally sized"
refers to an approximately equal number of items per partition.
The sketch must not be empty.
getPartitionBoundariesFromPartSize
in interface PartitioningFeature<T>
nominalPartitionSize
- an integer that specifies the nominal size, in items, of each target partition.
This must be a positive integer greater than
getMinPartitionSizeItems()
.searchCrit
- If INCLUSIVE, all the returned quantiles are the upper boundaries of the equally sized partitions
with the exception of the lowest returned quantile, which is the lowest boundary of the lowest ranked partition.
If EXCLUSIVE, all the returned quantiles are the lower boundaries of the equally sized partitions
with the exception of the highest returned quantile, which is the upper boundary of the highest ranked partition.GenericPartitionBoundaries
.public GenericPartitionBoundaries<T> getPartitionBoundariesFromNumParts(int numEquallySizedParts, QuantileSearchCriteria searchCrit)
PartitioningFeature
GenericPartitionBoundaries
which provides
sufficient information for the user to create the given number of equally sized partitions, where "equally sized"
refers to an approximately equal number of items per partition.
The sketch must not be empty.
getPartitionBoundariesFromNumParts
in interface PartitioningFeature<T>
numEquallySizedParts
- an integer that specifies the number of equally sized partitions between
getMinItem()
and
getMaxItem()
.
This must be a positive integer less than
getMaxPartitions()
searchCrit
- If INCLUSIVE, all the returned quantiles are the upper boundaries of the equally sized partitions
with the exception of the lowest returned quantile, which is the lowest boundary of the lowest ranked partition.
If EXCLUSIVE, all the returned quantiles are the lower boundaries of the equally sized partitions
with the exception of the highest returned quantile, which is the upper boundary of the highest ranked partition.GenericPartitionBoundaries
.public T getQuantile(double rank, QuantileSearchCriteria searchCrit)
GenericSortedView
getQuantile
in interface GenericSortedView<T>
rank
- the given normalized rank, a double in the range [0.0, 1.0].searchCrit
- If INCLUSIVE, the given rank includes all quantiles ≤
the quantile directly corresponding to the given rank.
If EXCLUSIVE, he given rank includes all quantiles <
the quantile directly corresponding to the given rank.QuantileSearchCriteria
public T[] getQuantiles(double[] ranks, QuantileSearchCriteria searchCrit)
ranks
- the given array of normalized rankssearchCrit
- The search criterion: either INCLUSIVE or EXCLUSIVE.public T[] getQuantiles()
GenericSortedView
getQuantiles
in interface GenericSortedView<T>
public double getRank(T quantile, QuantileSearchCriteria searchCrit)
GenericSortedView
getRank
in interface GenericSortedView<T>
quantile
- the given quantilesearchCrit
- if INCLUSIVE the given quantile is included into the rank.QuantileSearchCriteria
public boolean isEmpty()
SortedView
isEmpty
in interface SortedView
public GenericSortedViewIterator<T> iterator()
SortedView
iterator
in interface GenericSortedView<T>
iterator
in interface SortedView
Copyright © 2015–2024 The Apache Software Foundation. All rights reserved.