| 
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--ostore.util.QSTreeSet
A QSTreeSet is a wrapper class of TreeSet
 that implements QuickSerializable.  All elements of the
 QSTreeSet must also be QuickSerializable.
 Most of the functionality from the TreeSet has not been
 ported.  If you require the use of a missing method, implement it.
| Constructor Summary | |
|---|---|
QSTreeSet()
Constructs a QSTreeSet. | 
|
QSTreeSet(Collection c)
Constructs a new set containing the elements in the specified collection, sorted according to the elements' natural order.  | 
|
QSTreeSet(InputBuffer buffer)
Constructs a QSTreeSet from its
 serialized form. | 
|
QSTreeSet(QSComparator c)
 | 
|
QSTreeSet(SortedSet s)
Constructs a new set containing the same elements as the given sorted set, sorted according to the same ordering.  | 
|
| Method Summary | |
|---|---|
 boolean | 
add(QuickSerializable o)
Adds the specified element to this set if it is not already present.  | 
 boolean | 
addAll(Collection c)
Adds all of the elements in the specified collection to this set.  | 
 boolean | 
addAll(QSTreeSet c)
 | 
 void | 
clear()
Removes all of the elements from this set.  | 
 Object | 
clone()
Create an exact copy of this QSTreeSet | 
 Comparator | 
comparator()
Returns the comparator used to order this sorted set, or null if this tree set uses its elements natural ordering.  | 
 boolean | 
contains(QuickSerializable o)
Returns true if this set contains the specified element.  | 
 boolean | 
containsAll(Collection c)
Returns true if this collection contains all of the elements in the specified collection.  | 
 boolean | 
containsAll(QSTreeSet c)
 | 
 boolean | 
equals(Object o)
Compare this QSTreeSet to another Object. | 
 Object | 
first()
Returns the first (lowest) element currently in this sorted set.  | 
 TreeSet | 
getTreeSet()
 | 
 int | 
hashCode()
Return a hashcode, specified and generated as in TreeSet. | 
 SortedSet | 
headSet(QuickSerializable toElement)
Returns a view of the portion of this set whose elements are strictly less than toElement.  | 
 boolean | 
isEmpty()
Returns true if this set contains no elements.  | 
 Iterator | 
iterator()
Returns an iterator over the elements in this set.  | 
 QuickSerializable | 
last()
Returns the last (highest) element currently in this sorted set.  | 
 boolean | 
remove(QuickSerializable o)
Removes the given element from this set if it is present.  | 
 boolean | 
removeAll(Collection c)
Removes from this set all of its elements that are contained in the specified collection (optional operation).  | 
 boolean | 
removeAll(QSTreeSet c)
 | 
 void | 
serialize(OutputBuffer buffer)
Add the object to the buffer. | 
 int | 
size()
Returns the number of elements in this set (its cardinality).  | 
 SortedSet | 
subSet(QuickSerializable fromElement,
       QuickSerializable toElement)
Returns a view of the portion of this set whose elements range from fromElement, inclusive, to toElement, exclusive.  | 
 SortedSet | 
tailSet(QuickSerializable fromElement)
Returns a view of the portion of this set whose elements are greater than or equal to fromElement.  | 
 QuickSerializable[] | 
toArray()
Returns an array containing all of the elements in this collection.  | 
 QuickSerializable[] | 
toArray(QuickSerializable[] a)
Returns an array with a runtime type is that of the specified array and that contains all of the elements in this collection.  | 
 String | 
toString()
Produce a human-readable version of this QSVector,
 which includes all the elements. | 
| Methods inherited from class java.lang.Object | 
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
public QSTreeSet()
QSTreeSet.
public QSTreeSet(QSComparator c)
public QSTreeSet(InputBuffer buffer)
          throws QSException
QSTreeSet from its
 serialized form.
buffer - serialized
                form of object.
public QSTreeSet(SortedSet s)
          throws QSException
s - sorted set whose elements will comprise the new set.
QSException - if any of the elements are not instanceof 
                     QuickSerializable.
public QSTreeSet(Collection c)
          throws QSException
c - The elements that will comprise the new set.
ClassCastException - if the keys in the given collection are not
 comparable, or are not mutually comparable.
QSException - if any of the elements are not instanceof 
                     QuickSerializable.| Method Detail | 
public void serialize(OutputBuffer buffer)
QuickSerializablebuffer.
serialize in interface QuickSerializablebuffer - the output buffer to add the object topublic TreeSet getTreeSet()
public int hashCode()
TreeSet.
hashCode in class ObjectQSTreeSetpublic boolean equals(Object o)
QSTreeSet to another Object.
equals in class Objecttrue iff the other Object is also a
 QSTreeSet and contains equal elements.
public Object clone()
             throws CloneNotSupportedException
QSTreeSet
clone in class ObjectQSTreeSet identical to this one.
         this is a shallow-copy
CloneNotSupportedExceptionpublic String toString()
QSVector,
 which includes all the elements.
toString in class ObjectString representation of this
 		QSTreeSet.public Iterator iterator()
public int size()
public boolean isEmpty()
public boolean contains(QuickSerializable o)
o - the object to be checked for containment in this set.
ClassCastException - if the specified object cannot be compared
 		  with the elements currently in the set.public boolean add(QuickSerializable o)
o - element to be added to this set.
ClassCastException - if the specified object cannot be compared
 		  with the elements currently in the set.public boolean remove(QuickSerializable o)
o - object to be removed from this set, if present.
ClassCastException - if the specified object cannot be compared
 		  with the elements currently in the set.public void clear()
public boolean addAll(Collection c)
               throws QSException
c - elements to be added
ClassCastException - if the elements provided cannot be compared
		  with the elements currently in the set.
QSException - if any of the elements are not instanceof 
                     QuickSerializable.
public boolean addAll(QSTreeSet c)
               throws QSException
QSException
public SortedSet subSet(QuickSerializable fromElement,
                        QuickSerializable toElement)
The sorted set returned by this method will throw an IllegalArgumentException if the user attempts to insert an element outside the specified range.
Note: this method always returns a half-open range (which includes its low endpoint but not its high endpoint). If you need a closed range (which includes both endpoints), and the element type allows for calculation of the successor a given value, merely request the subrange from lowEndpoint to successor(highEndpoint). For example, suppose that s is a sorted set of strings. The following idiom obtains a view containing all of the strings in s from low to high, inclusive:
     SortedSet sub = s.subSet(low, high+"\0");
 
 
 A similar technique can be used to generate an open range (which
 contains neither endpoint).  The following idiom obtains a view
 containing all of the strings in s from low to
 high, exclusive: 
     SortedSet sub = s.subSet(low+"\0", high);
 
fromElement - low endpoint (inclusive) of the subSet.toElement - high endpoint (exclusive) of the subSet.
ClassCastException - if fromElement and
         toElement cannot be compared to one another using
         this set's comparator (or, if the set has no comparator,
         using natural ordering).
IllegalArgumentException - if fromElement is greater than
         toElement.
NullPointerException - if fromElement or
	       toElement is null and this set uses natural
	       order, or its comparator does not tolerate null
         elements.public SortedSet headSet(QuickSerializable toElement)
The sorted set returned by this method will throw an IllegalArgumentException if the user attempts to insert an element greater than or equal to toElement.
Note: this method always returns a view that does not contain its (high) endpoint. If you need a view that does contain this endpoint, and the element type allows for calculation of the successor a given value, merely request a headSet bounded by successor(highEndpoint). For example, suppose that s is a sorted set of strings. The following idiom obtains a view containing all of the strings in s that are less than or equal to high:
SortedSet head = s.headSet(high+"\0");
toElement - high endpoint (exclusive) of the headSet.
ClassCastException - if toElement is not compatible
         with this set's comparator (or, if the set has no comparator,
         if toElement does not implement Comparable).
IllegalArgumentException - if this set is itself a subSet,
         headSet, or tailSet, and toElement is not within the
         specified range of the subSet, headSet, or tailSet.
NullPointerException - if toElement is null and
	       this set uses natural ordering, or its comparator does
         not tolerate null elements.public SortedSet tailSet(QuickSerializable fromElement)
The sorted set returned by this method will throw an IllegalArgumentException if the user attempts to insert an element less than fromElement. Note: this method always returns a view that contains its (low) endpoint. If you need a view that does not contain this endpoint, and the element type allows for calculation of the successor a given value, merely request a tailSet bounded by successor(lowEndpoint). For example, suppose that s is a sorted set of strings. The following idiom obtains a view containing all of the strings in s that are strictly greater than low:
     SortedSet tail = s.tailSet(low+"\0");
 
fromElement - low endpoint (inclusive) of the tailSet.
ClassCastException - if fromElement is not compatible
         with this set's comparator (or, if the set has no comparator,
         if fromElement does not implement Comparable).
IllegalArgumentException - if this set is itself a subSet,
         headSet, or tailSet, and fromElement is not within the
         specified range of the subSet, headSet, or tailSet.
NullPointerException - if fromElement is null
	       and this set uses natural ordering, or its comparator does
         not tolerate null elements.
public boolean containsAll(Collection c)
                    throws QSException
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 true is returned, otherwise false.
c - collection to be checked for containment in this collection.
QSExceptioncontains(QuickSerializable)
public boolean containsAll(QSTreeSet c)
                    throws QSException
QSException
public boolean removeAll(Collection c)
                  throws QSException
This implementation determines which is the smaller of this set and the specified collection, by invoking the size method on each. If this set has fewer elements, then the implementation iterates over this set, checking each element returned by the iterator in turn to see if it is contained in the specified collection. If it is so contained, it is removed from this set with the iterator's remove method. If the specified collection has fewer elements, then the implementation iterates over the specified collection, removing from this set each element returned by the iterator, using this set's remove method.
Note that this implementation will throw an UnsupportedOperationException if the iterator returned by the iterator method does not implement the remove method.
c - elements to be removed from this set.
UnsupportedOperationException - removeAll is not supported
            by this set.
QSException - if any of the elements are not instanceof 
                     QuickSerializable.remove(QuickSerializable), 
contains(QuickSerializable)
public boolean removeAll(QSTreeSet c)
                  throws QSException
QSExceptionpublic Comparator comparator()
public Object first()
NoSuchElementException - sorted set is empty.public QuickSerializable last()
NoSuchElementException - sorted set is empty.public QuickSerializable[] toArray()
This implementation allocates the array to be returned, and iterates over the elements in the collection, storing each object reference in the next consecutive element of the array, starting with element 0.
public QuickSerializable[] toArray(QuickSerializable[] a)
If the collection fits in the specified array with room to spare (i.e., the array has more elements than the collection), the element in the array immediately following the end of the collection is set to null. This is useful in determining the length of the collection only if the caller knows that the collection does not contain any null elements.)
If this collection makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order.
This implementation checks if the array is large enough to contain the collection; if not, it allocates a new array of the correct size and type (using reflection). Then, it iterates over the collection, storing each object reference in the next consecutive element of the array, starting with element 0. If the array is larger than the collection, a null is stored in the first location after the end of the collection.
a - the array into which the elements of the collection are to
 	       be stored, if it is big enough; otherwise, a new array of the
 	       same runtime type is allocated for this purpose.
NullPointerException - if the specified array is null.
ArrayStoreException - if the runtime type of the specified array
         is not a supertype of the runtime type of every element in this
         collection.
  | 
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||