/** * 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 double[][] a, final long offset, final long length) { DoubleBigArrays.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 DoubleBigArrayBigList(final double a[][], final long offset, final long length) { this(length); DoubleBigArrays.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 DoubleOpenHashBigSet clone() { DoubleOpenHashBigSet c; try { c = (DoubleOpenHashBigSet) super.clone(); } catch (CloneNotSupportedException cantHappen) { throw new InternalError(); } c.key = DoubleBigArrays.copy(key); c.containsNull = containsNull; return c; } /**
@Override public DoubleBigArrayBigList clone() { DoubleBigArrayBigList c = new DoubleBigArrayBigList(size); DoubleBigArrays.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); DoubleBigArrays.copy(a, to, a, from, size - to); size -= (to - from); } /**
@Override public double removeDouble(final long index) { if (index >= size) throw new IndexOutOfBoundsException( "Index (" + index + ") is greater than or equal to list size (" + size + ")"); final double old = DoubleBigArrays.get(a, index); size--; if (index != size) DoubleBigArrays.copy(a, index + 1, a, index, size - index); assert size <= DoubleBigArrays.length(a); return old; } @Override
base[i] = new double[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 double a[][], final long offset, final long length) { ensureIndex(index); DoubleBigArrays.ensureOffsetLength(a, offset, length); grow(size + length); DoubleBigArrays.copy(this.a, index, this.a, index + length, size - index); DoubleBigArrays.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 double[][] copy(final double[][] array, final long offset, final long length) { ensureOffsetLength(array, offset, length); final double[][] a = newBigArray(length); copy(array, offset, a, 0, length); return a; } /**
DoubleBigArrays.copy( score.elements(), 0, this.score, 0, score.size64() );
@Override public void add(final long index, final double k) { ensureIndex(index); grow(size + 1); if (index != size) DoubleBigArrays.copy(a, index, a, index + 1, size - index); DoubleBigArrays.set(a, index, k); size++; assert size <= DoubleBigArrays.length(a); } @Override