Package org.apache.druid.segment.data
Interface Indexed<T>
-
- Type Parameters:
T- the type of the value
- All Superinterfaces:
HotLoopCallee,Iterable<T>
- All Known Subinterfaces:
CloseableIndexed<T>,ColumnarMultiInts
- All Known Implementing Classes:
CombineFirstTwoEntriesIndexed,CombineFirstTwoValuesColumnarMultiInts,CompressedVSizeColumnarMultiIntsSupplier.CompressedVSizeColumnarMultiInts,FixedIndexed,FrontCodedIndexed,FrontCodedIndexed.FrontCodedV0,FrontCodedIndexed.FrontCodedV1,FrontCodedIntArrayIndexed,GenericIndexed,GenericIndexed.BufferIndexed,ListIndexed,ReplaceFirstValueWithNullIndexed,StringEncodingStrategies.Utf8ToStringIndexed,VSizeColumnarMultiInts
public interface Indexed<T> extends Iterable<T>, HotLoopCallee
Indexed is a fixed-size, immutable, indexed set of values which allows locating a specific index via an exact match, the semantics of which are defined by the implementation. The indexed is ordered, and may contain duplicate values.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static voidcheckIndex(int index, int size)Checks ifindexis between 0 andsize.static <T> Indexed<T>empty()Tget(int index)Get the value at specified positionintindexOf(T value)Returns the index of "value" in this Indexed object, or a negative number if the value is not present.default booleanisSorted()Indicates if this value set is sorted, the implication being that the contract ofindexOf(T)is strenthened to return a negative number equal to (-(insertion point) - 1) when the value is not present in the set.intsize()Number of elements in the value set-
Methods inherited from interface org.apache.druid.query.monomorphicprocessing.HotLoopCallee
inspectRuntimeShape
-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
-
-
-
Method Detail
-
empty
static <T> Indexed<T> empty()
-
size
int size()
Number of elements in the value set
-
get
@CalledFromHotLoop @Nullable T get(int index)
Get the value at specified position
-
indexOf
int indexOf(@Nullable T value)
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 unlessisSorted()returns true, in which case it will be a negative number equal to (-(insertion point) - 1), in the manner of Arrays.binarySearch.- Parameters:
value- value to search for- Returns:
- index of value, or a negative number (equal to (-(insertion point) - 1) if
isSorted())
-
isSorted
default boolean isSorted()
Indicates if this value set is sorted, the implication being that the contract ofindexOf(T)is strenthened to return a negative number equal to (-(insertion point) - 1) when the value is not present in the set.
-
checkIndex
static void checkIndex(int index, int size)Checks ifindexis between 0 andsize. Similar to Preconditions.checkElementIndex() except this method throwsIAEwith custom error message.Used here to get existing behavior(same error message and exception) of V1
GenericIndexed.
-
-