private final ObjectIterator<TRECDocumentDescriptor> descriptorIterator = descriptors.iterator();
private final ObjectIterator<TRECDocumentDescriptor> descriptorIterator = descriptors.iterator();
/** * Merges a new collection in this one, by rebuilding the gzFile array and * appending the other object one, concatenating the descriptors while * rebuilding all. * <p> * It is supposed that the passed object contains no duplicates for the * local collection. */ public void merge( TRECDocumentCollection other ) { int oldLength = this.file.length; this.file = ObjectArrays.ensureCapacity( this.file, this.file.length + other.file.length ); System.arraycopy( other.file, 0, this.file, oldLength, other.file.length ); ObjectIterator<TRECDocumentDescriptor> iter = other.descriptors.iterator(); while ( iter.hasNext() ) { final TRECDocumentDescriptor tdd = (TRECDocumentDescriptor)iter.next().clone(); tdd.fileIndex += oldLength; this.descriptors.add( tdd ); } }
/** * Merges a new collection in this one, by rebuilding the gzFile array and * appending the other object one, concatenating the descriptors while * rebuilding all. * <p> * It is supposed that the passed object contains no duplicates for the * local collection. */ public void merge( TRECDocumentCollection other ) { int oldLength = this.file.length; this.file = ObjectArrays.ensureCapacity( this.file, this.file.length + other.file.length ); System.arraycopy( other.file, 0, this.file, oldLength, other.file.length ); ObjectIterator<TRECDocumentDescriptor> iter = other.descriptors.iterator(); while ( iter.hasNext() ) { final TRECDocumentDescriptor tdd = (TRECDocumentDescriptor)iter.next().clone(); tdd.fileIndex += oldLength; this.descriptors.add( tdd ); } }