T
- public abstract class CompactArray<T> extends java.lang.Object implements JmeCloneable
Modifier and Type | Field and Description |
---|---|
protected float[] |
array |
protected int[] |
index |
protected java.util.Map<T,java.lang.Integer> |
indexPool |
Constructor and Description |
---|
CompactArray()
Creates a compact array
|
CompactArray(float[] compressedArray,
int[] index)
create array using serialized data
|
Modifier and Type | Method and Description |
---|---|
void |
add(T... objArray)
Add objects.
|
java.lang.Object |
clone()
Create a deep clone of this array.
|
void |
cloneFields(Cloner cloner,
java.lang.Object original)
Callback from
Cloner to convert this
shallow-cloned array into a deep-cloned one, using the specified cloner
to resolve copied fields. |
protected abstract T |
deserialize(int compactIndex,
T store)
deserialize object
|
protected float[] |
ensureCapacity(float[] arr,
int size)
Ensure the capacity for the given array and the given size
|
void |
freeze()
release objects.
|
T |
get(int index,
T store)
returns the object for the given index
|
int |
getCompactIndex(int objIndex)
returns the corresponding index in the compact array
|
int |
getCompactObjectSize() |
protected abstract java.lang.Class<T> |
getElementClass() |
int[] |
getIndex(T... objArray)
Return an array of indices for the given objects
|
float[] |
getSerializedData()
return a float array of serialized data
|
protected int |
getSerializedSize() |
int |
getTotalObjectSize() |
protected abstract int |
getTupleSize()
serialized size of one object element
|
java.lang.Object |
jmeClone()
Create a shallow clone for the JME cloner.
|
void |
serialize()
serialize this compact array
|
protected abstract void |
serialize(int compactIndex,
T store)
serialize object
|
void |
set(int index,
T value) |
protected void |
setInvalid(boolean invalid) |
T[] |
toObjectArray()
decompress and return object array
|
protected java.util.Map<T,java.lang.Integer> indexPool
protected int[] index
protected float[] array
public CompactArray()
public CompactArray(float[] compressedArray, int[] index)
compressedArray
- index
- public void add(T... objArray)
objArray
- public void freeze()
protected void setInvalid(boolean invalid)
public final void set(int index, T value)
index
- value
- public final T get(int index, T store)
index
- the indexstore
- an object to store the resultpublic final float[] getSerializedData()
public final void serialize()
protected final int getSerializedSize()
protected float[] ensureCapacity(float[] arr, int size)
arr
- the arraysize
- the sizepublic final int[] getIndex(T... objArray)
objArray
- public int getCompactIndex(int objIndex)
objIndex
- public final int getTotalObjectSize()
public final int getCompactObjectSize()
public final T[] toObjectArray()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public java.lang.Object jmeClone()
jmeClone
in interface JmeCloneable
public void cloneFields(Cloner cloner, java.lang.Object original)
Cloner
to convert this
shallow-cloned array into a deep-cloned one, using the specified cloner
to resolve copied fields.cloneFields
in interface JmeCloneable
cloner
- the cloner currently cloning this control (not null)original
- the array from which this array was shallow-cloned
(unused)protected abstract void serialize(int compactIndex, T store)
compactIndex
- compacted object indexstore
- protected abstract T deserialize(int compactIndex, T store)
compactIndex
- compacted object indexstore
- protected abstract int getTupleSize()
protected abstract java.lang.Class<T> getElementClass()