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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidfinal voidfinal voidaddInt(int v) Makes a word-boundary and adds a full word.final voidfinal voidaddInts(int[] v, int off, int len) Makes a word-boundary and adds an array of words.final voidclear()Resets this key builder to initial state.final booleanCompares with packed int array (storage key).final voidflush()Introduces a word-boundary in the key.final inthashCode()Same asArrays.hashCode(int[]).final booleanisEmpty()final intsize()final Keyfinal voidtrim()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).
-