This class provides a skeletal implementation of the Map interface, to minimize the effort required to implement this interface. More...
#include <src/main/decaf/util/AbstractMap.h>

Public Member Functions | |
| AbstractMap () | |
| AbstractMap (const Map< K, V > &map) | |
| AbstractMap (const AbstractMap< K, V > &map) | |
| virtual | ~AbstractMap () |
| virtual void | lock () |
| Locks the object. | |
| virtual bool | tryLock () |
| Attempts to Lock the object, if the lock is already held by another thread than this method returns false. | |
| virtual void | unlock () |
| Unlocks the object. | |
| virtual void | wait () |
| Waits on a signal from this object, which is generated by a call to Notify. | |
| virtual void | wait (long long millisecs) |
| Waits on a signal from this object, which is generated by a call to Notify. | |
| virtual void | wait (long long millisecs, int nanos) |
| Waits on a signal from this object, which is generated by a call to Notify. | |
| virtual void | notify () |
| Signals a waiter on this object that it can now wake up and continue. | |
| virtual void | notifyAll () |
| Signals the waiters on this object that it can now wake up and continue. | |
Protected Attributes | |
| util::concurrent::Mutex | mutex |
This class provides a skeletal implementation of the Map interface, to minimize the effort required to implement this interface.
To implement an unmodifiable map, the programmer needs only to extend this class and provide an implementation for the entrySet method, which returns a set-view of the map's mappings. Typically, the returned set will, in turn, be implemented atop AbstractSet. This set should not support the add or remove methods, and its iterator should not support the remove method.
To implement a modifiable map, the programmer must additionally override this class's put method (which otherwise throws an UnsupportedOperationException), and the iterator returned by entrySet().iterator() must additionally implement its remove method.
The programmer should generally provide a void (no argument) and map constructor, as per the recommendation in the Map interface specification.
The documentation for each non-abstract method in this class describes its implementation in detail. Each of these methods may be overridden if the map being implemented admits a more efficient implementation.
| decaf::util::AbstractMap< K, V >::AbstractMap | ( | ) | [inline] |
| decaf::util::AbstractMap< K, V >::AbstractMap | ( | const Map< K, V > & | map | ) | [inline] |
| decaf::util::AbstractMap< K, V >::AbstractMap | ( | const AbstractMap< K, V > & | map | ) | [inline] |
| virtual decaf::util::AbstractMap< K, V >::~AbstractMap | ( | ) | [inline, virtual] |
| virtual void decaf::util::AbstractMap< K, V >::lock | ( | ) | [inline, virtual] |
Locks the object.
| RuntimeException | if an error occurs while locking the object. |
Implements decaf::util::concurrent::Synchronizable.
| virtual void decaf::util::AbstractMap< K, V >::notify | ( | ) | [inline, virtual] |
Signals a waiter on this object that it can now wake up and continue.
Must have this object locked before calling.
| IllegalMonitorStateException | - if the current thread is not the owner of the the Synchronizable Object. | |
| RuntimeException | if an error occurs while notifying one of the waiting threads. |
Implements decaf::util::concurrent::Synchronizable.
| virtual void decaf::util::AbstractMap< K, V >::notifyAll | ( | ) | [inline, virtual] |
Signals the waiters on this object that it can now wake up and continue.
Must have this object locked before calling.
| IllegalMonitorStateException | - if the current thread is not the owner of the the Synchronizable Object. | |
| RuntimeException | if an error occurs while notifying the waiting threads. |
Implements decaf::util::concurrent::Synchronizable.
| virtual bool decaf::util::AbstractMap< K, V >::tryLock | ( | ) | [inline, virtual] |
Attempts to Lock the object, if the lock is already held by another thread than this method returns false.
| RuntimeException | if an error occurs while locking the object. |
Implements decaf::util::concurrent::Synchronizable.
| virtual void decaf::util::AbstractMap< K, V >::unlock | ( | ) | [inline, virtual] |
Unlocks the object.
| RuntimeException | if an error occurs while unlocking the object. |
Implements decaf::util::concurrent::Synchronizable.
| virtual void decaf::util::AbstractMap< K, V >::wait | ( | long long | millisecs, | |
| int | nanos | |||
| ) | [inline, virtual] |
Waits on a signal from this object, which is generated by a call to Notify.
Must have this object locked before calling. This wait will timeout after the specified time interval. This method is similar to the one argument wait function except that it add a finer grained control over the amount of time that it waits by adding in the additional nanosecond argument.
NOTE: The ability to wait accurately at a nanosecond scale depends on the platform and OS that the Decaf API is running on, some systems do not provide an accurate enough clock to provide this level of granularity.
| millisecs | the time in milliseconds to wait, or WAIT_INIFINITE | |
| nanos | additional time in nanoseconds with a range of 0-999999 |
| IllegalArgumentException | if an error occurs or the nanos argument is not in the range of [0-999999] | |
| RuntimeException | if an error occurs while waiting on the object. | |
| InterruptedException | if the wait is interrupted before it completes. | |
| IllegalMonitorStateException | - if the current thread is not the owner of the the Synchronizable Object. |
Implements decaf::util::concurrent::Synchronizable.
| virtual void decaf::util::AbstractMap< K, V >::wait | ( | long long | millisecs | ) | [inline, virtual] |
Waits on a signal from this object, which is generated by a call to Notify.
Must have this object locked before calling. This wait will timeout after the specified time interval.
| millisecs | the time in milliseconds to wait, or WAIT_INIFINITE |
| RuntimeException | if an error occurs while waiting on the object. | |
| InterruptedException | if the wait is interrupted before it completes. | |
| IllegalMonitorStateException | - if the current thread is not the owner of the the Synchronizable Object. |
Implements decaf::util::concurrent::Synchronizable.
| virtual void decaf::util::AbstractMap< K, V >::wait | ( | ) | [inline, virtual] |
Waits on a signal from this object, which is generated by a call to Notify.
Must have this object locked before calling.
| RuntimeException | if an error occurs while waiting on the object. | |
| InterruptedException | if the wait is interrupted before it completes. | |
| IllegalMonitorStateException | - if the current thread is not the owner of the the Synchronizable Object. |
Implements decaf::util::concurrent::Synchronizable.
util::concurrent::Mutex decaf::util::AbstractMap< K, V >::mutex [mutable, protected] |
Referenced by decaf::util::AbstractMap< E, Set< E > * >::lock(), decaf::util::AbstractMap< E, Set< E > * >::notify(), decaf::util::AbstractMap< E, Set< E > * >::notifyAll(), decaf::util::AbstractMap< E, Set< E > * >::tryLock(), decaf::util::AbstractMap< E, Set< E > * >::unlock(), and decaf::util::AbstractMap< E, Set< E > * >::wait().
1.6.1