|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.globus.common.MVHashtable
public class MVHashtable
MVHashtable is an implementation of a multi-valued hashtable. Each entry of the hashtable is identified by a String key. Besides the key being a String rather than an object, MVHashtable differs from Hashtable in that it maps a single key to multiple values. Each attribute uses a vector for storing multiple values under the same key. Methods are available which help access and manipulate the entries. Where possible, methods are named analogous to similar methods in Hashtable.
Field Summary | |
---|---|
protected Hashtable |
attribs
holds the attributes of the MVHashtable |
Constructor Summary | |
---|---|
MVHashtable()
Default Constructor creates empty MVHashtable. |
|
MVHashtable(int initialSize)
Initial-size Constructor creates empty MVHashtable with specified initial size. |
|
MVHashtable(MVHashtable multivaluedHashtable)
Copy Constructor |
Method Summary | |
---|---|
void |
add(MVHashtable multivaluedHashtable)
Adds attributes that are stored in a seperate MVHashtable object. |
void |
add(String key,
Object value)
Adds a single value to the specified key. |
void |
add(String key,
Object[] values)
Adds multiple values to the attribute associated with the given key. |
void |
add(String key,
Vector values)
Adds multiple values to the attribute associated with the given key. |
void |
clear()
Deletes all attributes. |
boolean |
contains(String key,
Object value)
Returns true if the given value is stored under a specific attribute. |
boolean |
containsName(String key)
Returns true if the attribute associated with the given key exists. |
Vector |
get(String key)
Returns a vector of values for a specific attribute. |
Object |
getFirstValue(String key)
Returns the first value for a specific attribute. |
Vector |
getKeys()
Returns a vector of the keys. |
Object |
getLastValue(String key)
Returns the last value for a specific attribute. |
Object |
getValueAt(String key,
int index)
Returns a value at the given position index for a specific attribute. |
Enumeration |
keys()
Returns an enumeration of all attribute keys. |
void |
print()
Prints out the contents of the data structure. |
Object |
remove(String key)
Remove an attribute and all values associated with it. |
Object |
remove(String key,
int index)
Removes a value at the specified index within the attribute. |
boolean |
remove(String key,
Object value)
Removes a particular value within an attribute. |
Vector |
set(String key,
Object value)
Sets a new value for the specified attribute. |
int |
size()
Returns the number of attributes. |
int |
size(String key)
Returns the number of entries for an attribute. |
String |
toString()
Converts the internal data structure to a string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Hashtable attribs
Constructor Detail |
---|
public MVHashtable()
public MVHashtable(int initialSize)
initialSize
- the initial capacity of the hashtable.public MVHashtable(MVHashtable multivaluedHashtable)
multivaluedHashtable
- the MVHashtable that will start as the base of
this new MVHashtableMethod Detail |
---|
public Vector set(String key, Object value)
key
- the attribute key.value
- the entry value.
Vector
of previous values associated with
the attribute. Null, if the attribute was not associated
with any values.public void add(String key, Object value)
key
- the attribute key.value
- the value to add.public void add(String key, Object[] values)
key
- the attribute key.values
- the array of values.public void add(String key, Vector values)
key
- the attribute key.values
- the Vector of values to add.public void add(MVHashtable multivaluedHashtable)
multivaluedHashtable
- The to-be-absorbed MVHashtablepublic Object remove(String key)
key
- the attribute key.
public boolean remove(String key, Object value)
key
- the attribute key.value
- the value to delete.
public Object remove(String key, int index)
key
- the attribute key.index
- the index of the value to delete.
public void clear()
public int size()
int
the number of attributespublic int size(String key)
key
- The attribute key.
int
the number of entries of the attributepublic boolean containsName(String key)
key
- The attribute key.
boolean
true if attribute exists, false if notpublic boolean contains(String key, Object value)
key
- the attribute key.value
- the entry value.
boolean
true if value is stored under specified attributepublic Enumeration keys()
Enumeration
of all attribute keyspublic Vector getKeys()
Vector
of keyspublic Vector get(String key)
key
- the attribute key.
Vector
of values for the specified attributepublic Object getFirstValue(String key)
key
- the attribute key.
Object
the first value for the specified attributepublic Object getLastValue(String key)
key
- the attribute key.
Object
the last value for the specified attributepublic Object getValueAt(String key, int index)
key
- the attribute key.index
- the index of the value to return for the attribute.
Object
the value at the specified index position
of the specified attribute. Null if not found.public void print()
public String toString()
toString
in class Object
String
a string representation of this structure.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |