/** * Copies element of this type-specific list into the given big array using * optimized system calls. * * @param from * the start index (inclusive). * @param a * the destination big array. * @param offset * the offset into the destination array where to store the first * element copied. * @param length * the number of elements to be copied. */ @Override public void getElements(final long from, final long[][] a, final long offset, final long length) { LongBigArrays.copy(this.a, from, a, offset, length); } /**
/** * Creates a new big-array big list and fills it with the elements of a given * big array. * * <p> * Note that this constructor makes it easy to build big lists from literal * arrays declared as * <code><var>type</var>[][] {{ <var>init_values</var> }}</code>. The only * constraint is that the number of initialisation values is below * {@link it.unimi.dsi.fastutil.BigArrays#SEGMENT_SIZE}. * * @param a * a big array whose elements will be used to fill the array list. * @param offset * the first element to use. * @param length * the number of elements to use. */ public LongBigArrayBigList(final long a[][], final long offset, final long length) { this(length); LongBigArrays.copy(a, offset, this.a, 0, length); size = length; } /**
/** * Returns a deep copy of this big set. * * <p> * This method performs a deep copy of this big hash set; the data stored in the * set, however, is not cloned. Note that this makes a difference only for * object keys. * * @return a deep copy of this big set. */ @Override public LongOpenHashBigSet clone() { LongOpenHashBigSet c; try { c = (LongOpenHashBigSet) super.clone(); } catch (CloneNotSupportedException cantHappen) { throw new InternalError(); } c.key = LongBigArrays.copy(key); c.containsNull = containsNull; return c; } /**
@Override public LongBigArrayBigList clone() { LongBigArrayBigList c = new LongBigArrayBigList(size); LongBigArrays.copy(a, 0, c.a, 0, size); c.size = size; return c; } /**
/** * Removes elements of this type-specific list using optimized system calls. * * @param from * the start index (inclusive). * @param to * the end index (exclusive). */ @Override public void removeElements(final long from, final long to) { BigArrays.ensureFromTo(size, from, to); LongBigArrays.copy(a, to, a, from, size - to); size -= (to - from); } /**
@Override public long removeLong(final long index) { if (index >= size) throw new IndexOutOfBoundsException( "Index (" + index + ") is greater than or equal to list size (" + size + ")"); final long old = LongBigArrays.get(a, index); size--; if (index != size) LongBigArrays.copy(a, index + 1, a, index, size - index); assert size <= LongBigArrays.length(a); return old; } @Override
base[i] = new long[SEGMENT_SIZE]; if (preserve - (valid * (long) SEGMENT_SIZE) > 0) copy(array, valid * (long) SEGMENT_SIZE, base, valid * (long) SEGMENT_SIZE, preserve - (valid * (long) SEGMENT_SIZE)); return base;
/** * Adds elements to this type-specific list using optimized system calls. * * @param index * the index at which to add elements. * @param a * the big array containing the elements. * @param offset * the offset of the first element to add. * @param length * the number of elements to add. */ @Override public void addElements(final long index, final long a[][], final long offset, final long length) { ensureIndex(index); LongBigArrays.ensureOffsetLength(a, offset, length); grow(size + length); LongBigArrays.copy(this.a, index, this.a, index + length, size - index); LongBigArrays.copy(a, offset, this.a, index, length); size += length; } @Override
/** * Returns a copy of a portion of a big array. * * @param array * a big array. * @param offset * the first element to copy. * @param length * the number of elements to copy. * @return a new big array containing {@code length} elements of {@code array} * starting at {@code offset}. */ public static long[][] copy(final long[][] array, final long offset, final long length) { ensureOffsetLength(array, offset, length); final long[][] a = newBigArray(length); copy(array, offset, a, 0, length); return a; } /**
@Override public void add(final long index, final long k) { ensureIndex(index); grow(size + 1); if (index != size) LongBigArrays.copy(a, index, a, index + 1, size - index); LongBigArrays.set(a, index, k); size++; assert size <= LongBigArrays.length(a); } @Override