Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 
 package com.browseengine.bobo.geosearch.merge.impl;
 
 import java.util.List;
Can merge multiple BTreeAsArray≶GeoRecord> instances. Implements an Iterator that walks the GeoRecords in ascending order, with correctly assigned docids for the merged output partition.

Author(s):
Ken McCracken
    
    private static final Logger LOGGER = Logger.getLogger(ChainedConvertedGeoRecordIterator.class);
    
    protected IGeoConverter geoConverter;
    //protected Iterator<CartesianGeoRecord> mergedIterator;
    
    public ChainedConvertedGeoRecordIterator(IGeoConverter geoConverter
            List<BTree<CartesianGeoRecord>> partitions,
            List<BitVectordeletedDocsList
            int totalBufferCapacitythrows IOException {
        this. = geoConverter;
        
        int numberOfPartitions = partitions.size();
        if (numberOfPartitions != deletedDocsList.size()) {
            throw new RuntimeException("bad input, partitions.size() "
                    + numberOfPartitions + ", deletedDocsList.size() " + deletedDocsList.size());
        }
        
        int docid = 0;
        int bufferCapacityPerIterator = totalBufferCapacity / numberOfPartitions;
        List<Iterator<CartesianGeoRecord>> mergedIterators = new ArrayList<Iterator<CartesianGeoRecord>>(partitions.size());
        
        for (int i = 0; i < partitions.size(); i++) {
            BTree<CartesianGeoRecordpartition = partitions.get(i);
            BitVector deletedDocs = deletedDocsList.get(i);
            Iterator<CartesianGeoRecordmergedIterator = 
                new ConvertedGeoRecordIterator(geoConverterpartition
                        dociddeletedDocs);
            mergedIterator = new BufferedOrderedIterator<CartesianGeoRecord>(mergedIterator
                    bufferCapacityPerIterator);
            mergedIterators.add(mergedIterator);
            docid += deletedDocs.size() - deletedDocs.count();
        }
         = 
            new OrderedIteratorChain<CartesianGeoRecord>(mergedIterators);
    }
    
    
    @Override
    public boolean hasNext() {
        return .hasNext();
    }
    
    
    @Override
    public CartesianGeoRecord next() {
        return .next();
    }
    
    
    @Override
    public void remove() {
        throw new UnsupportedOperationException();
    }
    
New to GrepCode? Check out our FAQ X