#include <ReadonlyCollection.h>
Public Member Functions | |
virtual | ~ReadonlyCollection () |
virtual bool | hasTag (const TAG &tag) const |
Check if the collection contains a tag. | |
OpSet< TAG > | getTags (const ITEM &item) const |
Get the tags of item `item'. | |
OpSet< TAG > | getTags (const OpSet< ITEM > &items) const |
Get all the tags of items `items'. | |
OpSet< ITEM > | getItems (const TAG &tag) const |
Get the items with tag `tag'. | |
OpSet< ITEM > | getItems (const OpSet< TAG > &tags) const |
Get the items with tag `tag'. | |
virtual OpSet< ITEM > | getTaggedItems () const =0 |
Get the set of all the items that have tags according to this collection. | |
virtual OpSet< TAG > | getAllTags () const =0 |
Get the set of all the tags in this collection. | |
virtual int | getCardinality (const TAG &tag) const |
Get the cardinality of tag `tag' (that is, the number of items who have it). | |
virtual OpSet< TAG > | getCompanionTags (const OpSet< TAG > &tags) const |
Get the set of all tags in this collection that appear in tagsets containing `tags'. | |
virtual OpSet< ITEM > | getRelatedItems (const OpSet< TAG > &tags, int maxdistance=1) const |
Get the related items at the given maximum distance. | |
virtual void | output (Consumer< ITEM, TAG > &consumer) const =0 |
Output all the contents of the collection to a Consumer. | |
virtual void | outputHavingTags (const OpSet< TAG > &tags, Consumer< ITEM, TAG > &consumer) const |
Send to a consumer all the items which are tagged with at least the given tags. | |
Protected Member Functions | |
virtual OpSet< ITEM > | getItemsHavingTag (const TAG &tag) const =0 |
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 =0 |
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. |
virtual Tagcoll::ReadonlyCollection< ITEM, TAG >::~ReadonlyCollection | ( | ) | [inline, virtual] |
virtual OpSet<ITEM> Tagcoll::ReadonlyCollection< ITEM, TAG >::getItemsHavingTag | ( | const TAG & | tag | ) | const [protected, pure virtual] |
Get the items which are tagged with at least the tag `tag'.
Implemented in Tagcoll::CardinalityStore< ITEM, TAG >, Tagcoll::InputMerger< ITEM, TAG >, Tagcoll::IntDiskIndex< ITEM, TAG >, Tagcoll::ItemGrouper< ITEM, TAG >, Tagcoll::PatchCollection< ITEM, TAG >, Tagcoll::TDBDiskIndex< ITEM, TAG >, Tagcoll::TDBIndexer< ITEM, TAG >, Tagcoll::InputMerger< std::string, std::string >, and Tagcoll::IntDiskIndex< std::string, std::string >.
virtual OpSet<ITEM> Tagcoll::ReadonlyCollection< ITEM, TAG >::getItemsHavingTags | ( | const OpSet< TAG > & | tags | ) | const [inline, protected, virtual] |
Get the items which are tagged with at least the tags `tags'.
Reimplemented in Tagcoll::CardinalityStore< ITEM, TAG >, Tagcoll::InputMerger< ITEM, TAG >, Tagcoll::IntDiskIndex< ITEM, TAG >, Tagcoll::ItemGrouper< ITEM, TAG >, Tagcoll::InputMerger< std::string, std::string >, and Tagcoll::IntDiskIndex< std::string, std::string >.
virtual OpSet<TAG> Tagcoll::ReadonlyCollection< ITEM, TAG >::getTagsOfItem | ( | const ITEM & | item | ) | const [protected, pure virtual] |
Get the tags attached to an item.
item | The item to query |
Implemented in Tagcoll::CardinalityStore< ITEM, TAG >, Tagcoll::IntDiskIndex< ITEM, TAG >, Tagcoll::ItemGrouper< ITEM, TAG >, Tagcoll::PatchCollection< ITEM, TAG >, Tagcoll::TDBDiskIndex< ITEM, TAG >, Tagcoll::TDBIndexer< ITEM, TAG >, Tagcoll::InputMerger< std::string, std::string >, and Tagcoll::IntDiskIndex< std::string, std::string >.
virtual OpSet<TAG> Tagcoll::ReadonlyCollection< ITEM, TAG >::getTagsOfItems | ( | const OpSet< ITEM > & | items | ) | const [inline, protected, virtual] |
Get all the tags attached to the items in a set.
items | The items to query |
Reimplemented in Tagcoll::CardinalityStore< ITEM, TAG >, Tagcoll::IntDiskIndex< ITEM, TAG >, Tagcoll::ItemGrouper< ITEM, TAG >, and Tagcoll::IntDiskIndex< std::string, std::string >.
virtual bool Tagcoll::ReadonlyCollection< ITEM, TAG >::hasTag | ( | const TAG & | tag | ) | const [inline, virtual] |
Check if the collection contains a tag.
tag | The tag to look for |
Reimplemented in Tagcoll::CardinalityStore< ITEM, TAG >, Tagcoll::IntDiskIndex< ITEM, TAG >, Tagcoll::ItemGrouper< ITEM, TAG >, Tagcoll::PatchCollection< ITEM, TAG >, Tagcoll::TDBDiskIndex< ITEM, TAG >, Tagcoll::TDBIndexer< ITEM, TAG >, and Tagcoll::IntDiskIndex< std::string, std::string >.
OpSet<TAG> Tagcoll::ReadonlyCollection< ITEM, TAG >::getTags | ( | const ITEM & | item | ) | const [inline] |
Get the tags of item `item'.
Return an empty set if `item' does not exist
OpSet<TAG> Tagcoll::ReadonlyCollection< ITEM, TAG >::getTags | ( | const OpSet< ITEM > & | items | ) | const [inline] |
Get all the tags of items `items'.
Return an empty set if all of `item' do not exist
OpSet<ITEM> Tagcoll::ReadonlyCollection< ITEM, TAG >::getItems | ( | const TAG & | tag | ) | const [inline] |
Get the items with tag `tag'.
Return an empty set if `tag' does not exist
OpSet<ITEM> Tagcoll::ReadonlyCollection< ITEM, TAG >::getItems | ( | const OpSet< TAG > & | tags | ) | const [inline] |
Get the items with tag `tag'.
Return an empty set if `tag' does not exist
virtual OpSet<ITEM> Tagcoll::ReadonlyCollection< ITEM, TAG >::getTaggedItems | ( | ) | const [pure virtual] |
Get the set of all the items that have tags according to this collection.
Implemented in Tagcoll::CardinalityStore< ITEM, TAG >, Tagcoll::InputMerger< ITEM, TAG >, Tagcoll::IntDiskIndex< ITEM, TAG >, Tagcoll::ItemGrouper< ITEM, TAG >, Tagcoll::PatchCollection< ITEM, TAG >, Tagcoll::TDBDiskIndex< ITEM, TAG >, Tagcoll::TDBIndexer< ITEM, TAG >, Tagcoll::InputMerger< std::string, std::string >, and Tagcoll::IntDiskIndex< std::string, std::string >.
virtual OpSet<TAG> Tagcoll::ReadonlyCollection< ITEM, TAG >::getAllTags | ( | ) | const [pure virtual] |
Get the set of all the tags in this collection.
Implemented in Tagcoll::CardinalityStore< ITEM, TAG >, Tagcoll::InputMerger< ITEM, TAG >, Tagcoll::IntDiskIndex< ITEM, TAG >, Tagcoll::ItemGrouper< ITEM, TAG >, Tagcoll::PatchCollection< ITEM, TAG >, Tagcoll::TDBDiskIndex< ITEM, TAG >, Tagcoll::TDBIndexer< ITEM, TAG >, Tagcoll::InputMerger< std::string, std::string >, and Tagcoll::IntDiskIndex< std::string, std::string >.
virtual int Tagcoll::ReadonlyCollection< ITEM, TAG >::getCardinality | ( | const TAG & | tag | ) | const [inline, virtual] |
Get the cardinality of tag `tag' (that is, the number of items who have it).
Reimplemented in Tagcoll::CardinalityStore< ITEM, TAG >, Tagcoll::IntDiskIndex< ITEM, TAG >, Tagcoll::PatchCollection< ITEM, TAG >, Tagcoll::TDBDiskIndex< ITEM, TAG >, and Tagcoll::IntDiskIndex< std::string, std::string >.
virtual OpSet<TAG> Tagcoll::ReadonlyCollection< ITEM, TAG >::getCompanionTags | ( | const OpSet< TAG > & | tags | ) | const [inline, virtual] |
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 in Tagcoll::CardinalityStore< ITEM, TAG >, Tagcoll::IntDiskIndex< ITEM, TAG >, Tagcoll::ItemGrouper< ITEM, TAG >, Tagcoll::InputMerger< std::string, std::string >, and Tagcoll::IntDiskIndex< std::string, std::string >.
virtual OpSet<ITEM> Tagcoll::ReadonlyCollection< ITEM, TAG >::getRelatedItems | ( | const OpSet< TAG > & | tags, | |
int | maxdistance = 1 | |||
) | const [inline, virtual] |
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 in Tagcoll::CardinalityStore< ITEM, TAG >, Tagcoll::ItemGrouper< ITEM, TAG >, and Tagcoll::InputMerger< std::string, std::string >.
virtual void Tagcoll::ReadonlyCollection< ITEM, TAG >::output | ( | Consumer< ITEM, TAG > & | consumer | ) | const [pure virtual] |
Output all the contents of the collection to a Consumer.
Implemented in Tagcoll::CardinalityStore< ITEM, TAG >, Tagcoll::IntDiskIndex< ITEM, TAG >, Tagcoll::ItemGrouper< ITEM, TAG >, Tagcoll::PatchCollection< ITEM, TAG >, Tagcoll::TDBDiskIndex< ITEM, TAG >, Tagcoll::TDBIndexer< ITEM, TAG >, Tagcoll::InputMerger< std::string, std::string >, and Tagcoll::IntDiskIndex< std::string, std::string >.
virtual void Tagcoll::ReadonlyCollection< ITEM, TAG >::outputHavingTags | ( | const OpSet< TAG > & | tags, | |
Consumer< ITEM, TAG > & | consumer | |||
) | const [inline, virtual] |
Send to a consumer all the items which are tagged with at least the given tags.
Reimplemented in Tagcoll::CardinalityStore< ITEM, TAG >, Tagcoll::InputMerger< ITEM, TAG >, Tagcoll::ItemGrouper< ITEM, TAG >, and Tagcoll::InputMerger< std::string, std::string >.