Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

ShotResultList Impala::Core::Trec::IDashQueryEngine::MergeResultsByRoundRobin ( std::list< ShotResultList lists  )  [inline]

Definition at line 257 of file IDashQueryEngine.h.

References mMaxResults, and ProcessFilters().

Referenced by MergeResults().

00258     {
00259         ShotResultList      merged;
00260         std::map<int, int>  counts;
00261         std::list<int>      lengths;
00262         std::list<int>      positions;
00263 
00264         std::list<ShotResultList::iterator> iterators;
00265 
00266         // round robin: (BAD!)
00267         std::list<ShotResultList >::iterator i;
00268         for (i = lists.begin(); i != lists.end(); i++)
00269         {
00270             iterators.push_back(i->begin());
00271             lengths.push_back(i->size());
00272             positions.push_back(0);
00273         }
00274 
00275         for (int nr = 0; nr < mMaxResults; nr++)
00276         {
00277             std::list<int>::iterator length   = lengths.begin();
00278             std::list<int>::iterator position = positions.begin();
00279             std::list<ShotResultList::iterator>::iterator it;
00280             for (it = iterators.begin(); it != iterators.end(); it++)
00281             {
00282                 if (*position < *length)
00283                 {
00284                     int shotid = (*(*it)).shotid;
00285                     if (counts.find(shotid) == counts.end())
00286                     {
00287                         merged.push_back(*(*it));
00288                         counts[shotid] = 1;
00289                     }
00290                     else
00291                     {
00292                         counts[shotid] = counts[shotid] + 1;
00293                     }
00294                     (*it)++;
00295                     (*position)++;
00296                 }
00297                 position++;
00298                 length++;
00299             }
00300         }
00301 
00302         merged = ProcessFilters(merged);
00303 
00304         return merged;
00305     }

Here is the call graph for this function:


Generated on Fri Mar 19 11:25:20 2010 for ImpalaSrc by  doxygen 1.5.1