Class HnswGraph.NodesIterator

java.lang.Object
org.apache.lucene.util.hnsw.HnswGraph.NodesIterator
All Implemented Interfaces:
Iterator<Integer>, PrimitiveIterator<Integer,IntConsumer>, PrimitiveIterator.OfInt
Enclosing class:
HnswGraph

public static final class HnswGraph.NodesIterator extends Object implements PrimitiveIterator.OfInt
Iterator over the graph nodes on a certain level, Iterator also provides the size – the total number of nodes to be iterated over.
  • Field Details

    • EMPTY

    • nodes

      private final int[] nodes
    • size

      private final int size
    • cur

      int cur
  • Constructor Details

    • NodesIterator

      public NodesIterator(int[] nodes, int size)
      Constructor for iterator based on the nodes array up to the size
    • NodesIterator

      public NodesIterator(int size)
      Constructor for iterator based on the size
  • Method Details

    • consume

      public int consume(int[] dest)
      Consume integers from the iterator and place them into the `dest` array.
      Parameters:
      dest - where to put the integers
      Returns:
      The number of integers written to `dest`
    • nextInt

      public int nextInt()
      Specified by:
      nextInt in interface PrimitiveIterator.OfInt
    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<Integer>
    • size

      public int size()
      The number of elements in this iterator *