![]() |
The Simons
|
#include <Unordered.h>
Inheritance diagram for Unordered:
The Unordered class is an intermediate class in the collections hierarchy and the superclass of all unordered collections, such as Set, Bag and Map. In an Unordered collection, the inserted order of elements is not significant. Adding new elements includes them anywhere in the Unordered collection. The notions of element membership and a count of the number of occurrences are meaningful. Elements may be visited in an arbitrary order via an index in the range 0..n-1, where n is the size of the Unordered collection. Unordered defines the interface for seeking and counting specific elements. Unordered defines the interface for adding, removing and retaining single elements and collections of elements. Comparing two Unordered collections performs a symmetric test for inclusion. Hashing on an Unordered collection is sensitive only to the values, but not the order, of the elements.
Public Member Functions | |
Unordered () | |
Construct an empty Unordered collection. | |
virtual | ~Unordered () |
Destroy and release an Unordered collection. | |
virtual Natural | hash () const |
Return a quasi-unique hash code for this Unordered collection. | |
virtual Order | compare (ObjectID) const |
Compare this Unordered collection with another Object. | |
Order | compare (UnorderedID) const |
Compare this Unordered collection with another Unordered collection. | |
virtual Natural | count (ObjectID) const |
Count the occurrences of an Object in this Unordered collection. | |
virtual ObjectID | find (ObjectID) const |
Find one or more Objects equal to another in this Unordered collection. | |
virtual Void | remove (ObjectID) |
Remove an Object from this Unordered collection. | |
Void | removeAll (CollectionID) |
Remove all the elements present in another Collection. | |
virtual Void | retainAll (CollectionID) |
Retain only the elements present in another Collection. | |
Protected Member Functions | |
Natural | nextCapacity (Natural) const |
Return the next hash table capacity. | |
Unordered (const Unordered &) | |
Copy another Unordered collection. |
|
Copy another Unordered collection. Required by C++ to ensure that copying an Unordered collection faithfully copies a Collection.
|
|
Construct an empty Unordered collection.
|
|
Destroy and release an Unordered collection.
|
|
Compare this Unordered collection with another Unordered collection. A symmetric comparison which tests for the mutual containment of one Unordered collection in the other. Returns an Order in which LESS means contained within, EQUAL means has the identical quantity of each element, MORE means contains, NONE means incomparable and disjoint and SOME means incomparable, but overlapping.
|
|
Compare this Unordered collection with another Object. Generic comparison that tries to convert the other Object into an Unordered collection then proceeds to compare according to mutual containment of elements. If the other Object is not an Unordered collection, the comparison is undefined and the result is NONE.
Reimplemented from Object. |
|
Count the occurrences of an Object in this Unordered collection. This method is abstract, since different types of Unordered collection access their elements in different ways.
|
|
Find one or more Objects equal to another in this Unordered collection. This method is abstract, since different types of Unordered collection access their elements in different ways. In Set and its descendants, this returns a unique Object, or null. In Bag and its descendants, this returns a Bag of Objects judged EQUAL under compare(), or null.
|
|
Return a quasi-unique hash code for this Unordered collection. Sums the hash codes of the individual elements, modulo the maximum Natural number. The result is only based on the values of elements. Unordered collections that contain the same elements (in any order) will always yield identical hash codes.
Reimplemented from Object. |
|
Return the next hash table capacity. Calculates the next greater hash table capacity than the previous capacity (or than zero, initially). Each capacity is guaranteed to be a prime number and is approximately double the previous capacity. The least capacity returned is 13 and the greatest capacity, after 26 doublings, is 1073741789. Any attempt to grow larger than this requires unrepresentable numbers and raises an OutOfRange exception. This method is used in the prediction of hash table sizes during the construction and resizing of all Unordered collections.
|
|
Remove an Object from this Unordered collection. This method is abstract, since different types of Unordered collection access their elements in different ways.
|
|
Remove all the elements present in another Collection. This is equivalent to mutating set subtraction, bag subtraction, or domain anti-restriction, depending on the semantics of remove(). Iterates over the Collection using item() and uses remove() to remove each element from this Unordered collection.
|
|
Retain only the elements present in another Collection. This is equivalent to mutating set intersection, bag intersection or domain restriction, depending on the semantics of remove(). The default implementation copies this Unordered collection into a mask, removes all the elements of the other Collection from the mask, then removes all the elements of the mask from this Unordered collection. The double subtraction method is necessary to retain the correct quantities of elements.
|