public static class SparseMappingTable.Table extends Object
Constructor and Description |
---|
Table(SparseMappingTable parent) |
Modifier and Type | Method and Description |
---|---|
void |
copyFrom(SparseMappingTable.Table copyFrom,
int valueCount)
Pulls the data from 'copyFrom' and stores it in our own longs table.
|
String |
dumpInternalState() |
long[] |
getArrayForKey(int key)
Return the raw storage long[] for the given key.
|
int |
getKey(byte id)
Looks up a key in the table.
|
int |
getKeyAt(int i)
Get the key at the given index in our table.
|
int |
getKeyCount()
Return the number of keys that have been added to this Table.
|
int |
getOrAddKey(byte id,
int count)
Allocates data in the buffer, and stores that key in the mapping for this
table.
|
long |
getValue(int key)
Get the value for the given key and offset from that key.
|
long |
getValue(int key,
int index)
Get the value for the given key and offset from that key.
|
long |
getValueForId(byte id)
Set the value for the given id at offset 0 from that id.
|
long |
getValueForId(byte id,
int index)
Set the value for the given id and index offset from that id.
|
boolean |
readFromParcel(Parcel in)
Read the keys from the parcel.
|
void |
resetTable()
Clear out the table, and reset the sequence numbers so future writes
without allocations will assert.
|
void |
setValue(int key,
int index,
long value)
Set the value for the given key and offset from that key.
|
void |
setValue(int key,
long value)
Set the value for the given key and offset from that key.
|
void |
writeToParcel(Parcel out)
Write the keys stored in the table to the parcel.
|
public Table(SparseMappingTable parent)
public void copyFrom(SparseMappingTable.Table copyFrom, int valueCount)
copyFrom
- The Table to copy fromvalueCount
- The number of values to copy for each keypublic int getOrAddKey(byte id, int count)
id
- The id of the item (will be used in making the key)count
- The number of bytes to allocate. Must be less than
SparseMappingTable.ARRAY_SIZE.public int getKey(byte id)
public long getValue(int key)
key
- A key as obtained from getKey or getOrAddKey.value
- The value to set.public long getValue(int key, int index)
key
- A key as obtained from getKey or getOrAddKey.index
- The offset from that key. Must be less than the count
provided to getOrAddKey when the space was allocated.value
- The value to set.public long getValueForId(byte id)
id
- The id of the item.public long getValueForId(byte id, int index)
id
- The id of the item.index
- The offset from that key. Must be less than the count
provided to getOrAddKey when the space was allocated.public long[] getArrayForKey(int key)
public void setValue(int key, long value)
key
- A key as obtained from getKey or getOrAddKey.value
- The value to set.public void setValue(int key, int index, long value)
key
- A key as obtained from getKey or getOrAddKey.index
- The offset from that key. Must be less than the count
provided to getOrAddKey when the space was allocated.value
- The value to set.public void resetTable()
public void writeToParcel(Parcel out)
public boolean readFromParcel(Parcel in)
public int getKeyCount()
public int getKeyAt(int i)
public String dumpInternalState()