Oracle® Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.1.3.0.0)

E47891-01

TreeSet Class Reference

#include <coherence/util/TreeSet.hpp>

Inherits MappedSet, and SortedSet.

List of all members.


Detailed Description

A TreeSet implementation based on a TreeMap.

The elements are ordered using their natural ordering, or by a Comparator provided at set creation time, depending on which constructor is used.

Author:
hr 2011.09.07
See also:
SortedSet

TreeMap

Since:
Coherence 12.1.2

Public Types

typedef spec::Handle Handle
 TreeSet Handle definition.
typedef spec::View View
 TreeSet View definition.
typedef spec::Holder Holder
 TreeSet Holder definition.

Public Member Functions

virtual Comparator::View comparator () const
 Returns the comparator used in sorting this set, or NULL if it is the keys' natural ordering.

Returns:
the sorting comparator

virtual SortedSet::Handle subSet (Object::View vFromElement, Object::View vToElement)
 Returns a handle of the portion of the set greater than or equal to vFromElement, and strictly less than vToElement.

The handle is backed by this set, so changes in one show up in the other.

Parameters:
vFromElement the inclusive lower range of the sub-set
vToElement the exclusive upper range of the sub-set
Returns:
the sub-set
Exceptions:
ClassCastException if vFromElement or vToElement is not comparable to the set's contents
IllegalArgumentException if this is a sub-set, and vFromElement or or vToElement is out of range
NullPointerException if vFromElement or vToElement is NULL but the map does not allow NULL elements

virtual SortedSet::View subSet (Object::View vFromElement, Object::View vToElement) const
 Returns a view of the portion of the set greater than or equal to vFromElement, and strictly less than vToElement.

Parameters:
vFromElement the inclusive lower range of the sub-set
vToElement the exclusive upper range of the sub-set
Returns:
the sub-set
Exceptions:
ClassCastException if vFromElement or vToElement is not comparable to the set's contents
IllegalArgumentException if this is a sub-set, and vFromElement or vToElement is out of range
NullPointerException if vFromElement or vToElement is NULL but the set does not allow NULL elements

virtual SortedSet::Handle headSet (Object::View vToElement)
 Returns a handle of the portion of the set strictly less than vToElement.

The handle is backed by this set, so changes in one show up in the other. The sub-set supports all optional operations of the original.

Parameters:
vToElement the exclusive upper range of the sub-set
Returns:
the sub-set
Exceptions:
ClassCastException if vToElement is not comparable to the set contents
IllegalArgumentException if this is a sub-set, and vToElement is out of range
NullPointerException if vToElement is NULL but the set does not allow NULL elements

virtual SortedSet::View headSet (Object::View vToElement) const
 Returns a view of the portion of the set strictly less than vToElement.

Parameters:
vToElement the exclusive upper range of the sub-set
Returns:
the sub-set
Exceptions:
ClassCastException if vToElement is not comparable to the set contents
IllegalArgumentException if this is a sub-set, and vToElement is out of range
NullPointerException if vToElement is NULL but the set does not allow NULL elements

virtual SortedSet::Handle tailSet (Object::View vFromElement)
 Returns a handle of the portion of the set greater than or equal to vFromElement.

The handle is backed by this set, so changes in one show up in the other. The sub-set supports all optional operations of the original.

Parameters:
vFromElement the inclusive lower range of the sub-set
Returns:
the sub-set
Exceptions:
ClassCastException if vFromElement is not comparable to the set contents
IllegalArgumentException if this is a sub-set, and vFromElement is out of range
NullPointerException if vFromElement is NULL but the set does not allow NULL elements

virtual SortedSet::View tailSet (Object::View vFromElement) const
 Returns a view of the portion of the set greater than or equal to vFromElement.

Parameters:
vFromElement the inclusive lower range of the sub-set
Returns:
the sub-set
Exceptions:
ClassCastException if vFromElement is not comparable to the set contents
IllegalArgumentException if this is a sub-set, and vFromElement is out of range
NullPointerException if vFromElement is NULL but the set does not allow NULL elements

virtual Object::View first () const
 Returns the first (lowest sorted) element in the set.

Returns:
the first element
Exceptions:
NoSuchElementException if this set is empty.

virtual Object::View last () const
 Returns the last (highest sorted) element in the set.

Returns:
the last element
Exceptions:
NoSuchElementException if this set is empty.


Protected Member Functions

 TreeSet ()
 Return a new TreeSet that will sort it's elements using their natural ordering.
 TreeSet (Comparator::View vComparator)
 Return a new TreeSet that will sort it's elements using the supplied Comparator.
 TreeSet (SortedMap::Handle hMap)
 Return a TreeSet backed by the given SortedMap.
 TreeSet (SortedMap::View vMap)
 Return a TreeSet backed by the given SortedMap.
 TreeSet (const TreeSet &that)
 Copy constructor.
virtual void ensureMap ()
 Throws an exception iff the internal map is inaccessible.
virtual SortedMap::Handle getSortedMap ()
 Return the delegate SortedMap.
virtual SortedMap::View getSortedMap () const
 Return the delegate SortedMap.

Constructor & Destructor Documentation

TreeSet ( Comparator::View  vComparator  )  [protected]

Return a new TreeSet that will sort it's elements using the supplied Comparator.

Parameters:
vComparator the Comparator used to sort elements

TreeSet ( SortedMap::Handle  hMap  )  [protected]

Return a TreeSet backed by the given SortedMap.

Parameters:
hMap the delegate SortedMap

TreeSet ( SortedMap::View  vMap  )  [protected]

Return a TreeSet backed by the given SortedMap.

Parameters:
vMap the delegate SortedMap


Member Function Documentation

virtual void ensureMap (  )  [protected, virtual]

Throws an exception iff the internal map is inaccessible.

Exceptions:
IllegalStateException iff the internal map is inaccessible

virtual SortedMap::Handle getSortedMap (  )  [protected, virtual]

Return the delegate SortedMap.

Returns:
the delegate SortedMap

virtual SortedMap::View getSortedMap (  )  const [protected, virtual]

Return the delegate SortedMap.

Returns:
the delegate SortedMap


The documentation for this class was generated from the following file:
Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.