Package EDU.oswego.cs.dl.util.concurrent
Class SyncSortedSet
- java.lang.Object
-
- EDU.oswego.cs.dl.util.concurrent.SyncCollection
-
- EDU.oswego.cs.dl.util.concurrent.SyncSet
-
- EDU.oswego.cs.dl.util.concurrent.SyncSortedSet
-
- All Implemented Interfaces:
java.lang.Iterable
,java.util.Collection
,java.util.Set
,java.util.SortedSet
public class SyncSortedSet extends SyncSet implements java.util.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.- See Also:
SyncCollection
-
-
Nested Class Summary
-
Nested classes/interfaces 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
Constructors Constructor Description SyncSortedSet(java.util.SortedSet set, ReadWriteLock rwl)
Create a new SyncSortedSet protecting the given set, and using the given ReadWriteLock to control reader and writer methods.SyncSortedSet(java.util.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(java.util.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.SortedSet
baseSortedSet()
java.util.Comparator
comparator()
java.lang.Object
first()
java.util.SortedSet
headSet(java.lang.Object toElement)
java.lang.Object
last()
java.util.SortedSet
subSet(java.lang.Object fromElement, java.lang.Object toElement)
java.util.SortedSet
tailSet(java.lang.Object fromElement)
-
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
-
-
-
-
Constructor Detail
-
SyncSortedSet
public SyncSortedSet(java.util.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(java.util.SortedSet set, ReadWriteLock rwl)
Create a new SyncSortedSet protecting the given set, and using the given ReadWriteLock to control reader and writer methods.
-
-
Method Detail
-
baseSortedSet
protected java.util.SortedSet baseSortedSet()
-
comparator
public java.util.Comparator comparator()
- Specified by:
comparator
in interfacejava.util.SortedSet
-
first
public java.lang.Object first()
- Specified by:
first
in interfacejava.util.SortedSet
-
last
public java.lang.Object last()
- Specified by:
last
in interfacejava.util.SortedSet
-
subSet
public java.util.SortedSet subSet(java.lang.Object fromElement, java.lang.Object toElement)
- Specified by:
subSet
in interfacejava.util.SortedSet
-
headSet
public java.util.SortedSet headSet(java.lang.Object toElement)
- Specified by:
headSet
in interfacejava.util.SortedSet
-
tailSet
public java.util.SortedSet tailSet(java.lang.Object fromElement)
- Specified by:
tailSet
in interfacejava.util.SortedSet
-
-