org.apache.batik.css.engine

Class StringIntMap

public class StringIntMap extends Object

A simple hashtable, not synchronized, with fixed load factor. Keys are Strings and values are ints.
Nested Class Summary
protected static classStringIntMap.Entry
To manage collisions
Field Summary
protected intcount
The number of entries
protected StringIntMap.Entry[]table
The underlying array
Constructor Summary
StringIntMap(int c)
Creates a new table.
Method Summary
intget(String key)
Gets the value corresponding to the given string.
voidput(String key, int value)
Sets a new value for the given variable
protected voidrehash()
Rehash the table

Field Detail

count

protected int count
The number of entries

table

protected StringIntMap.Entry[] table
The underlying array

Constructor Detail

StringIntMap

public StringIntMap(int c)
Creates a new table.

Parameters: c The capacity of the table.

Method Detail

get

public int get(String key)
Gets the value corresponding to the given string.

Returns: the value or -1.

put

public void put(String key, int value)
Sets a new value for the given variable

rehash

protected void rehash()
Rehash the table
Copyright B) 2007 Apache Software Foundation. All Rights Reserved.