#include <coherence/util/LiteSet.hpp>
Inherits AbstractSet.
This implementation is not thread-safe.
The LiteSet implementation switches at runtime between several different sub-implementations for storing the set of objects, described here:
The LiteSet implementation supports the NULL value.
Public Types | |||||||
typedef spec::Handle | Handle | ||||||
LiteSet Handle definition. | |||||||
typedef spec::View | View | ||||||
LiteSet View definition. | |||||||
typedef spec::Holder | Holder | ||||||
LiteSet Holder definition. | |||||||
Public Member Functions | |||||||
LiteSet () | |||||||
Construct a LiteSet. | |||||||
LiteSet (Collection::View vCollection) | |||||||
Construct a LiteSet containing the elements of the passed Collection. | |||||||
virtual bool | isEmpty () const | ||||||
Determine whether this collection contains any elements.
| |||||||
virtual size32_t | size () const | ||||||
Return the number of elements in this collection.
| |||||||
virtual bool | contains (Object::View v) const | ||||||
Determine if this collection contains the specified element.
| |||||||
virtual Iterator::Handle | iterator () const | ||||||
Return an Iterator over this collection.
| |||||||
virtual Muterator::Handle | iterator () | ||||||
Return an Iterator over this collection.
| |||||||
ObjectArray::Handle | toArray (ObjectArray::Handle haDest=NULL) const | ||||||
Return the contents of this collection as an ObjectArray. If the collection fits in the specified array, it is returned, otherwise, a new array is allocated that is the size of this collection. If this collection fits in the array with aditional room then the element in the array immediately following the end of the collection is set to NULL. This can be useful in determining the length of this collection if the caller knows that the collection does not contain any NULL elements.
| |||||||
bool | add (Object::Holder oh) | ||||||
Add the given element to this collection.
This implementation will throw a coherence::lang::UnsupportedOperationException | |||||||
bool | remove (Object::View v) | ||||||
Remove the supplied element from this collection.
This implementation will throw a coherence::lang::UnsupportedOperationException unless add() is overridden (assuming the specified collection is non-empty). | |||||||
virtual bool | containsAll (Collection::View vCollection) const | ||||||
Determine if this collection contains all elements from the supplied collection.
This implementation iterates over the specified collection, checking each element returned by the iterator in turn to see if it's contained in this collection. If all elements are so contained | |||||||
virtual bool | addAll (Collection::View vCollection) | ||||||
Add all elements from the supplied collection to this collection.
This implementation will throw a coherence::lang::UnsupportedOperationException unless add() is overridden (assuming the specified collection is non-empty). | |||||||
virtual bool | retainAll (Collection::View vCollection) | ||||||
Remove all elements from this collection that are not present in the supplied collection.
This implementation will throw a coherence::lang::UnsupportedOperationException unless remove() is overridden (assuming there are items to be removed by the operation). | |||||||
virtual bool | removeAll (Collection::View vCollection) | ||||||
Remove all instances of the elements in the supplied collection from this collection. Upon completion, contains() on this collection will return false for all elements in the supplied collection.
This implementation will throw a coherence::lang::UnsupportedOperationException} unless remove() is overridden (assuming the specified collection is non-empty). | |||||||
virtual void | clear () | ||||||
Remove all elements from this collection.
This implementation will throw a coherence::lang::UnsupportedOperationException. | |||||||
Protected Member Functions | |||||||
Set::Handle | instantiateSet () | ||||||
(Factory pattern) Instantiate a Set object to store items in once the "lite" threshold has been exceeded. | |||||||
Set::View | instantiateSet () const | ||||||
(Factory pattern) Instantiate a Set object to store items in once the "lite" threshold has been exceeded. | |||||||
void | initFromArray (ObjectArray::View va, size32_t c) | ||||||
Initialize the contents of this Set from the passed array ao containing c values. | |||||||
void | checkShrinkFromOther () | ||||||
After a mutation operation has reduced the size of an underlying Set, check if the delegation model should be replaced with a more size-efficient storage approach, and switch accordingly. |
LiteSet | ( | Collection::View | vCollection | ) |
Construct a LiteSet containing the elements of the passed Collection.
vCollection | a Collection |
Set::Handle instantiateSet | ( | ) | [protected] |
Set::View instantiateSet | ( | ) | const [protected] |
void initFromArray | ( | ObjectArray::View | va, | |
size32_t | c | |||
) | [protected] |