Package icyllis.arc3d.engine
Class KeyBuilder
java.lang.Object
icyllis.arc3d.engine.Key
icyllis.arc3d.engine.KeyBuilder
- Direct Known Subclasses:
PipelineKey_old
Used to build a packed array as the storage or lookup key of a hash map.
Note: A flush()
is expected at the end of key building.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
final void
final void
addInt
(int v) Makes a word-boundary and adds a full word.final void
final void
addInts
(int[] v, int off, int len) Makes a word-boundary and adds an array of words.final void
clear()
Resets this key builder to initial state.final boolean
Compares with packed int array (storage key).final void
flush()
Introduces a word-boundary in the key.final int
hashCode()
Same asArrays.hashCode(int[])
.final boolean
isEmpty()
final int
size()
final Key
final void
trim()
Trims the backing store so that the capacity is equal to the size.
-
Constructor Details
-
KeyBuilder
public KeyBuilder() -
KeyBuilder
-
-
Method Details
-
clear
public final void clear()Resets this key builder to initial state. -
size
public final int size() -
isEmpty
public final boolean isEmpty() -
addBits
-
addBool
-
addInt32
-
addInt
public final void addInt(int v) Makes a word-boundary and adds a full word. -
addInts
public final void addInts(int[] v, int off, int len) Makes a word-boundary and adds an array of words. -
flush
public final void flush()Introduces a word-boundary in the key. Must be called before using the key with any cache, but can also be called to create a break between generic data and backend-specific data. -
trim
public final void trim()Trims the backing store so that the capacity is equal to the size. -
toStorageKey
- Returns:
- a copy of packed int array as storage key
-
hashCode
public final int hashCode()Same asArrays.hashCode(int[])
. -
equals
Compares with packed int array (storage key).
-