org.apache.batik.util
Class DoublyIndexedTable

java.lang.Object
  extended by org.apache.batik.util.DoublyIndexedTable

public class DoublyIndexedTable
extends Object

This class represents a doubly indexed hash table.


Nested Class Summary
static class DoublyIndexedTable.Entry
          An entry in the DoublyIndexedTable.
protected  class DoublyIndexedTable.TableIterator
          An Iterator class for a DoublyIndexedTable.
 
Field Summary
protected  int count
          The number of entries
protected  int initialCapacity
          The initial capacity
protected  DoublyIndexedTable.Entry[] table
          The underlying array
 
Constructor Summary
DoublyIndexedTable()
          Creates a new DoublyIndexedTable.
DoublyIndexedTable(DoublyIndexedTable other)
          Creates a new DoublyIndexedTable initialized to contain all of the entries of the specified other DoublyIndexedTable.
DoublyIndexedTable(int c)
          Creates a new DoublyIndexedTable.
 
Method Summary
 void clear()
          Clears the table.
 Object get(Object o1, Object o2)
          Gets the value of an entry
 Object[] getValuesArray()
          Returns an array of all of the values in the table.
protected  int hashCode(Object o1, Object o2)
          Computes a hash code corresponding to the given objects.
 Iterator iterator()
          Returns an iterator on the entries of the table.
 Object put(Object o1, Object o2, Object value)
          Puts a value in the table.
protected  void rehash()
          Rehash the table
 Object remove(Object o1, Object o2)
          Removes an entry from the table.
 int size()
          Returns the size of this table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

initialCapacity

protected int initialCapacity
The initial capacity


table

protected DoublyIndexedTable.Entry[] table
The underlying array


count

protected int count
The number of entries

Constructor Detail

DoublyIndexedTable

public DoublyIndexedTable()
Creates a new DoublyIndexedTable.


DoublyIndexedTable

public DoublyIndexedTable(int c)
Creates a new DoublyIndexedTable.

Parameters:
c - The inital capacity.

DoublyIndexedTable

public DoublyIndexedTable(DoublyIndexedTable other)
Creates a new DoublyIndexedTable initialized to contain all of the entries of the specified other DoublyIndexedTable.

Method Detail

size

public int size()
Returns the size of this table.


put

public Object put(Object o1,
                  Object o2,
                  Object value)
Puts a value in the table.

Returns:
the old value or null

get

public Object get(Object o1,
                  Object o2)
Gets the value of an entry

Returns:
the value or null

remove

public Object remove(Object o1,
                     Object o2)
Removes an entry from the table.

Returns:
the value or null

getValuesArray

public Object[] getValuesArray()
Returns an array of all of the values in the table.


clear

public void clear()
Clears the table.


iterator

public Iterator iterator()
Returns an iterator on the entries of the table.


rehash

protected void rehash()
Rehash the table


hashCode

protected int hashCode(Object o1,
                       Object o2)
Computes a hash code corresponding to the given objects.



Copyright © 2008 Apache Software Foundation. All Rights Reserved.