#include <CardinalityStore.h>
Inheritance diagram for Tagcoll::CardinalityStore< ITEM, TAG >:
typedef tagsets_t::const_iterator | const_iterator |
Iterators support. | |
typedef tagsets_t::iterator | iterator |
Iterators support. | |
iterator | begin () |
Iterators support. | |
iterator | end () |
Iterators support. | |
const_iterator | begin () const |
Iterators support. | |
const_iterator | end () const |
Iterators support. | |
Public Types | |
typedef std::map< OpSet< TAG >, OpSet< ITEM > > | tagsets_t |
Public Member Functions | |
CardinalityStore () | |
virtual | ~CardinalityStore () |
int | itemCount () const |
Get the total number of items in this collection. | |
int | tagCount () const |
Get the number of different tags in this collection. | |
int | tagsetCount () const |
Get the number of different tag sets in this collection. | |
OpSet< ITEM > | getItemsExactMatch (const OpSet< TAG > &ts) const |
Get the set of items with exactly the given tagset. | |
bool | hasItem (const ITEM &item) const |
bool | hasTag (const TAG &tag) const |
Check if the collection contains a tag. | |
OpSet< TAG > | getAllTags () const |
Get the set of all the tags in this collection. | |
OpSet< ITEM > | getTaggedItems () const |
Get the set of all the items that have tags according to this collection. | |
OpSet< TAG > | getCompanionTags (const OpSet< TAG > &ts) const |
Get the set of all tags in this collection that appear in tagsets containing `tags'. | |
OpSet< ITEM > | getCompanionItems (const OpSet< TAG > &ts) const |
Get the set of all items in this collection whose tagsets contain `ts'. | |
std::map< ITEM, OpSet< TAG > > | getCompanionItemsAndTagsets (const OpSet< TAG > &ts) const |
Get the set of all items in this collection whose tagsets contain `ts'. | |
OpSet< ITEM > | getRelatedItems (const OpSet< TAG > &ts, int maxdistance=1) const |
Get the related items at the given maximum distance. | |
std::list< OpSet< TAG > > | getRelatedTagsets (const OpSet< TAG > &ts, int maxdistance=1) const |
Get the list of tagsets related to the given one, with distance > 0 and <= maxdistance. | |
void | applyChange (const PatchList< ITEM, TAG > &change) |
Apply a patch to the collection. | |
CardinalityStore< ITEM, TAG > | getChildCollection (const TAG &tag) const |
Return a tagged collection with all tagsets of this one that contain the tag `tag', but with the tag removed. | |
CardinalityStore< ITEM, TAG > | getCollectionWithoutTags (const OpSet< TAG > &tag) const |
Return a tagged collection with all tagsets of this one that are nonempty when stripped by the tag `tag' and all tags that imply it. | |
CardinalityStore< ITEM, TAG > | getCollectionWithoutTagsetsHaving (const TAG &tag) const |
Return the tagged collection with all tagsets of this one that do not contain the tag `tag'. | |
CardinalityStore< ITEM, TAG > | getCollectionWithoutTagsetsHavingAnyOf (const OpSet< TAG > &tag) const |
Return the tagged collection with all tagsets of this one that do not contain the tags in `tags'. | |
OpSet< TAG > | getImpliedBy (const TAG &tag) const |
Return the list of tags that the given tag implies. | |
int | getCardinality (const TAG &tag) const |
Get the cardinality of tag `tag' (that is, the number of items who have it). | |
TAG | findTagWithMaxCardinalityNotIn (const OpSet< TAG > &tags, int *card=0) const |
void | mergeEquivalentTags () |
void | removeTagsWithCardinalityLessThan (int card) |
void | output (Consumer< ITEM, TAG > &cons) const |
Output all the contents of the collection to a Consumer. | |
void | outputHavingTags (const OpSet< TAG > &ts, Consumer< ITEM, TAG > &consumer) const |
Send to a consumer all the items which are tagged with at least the given tags. | |
Protected Member Functions | |
OpSet< TAG > | getImplyingOneOf (const OpSet< TAG > &tags) const |
Get the list of tags that imply one of the tags in `tags'. | |
void | consumeItem (const ITEM &item, const OpSet< TAG > &tagset) |
Process a tagged item, with its tags. | |
void | consumeItems (const OpSet< ITEM > &items, const OpSet< TAG > &tagset) |
Process a set of items identically tagged, with their tags. | |
virtual OpSet< ITEM > | getItemsHavingTag (const TAG &tag) const |
Get the items which are tagged with at least the tag `tag'. | |
virtual OpSet< ITEM > | getItemsHavingTags (const OpSet< TAG > &tags) const |
Get the items which are tagged with at least the tags `tags'. | |
virtual OpSet< TAG > | getTagsOfItem (const ITEM &item) const |
Get the tags attached to an item. | |
virtual OpSet< TAG > | getTagsOfItems (const OpSet< ITEM > &items) const |
Get all the tags attached to the items in a set. | |
Protected Attributes | |
TagContainer | tags |
tagsets_t | tagsets |
Classes | |
class | TagContainer |
This in-memory collection has different computational-complexity behaviour from InputMerger, TDBIndexer or TDBDiskIndex, and can be more or less suited to be used as a collection than the other alternatives, depending on the computational needs of the caller.
|
Iterators support.
|
|
Iterators support.
|
|
Reimplemented in Tagcoll::Normalizer< ITEM, TAG >, and Tagcoll::Graph< ITEM, TAG >. |
|
|
|
|
|
Apply a patch to the collection. Example: void perform(const PatchList<ITEM, TAG>& change) { collection.applyChange(change); undo.push_back(change.getReverse()); } Implements Tagcoll::Collection< ITEM, TAG >. |
|
Iterators support.
|
|
Iterators support.
|
|
Process a tagged item, with its tags.
Implements Tagcoll::Consumer< ITEM, TAG >. |
|
Process a set of items identically tagged, with their tags.
Reimplemented from Tagcoll::Consumer< ITEM, TAG >. |
|
Iterators support.
|
|
Iterators support.
|
|
|
|
Get the set of all the tags in this collection.
Implements Tagcoll::ReadonlyCollection< ITEM, TAG >. |
|
Get the cardinality of tag `tag' (that is, the number of items who have it).
Reimplemented from Tagcoll::ReadonlyCollection< ITEM, TAG >. |
|
Return a tagged collection with all tagsets of this one that contain the tag `tag', but with the tag removed.
|
|
Return a tagged collection with all tagsets of this one that are nonempty when stripped by the tag `tag' and all tags that imply it.
|
|
Return the tagged collection with all tagsets of this one that do not contain the tag `tag'.
|
|
Return the tagged collection with all tagsets of this one that do not contain the tags in `tags'.
|
|
Get the set of all items in this collection whose tagsets contain `ts'.
|
|
Get the set of all items in this collection whose tagsets contain `ts'.
|
|
Get the set of all tags in this collection that appear in tagsets containing `tags'. Example: void refineSelection(const OpSet<Tag>& selection) { OpSet<Tag> extraTags = collection.getCompanionTags(selection); tagMenu.setAvailableOptions(extraTags); } Reimplemented from Tagcoll::ReadonlyCollection< ITEM, TAG >. |
|
Return the list of tags that the given tag implies.
|
|
Get the list of tags that imply one of the tags in `tags'.
|
|
Get the set of items with exactly the given tagset.
|
|
Get the items which are tagged with at least the tag `tag'.
Implements Tagcoll::ReadonlyCollection< ITEM, TAG >. |
|
Get the items which are tagged with at least the tags `tags'.
Reimplemented from Tagcoll::ReadonlyCollection< ITEM, TAG >. |
|
Get the related items at the given maximum distance. Examples: // Get the items related to a given one, at the given distance OpSet<Item> getRelated(const Item& item, int distance) { OpSet<Item> res = collection.getRelatedItems(collection.getTags(item), distance); return res - item; } // Get the items related to the given ones, at the given distance OpSet<Item> getRelated(const OpSet<Item>& items, int distance) { OpSet<Item> res = collection.getRelatedItems(collection.getTags(items), distance); return res - items; } // Get the related items, increasing the distance until it finds at // least 'minimum' items OpSet<Item> getRelated(const Item& item, int minimum) { OpSet<Tag> tags = collection.getTags(item); OpSet<Item> res; for (int i = 0; i < tags.size() && res.size() < minimum; i++) res += collection.getRelatedItems(tags, i); return res - item; } Reimplemented from Tagcoll::ReadonlyCollection< ITEM, TAG >. |
|
Get the list of tagsets related to the given one, with distance > 0 and <= maxdistance.
|
|
Get the set of all the items that have tags according to this collection.
Implements Tagcoll::ReadonlyCollection< ITEM, TAG >. |
|
Get the tags attached to an item.
Implements Tagcoll::ReadonlyCollection< ITEM, TAG >. |
|
Get all the tags attached to the items in a set.
Reimplemented from Tagcoll::ReadonlyCollection< ITEM, TAG >. |
|
|
|
Check if the collection contains a tag.
Reimplemented from Tagcoll::ReadonlyCollection< ITEM, TAG >. |
|
Get the total number of items in this collection.
|
|
|
|
Output all the contents of the collection to a Consumer.
Implements Tagcoll::ReadonlyCollection< ITEM, TAG >. |
|
Send to a consumer all the items which are tagged with at least the given tags.
Reimplemented from Tagcoll::ReadonlyCollection< ITEM, TAG >. |
|
|
|
Get the number of different tags in this collection.
|
|
Get the number of different tag sets in this collection.
|
|
|
|
|