@Override public DoubleBigArrayBigList clone() { DoubleBigArrayBigList c = new DoubleBigArrayBigList(size); DoubleBigArrays.copy(a, 0, c.a, 0, size); c.size = size; return c; } /**
@Override public void add(double k) { DoubleBigArrayBigList.this.add(pos++, k); last = -1; } @Override
@Override public DoubleBigListIterator listIterator(final long index) { ensureIndex(index); return new DoubleBigListIterator() { long pos = index, last = -1;
@Override public boolean rem(final double k) { final long index = indexOf(k); if (index == -1) return false; removeDouble(index); assert size <= DoubleBigArrays.length(a); return true; } @Override
final DataInputStream dis = new DataInputStream( new FastBufferedInputStream( is ) ); if ( gzip ) { final DoubleBigArrayBigList score = new DoubleBigArrayBigList( 2 * n ); // Very wild approximation try { if ( type.equals( "int" ) ) for(;;) score.add( dis.readInt() ); else if ( type.equals( "long" ) ) for(;;) score.add( dis.readLong() ); else if ( type.equals( "float" ) ) for(;;) score.add( dis.readFloat() ); else if ( type.equals( "double" ) ) for(;;) score.add( dis.readDouble() ); else throw new IllegalArgumentException( "Unknown type \"" + type + "\"" ); this.score = DoubleBigArrays.newBigArray( score.size64() ); 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
/** * Compares this type-specific big-array list to another one. * * <p> * This method exists only for sake of efficiency. The implementation inherited * from the abstract implementation would already work. * * @param l * a type-specific big-array list. * @return true if the argument contains the same elements of this type-specific * big-array list. */ public boolean equals(final DoubleBigArrayBigList l) { if (l == this) return true; long s = size64(); if (s != l.size64()) return false; final double[][] a1 = a; final double[][] a2 = l.a; while (s-- != 0) if (DoubleBigArrays.get(a1, s) != DoubleBigArrays.get(a2, s)) return false; return true; } /**
@Override public double getDocumentScore(long rank) throws IndexOutOfBoundsException, IOException { return (documentScores != null) ? documentScores.getDouble(getDocumentIndex(rank)) : DEFAULT_SCORE; }
@Override public void remove() { if (last == -1) throw new IllegalStateException(); DoubleBigArrayBigList.this.removeDouble(last); /* * If the last operation was a next(), we are removing an element *before* us, * and we must decrease pos correspondingly. */ if (last < pos) pos--; last = -1; } };
@Override public boolean add(final double k) { grow(size + 1); DoubleBigArrays.set(a, size++, k); assert size <= DoubleBigArrays.length(a); return true; } @Override
/** * 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
/** * Compares this big list to another big list. * * <p> * This method exists only for sake of efficiency. The implementation inherited * from the abstract implementation would already work. * * @param l * a big list. * @return a negative integer, zero, or a positive integer as this big list is * lexicographically less than, equal to, or greater than the argument. */ public int compareTo(final DoubleBigArrayBigList l) { final long s1 = size64(), s2 = l.size64(); final double a1[][] = a, a2[][] = l.a; double e1, e2; int r, i; for (i = 0; i < s1 && i < s2; i++) { e1 = DoubleBigArrays.get(a1, i); e2 = DoubleBigArrays.get(a2, i); if ((r = (Double.compare((e1), (e2)))) != 0) return r; } return i < s2 ? -1 : (i < s1 ? 1 : 0); } private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
/** * Creates a new big-array big list and fills it with the elements returned by * an iterator.. * * @param i * an iterator whose returned elements will fill the array list. */ public DoubleBigArrayBigList(final Iterator<? extends Double> i) { this(); while (i.hasNext()) this.add((i.next()).doubleValue()); } /**
/** * Wraps a given big array into a big-array list of given size. * * @param a * a big array to wrap. * @param length * the length of the resulting big-array list. * @return a new big-array list of the given size, wrapping the given big array. */ public static DoubleBigArrayBigList wrap(final double a[][], final long length) { if (length > DoubleBigArrays.length(a)) throw new IllegalArgumentException("The specified length (" + length + ") is greater than the array size (" + DoubleBigArrays.length(a) + ")"); final DoubleBigArrayBigList l = new DoubleBigArrayBigList(a, false); l.size = length; return l; } /**
/** * Creates a new big-array big list and fills it with the elements returned by a * type-specific iterator.. * * @param i * a type-specific iterator whose returned elements will fill the * array list. */ public DoubleBigArrayBigList(final DoubleIterator i) { this(); while (i.hasNext()) this.add(i.nextDouble()); } /**
documentHits = new ObjectBigArrayBigList<List<Binding>>(); if(scorer != null) { documentScores = new DoubleBigArrayBigList(); documentsOrder = new LongBigArrayBigList(docBlockSize);
/** * Creates a new big-array big list and fills it with a given type-specific * collection. * * @param c * a type-specific collection that will be used to fill the array * list. */ public DoubleBigArrayBigList(final DoubleCollection c) { this(c.size()); for (DoubleIterator i = c.iterator(); i.hasNext();) add(i.nextDouble()); } /**
documentScores.add(scorer.score()); documentHits.add(null); } else {