public interface Index extends com.fishlib.base.log.LogOutputAppendable, Iterable<Long>, LongSizedDataStructure
Modifier and Type | Interface and Description |
---|---|
static interface |
Index.Evaluator<T extends Comparable<T>> |
static interface |
Index.Factory |
static class |
Index.IndexUpdateCoalescer |
static interface |
Index.Iterator |
static interface |
Index.RandomBuilder |
static interface |
Index.RangeIterator |
static interface |
Index.SequentialBuilder |
static interface |
Index.TargetComparator |
Modifier and Type | Field and Description |
---|---|
static Index.Iterator |
EMPTY_ITERATOR |
static Index.Factory |
FACTORY |
static long |
NULL_KEY |
static boolean |
USE_PRIORITY_QUEUE_RANDOM_BUILDER |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
Index |
clone() |
default boolean |
empty()
Queries whether this Index is empty (i.e.
|
long |
find(long key)
Returns the position in [0..(size-1)] where the key is found.
|
gnu.trove.list.array.TLongArrayList[] |
findMissing(Index keys)
For the given keys Index, under the assertion that none of them are present in the current index, return the tentative
insertion points in the current index with the count for each of them
|
long |
findPrev(long key)
Returns the position in [0..(size-1)] where the key is found in the previous index.
|
long |
firstKey() |
long |
get(long pos) |
Map<Object,Index> |
getGrouping(TupleSource tupleSource) |
Map<Object,Index> |
getGroupingForKeySet(Set<Object> keys,
TupleSource tupleSource)
Return a grouping that contains keys that match the values in keySet.
|
long |
getPrev(long pos) |
Map<Object,Index> |
getPrevGrouping(TupleSource tupleSource) |
Index |
getPrevIndex() |
Index |
getSubIndexForKeySet(Set<Object> keySet,
TupleSource tupleSource)
Return a subIndex that contains indices that match the values in keySet.
|
boolean |
hasGrouping(ColumnSource... keyColumns) |
void |
initializePreviousValue()
Initializes our previous value from the current value.
|
void |
insert(Index added)
Adds the keys from a given index to the current index
|
void |
insert(long key) |
void |
insertRange(long startKey,
long endKey) |
Index |
intersect(Index range)
Returns a new index representing the intersection of the current index with the input index
|
Index |
invert(Index keys)
Returns an Index with the positions of keys in this Index.
|
Index |
invert(Index keys,
long maximumPosition)
Returns the positions of keys in the current set as an Index, stopping at maximumPosition.
|
boolean |
isFlat()
Returns whether or not this index is flat.
|
boolean |
isSorted() |
Index.Iterator |
iterator() |
long |
lastKey() |
Index |
minus(Index indexToRemove)
Returns a new index representing the keys of the current set not present inside indexToRemove
|
default boolean |
nonempty()
Queries whether this Index is non-empty (i.e.
|
default boolean |
overlaps(Index index)
Returns true if an index has any overlap.
|
Index.RangeIterator |
rangeIterator() |
int |
refCount() |
void |
release() |
void |
remove(Index removed)
Removes all the keys from removed index that are present in the current set
|
void |
remove(long key)
Removes the given key from the current set if present
|
void |
removeRange(long start,
long end)
Removes any key in the given range from the current set.
|
Index.Iterator |
reverseIterator() |
Index |
shift(long shiftAmount) |
long |
size()
How many keys are in this index.
|
Index |
subindexByKey(long startKey,
long endKey)
Get a subset of this index within this range of keys.
|
Index |
subindexByPos(long startPos,
long endPos)
Get a subset of this index within this range of positions
|
default boolean |
subsetOf(Index other)
Returns true if this index is a (possibly improper) subset of other.
|
void |
update(Index added,
Index removed)
Simultaneously adds the keys from the first index and removes the keys from the second one.
|
void |
validate() |
forEach, spliterator
intSize, intSize, intSize
static final boolean USE_PRIORITY_QUEUE_RANDOM_BUILDER
static final long NULL_KEY
static final Index.Iterator EMPTY_ITERATOR
static final Index.Factory FACTORY
void release()
@VisibleForTesting int refCount()
void insert(long key)
void insertRange(long startKey, long endKey)
void insert(Index added)
void remove(Index removed)
Index clone()
void remove(long key)
void removeRange(long start, long end)
void update(Index added, Index removed)
long lastKey()
long firstKey()
Index invert(Index keys)
keys
- the keys to find positions forIllegalArgumentException
- if an element in keys is missing from this IndexIndex invert(Index keys, long maximumPosition)
keys
- the keys to find positions formaximumPosition
- the largest position for which we will find a keygnu.trove.list.array.TLongArrayList[] findMissing(Index keys)
keys
- the keys to identify insertion locations@NotNull Index intersect(@NotNull Index range)
default boolean overlaps(@NotNull Index index)
default boolean subsetOf(@NotNull Index other)
Index minus(Index indexToRemove)
void clear()
Index shift(long shiftAmount)
Map<Object,Index> getGrouping(TupleSource tupleSource)
Map<Object,Index> getPrevGrouping(TupleSource tupleSource)
Map<Object,Index> getGroupingForKeySet(Set<Object> keys, TupleSource tupleSource)
keys
- a set of values that keyColumns should match. For a single keyColumns, the values within the set
are the values that we would like to find. For multiple keyColumns, the values are SmartKeys.tupleSource
- the tuple factory for the keyColumnsIndex getSubIndexForKeySet(Set<Object> keySet, TupleSource tupleSource)
keySet
- a set of values that keyColumns should match. For a single keyColumns, the values within the set
are the values that we would like to find. For multiple keyColumns, the values are SmartKeys.tupleSource
- the tuple factory for the keyColumnboolean hasGrouping(ColumnSource... keyColumns)
void validate()
Index subindexByPos(long startPos, long endPos)
startPos
- The first position to included in the output (inclusive)endPos
- The last position to included in the output (exclusive)Index subindexByKey(long startKey, long endKey)
startKey
- The first key to include in the output.endKey
- The last key (inclusive) to include in the output.long get(long pos)
long getPrev(long pos)
Index getPrevIndex()
void initializePreviousValue()
long find(long key)
key
- the key to search forlong findPrev(long key)
key
- the key to search forboolean isSorted()
Index.Iterator iterator()
Index.Iterator reverseIterator()
Index.RangeIterator rangeIterator()
long size()
size
in interface LongSizedDataStructure
boolean isFlat()
default boolean empty()
default boolean nonempty()