org.apache.datasketches.quantilescommon

## Interface SortedView

All Known Subinterfaces:
  DoublesSortedView, FloatsSortedView, GenericSortedView<T>, LongsSortedView

All Known Implementing Classes:
  DoublesSketchSortedView, FloatsSketchSortedView, ItemsSketchSortedView, LongsSketchSortedView

    public interface SortedView

This is the base interface for the Sorted View interface hierarchy and defines the methods that are type independent.

The SortedView interface hierarchy provides a sorted view of the data retained by a quantiles-type sketch that would be cumbersome to get any other way. One could use the sketch's iterator to iterate over the contents of the sketch, but the result would not be sorted.

The data from a Sorted view is an unbiased random sample of the input stream that can be used for other kinds of analysis not directly provided by the sketch.

Author:
  Alexander Saydakov, Lee Rhodes

### Method Summary

All Methods Instance Methods Abstract Methods
`long[]` `getCumulativeWeights()` Returns the array of cumulative weights from the sketch.
`long` `getN()` Returns the total number of items presented to the sourcing sketch.
`int` `getNumRetained()` Gets the number of quantiles retained by this sorted view.
`boolean` `isEmpty()` Returns true if this sorted view is empty.
`SortedViewIterator` `iterator()` Returns an iterator for this Sorted View.

### Method Detail

#### getCumulativeWeights

    long[] getCumulativeWeights()

Returns the array of cumulative weights from the sketch. Also known as the natural ranks, which are the Natural Numbers on the interval [1, N].

Returns:
  the array of cumulative weights (or natural ranks).

#### getN

    long getN()

Returns the total number of items presented to the sourcing sketch.

Returns:
  the total number of items presented to the sourcing sketch.

#### getNumRetained

    int getNumRetained()

Gets the number of quantiles retained by this sorted view. This may be slightly different from the function with the same name when called from the originating sketch.

Returns:
  the number of quantiles retained by this sorted view

#### isEmpty

    boolean isEmpty()

Returns true if this sorted view is empty.

Returns:
  true if this sorted view is empty.

#### iterator

    SortedViewIterator iterator()

Returns an iterator for this Sorted View.

Returns:
  an iterator for this Sorted View.