org.apache.ojb.broker.util
Class DoubleHashtable

java.lang.Object
  extended by org.apache.ojb.broker.util.DoubleHashtable

public class DoubleHashtable
extends java.lang.Object

this class can be used to build two-way lookup tables. It provides lookup from keys to values and the inverse lookup from values to keys.

Version:
$Id: DoubleHashtable.java 365232 2005-12-21 22:36:07Z tomdz $
Author:
Thomas Mahler

Constructor Summary
DoubleHashtable()
          public default constructor.
 
Method Summary
 java.lang.Object getKeyByValue(java.lang.Object value)
          lookup a key from the table by its value.
 java.lang.Object getValueByKey(java.lang.Object key)
          lookup a value from the table by its key.
 void put(java.lang.Object key, java.lang.Object value)
          put a (key, value) pair into the table.
 void removeByKey(java.lang.Object key)
          remove a (key, value)-entry by its key
 void removeByValue(java.lang.Object value)
          remove a (key, value)-entry by its value
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleHashtable

public DoubleHashtable()
public default constructor.

Method Detail

put

public void put(java.lang.Object key,
                java.lang.Object value)
put a (key, value) pair into the table.

Parameters:
key - the key object.
value - the value object.

getValueByKey

public java.lang.Object getValueByKey(java.lang.Object key)
lookup a value from the table by its key.

Parameters:
key - the key object
Returns:
the associated value object

getKeyByValue

public java.lang.Object getKeyByValue(java.lang.Object value)
lookup a key from the table by its value.

Parameters:
value - the value object
Returns:
the associated key object

removeByKey

public void removeByKey(java.lang.Object key)
remove a (key, value)-entry by its key

Parameters:
key - the key object

removeByValue

public void removeByValue(java.lang.Object value)
remove a (key, value)-entry by its value

Parameters:
value - the value object


(C) 2002 - 2006 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30