com.plumtree.openfoundation.util
Interface IXPDictionary

All Known Implementing Classes:
XPHashtable, XPSortedDictionary, XPSynchronizedHashtable

public interface IXPDictionary

The IXPDictionary class is the abstract parent of any class, such as IXPHashtable, which maps keys to values. Every key and every value is an object. In any one IXPDictionary object, every key is associated with at most one value. Given a IXPDictionary and a key, the associated element can be looked up. Any non-null object can be used as a key and as a value.

As a rule, the equals method should be used by implementations of this class to decide if two keys are the same.


Method Summary
 boolean ContainsKey(java.lang.Object key)
          Returns if the input key exists in this IXPDictionary.
 java.lang.Object GetElement(java.lang.Object key)
          Returns the value to which the key is mapped in this dictionary.
 IXPEnumerator GetElements()
          Returns an enumeration of the Elements in this IXPDictionary.
 IXPDictionaryEnumerator GetEnumerator()
          Returns IXPDictionaryEnumerator for this dictionary, each of whose elements is an XPDictionaryEntry.
 IXPEnumerator GetKeys()
          Returns an enumeration of the keys in this IXPDictionary.
 int GetSize()
          Returns the number of entries (dinstint keys) in this dictionary.
 java.lang.Object PutElement(java.lang.Object key, java.lang.Object _value)
          Removes the key (and its corresponding value) from this dictionary.
 java.lang.Object RemoveElement(java.lang.Object key)
          Removes the key (and its corresponding value) from this dictionary.
 

Method Detail

ContainsKey

public boolean ContainsKey(java.lang.Object key)
Returns if the input key exists in this IXPDictionary.

Parameters:
key - to be verified in the IXPDictionary.
Returns:
true if Key exists in this IXPDictionary or false if not.

GetKeys

public IXPEnumerator GetKeys()
Returns an enumeration of the keys in this IXPDictionary. The general contract for the keys method is that an IXPEnumerator object is returned that will generate all the keys for which this IXPDictionary contains entries.

Returns:
an enumeration of the keys in this dictionary.

GetElements

public IXPEnumerator GetElements()
Returns an enumeration of the Elements in this IXPDictionary.

Returns:
an IXPEnumerator over the elements of this dictionary.

GetEnumerator

public IXPDictionaryEnumerator GetEnumerator()
Returns IXPDictionaryEnumerator for this dictionary, each of whose elements is an XPDictionaryEntry.

Returns:
IXPDictionaryEnumerator

GetElement

public java.lang.Object GetElement(java.lang.Object key)
Returns the value to which the key is mapped in this dictionary. The general contract for the isEmpty method is that if this dictionary contains an entry for the specified key, the associated value is returned; otherwise, null is returned.

Parameters:
key - a key in this dictionary. null if the key is not mapped to any value in this dictionary.
Returns:
the value to which the key is mapped in this dictionary;
Throws:
java.lang.NullPointerException - if the key is null.

PutElement

public java.lang.Object PutElement(java.lang.Object key,
                                   java.lang.Object _value)
Removes the key (and its corresponding value) from this dictionary. This method does nothing if the key is not in this dictionary.

Parameters:
key - the key that needs to be added.
_value - The Value to be associated with the key.
Returns:
the value to which the key had been mapped in this dictionary.

RemoveElement

public java.lang.Object RemoveElement(java.lang.Object key)
Removes the key (and its corresponding value) from this dictionary. This method does nothing if the key is not in this dictionary.

Parameters:
key - the key that needs to be removed.
Returns:
the value to which the key had been mapped in this dictionary, or null if the key did not have a mapping.
Throws:
java.lang.NullPointerException - if key is null.

GetSize

public int GetSize()
Returns the number of entries (dinstint keys) in this dictionary.

Returns:
the number of keys in this dictionary.


Copyright 2002, 2003, 2004 Plumtree Software Inc. All Rights Reserved.