public T getEntryModSkip(int index, T store) { int total = data.getTotalObjectSize(); if (index == -1) { index--; } else if (index >= total) { index++; } index = mod(index, total); return data.get(index, store); } }
public T getEntryMod(int index, T store) { return data.get(mod(index, data.getTotalObjectSize()), store); }
public T getEntryClamp(int index, T store) { index = (int) FastMath.clamp(index, 0, data.getTotalObjectSize() - 1); return data.get(index, store); }
/** * decompress and return object array * @return decompress and return object array */ @SuppressWarnings("unchecked") public final T[] toObjectArray() { try { T[] compactArr = (T[]) Array.newInstance(getElementClass(), getSerializedSize() / getTupleSize()); for (int i = 0; i < compactArr.length; i++) { compactArr[i] = getElementClass().newInstance(); deserialize(i, compactArr[i]); } T[] objArr = (T[]) Array.newInstance(getElementClass(), getTotalObjectSize()); for (int i = 0; i < objArr.length; i++) { int compactIndex = getCompactIndex(i); objArr[i] = compactArr[compactIndex]; } return objArr; } catch (Exception e) { return null; } }
/** * decompress and return object array * @return decompress and return object array */ public final T[] toObjectArray() { try { T[] compactArr = (T[]) Array.newInstance(getElementClass(), getSerializedSize() / getTupleSize()); for (int i = 0; i < compactArr.length; i++) { compactArr[i] = getElementClass().newInstance(); deserialize(i, compactArr[i]); } T[] objArr = (T[]) Array.newInstance(getElementClass(), getTotalObjectSize()); for (int i = 0; i < objArr.length; i++) { int compactIndex = getCompactIndex(i); objArr[i] = compactArr[compactIndex]; } return objArr; } catch (Exception e) { return null; } }
/** * decompress and return object array * @return decompress and return object array */ @SuppressWarnings("unchecked") public final T[] toObjectArray() { try { T[] compactArr = (T[]) Array.newInstance(getElementClass(), getSerializedSize() / getTupleSize()); for (int i = 0; i < compactArr.length; i++) { compactArr[i] = getElementClass().newInstance(); deserialize(i, compactArr[i]); } T[] objArr = (T[]) Array.newInstance(getElementClass(), getTotalObjectSize()); for (int i = 0; i < objArr.length; i++) { int compactIndex = getCompactIndex(i); objArr[i] = compactArr[compactIndex]; } return objArr; } catch (Exception e) { return null; } }