org.apache.batik.dom.util

Class DoublyIndexedTable

public class DoublyIndexedTable extends Object

This class represents a doubly indexed hash table.
Nested Class Summary
static classDoublyIndexedTable.Entry
An entry in the {@link DoublyIndexedTable}.
protected classDoublyIndexedTable.TableIterator
An Iterator class for a {@link DoublyIndexedTable}.
Field Summary
protected intcount
The number of entries
protected intinitialCapacity
The initial capacity
protected DoublyIndexedTable.Entry[]table
The underlying array
Constructor Summary
DoublyIndexedTable()
Creates a new DoublyIndexedTable.
DoublyIndexedTable(int c)
Creates a new DoublyIndexedTable.
DoublyIndexedTable(DoublyIndexedTable other)
Creates a new DoublyIndexedTable initialized to contain all of the entries of the specified other DoublyIndexedTable.
Method Summary
voidclear()
Clears the table.
Objectget(Object o1, Object o2)
Gets the value of an entry
Object[]getValuesArray()
Returns an array of all of the values in the table.
protected inthashCode(Object o1, Object o2)
Computes a hash code corresponding to the given objects.
Iteratoriterator()
Returns an iterator on the entries of the table.
Objectput(Object o1, Object o2, Object value)
Puts a value in the table.
protected voidrehash()
Rehash the table
Objectremove(Object o1, Object o2)
Removes an entry from the table.
intsize()
Returns the size of this table.

Field Detail

count

protected int count
The number of entries

initialCapacity

protected int initialCapacity
The initial capacity

table

protected DoublyIndexedTable.Entry[] table
The underlying array

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

clear

public void clear()
Clears the table.

get

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

Returns: the value or null

getValuesArray

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

hashCode

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

iterator

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

put

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

Returns: the old value or null

rehash

protected void rehash()
Rehash the table

remove

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

Returns: the value or null

size

public int size()
Returns the size of this table.
Copyright B) 2007 Apache Software Foundation. All Rights Reserved.