|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.plumtree.openfoundation.util.XPSortedDictionary
public class XPSortedDictionary
Implements a collection of key-value mappings, maintained in order of the keys, which should be all of the same type (e.g. String or Integer). The implementation depends on java.util.TreeMap, which notes: All keys inserted into the map must implement the Comparable interface. Furthermore, all such keys must be mutually comparable: k1.compareTo(k2) must not throw a ClassCastException for any elements k1 and k2 in the map.
Constructor Summary | |
---|---|
XPSortedDictionary()
Constructs a new, empty XPSortedDictionary, sorted according to the keys' natural order. |
|
XPSortedDictionary(java.util.TreeMap treeMap)
Takes the Red-Black tree based implementation of the SortedMap interface.This class guarantees that the map will be in ascending key order, sorted according to the natural order for the key's class (see Comparable), or by the comparator provided at creation time, depending on which constructor is used. |
Method Summary | |
---|---|
void |
Clear()
Removes all mappings from this TreeMap. |
boolean |
ContainsKey(java.lang.Object key)
Returns if the input key exists in this IXPDictionary. |
boolean |
ContainsValue(java.lang.Object _value)
Returns true if this map maps one or more keys to the specified value. |
java.lang.Object |
GetElement(java.lang.Object key)
Return the object mapped to this key, or null if the key is not present in this XPSortedDictionary instance. |
IXPEnumerator |
GetElements()
Returns an enumeration of the Elements in this IXPDictionary. |
IXPDictionaryEnumerator |
GetEnumerator()
Returns IXPDictionaryEnumerator for this dictionary. |
IXPEnumerator |
GetKeys()
Returns an enumeration of the keys in this IXPDictionary. |
int |
GetSize()
Returns the number of entries (dinstint keys) in this dictionary. |
java.util.Map |
GetUnderlyingObject()
|
boolean |
IsEmpty()
Returns true if this map contains no key-value mappings. |
java.lang.Object |
PutElement(java.lang.Object key,
java.lang.Object _value)
Store an object in this XPSortedDictionary instance. |
java.lang.Object |
RemoveElement(java.lang.Object key)
Removes the key (and its corresponding
value ) from this dictionary. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XPSortedDictionary()
public XPSortedDictionary(java.util.TreeMap treeMap)
treeMap
- Red-Black tree based TreeMap.Method Detail |
---|
public void Clear()
public boolean ContainsKey(java.lang.Object key)
IXPDictionary
ContainsKey
in interface IXPDictionary
key
- to be verified in the IXPDictionary.
public boolean ContainsValue(java.lang.Object _value)
_value
- value whose presence in this Map is to be tested.
public IXPEnumerator GetElements()
IXPDictionary
GetElements
in interface IXPDictionary
public IXPEnumerator GetKeys()
IXPDictionary
GetKeys
in interface IXPDictionary
public IXPDictionaryEnumerator GetEnumerator()
GetEnumerator
in interface IXPDictionary
public java.lang.Object GetElement(java.lang.Object key)
GetElement
in interface IXPDictionary
key
- a key in this dictionary.
null
if the key is not mapped to any value in
this dictionary.
public boolean IsEmpty()
This implementation returns size() == 0.
public java.lang.Object PutElement(java.lang.Object key, java.lang.Object _value)
PutElement
in interface IXPDictionary
key
- key with which the specified value is to be associated._value
- value to be associated with the specified key.
XPClassCastException
- if the key is of a type which
is not comparable with the pre-existing keys in the map.public java.lang.Object RemoveElement(java.lang.Object key)
IXPDictionary
key
(and its corresponding
value
) from this dictionary. This method does nothing
if the key
is not in this dictionary.
RemoveElement
in interface IXPDictionary
key
- the key that needs to be removed.
key
had been mapped in this
dictionary, or null
if the key did not have a
mapping.public int GetSize()
IXPDictionary
GetSize
in interface IXPDictionary
public java.util.Map GetUnderlyingObject()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |