/** * return a float array of serialized data * @return */ public final float[] getSerializedData() { serialize(); return array; }
/** * release objects. * add() method call is not allowed anymore. */ public void freeze() { serialize(); indexPool.clear(); }
/** * @param index * @param value */ public final void set(int index, T value) { int j = getCompactIndex(index); serialize(j, value); }
/** * serialize this compact array */ public final void serialize() { if (invalid) { int newSize = indexPool.size() * getTupleSize(); if (array == null || Array.getLength(array) < newSize) { array = ensureCapacity(array, newSize); for (Map.Entry<T, Integer> entry : indexPool.entrySet()) { int i = entry.getValue(); T obj = entry.getKey(); serialize(i, obj); } } invalid = false; } }
/** * returns the object for the given index * @param index the index * @param store an object to store the result * @return */ public final T get(int index, T store) { serialize(); int j = getCompactIndex(index); return deserialize(j, store); }
/** * return a float array of serialized data * @return */ public final float[] getSerializedData() { serialize(); return array; }
/** * return a float array of serialized data * @return */ public final float[] getSerializedData() { serialize(); return array; }
/** * release objects. * add() method call is not allowed anymore. */ public void freeze() { serialize(); indexPool.clear(); }
/** * release objects. * add() method call is not allowed anymore. */ public void freeze() { serialize(); indexPool.clear(); }
/** * @param index * @param value */ public final void set(int index, T value) { int j = getCompactIndex(index); serialize(j, value); }
/** * @param index * @param value */ public final void set(int index, T value) { int j = getCompactIndex(index); serialize(j, value); }
/** * serialize this compact array */ public final void serialize() { if (invalid) { int newSize = indexPool.size() * getTupleSize(); if (array == null || Array.getLength(array) < newSize) { array = ensureCapacity(array, newSize); for (Map.Entry<T, Integer> entry : indexPool.entrySet()) { int i = entry.getValue(); T obj = entry.getKey(); serialize(i, obj); } } invalid = false; } }
/** * serialize this compact array */ public final void serialize() { if (invalid) { int newSize = indexPool.size() * getTupleSize(); if (array == null || Array.getLength(array) < newSize) { array = ensureCapacity(array, newSize); for (Map.Entry<T, Integer> entry : indexPool.entrySet()) { int i = entry.getValue(); T obj = entry.getKey(); serialize(i, obj); } } invalid = false; } }
/** * returns the object for the given index * @param index the index * @param store an object to store the result * @return */ public final T get(int index, T store) { serialize(); int j = getCompactIndex(index); return deserialize(j, store); }
/** * returns the object for the given index * @param index the index * @param store an object to store the result * @return */ public final T get(int index, T store) { serialize(); int j = getCompactIndex(index); return deserialize(j, store); }