/** * Allocate a new {@link LongArray}. * @param size the initial length of the array * @param clearOnResize whether values should be set to 0 on initialization and resize */ public LongArray newLongArray(long size, boolean clearOnResize) { if (size > PageCacheRecycler.LONG_PAGE_SIZE) { // when allocating big arrays, we want to first ensure we have the capacity by // checking with the circuit breaker before attempting to allocate adjustBreaker(BigLongArray.estimateRamBytes(size), false); return new BigLongArray(size, this, clearOnResize); } else if (size >= PageCacheRecycler.LONG_PAGE_SIZE / 2 && recycler != null) { final Recycler.V<long[]> page = recycler.longPage(clearOnResize); return validate(new LongArrayWrapper(this, page.v(), size, page, clearOnResize)); } else { return validate(new LongArrayWrapper(this, new long[(int) size], size, null, clearOnResize)); } }
/** * Allocate a new {@link ObjectArray}. * @param size the initial length of the array */ public <T> ObjectArray<T> newObjectArray(long size) { final ObjectArray<T> array; if (size > PageCacheRecycler.OBJECT_PAGE_SIZE) { // when allocating big arrays, we want to first ensure we have the capacity by // checking with the circuit breaker before attempting to allocate adjustBreaker(BigObjectArray.estimateRamBytes(size), false); return new BigObjectArray<>(size, this); } else if (size >= PageCacheRecycler.OBJECT_PAGE_SIZE / 2 && recycler != null) { final Recycler.V<Object[]> page = recycler.objectPage(); return validate(new ObjectArrayWrapper<>(this, page.v(), size, page)); } else { return validate(new ObjectArrayWrapper<>(this, new Object[(int) size], size, null)); } }
/** * Allocate a new {@link IntArray}. * @param size the initial length of the array * @param clearOnResize whether values should be set to 0 on initialization and resize */ public IntArray newIntArray(long size, boolean clearOnResize) { if (size > PageCacheRecycler.INT_PAGE_SIZE) { // when allocating big arrays, we want to first ensure we have the capacity by // checking with the circuit breaker before attempting to allocate adjustBreaker(BigIntArray.estimateRamBytes(size), false); return new BigIntArray(size, this, clearOnResize); } else if (size >= PageCacheRecycler.INT_PAGE_SIZE / 2 && recycler != null) { final Recycler.V<int[]> page = recycler.intPage(clearOnResize); return validate(new IntArrayWrapper(this, page.v(), size, page, clearOnResize)); } else { return validate(new IntArrayWrapper(this, new int[(int) size], size, null, clearOnResize)); } }
/** * Allocate a new {@link ByteArray}. * @param size the initial length of the array * @param clearOnResize whether values should be set to 0 on initialization and resize */ public ByteArray newByteArray(long size, boolean clearOnResize) { if (size > PageCacheRecycler.BYTE_PAGE_SIZE) { // when allocating big arrays, we want to first ensure we have the capacity by // checking with the circuit breaker before attempting to allocate adjustBreaker(BigByteArray.estimateRamBytes(size), false); return new BigByteArray(size, this, clearOnResize); } else if (size >= PageCacheRecycler.BYTE_PAGE_SIZE / 2 && recycler != null) { final Recycler.V<byte[]> page = recycler.bytePage(clearOnResize); return validate(new ByteArrayWrapper(this, page.v(), size, page, clearOnResize)); } else { return validate(new ByteArrayWrapper(this, new byte[(int) size], size, null, clearOnResize)); } }
/** * Allocate a new {@link DoubleArray}. * @param size the initial length of the array * @param clearOnResize whether values should be set to 0 on initialization and resize */ public DoubleArray newDoubleArray(long size, boolean clearOnResize) { if (size > PageCacheRecycler.LONG_PAGE_SIZE) { // when allocating big arrays, we want to first ensure we have the capacity by // checking with the circuit breaker before attempting to allocate adjustBreaker(BigDoubleArray.estimateRamBytes(size), false); return new BigDoubleArray(size, this, clearOnResize); } else if (size >= PageCacheRecycler.LONG_PAGE_SIZE / 2 && recycler != null) { final Recycler.V<long[]> page = recycler.longPage(clearOnResize); return validate(new DoubleArrayWrapper(this, page.v(), size, page, clearOnResize)); } else { return validate(new DoubleArrayWrapper(this, new long[(int) size], size, null, clearOnResize)); } }
/** * Allocate a new {@link FloatArray}. * @param size the initial length of the array * @param clearOnResize whether values should be set to 0 on initialization and resize */ public FloatArray newFloatArray(long size, boolean clearOnResize) { if (size > PageCacheRecycler.INT_PAGE_SIZE) { // when allocating big arrays, we want to first ensure we have the capacity by // checking with the circuit breaker before attempting to allocate adjustBreaker(BigFloatArray.estimateRamBytes(size), false); return new BigFloatArray(size, this, clearOnResize); } else if (size >= PageCacheRecycler.INT_PAGE_SIZE / 2 && recycler != null) { final Recycler.V<int[]> page = recycler.intPage(clearOnResize); return validate(new FloatArrayWrapper(this, page.v(), size, page, clearOnResize)); } else { return validate(new FloatArrayWrapper(this, new int[(int) size], size, null, clearOnResize)); } }
/** * Allocate a new {@link IntArray}. * @param size the initial length of the array * @param clearOnResize whether values should be set to 0 on initialization and resize */ public IntArray newIntArray(long size, boolean clearOnResize) { if (size > INT_PAGE_SIZE) { // when allocating big arrays, we want to first ensure we have the capacity by // checking with the circuit breaker before attempting to allocate adjustBreaker(BigIntArray.estimateRamBytes(size), false); return new BigIntArray(size, this, clearOnResize); } else if (size >= INT_PAGE_SIZE / 2 && recycler != null) { final Recycler.V<int[]> page = recycler.intPage(clearOnResize); return validate(new IntArrayWrapper(this, page.v(), size, page, clearOnResize)); } else { return validate(new IntArrayWrapper(this, new int[(int) size], size, null, clearOnResize)); } }
/** * Allocate a new {@link ObjectArray}. * @param size the initial length of the array */ public <T> ObjectArray<T> newObjectArray(long size) { final ObjectArray<T> array; if (size > OBJECT_PAGE_SIZE) { // when allocating big arrays, we want to first ensure we have the capacity by // checking with the circuit breaker before attempting to allocate adjustBreaker(BigObjectArray.estimateRamBytes(size), false); return new BigObjectArray<>(size, this); } else if (size >= OBJECT_PAGE_SIZE / 2 && recycler != null) { final Recycler.V<Object[]> page = recycler.objectPage(); return validate(new ObjectArrayWrapper<>(this, page.v(), size, page)); } else { return validate(new ObjectArrayWrapper<>(this, new Object[(int) size], size, null)); } }
/** * Allocate a new {@link IntArray}. * @param size the initial length of the array * @param clearOnResize whether values should be set to 0 on initialization and resize */ public IntArray newIntArray(long size, boolean clearOnResize) { if (size > INT_PAGE_SIZE) { // when allocating big arrays, we want to first ensure we have the capacity by // checking with the circuit breaker before attempting to allocate adjustBreaker(BigIntArray.estimateRamBytes(size), false); return new BigIntArray(size, this, clearOnResize); } else if (size >= INT_PAGE_SIZE / 2 && recycler != null) { final Recycler.V<int[]> page = recycler.intPage(clearOnResize); return validate(new IntArrayWrapper(this, page.v(), size, page, clearOnResize)); } else { return validate(new IntArrayWrapper(this, new int[(int) size], size, null, clearOnResize)); } }
/** * Allocate a new {@link DoubleArray}. * @param size the initial length of the array * @param clearOnResize whether values should be set to 0 on initialization and resize */ public DoubleArray newDoubleArray(long size, boolean clearOnResize) { if (size > LONG_PAGE_SIZE) { // when allocating big arrays, we want to first ensure we have the capacity by // checking with the circuit breaker before attempting to allocate adjustBreaker(BigDoubleArray.estimateRamBytes(size), false); return new BigDoubleArray(size, this, clearOnResize); } else if (size >= LONG_PAGE_SIZE / 2 && recycler != null) { final Recycler.V<long[]> page = recycler.longPage(clearOnResize); return validate(new DoubleArrayWrapper(this, page.v(), size, page, clearOnResize)); } else { return validate(new DoubleArrayWrapper(this, new long[(int) size], size, null, clearOnResize)); } }
/** * Allocate a new {@link ObjectArray}. * @param size the initial length of the array */ public <T> ObjectArray<T> newObjectArray(long size) { final ObjectArray<T> array; if (size > OBJECT_PAGE_SIZE) { // when allocating big arrays, we want to first ensure we have the capacity by // checking with the circuit breaker before attempting to allocate adjustBreaker(BigObjectArray.estimateRamBytes(size), false); return new BigObjectArray<>(size, this); } else if (size >= OBJECT_PAGE_SIZE / 2 && recycler != null) { final Recycler.V<Object[]> page = recycler.objectPage(); return validate(new ObjectArrayWrapper<>(this, page.v(), size, page)); } else { return validate(new ObjectArrayWrapper<>(this, new Object[(int) size], size, null)); } }
/** * Allocate a new {@link ObjectArray}. * @param size the initial length of the array */ public <T> ObjectArray<T> newObjectArray(long size) { final ObjectArray<T> array; if (size > OBJECT_PAGE_SIZE) { // when allocating big arrays, we want to first ensure we have the capacity by // checking with the circuit breaker before attempting to allocate adjustBreaker(BigObjectArray.estimateRamBytes(size), false); return new BigObjectArray<>(size, this); } else if (size >= OBJECT_PAGE_SIZE / 2 && recycler != null) { final Recycler.V<Object[]> page = recycler.objectPage(); return validate(new ObjectArrayWrapper<>(this, page.v(), size, page)); } else { return validate(new ObjectArrayWrapper<>(this, new Object[(int) size], size, null)); } }
/** * Allocate a new {@link ByteArray}. * @param size the initial length of the array * @param clearOnResize whether values should be set to 0 on initialization and resize */ public ByteArray newByteArray(long size, boolean clearOnResize) { if (size > BYTE_PAGE_SIZE) { // when allocating big arrays, we want to first ensure we have the capacity by // checking with the circuit breaker before attempting to allocate adjustBreaker(BigByteArray.estimateRamBytes(size), false); return new BigByteArray(size, this, clearOnResize); } else if (size >= BYTE_PAGE_SIZE / 2 && recycler != null) { final Recycler.V<byte[]> page = recycler.bytePage(clearOnResize); return validate(new ByteArrayWrapper(this, page.v(), size, page, clearOnResize)); } else { return validate(new ByteArrayWrapper(this, new byte[(int) size], size, null, clearOnResize)); } }
/** * Allocate a new {@link LongArray}. * @param size the initial length of the array * @param clearOnResize whether values should be set to 0 on initialization and resize */ public LongArray newLongArray(long size, boolean clearOnResize) { if (size > LONG_PAGE_SIZE) { // when allocating big arrays, we want to first ensure we have the capacity by // checking with the circuit breaker before attempting to allocate adjustBreaker(BigLongArray.estimateRamBytes(size), false); return new BigLongArray(size, this, clearOnResize); } else if (size >= LONG_PAGE_SIZE / 2 && recycler != null) { final Recycler.V<long[]> page = recycler.longPage(clearOnResize); return validate(new LongArrayWrapper(this, page.v(), size, page, clearOnResize)); } else { return validate(new LongArrayWrapper(this, new long[(int) size], size, null, clearOnResize)); } }
/** * Allocate a new {@link ByteArray}. * @param size the initial length of the array * @param clearOnResize whether values should be set to 0 on initialization and resize */ public ByteArray newByteArray(long size, boolean clearOnResize) { if (size > BYTE_PAGE_SIZE) { // when allocating big arrays, we want to first ensure we have the capacity by // checking with the circuit breaker before attempting to allocate adjustBreaker(BigByteArray.estimateRamBytes(size), false); return new BigByteArray(size, this, clearOnResize); } else if (size >= BYTE_PAGE_SIZE / 2 && recycler != null) { final Recycler.V<byte[]> page = recycler.bytePage(clearOnResize); return validate(new ByteArrayWrapper(this, page.v(), size, page, clearOnResize)); } else { return validate(new ByteArrayWrapper(this, new byte[(int) size], size, null, clearOnResize)); } }
/** * Allocate a new {@link IntArray}. * @param size the initial length of the array * @param clearOnResize whether values should be set to 0 on initialization and resize */ public IntArray newIntArray(long size, boolean clearOnResize) { if (size > INT_PAGE_SIZE) { // when allocating big arrays, we want to first ensure we have the capacity by // checking with the circuit breaker before attempting to allocate adjustBreaker(BigIntArray.estimateRamBytes(size), false); return new BigIntArray(size, this, clearOnResize); } else if (size >= INT_PAGE_SIZE / 2 && recycler != null) { final Recycler.V<int[]> page = recycler.intPage(clearOnResize); return validate(new IntArrayWrapper(this, page.v(), size, page, clearOnResize)); } else { return validate(new IntArrayWrapper(this, new int[(int) size], size, null, clearOnResize)); } }
/** * Allocate a new {@link FloatArray}. * @param size the initial length of the array * @param clearOnResize whether values should be set to 0 on initialization and resize */ public FloatArray newFloatArray(long size, boolean clearOnResize) { if (size > INT_PAGE_SIZE) { // when allocating big arrays, we want to first ensure we have the capacity by // checking with the circuit breaker before attempting to allocate adjustBreaker(BigFloatArray.estimateRamBytes(size), false); return new BigFloatArray(size, this, clearOnResize); } else if (size >= INT_PAGE_SIZE / 2 && recycler != null) { final Recycler.V<int[]> page = recycler.intPage(clearOnResize); return validate(new FloatArrayWrapper(this, page.v(), size, page, clearOnResize)); } else { return validate(new FloatArrayWrapper(this, new int[(int) size], size, null, clearOnResize)); } }
/** * Allocate a new {@link LongArray}. * @param size the initial length of the array * @param clearOnResize whether values should be set to 0 on initialization and resize */ public LongArray newLongArray(long size, boolean clearOnResize) { final LongArray array; if (size > LONG_PAGE_SIZE) { array = new BigLongArray(size, this, clearOnResize); } else if (size >= LONG_PAGE_SIZE / 2 && recycler != null) { final Recycler.V<long[]> page = recycler.longPage(clearOnResize); array = new LongArrayWrapper(this, page.v(), size, page, clearOnResize); } else { array = new LongArrayWrapper(this, new long[(int) size], size, null, clearOnResize); } return validate(array); }
/** * Allocate a new {@link ByteArray}. * @param size the initial length of the array * @param clearOnResize whether values should be set to 0 on initialization and resize */ public ByteArray newByteArray(long size, boolean clearOnResize) { final ByteArray array; if (size > BYTE_PAGE_SIZE) { array = new BigByteArray(size, this, clearOnResize); } else if (size >= BYTE_PAGE_SIZE / 2 && recycler != null) { final Recycler.V<byte[]> page = recycler.bytePage(clearOnResize); array = new ByteArrayWrapper(this, page.v(), size, page, clearOnResize); } else { array = new ByteArrayWrapper(this, new byte[(int) size], size, null, clearOnResize); } return validate(array); }
/** * Allocate a new {@link IntArray}. * @param size the initial length of the array * @param clearOnResize whether values should be set to 0 on initialization and resize */ public IntArray newIntArray(long size, boolean clearOnResize) { final IntArray array; if (size > INT_PAGE_SIZE) { array = new BigIntArray(size, this, clearOnResize); } else if (size >= INT_PAGE_SIZE / 2 && recycler != null) { final Recycler.V<int[]> page = recycler.intPage(clearOnResize); array = new IntArrayWrapper(this, page.v(), size, page, clearOnResize); } else { array = new IntArrayWrapper(this, new int[(int) size], size, null, clearOnResize); } return validate(array); }