/** * Ensures that the receiver can hold at least the specified number of elements without needing to allocate new internal memory. * If necessary, allocates new internal memory and increases the capacity of the receiver. * * @param minCapacity the desired minimum capacity. */ public void ensureCapacity(int minCapacity) { elements.ensureCapacity(minCapacity); } /**
/** * Ensures that the receiver can hold at least the specified number of elements without needing to allocate new internal memory. * If necessary, allocates new internal memory and increases the capacity of the receiver. * * @param minCapacity the desired minimum capacity. */ public void ensureCapacity(int minCapacity) { elements.ensureCapacity(minCapacity); } /**
/** * Appends the specified element to the end of this list. * * @param element element to be appended to this list. */ public void add(long element) { // overridden for performance only. if (size == capacity) { ensureCapacity(size + 1); } int i=size*this.bitsPerElement; QuickBitVector.putLongFromTo(this.bits, element-this.minValue,i,i+this.bitsPerElement-1); size++; } /**
/** * Appends the specified element to the end of this list. * * @param element element to be appended to this list. */ public void add(long element) { // overridden for performance only. if (size == capacity) { ensureCapacity(size + 1); } int i=size*this.bitsPerElement; QuickBitVector.putLongFromTo(this.bits, element-this.minValue,i,i+this.bitsPerElement-1); size++; } /**
/** * Appends the elements <tt>elements[from]</tt> (inclusive), ..., <tt>elements[to]</tt> (inclusive) to the receiver. * @param elements the elements to be appended to the receiver. * @param from the index of the first element to be appended (inclusive) * @param to the index of the last element to be appended (inclusive) */ public void addAllOfFromTo(long[] elements, int from, int to) { // cache some vars for speed. int bitsPerElem = this.bitsPerElement; int bitsPerElemMinusOne = bitsPerElem-1; long min = this.minValue; long[] theBits = this.bits; // now let's go. ensureCapacity(this.size+to-from+1); int firstBit = this.size*bitsPerElem; int i=from; for (int times=to-from+1; --times >=0; ) { QuickBitVector.putLongFromTo(theBits, elements[i++]-min, firstBit, firstBit+bitsPerElemMinusOne); firstBit += bitsPerElem; } this.size += (to-from+1); //*bitsPerElem; } /**
/** * Appends the elements <tt>elements[from]</tt> (inclusive), ..., <tt>elements[to]</tt> (inclusive) to the receiver. * @param elements the elements to be appended to the receiver. * @param from the index of the first element to be appended (inclusive) * @param to the index of the last element to be appended (inclusive) */ public void addAllOfFromTo(long[] elements, int from, int to) { // cache some vars for speed. int bitsPerElem = this.bitsPerElement; int bitsPerElemMinusOne = bitsPerElem-1; long min = this.minValue; long[] theBits = this.bits; // now let's go. ensureCapacity(this.size+to-from+1); int firstBit = this.size*bitsPerElem; int i=from; for (int times=to-from+1; --times >=0; ) { QuickBitVector.putLongFromTo(theBits, elements[i++]-min, firstBit, firstBit+bitsPerElemMinusOne); firstBit += bitsPerElem; } this.size += (to-from+1); //*bitsPerElem; } /**