Package org.apache.batik.util
Class DoublyIndexedTable
- java.lang.Object
-
- org.apache.batik.util.DoublyIndexedTable
-
public class DoublyIndexedTable extends java.lang.ObjectThis class represents a doubly indexed hash table.- Version:
- $Id: DoublyIndexedTable.java 1804130 2017-08-04 14:41:11Z ssteiner $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDoublyIndexedTable.EntryAn entry in theDoublyIndexedTable.protected classDoublyIndexedTable.TableIteratorAn Iterator class for aDoublyIndexedTable.
-
Field Summary
Fields Modifier and Type Field Description protected intcountThe number of entriesprotected intinitialCapacityThe initial capacityprotected DoublyIndexedTable.Entry[]tableThe underlying array
-
Constructor Summary
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears the table.java.lang.Objectget(java.lang.Object o1, java.lang.Object o2)Gets the value of an entryjava.lang.Object[]getValuesArray()Returns an array of all of the values in the table.protected inthashCode(java.lang.Object o1, java.lang.Object o2)Computes a hash code corresponding to the given objects.java.util.Iteratoriterator()Returns an iterator on the entries of the table.java.lang.Objectput(java.lang.Object o1, java.lang.Object o2, java.lang.Object value)Puts a value in the table.protected voidrehash()Rehash the tablejava.lang.Objectremove(java.lang.Object o1, java.lang.Object o2)Removes an entry from the table.intsize()Returns the size of this table.
-
-
-
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 java.lang.Object put(java.lang.Object o1, java.lang.Object o2, java.lang.Object value)Puts a value in the table.- Returns:
- the old value or null
-
get
public java.lang.Object get(java.lang.Object o1, java.lang.Object o2)Gets the value of an entry- Returns:
- the value or null
-
remove
public java.lang.Object remove(java.lang.Object o1, java.lang.Object o2)Removes an entry from the table.- Returns:
- the value or null
-
getValuesArray
public java.lang.Object[] getValuesArray()
Returns an array of all of the values in the table.
-
clear
public void clear()
Clears the table.
-
iterator
public java.util.Iterator iterator()
Returns an iterator on the entries of the table.
-
rehash
protected void rehash()
Rehash the table
-
hashCode
protected int hashCode(java.lang.Object o1, java.lang.Object o2)Computes a hash code corresponding to the given objects.
-
-