java.lang.Object
com.pervasive.datarush.tokens.record.RecordToIDMap
Provides a mapping between records and integer ids. The keys are maintained
in a space-efficient data structure in order to minimize the per-entry
object overhead. By providing a mapping from record to IDs, this can be
used as a building-block for a number of data structures and operator.
The ids returned are from a zero-based, strictly monotonically increasing
sequence such that they can be used as indexes into arrays that wish to
associate additional information with the keys.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAn accessor for performing lookup operations.static classAn accessor for building the map. -
Constructor Summary
ConstructorsConstructorDescriptionRecordToIDMap(RecordTokenType keyType, int initialCapacity) Create a new RecordToIDMap -
Method Summary
Modifier and TypeMethodDescriptionReturns the type of keys contained within this map.Creates an iterator to iterate over keys within the map.newLRUWriteAccessor(RecordValued value, int maxSize) Creates an accessor for building the map.newReadAccessor(RecordValued value) Creates an accessor for performing lookup operations.newWriteAccessor(RecordValued value) Creates an accessor for building the map.intsize()Creates the number of entries in the map.
-
Constructor Details
-
RecordToIDMap
Create a new RecordToIDMap- Parameters:
keyType- The record token type that corresponds to the keys that we are selecting. Must be a subset of values from the record input from which we are building/looking up.initialCapacity- The initial capacity ( in records ) to use for the internal data structures of this mapping.
-
-
Method Details
-
newReadAccessor
Creates an accessor for performing lookup operations.NOTE: From a thread safety standpoint, it is safe to have multiple
ReadAccessorsin different threads that reference a singleRecordToIDMap. However, each thread must have its ownReadAccessorinstance.- Parameters:
value- The record valued object for which we are performing lookup operations. Typically will be aRecordInput.- Returns:
- the newly-created
ReadAccessor
-
getKeyType
Returns the type of keys contained within this map.- Returns:
- the type of keys contained within this map.
-
newWriteAccessor
Creates an accessor for building the map.NOTE: From a thread safety standpoint, it is unsafe to have multiple
WriteAccessorsin different threads that reference a singleRecordToIDMap.- Parameters:
value- The record valued object from which we are building the map. Typically will be aRecordInput.- Returns:
- the newly-created
WriteAccessor
-
newLRUWriteAccessor
Creates an accessor for building the map.NOTE: From a thread safety standpoint, it is unsafe to have multiple
WriteAccessorsin different threads that reference a singleRecordToIDMap.- Parameters:
value- The record valued object from which we are building the map. Typically will be aRecordInput.maxSize- The maximum number of items to keep in the map- Returns:
- the newly-created
WriteAccessor
-
newIterator
Creates an iterator to iterate over keys within the map. Keys will be returned in order by their associated ID. Moreover, theabsolute indexof the iterator will be equivalent to the ID.- Returns:
- an iterator to iterate over keys within the map.
-
size
public int size()Creates the number of entries in the map.- Returns:
- the number of entries in the map.
-