org.hsqldb.store
Class ValuePoolHashMap

java.lang.Object
  extended byorg.hsqldb.store.BaseHashMap
      extended byorg.hsqldb.store.ValuePoolHashMap

public class ValuePoolHashMap
extends BaseHashMap

To Do:
fredt - check accessCount and reset on each getOrAddXXX()

Nested Class Summary
 
Nested classes inherited from class org.hsqldb.store.BaseHashMap
BaseHashMap.BaseHashIterator
 
Field Summary
 
Fields inherited from class org.hsqldb.store.BaseHashMap
hashIndex, intKeyOrValue, intKeyTable, intValueTable, longKeyOrValue, longKeyTable, longValueTable, NO_PURGE, noKeyOrValue, objectKeyOrValue, objectKeyTable, objectValueTable, PURGE_ALL, PURGE_HALF, PURGE_QUARTER, purgePolicy
 
Constructor Summary
ValuePoolHashMap(int initialCapacity, int maxCapacity, int purgePolicy)
           
 
Method Summary
protected  Date getOrAddDate(long longKey)
           
protected  Double getOrAddDouble(long longKey)
           
protected  Integer getOrAddInteger(int intKey)
           
protected  Long getOrAddLong(long longKey)
           
protected  Object getOrAddObject(Object key)
           
protected  String getOrAddString(Object key)
          This is dissimilar to normal hash map get() methods.
 void resetCapacity(int maxCapacity, int purgePolicy)
           
 
Methods inherited from class org.hsqldb.store.BaseHashMap
addOrRemove, clear, clear, containsKey, containsKey, containsKey, containsValue, getLookup, getLookup, getLookup, getObject, getObject, getObject, isEmpty, rehash, removeLookup, removeObject, removeRow, reset, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValuePoolHashMap

public ValuePoolHashMap(int initialCapacity,
                        int maxCapacity,
                        int purgePolicy)
                 throws IllegalArgumentException
Method Detail

resetCapacity

public void resetCapacity(int maxCapacity,
                          int purgePolicy)
                   throws IllegalArgumentException
Throws:
IllegalArgumentException

getOrAddInteger

protected Integer getOrAddInteger(int intKey)

getOrAddLong

protected Long getOrAddLong(long longKey)

getOrAddString

protected String getOrAddString(Object key)
This is dissimilar to normal hash map get() methods. The key Object should have an equals(String) method which should return true if the key.toString.equals(String) is true. Also the key.hashCode() method must return the same value as key.toString.hashCode().

The above is always true when the key is a String. But it means it is possible to submit special keys that fulfill the contract. For example a wrapper around a byte[] can be submitted as key to retrieve either a new String, which is the toString() method of the wrapper, or return an existing String which would be equal to the product of toString().

Parameters:
key - String or other Object with compatible equals(String) and hashCode().
Returns:
String from map or a new String

getOrAddDate

protected Date getOrAddDate(long longKey)

getOrAddDouble

protected Double getOrAddDouble(long longKey)

getOrAddObject

protected Object getOrAddObject(Object key)


Copyright © 2001 - 2004 HSQL Development Group. All Rights Reserved.