EDU.oswego.cs.dl.util.concurrent
Class SyncSortedSet

java.lang.Object
  extended byEDU.oswego.cs.dl.util.concurrent.SyncCollection
      extended byEDU.oswego.cs.dl.util.concurrent.SyncSet
          extended byEDU.oswego.cs.dl.util.concurrent.SyncSortedSet
All Implemented Interfaces:
Collection, Set, SortedSet

public class SyncSortedSet
extends SyncSet
implements SortedSet

SyncSortedSets wrap Sync-based control around java.util.SortedSets. They support the following additional reader operations over SyncCollection: comparator, subSet, headSet, tailSet, first, last.

[ Introduction to this package. ]

See Also:
SyncCollection

Nested Class Summary
 
Nested classes inherited from class EDU.oswego.cs.dl.util.concurrent.SyncCollection
SyncCollection.SyncCollectionIterator
 
Field Summary
 
Fields inherited from class EDU.oswego.cs.dl.util.concurrent.SyncCollection
c_, rd_, syncFailures_, wr_
 
Constructor Summary
SyncSortedSet(SortedSet set, ReadWriteLock rwl)
          Create a new SyncSortedSet protecting the given set, and using the given ReadWriteLock to control reader and writer methods.
SyncSortedSet(SortedSet set, Sync sync)
          Create a new SyncSortedSet protecting the given collection, and using the given sync to control both reader and writer methods.
SyncSortedSet(SortedSet set, Sync readLock, Sync writeLock)
          Create a new SyncSortedSet protecting the given set, and using the given pair of locks to control reader and writer methods.
 
Method Summary
protected  SortedSet baseSortedSet()
           
 Comparator comparator()
           
 Object first()
           
 SortedSet headSet(Object toElement)
           
 Object last()
           
 SortedSet subSet(Object fromElement, Object toElement)
           
 SortedSet tailSet(Object fromElement)
           
 
Methods inherited from class EDU.oswego.cs.dl.util.concurrent.SyncSet
equals, hashCode
 
Methods inherited from class EDU.oswego.cs.dl.util.concurrent.SyncCollection
add, addAll, afterRead, beforeRead, clear, contains, containsAll, isEmpty, iterator, readerSync, remove, removeAll, retainAll, size, syncFailures, toArray, toArray, unprotectedIterator, writerSync
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Constructor Detail

SyncSortedSet

public SyncSortedSet(SortedSet set,
                     Sync sync)
Create a new SyncSortedSet protecting the given collection, and using the given sync to control both reader and writer methods. Common, reasonable choices for the sync argument include Mutex, ReentrantLock, and Semaphores initialized to 1.


SyncSortedSet

public SyncSortedSet(SortedSet set,
                     ReadWriteLock rwl)
Create a new SyncSortedSet protecting the given set, and using the given ReadWriteLock to control reader and writer methods.


SyncSortedSet

public SyncSortedSet(SortedSet set,
                     Sync readLock,
                     Sync writeLock)
Create a new SyncSortedSet protecting the given set, and using the given pair of locks to control reader and writer methods.

Method Detail

baseSortedSet

protected SortedSet baseSortedSet()

comparator

public Comparator comparator()
Specified by:
comparator in interface SortedSet

first

public Object first()
Specified by:
first in interface SortedSet

last

public Object last()
Specified by:
last in interface SortedSet

subSet

public SortedSet subSet(Object fromElement,
                        Object toElement)
Specified by:
subSet in interface SortedSet

headSet

public SortedSet headSet(Object toElement)
Specified by:
headSet in interface SortedSet

tailSet

public SortedSet tailSet(Object fromElement)
Specified by:
tailSet in interface SortedSet