#include <Collection.h>
Inheritance diagram for Tagcoll::Collection< ITEM, TAG >:
Public Member Functions | |
virtual | ~Collection () |
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 void | applyChange (const PatchList< ITEM, TAG > &change)=0 |
Apply a patch to the collection. | |
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 | |
void | consumeItemUntagged (const ITEM &) |
Process an untagged item. | |
void | consumeItemsUntagged (const OpSet< ITEM > &) |
Process a set of items, all with no tags. | |
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. |
|
|
|
Apply a patch to the collection. Example: void perform(const PatchList<ITEM, TAG>& change) { collection.applyChange(change); undo.push_back(change.getReverse()); } Implemented in Tagcoll::CardinalityStore< ITEM, TAG >, Tagcoll::ItemGrouper< ITEM, TAG >, Tagcoll::PatchCollection< ITEM, TAG >, Tagcoll::TDBDiskIndex< ITEM, TAG >, and Tagcoll::TDBIndexer< ITEM, TAG >. |
|
Process a set of items, all with no tags.
Reimplemented from Tagcoll::Consumer< ITEM, TAG >. |
|
Process an untagged item.
Implements Tagcoll::Consumer< ITEM, TAG >. |
|
Get the set of all the tags in this collection.
Implemented in Tagcoll::CardinalityStore< ITEM, TAG >, Tagcoll::InputMerger< ITEM, TAG >, Tagcoll::ItemGrouper< ITEM, TAG >, Tagcoll::PatchCollection< ITEM, TAG >, Tagcoll::TDBDiskIndex< ITEM, TAG >, and Tagcoll::TDBIndexer< ITEM, TAG >. |
|
Get the cardinality of tag `tag' (that is, the number of items who have it).
Reimplemented in Tagcoll::CardinalityStore< ITEM, TAG >, Tagcoll::PatchCollection< ITEM, TAG >, and Tagcoll::TDBDiskIndex< ITEM, TAG >. |
|
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 >, and Tagcoll::ItemGrouper< ITEM, TAG >. |
|
Get the items with tag `tag'. Return an empty set if `tag' does not exist |
|
Get the items with tag `tag'. Return an empty set if `tag' does not exist |
|
Get the items which are tagged with at least the tag `tag'.
Implemented in Tagcoll::CardinalityStore< ITEM, TAG >, Tagcoll::InputMerger< ITEM, TAG >, Tagcoll::ItemGrouper< ITEM, TAG >, Tagcoll::PatchCollection< ITEM, TAG >, Tagcoll::TDBDiskIndex< ITEM, TAG >, and Tagcoll::TDBIndexer< ITEM, TAG >. |
|
Get the items which are tagged with at least the tags `tags'.
Reimplemented in Tagcoll::CardinalityStore< ITEM, TAG >, Tagcoll::InputMerger< ITEM, TAG >, and Tagcoll::ItemGrouper< 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 in Tagcoll::CardinalityStore< ITEM, TAG >, and Tagcoll::ItemGrouper< ITEM, TAG >. |
|
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::ItemGrouper< ITEM, TAG >, Tagcoll::PatchCollection< ITEM, TAG >, Tagcoll::TDBDiskIndex< ITEM, TAG >, and Tagcoll::TDBIndexer< ITEM, TAG >. |
|
Get all the tags of items `items'. Return an empty set if all of `item' do not exist |
|
Get the tags of item `item'. Return an empty set if `item' does not exist |
|
Get the tags attached to an item.
Implemented in Tagcoll::CardinalityStore< ITEM, TAG >, Tagcoll::ItemGrouper< ITEM, TAG >, Tagcoll::PatchCollection< ITEM, TAG >, Tagcoll::TDBDiskIndex< ITEM, TAG >, and Tagcoll::TDBIndexer< ITEM, TAG >. |
|
Get all the tags attached to the items in a set.
Reimplemented in Tagcoll::CardinalityStore< ITEM, TAG >, and Tagcoll::ItemGrouper< ITEM, TAG >. |
|
Check if the collection contains a tag.
Reimplemented in Tagcoll::CardinalityStore< ITEM, TAG >, Tagcoll::ItemGrouper< ITEM, TAG >, Tagcoll::PatchCollection< ITEM, TAG >, Tagcoll::TDBDiskIndex< ITEM, TAG >, and Tagcoll::TDBIndexer< ITEM, TAG >. |
|
Output all the contents of the collection to a Consumer.
Implemented in Tagcoll::CardinalityStore< ITEM, TAG >, Tagcoll::ItemGrouper< ITEM, TAG >, Tagcoll::PatchCollection< ITEM, TAG >, Tagcoll::TDBDiskIndex< ITEM, TAG >, and Tagcoll::TDBIndexer< ITEM, TAG >. |
|
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 >, and Tagcoll::ItemGrouper< ITEM, TAG >. |