org.apache.batik.dom.util

Class IntTable

public class IntTable extends Object implements Serializable

A simple hashtable, not synchronized, with fixed load factor, that maps objects to ints. This implementation is not Thread-safe.
Nested Class Summary
protected static classIntTable.Entry
To manage collisions.
Field Summary
protected intcount
The number of entries
protected static intINITIAL_CAPACITY
The initial capacity
protected IntTable.Entry[]table
The underlying array
Constructor Summary
IntTable()
Creates a new table.
IntTable(int c)
Creates a new table.
IntTable(IntTable t)
Creates a copy of the given HashTable object.
Method Summary
voidclear()
Clears the table.
intdec(Object key)
Decrements the value associated with the given key.
protected IntTable.Entryfind(Object key)
Finds the Entry with the given key.
intget(Object key)
Returns the value associated with the given key.
intinc(Object key)
Increments the value associated with the given key.
intput(Object key, int value)
Sets the value associated with the given key.
protected voidrehash()
Rehashes the table.
intremove(Object key)
Removes an entry from the table.
intsize()
Returns the size of this table.

Field Detail

count

protected int count
The number of entries

INITIAL_CAPACITY

protected static final int INITIAL_CAPACITY
The initial capacity

table

protected IntTable.Entry[] table
The underlying array

Constructor Detail

IntTable

public IntTable()
Creates a new table.

IntTable

public IntTable(int c)
Creates a new table.

Parameters: c The initial capacity.

IntTable

public IntTable(IntTable t)
Creates a copy of the given HashTable object.

Parameters: t The table to copy.

Method Detail

clear

public void clear()
Clears the table.

dec

public int dec(Object key)
Decrements the value associated with the given key.

find

protected IntTable.Entry find(Object key)
Finds the Entry with the given key.

get

public int get(Object key)
Returns the value associated with the given key.

inc

public int inc(Object key)
Increments the value associated with the given key.

put

public int put(Object key, int value)
Sets the value associated with the given key.

rehash

protected void rehash()
Rehashes the table.

remove

public int remove(Object key)
Removes an entry from the table.

size

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