com.xavax.xstore.util
Class RDictionary

Object
  extended byRDictionary

public class RDictionary
extends Object

RDictionary is a reverse dictionary that allows looking up keys by value as well as looking up values by key.


Constructor Summary
RDictionary()
          Construct an RDictionary.
RDictionary(NamedValue[] pairs)
          Construct an RDictionary from an array of name:value pairs.
 
Method Summary
 void add(NamedValue nv)
          Add a name:value pair to the dictionary.
 void add(NamedValue[] pairs)
          Add an array of name:value pairs to the dictionary.
 void add(String name, int ivalue)
          Add a name:value pair to the dictionary.
 void add(String name, Object value)
          Add a name:value pair to the dictionary.
 void clear()
          Remove all entries from the dictionary.
 int intValue(String name)
          Returns the integer value matching the specified key if it exists.
 String name(int ivalue)
          Returns the name matching the specified integer value if it exists.
 String name(Object value)
          Returns the name (key) matching the specified value if it exists.
 String toString()
          Returns a string representation of the contents of this dictionary.
 Object value(String name)
          Returns the value matching the specified key if it exists.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RDictionary

public RDictionary()
Construct an RDictionary.


RDictionary

public RDictionary(NamedValue[] pairs)
Construct an RDictionary from an array of name:value pairs.

Method Detail

add

public void add(NamedValue nv)
Add a name:value pair to the dictionary.

Parameters:
nv - the name:value pair to be added.

add

public void add(String name,
                Object value)
Add a name:value pair to the dictionary.

Parameters:
name - the name to be added.
value - the value to be added.

add

public void add(String name,
                int ivalue)
Add a name:value pair to the dictionary.

Parameters:
name - the name to be added.
ivalue - the integer value to be added.

add

public void add(NamedValue[] pairs)
Add an array of name:value pairs to the dictionary.

Parameters:
pairs - the name:value pairs to be added.

name

public String name(Object value)
Returns the name (key) matching the specified value if it exists.

Parameters:
value - the value to be found.
Returns:
the name matching the specified value.

name

public String name(int ivalue)
Returns the name matching the specified integer value if it exists.

Parameters:
ivalue - the integer value to be found.
Returns:
the name matching the specified value.

value

public Object value(String name)
Returns the value matching the specified key if it exists.

Parameters:
name - the key to be found.
Returns:
the value matching the specified key if it exists.

intValue

public int intValue(String name)
Returns the integer value matching the specified key if it exists.

Parameters:
name - the key to be found.
Returns:
the integer value matching the specified key if it exists.

clear

public void clear()
Remove all entries from the dictionary.


toString

public String toString()
Returns a string representation of the contents of this dictionary.