org.apache.batik.dom.util
Class IntTable

java.lang.Object
  extended by org.apache.batik.dom.util.IntTable
All Implemented Interfaces:
Serializable

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.

See Also:
Serialized Form

Nested Class Summary
protected static class IntTable.Entry
          To manage collisions.
 
Field Summary
protected  int count
          The number of entries
protected static int INITIAL_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
 void clear()
          Clears the table.
 int dec(Object key)
          Decrements the value associated with the given key.
protected  IntTable.Entry find(Object key)
          Finds the Entry with the given key.
 int get(Object key)
          Returns the value associated with the given key.
 int inc(Object key)
          Increments the value associated with the given key.
 int put(Object key, int value)
          Sets the value associated with the given key.
protected  void rehash()
          Rehashes the table.
 int remove(Object key)
          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

INITIAL_CAPACITY

protected static final int INITIAL_CAPACITY
The initial capacity

See Also:
Constant Field Values

table

protected IntTable.Entry[] table
The underlying array


count

protected int count
The number of entries

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

size

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


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.


put

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


inc

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


dec

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


remove

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


clear

public void clear()
Clears the table.


rehash

protected void rehash()
Rehashes the table.



Copyright © 2008 Apache Software Foundation. All Rights Reserved.