|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ozoneDB.OzoneObject
org.ozoneDB.collections.AbstractOzoneMap
org.ozoneDB.collections._BaseTreeMap_SubMapImpl
Do not use this class directly. This should be an inner class; unfortunately ozone does not support those yet.
Implementation of subMap(Object, Object)
and other map
ranges. This class provides a view of a portion of the original backing
map, and throws IllegalArgumentException
for attempts to
access beyond that range.
Nested Class Summary |
Nested classes inherited from class org.ozoneDB.collections.OzoneMap |
OzoneMap.Node |
Nested classes inherited from class java.util.Map |
java.util.Map.Entry |
Field Summary | |
protected BaseTreeMap |
owner
underlying BaseTreeMap. |
Fields inherited from class org.ozoneDB.collections.AbstractOzoneMap |
keys, values |
Constructor Summary | |
_BaseTreeMap_SubMapImpl(BaseTreeMap owner,
java.lang.Object minKey,
java.lang.Object maxKey)
Create a SubMap representing the elements between minKey (inclusive) and maxKey (exclusive). |
Method Summary | |
void |
clear()
Remove all entries from this Map (optional operation). |
java.util.Comparator |
comparator()
|
boolean |
containsKey(java.lang.Object key)
Returns true if this contains a mapping for the given key. |
boolean |
containsValue(java.lang.Object value)
Returns true if this contains at least one mapping with the given value. |
java.util.Set |
entrySet()
Returns a set view of the mappings in this Map. |
java.lang.Object |
firstKey()
|
java.lang.Object |
get(java.lang.Object key)
Returns the value mapped by the given key. |
java.util.Map |
getClientMap()
Returns a Map that contains the same entries as this
persistent one; it is (by nature of the client-server enviromnent) always
a 'deep' copy of this OzoneMap . |
java.util.SortedMap |
getClientSortedMap()
Returns a SortedMap that contains the same entries as this
persistent one; it is (by nature of the client-server enviromnent) always
a 'deep' copy of this OzoneSortedMap . |
java.lang.Object |
getMaxKey()
|
java.lang.Object |
getMinKey()
|
BaseTreeMap |
getOwner()
|
java.util.SortedMap |
headMap(java.lang.Object toKey)
|
boolean |
keyInRange(java.lang.Object key)
Check if "key" is in within the range bounds for this SubMap. |
java.util.Set |
keySet()
Returns a set view of this map's keys. |
java.lang.Object |
lastKey()
|
OzoneSortedMap |
ozoneHeadMap(java.lang.Object toKey)
Basically nothing more than a typecasted HeadMap method.
|
OzoneSortedMap |
ozoneSubMap(java.lang.Object fromKey,
java.lang.Object toKey)
Basically nothing more than a typecasted SubMap method.
|
OzoneSortedMap |
ozoneTailMap(java.lang.Object toKey)
Basically nothing more than a typecasted TailMap method. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Associates the given key to the given value (optional operation). |
java.lang.Object |
remove(java.lang.Object key)
Removes the mapping for this key if present (optional operation). |
int |
size()
Returns the number of key-value mappings in the map. |
java.util.SortedMap |
subMap(java.lang.Object fromKey,
java.lang.Object toKey)
|
java.util.SortedMap |
tailMap(java.lang.Object fromKey)
|
java.util.Collection |
values()
Returns a collection or bag view of this map's values. |
Methods inherited from class org.ozoneDB.collections.AbstractOzoneMap |
clone, equals, hashCode, isEmpty, ozoneEntrySet, ozoneKeySet, ozoneValues, putAll, toString |
Methods inherited from class org.ozoneDB.OzoneObject |
container, database, deleteRecursive, getHandle, getObjectID, handle, onActivate, onCreate, onDelete, onPassivate, requireWriteLocking, self, setContainer, toXML |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.ozoneDB.collections.OzoneMap |
ozoneEntrySet, ozoneKeySet, ozoneValues, putAll |
Methods inherited from interface java.util.Map |
equals, hashCode, isEmpty |
Methods inherited from interface org.ozoneDB.OzoneCompatibleOrProxy |
getObjectID |
Field Detail |
protected BaseTreeMap owner
Constructor Detail |
public _BaseTreeMap_SubMapImpl(BaseTreeMap owner, java.lang.Object minKey, java.lang.Object maxKey)
minKey
- the lower boundmaxKey
- the upper bound
java.lang.IllegalArgumentException
- if minKey > maxKeyMethod Detail |
public final boolean keyInRange(java.lang.Object key)
keyInRange
in interface _BaseTreeMap_SubMap
key
- the key to check
public void clear()
AbstractOzoneMap
AbstractMap.clear
unless you want an infinite loop.
clear
in interface OzoneMap
clear
in class AbstractOzoneMap
Set.clear()
public java.util.Comparator comparator()
comparator
in interface java.util.SortedMap
public boolean containsKey(java.lang.Object key)
AbstractOzoneMap
entrySet()
, returning true
if a match
is found, false
if the iteration ends. Many subclasses
can implement this more efficiently.
containsKey
in interface java.util.Map
containsKey
in class AbstractOzoneMap
key
- the key to search for
AbstractOzoneMap.containsValue(Object)
public boolean containsValue(java.lang.Object value)
AbstractOzoneMap
entrySet()
, returning true
if a match
is found, false
if the iteration ends. A match is
defined as (value == null ? v == null : value.equals(v))
Subclasses are unlikely to implement this more efficiently.
containsValue
in interface java.util.Map
containsValue
in class AbstractOzoneMap
value
- the value to search for
AbstractOzoneMap.containsKey(Object)
public java.util.Set entrySet()
AbstractOzoneMap
Iterator.remove
, Set.remove
,
removeAll
, retainAll
, and clear
.
Element addition is not supported via this set.
entrySet
in interface java.util.Map
entrySet
in class AbstractOzoneMap
Map.Entry
public java.lang.Object firstKey()
firstKey
in interface java.util.SortedMap
public java.lang.Object get(java.lang.Object key)
AbstractOzoneMap
null
if
there is no mapping. However, in Maps that accept null values, you
must rely on containsKey
to determine if a mapping exists.
This iteration takes linear time, searching entrySet().iterator() of
the key. Many implementations override this method.
get
in interface java.util.Map
get
in class AbstractOzoneMap
key
- the key to look up
AbstractOzoneMap.containsKey(Object)
public java.util.SortedMap headMap(java.lang.Object toKey)
headMap
in interface java.util.SortedMap
public java.util.Set keySet()
AbstractOzoneMap
This implementation creates an AbstractSet, where the iterator wraps the entrySet iterator, size defers to the Map's size, and contains defers to the Map's containsKey. The set is created on first use, and returned on subsequent uses, although since no synchronization occurs, there is a slight possibility of creating two sets.
keySet
in interface java.util.Map
keySet
in class AbstractOzoneMap
Set.iterator()
,
AbstractOzoneMap.size()
,
AbstractOzoneMap.containsKey(Object)
,
AbstractOzoneMap.values()
public java.lang.Object lastKey()
lastKey
in interface java.util.SortedMap
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
AbstractOzoneMap
null
values, a null return does not always
imply that the mapping was created.
put
in interface OzoneMap
put
in class AbstractOzoneMap
key
- the key to mapvalue
- the value to be mapped
AbstractOzoneMap.containsKey(Object)
public java.lang.Object remove(java.lang.Object key)
AbstractOzoneMap
remove
method.
It returns the result of getValue()
on the entry, if found,
or null if no entry is found. Note that maps which permit null values
may also return null if the key was removed. If the entrySet does not
support removal, this will also fail. This is O(n), so many
implementations override it for efficiency.
remove
in interface OzoneMap
remove
in class AbstractOzoneMap
key
- the key to remove
Iterator.remove()
public int size()
AbstractOzoneMap
entrySet().size()
.
size
in interface java.util.Map
size
in class AbstractOzoneMap
Set.size()
public java.util.SortedMap subMap(java.lang.Object fromKey, java.lang.Object toKey)
subMap
in interface java.util.SortedMap
public java.util.SortedMap tailMap(java.lang.Object fromKey)
tailMap
in interface java.util.SortedMap
public java.util.Collection values()
AbstractOzoneMap
This implementation creates an AbstractCollection, where the iterator wraps the entrySet iterator, size defers to the Map's size, and contains defers to the Map's containsValue. The collection is created on first use, and returned on subsequent uses, although since no synchronization occurs, there is a slight possibility of creating two collections.
values
in interface java.util.Map
values
in class AbstractOzoneMap
Collection.iterator()
,
AbstractOzoneMap.size()
,
AbstractOzoneMap.containsValue(Object)
,
AbstractOzoneMap.keySet()
public java.util.Map getClientMap()
Returns a Map
that contains the same entries as this
persistent one; it is (by nature of the client-server enviromnent) always
a 'deep' copy of this OzoneMap
. I.e. the contents of
this OzoneMap
instance are always copied to the client
by use of serialization.
getClientMap
in interface OzoneMap
public java.util.SortedMap getClientSortedMap()
Returns a SortedMap
that contains the same entries as this
persistent one; it is (by nature of the client-server enviromnent) always
a 'deep' copy of this OzoneSortedMap
. I.e. the contents of
this OzoneSortedMap
instance are always copied to the client
by use of serialization.
getClientSortedMap
in interface OzoneSortedMap
public java.lang.Object getMinKey()
getMinKey
in interface _BaseTreeMap_SubMap
public java.lang.Object getMaxKey()
getMaxKey
in interface _BaseTreeMap_SubMap
public BaseTreeMap getOwner()
getOwner
in interface _BaseTreeMap_SubMap
public OzoneSortedMap ozoneHeadMap(java.lang.Object toKey)
Basically nothing more than a typecasted HeadMap
method.
Because subsets are also OzoneSortedMap
s, this method is
provided to do away with the need for a typecast.
ozoneHeadMap
in interface OzoneSortedMap
public OzoneSortedMap ozoneSubMap(java.lang.Object fromKey, java.lang.Object toKey)
Basically nothing more than a typecasted SubMap
method.
Because subsets are also OzoneSortedMap
s, this method is
provided to do away with the need for a typecast.
ozoneSubMap
in interface OzoneSortedMap
public OzoneSortedMap ozoneTailMap(java.lang.Object toKey)
Basically nothing more than a typecasted TailMap
method.
OzoneSortedMap
s, this method is
provided to do away with the need for a typecast.
ozoneTailMap
in interface OzoneSortedMap
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |