Package org.apache.druid.segment.data
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 Summary
Constructors Constructor Description BufferIndexed()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description T
get(int index)
Get the value at specified positionprotected abstract ByteBuffer
getByteBuffer(int index)
int
indexOf(T value)
Returns the index of "value" in this Indexed object, or a negative number if the value is not present.boolean
isSorted()
Indicates if this value set is sorted, the implication being that the contract ofIndexed.indexOf(T)
is strenthened to return a negative number equal to (-(insertion point) - 1) when the value is not present in the set.Iterator<T>
iterator()
int
size()
Number of elements in the value set-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.druid.query.monomorphicprocessing.HotLoopCallee
inspectRuntimeShape
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
size
public int size()
Description copied from interface:Indexed
Number of elements in the value set
-
get
public T get(int index)
Description copied from interface:Indexed
Get the value at specified position
-
getByteBuffer
@Nullable protected abstract ByteBuffer getByteBuffer(int index)
Likeget(int)
, but returns aByteBuffer
instead of using theObjectStrategy
. 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 unlessIndexed.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 interfaceIndexed<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 ofIndexed.indexOf(T)
is strenthened to return a negative number equal to (-(insertion point) - 1) when the value is not present in the set.
-
-