displayablecollections
Interface DisplayableSortedSet<E>

All Superinterfaces:
java.util.Collection<E>, DisplayableCollection<E>, DisplayableSet<E>, java.lang.Iterable<E>, java.util.Set<E>, java.util.SortedSet<E>
All Known Implementing Classes:
DisplayableTreeSet

public interface DisplayableSortedSet<E>
extends DisplayableSet<E>, java.util.SortedSet<E>

A DisplayableSortedSet encapsulates a SortedSet and allows it to be displayed by a JList


Nested Class Summary
 
Nested classes/interfaces inherited from interface displayablecollections.DisplayableCollection
DisplayableCollection.CollectionChangedNotification<E>
 
Method Summary
 java.util.SortedSet<E> headSet(E toElement)
          Returns a view of the portion of this sorted set whose elements are strictly less than toElement.
 javax.swing.ListModel orderedListModel()
          Create a list model for displaying this collection in a JList.
 java.util.SortedSet<E> subSet(E fromElement, E toElement)
          Returns a view of the portion of this sorted set whose elements range from fromElement, inclusive, to toElement, exclusive.
 java.util.SortedSet<E> tailSet(E fromElement)
          Returns a view of the portion of this sorted set whose elements are greater than or equal to fromElement.
 
Methods inherited from interface displayablecollections.DisplayableCollection
addObserver, deleteObservers, listModel
 
Methods inherited from interface java.util.SortedSet
comparator, first, last
 
Methods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Method Detail

orderedListModel

javax.swing.ListModel orderedListModel()
Create a list model for displaying this collection in a JList. The result of calling toString() is what will actually be displayed for each. The display will show the elements in the same order as they appear in in the set.


headSet

java.util.SortedSet<E> headSet(E toElement)
Returns a view of the portion of this sorted set whose elements are strictly less than toElement. The returned sorted set is backed by this sorted set, so changes in the returned sorted set are reflected in this sorted set, and vice-versa. The returned set supports all optional set operations that this sorted set supports.

The sorted set returned by this method implements the DisplayableSortedSet interface to support enabling this set to notify its observers of changes made through the headSet; but the headSet itself cannot have observers of its own. Attempting to add an observer to the headSet will result in an UnsupportedOperation exception.

Specified by:
headSet in interface java.util.SortedSet<E>
Parameters:
toElement - - high endpoint (exclusive) of the headSet.
Returns:
a view of the specified initial range of this sorted set.
Throws:
java.lang.ClassCastException - - if toElement is not compatible with this set's comparator (or, if the set has no comparator, if toElement does not implement Comparable). Implementations may, but are not required to, throw this exception if toElement cannot be compared to elements currently in the set.
java.lang.NullPointerException - - if toElement is null and the encapsulated sorted set does not tolerate null elements.

subSet

java.util.SortedSet<E> subSet(E fromElement,
                              E toElement)
Returns a view of the portion of this sorted set whose elements range from fromElement, inclusive, to toElement, exclusive. (If fromElement and toElement are equal, the returned sorted set is empty.) The returned sorted set is backed by this sorted set, so changes in the returned sorted set are reflected in this sorted set, and vice-versa. The returned set supports all optional set operations that this sorted set supports.

The sorted set returned by this method implements the DisplayableSortedSet interface to support enabling this set to notify its observers of changes made through the subSet; but the subSeet itself cannot have observers of its own. Attempting to add an observer to the subSet will result in an UnsupportedOperation exception.

Specified by:
subSet in interface java.util.SortedSet<E>
Parameters:
fromElement - - low endpoint (inclusive) of the subSet.
toElement - - high endpoint (exclusive) of the subSeet.
Returns:
a view of the specified initial range of this sorted set.
Throws:
java.lang.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). Implementations may, but are not required to, throw this exception if fromElement or toElement cannot be compared to elements currently in the set.
java.lang.IllegalArgumentException - if fromElement is greater than toElement
java.lang.NullPointerException - - if fromElement or toElement is null and the encapsulated sorted set does not tolerate null elements

tailSet

java.util.SortedSet<E> tailSet(E fromElement)
Returns a view of the portion of this sorted set whose elements are greater than or equal to fromElement. The returned sorted set is backed by this sorted set, so changes in the returned sorted set are reflected in this sorted set, and vice-versa. The returned set supports all optional set operations that this sorted set supports.

The sorted set returned by this method implements the DisplayableSortedSet interface to support enabling this set to notify its observers of changes made through the tailSet; but the tailSet itself cannot have observers of its own. Attempting to add an observer to the tailSet will result in an UnsupportedOperation exception.

Specified by:
tailSet in interface java.util.SortedSet<E>
Parameters:
fromElement - - low endpoint (inclusive) of the tailSet.
Returns:
a view of the specified initial range of this sorted set.
Throws:
java.lang.ClassCastException - - if fromElement is not compatible with this set's comparator (or, if the seet has no comparator, if fromElement does not implement Comparable). Implementations may, but are not required to, throw this exception if fromElement cannot be compared to elements currently in the set.
java.lang.NullPointerException - - if fromElement is null and the encapsulated sorted set does not tolerate null elements.