Nitido Inc.

com.nitido.util
Class OpenSerializableHash

java.lang.Object
  extended by com.nitido.util.OpenSerializableHash
All Implemented Interfaces:
java.io.Serializable

public class OpenSerializableHash
extends java.lang.Object
implements java.io.Serializable

A Hashtable that allows more than one value associated to a key and each value must be serializable.

See Also:
Serialized Form

Constructor Summary
OpenSerializableHash()
          Constructs a new, empty OpenSerializableHash.
OpenSerializableHash(java.util.Hashtable hash)
          Constructs a new OpenSerializableHash, copying the contents of the passed in Hashtable object into the OpenSerializableHash.
OpenSerializableHash(OpenHash hash)
          Constructs a new OpenSerializableHash, copying the contents of the passed in OpenHash object into the OpenSerializableHash.
 
Method Summary
 void clear()
          This method removes all entries from the hashtable.
 boolean containsKey(java.io.Serializable key)
          Returns true if this OpenSerializableHash contains a key equal to the one passed in.
 boolean containsValue(java.io.Serializable value)
          Returns true if this OpenSerializableHash contains the given value.
 boolean containsValue(java.io.Serializable key, java.io.Serializable value)
          Returns true if this OpenSerializableHash contains the given value with the given key.
 java.io.Serializable get(java.io.Serializable key)
          This method retrieves the first value which corresponds to the key given, or null if no value is mapped to that key.
 java.util.Enumeration getKeys()
          Returns an Enumeration of all of the keys in this OpenSerializableHash.
 java.util.Enumeration getValues(java.io.Serializable key)
          Returns an enumeration of values for the given key.
 java.util.Vector getValuesVector(java.io.Serializable key)
          Returns a vector of the values for the given key.
 java.util.Enumeration keys()
          Convenience alias to getKeys() for Hashtable users.
 void put(java.io.Serializable key, java.io.Serializable value)
          This method maps a key to a value in the hashtable.
 java.util.Vector remove(java.io.Serializable key)
          Removes all the values that are associated with the given key.
 java.io.Serializable remove(java.io.Serializable key, java.io.Serializable value)
          Removes the key/value pair specified.
 void setValues(java.lang.Object key, java.util.Collection values)
          This method replace all old mapped values with the new ones.
 int size()
          Returns the number of keys in this OpenSerializableHash.
 java.lang.String toString()
          Utility method for displaying the content of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OpenSerializableHash

public OpenSerializableHash()
Constructs a new, empty OpenSerializableHash.


OpenSerializableHash

public OpenSerializableHash(java.util.Hashtable hash)
Constructs a new OpenSerializableHash, copying the contents of the passed in Hashtable object into the OpenSerializableHash. Any items that are in the Hashtable that are not Serializable will be ignored.

Parameters:
hash - The Hashtable whose contents are copied into this OpenSerializableHash.

OpenSerializableHash

public OpenSerializableHash(OpenHash hash)
Constructs a new OpenSerializableHash, copying the contents of the passed in OpenHash object into the OpenSerializableHash. Any items that are in the OpenHash that are not Serializable will be ignored.

Parameters:
hash - The Hashtable whose contents are copied into this OpenSerializableHash.
Method Detail

get

public java.io.Serializable get(java.io.Serializable key)
This method retrieves the first value which corresponds to the key given, or null if no value is mapped to that key.

Parameters:
key - A key in the hashtable.
Returns:
The first mapping or null if there is none.

getKeys

public java.util.Enumeration getKeys()
Returns an Enumeration of all of the keys in this OpenSerializableHash.

Returns:
Returns an Enumeration of all of the keys in this OpenSerializableHash.

keys

public java.util.Enumeration keys()
Convenience alias to getKeys() for Hashtable users.


getValues

public java.util.Enumeration getValues(java.io.Serializable key)
Returns an enumeration of values for the given key.

Parameters:
key - A key in the hashtable.
Returns:
An enumeration of the values for the key.

getValuesVector

public java.util.Vector getValuesVector(java.io.Serializable key)
Returns a vector of the values for the given key.


containsValue

public boolean containsValue(java.io.Serializable value)
Returns true if this OpenSerializableHash contains the given value.

Parameters:
value - The value to check for in this OpenSerializableHash.
Returns:
True if the value is found in the OpenSerializableHash, otherwise false.

containsValue

public boolean containsValue(java.io.Serializable key,
                             java.io.Serializable value)
Returns true if this OpenSerializableHash contains the given value with the given key.

Parameters:
key - The key to search for in this OpenSerializableHash.
value - The value to search for in this OpenSerializableHash.
Returns:
Returns true if the key/value pair is found, otherwise returns false.

containsKey

public boolean containsKey(java.io.Serializable key)
Returns true if this OpenSerializableHash contains a key equal to the one passed in.

Parameters:
key - The key to check.
Returns:
True if the key is found, false otherwise.

size

public int size()
Returns the number of keys in this OpenSerializableHash.

Returns:
The number of keys in this OpenSerializableHash.

put

public void put(java.io.Serializable key,
                java.io.Serializable value)
This method maps a key to a value in the hashtable.

Parameters:
key - The object to be used as a key in the mapping.
value - The object which the key is being mapped to.

remove

public java.util.Vector remove(java.io.Serializable key)
Removes all the values that are associated with the given key.

Parameters:
key - the key to be removed.
Returns:
A Vector containing the objects removed from this OpenSerializableHash, or null if there was no such key.

remove

public java.io.Serializable remove(java.io.Serializable key,
                                   java.io.Serializable value)
Removes the key/value pair specified.

Parameters:
key - The key in the key/value pair to remove.
value - The value in the key/value pair to remove.
Returns:
The element removed, or null if no matching key/value pair was found.

setValues

public void setValues(java.lang.Object key,
                      java.util.Collection values)
This method replace all old mapped values with the new ones.

Parameters:
key - The object to be used as a key in the mapping.
values - The collection of values to be associated to the key.

clear

public void clear()
This method removes all entries from the hashtable.


toString

public java.lang.String toString()
Utility method for displaying the content of this object.

Overrides:
toString in class java.lang.Object

Nitido NiM 2.5 Java API

These JavaDoc pages are generated for release/nim_2_5-2.5.44

Copyright © 1999-2009 Nitido Inc.    Proprietary and Confidential.    All Rights Reserved.