Bag
0.9
|
#include <Bag.h>
Public Member Functions | |
Bag () | |
int | getCurrentSize () const |
bool | isEmpty () const |
bool | add (const ItemType &newEntry) |
bool | remove (const ItemType &anEntry) |
void | clear () |
bool | contains (const ItemType &anEntry) const |
int | getFrequencyOf (const ItemType &anEntry) const |
vector< ItemType > | toVector () const |
|
virtual |
Adds a new entry to this bag.
newEntry | The object to be added as a new entry. |
Implements BagInterface< ItemType >.
Definition at line 27 of file Bag.cpp.
Referenced by main(), and restoreBag().
|
virtual |
Removes all entries from this bag.
Implements BagInterface< ItemType >.
|
virtual |
Tests whether this bag contains a given entry.
anEntry | The entry to locate. |
Implements BagInterface< ItemType >.
Definition at line 78 of file Bag.cpp.
Referenced by main().
|
virtual |
Gets the current number of entries in this bag.
Implements BagInterface< ItemType >.
Definition at line 15 of file Bag.cpp.
Referenced by processOption(), and restoreBag().
|
virtual |
Counts the number of times a given entry appears in bag.
anEntry | The entry to be counted. |
Implements BagInterface< ItemType >.
|
virtual |
Sees whether this bag is empty.
Implements BagInterface< ItemType >.
Definition at line 21 of file Bag.cpp.
Referenced by main().
|
virtual |
Removes one occurrence of a given entry from this bag, if possible.
anEntry | The entry to be removed. |
Implements BagInterface< ItemType >.
Definition at line 40 of file Bag.cpp.
Referenced by main().
|
virtual |
Empties and then fills a given vector with all entries that are in this bag.
Implements BagInterface< ItemType >.
Definition at line 108 of file Bag.cpp.
Referenced by displayBag().