org.ozoneDB.collections
Class NodeTreeSetImpl
java.lang.Object
org.ozoneDB.OzoneObject
org.ozoneDB.collections.AbstractOzoneCollection
org.ozoneDB.collections.AbstractOzoneSet
org.ozoneDB.collections.BaseTreeSetImpl
org.ozoneDB.collections.NodeTreeSetImpl
- All Implemented Interfaces:
- BaseTreeSet, java.lang.Cloneable, java.util.Collection, NodeTreeSet, OzoneCollection, org.ozoneDB.OzoneCompatible, org.ozoneDB.OzoneCompatibleOrProxy, org.ozoneDB.OzoneRemote, OzoneSet, OzoneSortedSet, OzoneTreeSet, java.io.Serializable, java.util.Set, java.util.SortedSet
- public class NodeTreeSetImpl
- extends BaseTreeSetImpl
- implements NodeTreeSet
Note that calling iterator()
does NOT result in the creation
of an ozone object; this is opposite to behaviour of FullTreeSetImpl
.
- Author:
- Leo Mekenkamp (mind the anti-sp@m)
- See Also:
- Serialized Form
Constructor Summary |
NodeTreeSetImpl()
Construct a new TreeSet whose backing TreeMap using the "natural"
ordering of keys. |
NodeTreeSetImpl(java.util.Collection collection)
Construct a new TreeSet whose backing TreeMap uses the "natural"
orering of the keys and which contains all of the elements in the
supplied Collection. |
NodeTreeSetImpl(java.util.Comparator comparator)
Construct a new TreeSet whose backing TreeMap uses the supplied
Comparator. |
NodeTreeSetImpl(java.util.SortedSet sortedSet)
Construct a new TreeSet, using the same key ordering as the supplied
SortedSet and containing all of the elements in the supplied SortedSet.
|
Method Summary |
java.lang.Object |
clone()
Returns a shallow copy of this Set. |
java.util.SortedSet |
headSet(java.lang.Object to)
Returns a view of this Set including all elements less than
to . |
protected java.util.SortedMap |
newBackingMap()
|
protected java.util.SortedMap |
newBackingMap(java.util.Comparator comparator)
|
java.util.SortedSet |
subSet(java.lang.Object from,
java.lang.Object to)
Returns a view of this Set including all elements greater or equal to
from and less than to (a half-open interval).
|
java.util.SortedSet |
tailSet(java.lang.Object from)
Returns a view of this Set including all elements greater or equal to
from . |
Methods inherited from class org.ozoneDB.collections.BaseTreeSetImpl |
_org_ozoneDB_internalIterator, add, addAll, clear, comparator, contains, first, getClientCollection, getClientSet, getClientSortedSet, getClientTreeSet, isEmpty, iterator, last, onCreate, ozoneHeadSet, ozoneSubSet, ozoneTailSet, remove, size, toString |
Methods inherited from class org.ozoneDB.OzoneObject |
container, database, deleteRecursive, getHandle, getObjectID, handle, onActivate, onDelete, onPassivate, requireWriteLocking, self, setContainer, toXML |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Collection |
contains, containsAll, equals, hashCode, isEmpty, iterator, size, toArray, toArray |
Methods inherited from interface org.ozoneDB.OzoneCompatibleOrProxy |
getObjectID |
Methods inherited from interface java.util.Set |
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
Methods inherited from interface java.util.SortedSet |
comparator, first, last |
NodeTreeSetImpl
public NodeTreeSetImpl()
- Construct a new TreeSet whose backing TreeMap using the "natural"
ordering of keys. Elements that are not mutually comparable will cause
ClassCastExceptions down the road.
- See Also:
Comparable
NodeTreeSetImpl
public NodeTreeSetImpl(java.util.Comparator comparator)
- Construct a new TreeSet whose backing TreeMap uses the supplied
Comparator. Elements that are not mutually comparable will cause
ClassCastExceptions down the road.
- Parameters:
comparator
- the Comparator this Set will use
NodeTreeSetImpl
public NodeTreeSetImpl(java.util.Collection collection)
- Construct a new TreeSet whose backing TreeMap uses the "natural"
orering of the keys and which contains all of the elements in the
supplied Collection. This runs in n*log(n) time.
- Parameters:
collection
- the new Set will be initialized with all
of the elements in this Collection
- Throws:
java.lang.ClassCastException
- if the elements of the collection are not
comparable
java.lang.NullPointerException
- if the collection is null- See Also:
Comparable
NodeTreeSetImpl
public NodeTreeSetImpl(java.util.SortedSet sortedSet)
- Construct a new TreeSet, using the same key ordering as the supplied
SortedSet and containing all of the elements in the supplied SortedSet.
This constructor runs in linear time.
- Parameters:
sortedSet
- the new TreeSet will use this SortedSet's comparator
and will initialize itself with all its elements
- Throws:
java.lang.NullPointerException
- if sortedSet is null
clone
public java.lang.Object clone()
- Returns a shallow copy of this Set. The elements are not cloned.
- Returns:
- the cloned set
headSet
public java.util.SortedSet headSet(java.lang.Object to)
- Returns a view of this Set including all elements less than
to
. The returned set is backed by the original, so changes
in one appear in the other. The subset will throw an
IllegalArgumentException
for any attempt to access or add an
element beyond the specified cutoff. The returned set does not include
the endpoint; if you want inclusion, pass the successor element.
- Specified by:
headSet
in interface java.util.SortedSet
- Parameters:
to
- the (exclusive) cutoff point
- Returns:
- a view of the set less than the cutoff
- Throws:
java.lang.ClassCastException
- if to
is not compatible with
the comparator (or is not Comparable, for natural ordering)
java.lang.NullPointerException
- if to is null, but the comparator does not
tolerate null elements
subSet
public java.util.SortedSet subSet(java.lang.Object from,
java.lang.Object to)
- Returns a view of this Set including all elements greater or equal to
from
and less than to
(a half-open interval).
The returned set is backed by the original, so changes in one appear in
the other. The subset will throw an IllegalArgumentException
for any attempt to access or add an element beyond the specified cutoffs.
The returned set includes the low endpoint but not the high; if you want
to reverse this behavior on either end, pass in the successor element.
- Specified by:
subSet
in interface java.util.SortedSet
- Parameters:
from
- the (inclusive) low cutoff pointto
- the (exclusive) high cutoff point
- Returns:
- a view of the set between the cutoffs
- Throws:
java.lang.ClassCastException
- if either cutoff is not compatible with
the comparator (or is not Comparable, for natural ordering)
java.lang.NullPointerException
- if from or to is null, but the comparator
does not tolerate null elements
java.lang.IllegalArgumentException
- if from is greater than to
tailSet
public java.util.SortedSet tailSet(java.lang.Object from)
- Returns a view of this Set including all elements greater or equal to
from
. The returned set is backed by the original, so
changes in one appear in the other. The subset will throw an
IllegalArgumentException
for any attempt to access or add an
element beyond the specified cutoff. The returned set includes the
endpoint; if you want to exclude it, pass in the successor element.
- Specified by:
tailSet
in interface java.util.SortedSet
- Parameters:
from
- the (inclusive) low cutoff point
- Returns:
- a view of the set above the cutoff
- Throws:
java.lang.ClassCastException
- if from
is not compatible with
the comparator (or is not Comparable, for natural ordering)
java.lang.NullPointerException
- if from is null, but the comparator
does not tolerate null elements
newBackingMap
protected java.util.SortedMap newBackingMap()
- Specified by:
newBackingMap
in class BaseTreeSetImpl
newBackingMap
protected java.util.SortedMap newBackingMap(java.util.Comparator comparator)
- Specified by:
newBackingMap
in class BaseTreeSetImpl
Copyright © 2004 The Ozone Database Project - www.ozone-db.org. All Rights Reserved.