org.apache.ojb.broker.util
Class DoubleHashtable

java.lang.Object
  extended byorg.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,v 1.2 2002/06/17 19:34:24 jvanzyl Exp $
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
clone, equals, finalize, 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


Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14