MergeDocIDRemapper::MergeDocIDRemapper(SegmentInfosPtr infos, Collection< Collection<int32_t> > docMaps, Collection<int32_t> delCounts, OneMergePtr merge, int32_t mergedDocCount)
 {
     this->docMaps = docMaps;
     SegmentInfoPtr firstSegment(merge->segments->info(0));
     int32_t i = 0;
     this->minDocID = 0;
     while (true)
     {
         SegmentInfoPtr info(infos->info(i));
         if (info->equals(firstSegment))
             break;
         minDocID += info->docCount;
         ++i;
     }
     
     int32_t numDocs = 0;
     for (int32_t j = 0; j < docMaps.size(); ++i, ++j)
     {
         numDocs += infos->info(i)->docCount;
         BOOST_ASSERT(infos->info(i)->equals(merge->segments->info(j)));
     }
     this->maxDocID = minDocID + numDocs;
     
     starts = Collection<int32_t>::newInstance(docMaps.size());
     newStarts = Collection<int32_t>::newInstance(docMaps.size());
     
     starts[0] = minDocID;
     newStarts[0] = minDocID;
     for (i = 1; i < docMaps.size(); ++i)
     {
         int32_t lastDocCount = merge->segments->info(i - 1)->docCount;
         starts[i] = starts[i - 1] + lastDocCount;
         newStarts[i] = newStarts[i - 1] + lastDocCount - delCounts[i - 1];
     }
     this->docShift = numDocs - mergedDocCount;
     
     // There are rare cases when docShift is 0.  It happens if you try to delete a docID that's 
     // out of bounds, because the SegmentReader still allocates deletedDocs and pretends it has 
     // deletions ... so we can't make this assert here: BOOST_ASSERT(docShift > 0);
     
     // Make sure it all adds up
     BOOST_ASSERT(docShift == maxDocID - (newStarts[docMaps.size() - 1] + merge->segments->info(docMaps.size() - 1)->docCount - delCounts[docMaps.size() - 1]));
 }
Exemple #2
0
Path::Path(const Vec2 & segmentStartPoint, const Vec2 & segmentEndPoint)
{
	PathSegment firstSegment(segmentStartPoint, segmentEndPoint);
	segments.push_back(firstSegment);
	length = firstSegment.length;
}