Bag
0.91
|
#include <ArrayBag.h>
Public Member Functions | |
ArrayBag () | |
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 |
std::vector< ItemType > | toVector () const |
Public Member Functions inherited from BagInterface< ItemType > | |
virtual | ~BagInterface () |
Definition at line 13 of file ArrayBag.h.
Definition at line 11 of file ArrayBag.cpp.
|
virtual |
Adds a new entry to this bag.
newEntry | The object to be added as a new entry. |
Implements BagInterface< ItemType >.
Definition at line 28 of file ArrayBag.cpp.
Referenced by restoreBag().
|
virtual |
Removes all entries from this bag.
Implements BagInterface< ItemType >.
Definition at line 55 of file ArrayBag.cpp.
|
virtual |
Tests whether this bag contains a given entry.
anEntry | The entry to locate. |
Implements BagInterface< ItemType >.
Definition at line 79 of file ArrayBag.cpp.
|
virtual |
Gets the current number of entries in this bag.
Implements BagInterface< ItemType >.
Definition at line 16 of file ArrayBag.cpp.
Referenced by processOption(), and restoreBag().
|
virtual |
Counts the number of times a given entry appears in this bag.
anEntry | The entry to be counted. |
Implements BagInterface< ItemType >.
Definition at line 61 of file ArrayBag.cpp.
|
virtual |
Sees whether this bag is empty.
Implements BagInterface< ItemType >.
Definition at line 22 of file ArrayBag.cpp.
|
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 41 of file ArrayBag.cpp.
|
virtual |
Empties and then fills a given vector with all entries that are in this bag.
Implements BagInterface< ItemType >.
Definition at line 85 of file ArrayBag.cpp.
Referenced by displayBag().