org.apache.datasketches.kll

## Class KllSketchIterator

- java.lang.Object
- - org.apache.datasketches.kll.KllSketchIterator

All Implemented Interfaces:
  QuantilesSketchIterator

Direct Known Subclasses:
  KllDoublesSketchIterator, KllFloatsSketchIterator, KllItemsSketchIterator, KllLongsSketchIterator

    public class KllSketchIterator
    extends Object
    implements QuantilesSketchIterator

The base implementation for the KLL sketch iterator hierarchy used for viewing the non-ordered quantiles retained by a sketch.

Prototype example of the recommended iteration loop:

       SketchIterator itr = sketch.iterator();
       while (itr.next()) {
         ...get*();
       }

Author:
  Lee Rhodes

### Field Summary

Fields
`protected int` `index`
`protected boolean` `isInitialized_`
`protected int` `level`
`protected int[]` `levelsArr`
`protected int` `numLevels`
`protected long` `weight`

### Method Summary

All Methods Instance Methods Concrete Methods
`long` `getWeight()` Gets the natural weight at the current index.
`boolean` `next()` Advances the index and checks if it is valid.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### levelsArr

    protected final int[] levelsArr

#### numLevels

    protected final int numLevels

#### level

    protected int level

#### index

    protected int index

#### weight

    protected long weight

#### isInitialized_

    protected boolean isInitialized_

### Method Detail

#### getWeight

    public long getWeight()

Description copied from interface: `QuantilesSketchIterator`
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().

Specified by:
  `getWeight` in interface `QuantilesSketchIterator`
Returns:
  the natural weight at the current index.

#### next

    public boolean next()

Description copied from interface: `QuantilesSketchIterator`
Advances the index and checks if it is valid. The state of this iterator is undefined before the first call of this method.

Specified by:
  `next` in interface `QuantilesSketchIterator`
Returns:
  true if the next index is valid.