/** * 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 boolean[][] a, final long offset, final long length) { BooleanBigArrays.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 BooleanBigArrayBigList(final boolean a[][], final long offset, final long length) { this(length); BooleanBigArrays.copy(a, offset, this.a, 0, length); size = length; } /**
@Override public BooleanBigArrayBigList clone() { BooleanBigArrayBigList c = new BooleanBigArrayBigList(size); BooleanBigArrays.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); BooleanBigArrays.copy(a, to, a, from, size - to); size -= (to - from); } /**
@Override public boolean removeBoolean(final long index) { if (index >= size) throw new IndexOutOfBoundsException( "Index (" + index + ") is greater than or equal to list size (" + size + ")"); final boolean old = BooleanBigArrays.get(a, index); size--; if (index != size) BooleanBigArrays.copy(a, index + 1, a, index, size - index); assert size <= BooleanBigArrays.length(a); return old; } @Override
base[i] = new boolean[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 boolean a[][], final long offset, final long length) { ensureIndex(index); BooleanBigArrays.ensureOffsetLength(a, offset, length); grow(size + length); BooleanBigArrays.copy(this.a, index, this.a, index + length, size - index); BooleanBigArrays.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 boolean[][] copy(final boolean[][] array, final long offset, final long length) { ensureOffsetLength(array, offset, length); final boolean[][] a = newBigArray(length); copy(array, offset, a, 0, length); return a; } /**
@Override public void add(final long index, final boolean k) { ensureIndex(index); grow(size + 1); if (index != size) BooleanBigArrays.copy(a, index, a, index + 1, size - index); BooleanBigArrays.set(a, index, k); size++; assert size <= BooleanBigArrays.length(a); } @Override