Class IntTable

java.lang.Object
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.
Version:
$Id: IntTable.java 1733416 2016-03-03 07:07:13Z gadams $
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static class 
    To manage collisions.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
    The number of entries
    protected static final int
    The initial capacity
    protected IntTable.Entry[]
    The underlying array
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new table.
    IntTable(int c)
    Creates a new table.
    Creates a copy of the given HashTable object.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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
    Rehashes the table.
    int
    Removes an entry from the table.
    int
    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 Details

    • INITIAL_CAPACITY

      protected static final int INITIAL_CAPACITY
      The initial capacity
      See Also:
    • table

      protected IntTable.Entry[] table
      The underlying array
    • count

      protected int count
      The number of entries
  • Constructor Details

    • 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 Details

    • 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.