Class GenericIndexed.BufferIndexed

java.lang.Object
org.apache.druid.segment.data.GenericIndexed.BufferIndexed
All Implemented Interfaces:
Iterable<T>, HotLoopCallee, Indexed<T>
Enclosing class:
GenericIndexed<T>

public abstract class GenericIndexed.BufferIndexed extends Object implements Indexed<T>
Single-threaded view.
  • Constructor Details

    • BufferIndexed

      public BufferIndexed()
  • Method Details

    • size

      public int size()
      Description copied from interface: Indexed
      Number of elements in the value set
      Specified by:
      size in interface Indexed<T>
    • get

      public T get(int index)
      Description copied from interface: Indexed
      Get the value at specified position
      Specified by:
      get in interface Indexed<T>
    • getByteBuffer

      @Nullable protected abstract ByteBuffer getByteBuffer(int index)
      Like get(int), but returns a ByteBuffer instead of using the ObjectStrategy. The returned ByteBuffer is reused by future calls. Callers must discard it before calling another method on this BufferedIndexed object that may want to reuse the buffer.
    • indexOf

      public int indexOf(@Nullable T value)
      Description copied from interface: Indexed
      Returns the index of "value" in this Indexed object, or a negative number if the value is not present. The negative number is not guaranteed to be any particular number unless Indexed.isSorted() returns true, in which case it will be a negative number equal to (-(insertion point) - 1), in the manner of Arrays.binarySearch.
      Specified by:
      indexOf in interface Indexed<T>
      Parameters:
      value - value to search for
      Returns:
      index of value, or a negative number (equal to (-(insertion point) - 1) if Indexed.isSorted())
    • isSorted

      public boolean isSorted()
      Description copied from interface: Indexed
      Indicates if this value set is sorted, the implication being that the contract of Indexed.indexOf(T) is strenthened to return a negative number equal to (-(insertion point) - 1) when the value is not present in the set.
      Specified by:
      isSorted in interface Indexed<T>
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>