Package EDU.oswego.cs.dl.util.concurrent
Class SyncSortedMap
- java.lang.Object
-
- EDU.oswego.cs.dl.util.concurrent.SyncMap
-
- EDU.oswego.cs.dl.util.concurrent.SyncSortedMap
-
- All Implemented Interfaces:
java.util.Map,java.util.SortedMap
public class SyncSortedMap extends SyncMap implements java.util.SortedMap
SyncSortedMaps wrap Sync-based control around java.util.SortedMaps. They support the following additional reader operations over SyncMap: comparator, subMap, headMap, tailMap, firstKey, lastKey.- See Also:
SyncCollection
-
-
Field Summary
-
Fields inherited from class EDU.oswego.cs.dl.util.concurrent.SyncMap
c_, rd_, syncFailures_, wr_
-
-
Constructor Summary
Constructors Constructor Description SyncSortedMap(java.util.SortedMap map, ReadWriteLock rwl)Create a new SyncSortedMap protecting the given map, and using the given ReadWriteLock to control reader and writer methods.SyncSortedMap(java.util.SortedMap map, Sync sync)Create a new SyncSortedMap protecting the given map, and using the given sync to control both reader and writer methods.SyncSortedMap(java.util.SortedMap map, Sync readLock, Sync writeLock)Create a new SyncSortedMap protecting the given map, 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.SortedMapbaseSortedMap()java.util.Comparatorcomparator()java.lang.ObjectfirstKey()java.util.SortedMapheadMap(java.lang.Object toElement)java.lang.ObjectlastKey()java.util.SortedMapsubMap(java.lang.Object fromElement, java.lang.Object toElement)java.util.SortedMaptailMap(java.lang.Object fromElement)-
Methods inherited from class EDU.oswego.cs.dl.util.concurrent.SyncMap
afterRead, beforeRead, clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, readerSync, remove, size, syncFailures, values, writerSync
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Constructor Detail
-
SyncSortedMap
public SyncSortedMap(java.util.SortedMap map, Sync sync)Create a new SyncSortedMap protecting the given map, 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.
-
SyncSortedMap
public SyncSortedMap(java.util.SortedMap map, ReadWriteLock rwl)Create a new SyncSortedMap protecting the given map, and using the given ReadWriteLock to control reader and writer methods.
-
-
Method Detail
-
baseSortedMap
protected java.util.SortedMap baseSortedMap()
-
comparator
public java.util.Comparator comparator()
- Specified by:
comparatorin interfacejava.util.SortedMap
-
firstKey
public java.lang.Object firstKey()
- Specified by:
firstKeyin interfacejava.util.SortedMap
-
lastKey
public java.lang.Object lastKey()
- Specified by:
lastKeyin interfacejava.util.SortedMap
-
subMap
public java.util.SortedMap subMap(java.lang.Object fromElement, java.lang.Object toElement)- Specified by:
subMapin interfacejava.util.SortedMap
-
headMap
public java.util.SortedMap headMap(java.lang.Object toElement)
- Specified by:
headMapin interfacejava.util.SortedMap
-
tailMap
public java.util.SortedMap tailMap(java.lang.Object fromElement)
- Specified by:
tailMapin interfacejava.util.SortedMap
-
-