EDU.oswego.cs.dl.util.concurrent

Class SyncSortedMap

Implemented Interfaces:
Map, SortedMap

public class SyncSortedMap
extends SyncMap
implements 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.

[ Introduction to this package. ]

See Also:
SyncCollection

Field Summary

Fields inherited from class EDU.oswego.cs.dl.util.concurrent.SyncMap

c_, rd_, syncFailures_, wr_

Constructor Summary

SyncSortedMap(SortedMap map, ReadWriteLock rwl)
Create a new SyncSortedMap protecting the given map, and using the given ReadWriteLock to control reader and writer methods.
SyncSortedMap(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(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

protected SortedMap
baseSortedMap()
Comparator
comparator()
Object
firstKey()
SortedMap
headMap(Object toElement)
Object
lastKey()
SortedMap
subMap(Object fromElement, Object toElement)
SortedMap
tailMap(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

Constructor Details

SyncSortedMap

public SyncSortedMap(SortedMap map,
                     ReadWriteLock rwl)
Create a new SyncSortedMap protecting the given map, and using the given ReadWriteLock to control reader and writer methods.


SyncSortedMap

public SyncSortedMap(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(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 Details

baseSortedMap

protected SortedMap baseSortedMap()


comparator

public Comparator comparator()


firstKey

public Object firstKey()


headMap

public SortedMap headMap(Object toElement)


lastKey

public Object lastKey()


subMap

public SortedMap subMap(Object fromElement,
                        Object toElement)


tailMap

public SortedMap tailMap(Object fromElement)