MultiIndex
|
#include <ordered_lists_merger.h>
Public Member Functions | |
OrderedListsMerger () | |
void | setLists (const vector< vector< pair< OrderType, MetaInfo > > > &lists) |
bool | GetNextMergedItemIndices (MergedItemIndices *merged_item_indices) |
Multitable< char > & | GetYieldedItems () |
Public Attributes | |
const vector< vector< pair < OrderType, MetaInfo > > > * | lists_ptr |
Private Member Functions | |
void | InsertMergedItemIndicesInHeap (const MergedItemIndices &merged_item_indices) |
void | UpdatePrioirityQueue (MergedItemIndices &merged_item_indices) |
Private Attributes | |
multimap< OrderType, MergedItemIndices > | heap_ |
Multitable< char > | yielded_items_indices_ |
This class merges any number of ordered lists and yields elements of merged list in Order-increasing order. Initial lists are ordered by Order. This class is used in multilist algorithm to get coordinates of cells in multiindex. Class does not return the whole result list, it just yields by one item. Class also assumes that input lists are the same length
OrderedListsMerger< OrderType, MetaInfo >::OrderedListsMerger | ( | ) |
This constructor inits merger for input lists
bool OrderedListsMerger< OrderType, MetaInfo >::GetNextMergedItemIndices | ( | MergedItemIndices * | merged_item_indices | ) | [inline] |
This function yields indices if next item of merged list. It returns "false" if all items have been already yielded and "true" otherwise
merged_item_indices | result indices |
Multitable<char>& OrderedListsMerger< OrderType, MetaInfo >::GetYieldedItems | ( | ) | [inline] |
Getter
void OrderedListsMerger< OrderType, MetaInfo >::InsertMergedItemIndicesInHeap | ( | const MergedItemIndices & | merged_item_indices | ) | [private] |
This function pushes new item into priority queue
merged_item_indices | indices of item to add |
void OrderedListsMerger< OrderType, MetaInfo >::setLists | ( | const vector< vector< pair< OrderType, MetaInfo > > > & | lists | ) |
This function sets lists to merge
lists | input lists to merge (must be ordered) |
void OrderedListsMerger< OrderType, MetaInfo >::UpdatePrioirityQueue | ( | MergedItemIndices & | merged_item_indices | ) | [private] |
This function tries to update priority queue after yielding
merged_item_indices | new indices we should try to push in priority queue |
multimap<OrderType, MergedItemIndices> OrderedListsMerger< OrderType, MetaInfo >::heap_ [private] |
Proirity queue for multilist algorithm
const vector<vector<pair<OrderType, MetaInfo> > >* OrderedListsMerger< OrderType, MetaInfo >::lists_ptr |
Pointer to input lists
Multitable<char> OrderedListsMerger< OrderType, MetaInfo >::yielded_items_indices_ [private] |
Table with "1"-value for yielded items and "0"-value otherwise