Package com.sun.msv.grammar
Class ExpressionPool.ClosedHash
- java.lang.Object
-
- com.sun.msv.grammar.ExpressionPool.ClosedHash
-
- All Implemented Interfaces:
java.io.Serializable
- Enclosing class:
- ExpressionPool
public static final class ExpressionPool.ClosedHash extends java.lang.Object implements java.io.Serializableexpression cache by closed hash. Special care has to be taken wrt threading. This implementation allows get and put method to be called simulatenously.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private intcountThe total number of mappings in the hash table.private static intinitialCapacityprivate static floatloadFactorThe load factor for the hashtable.private ExpressionPool.ClosedHashparentThe parent hash table.private static java.io.ObjectStreamField[]serialPersistentFieldsprivate static longserialVersionUIDprivate Expression[]tableThe hash table data.private intthresholdThe table is rehashed when its size exceeds this threshold.
-
Constructor Summary
Constructors Constructor Description ClosedHash()ClosedHash(ExpressionPool.ClosedHash parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Expressionget(int hash, Expression child, java.lang.Class type)Expressionget(Expression key)private ExpressiongetBinExp(int hash, Expression left, Expression right, java.lang.Class type)ExpressiongetBinExp(Expression left, Expression right, java.lang.Class type)voidput(Expression newExp)put method.private voidreadObject(java.io.ObjectInputStream s)private voidrehash()rehash.private voidwriteObject(java.io.ObjectOutputStream s)
-
-
-
Field Detail
-
table
private Expression[] table
The hash table data.
-
count
private int count
The total number of mappings in the hash table.
-
threshold
private int threshold
The table is rehashed when its size exceeds this threshold. (The value of this field is (int)(capacity * loadFactor).)
-
loadFactor
private static final float loadFactor
The load factor for the hashtable.- See Also:
- Constant Field Values
-
initialCapacity
private static final int initialCapacity
- See Also:
- Constant Field Values
-
parent
private ExpressionPool.ClosedHash parent
The parent hash table. can be null. items in the parent hash table will be returned by get method.The field is essentially final but because of the serialization support we cannot mark it as such.
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
serialPersistentFields
private static final java.io.ObjectStreamField[] serialPersistentFields
-
-
Constructor Detail
-
ClosedHash
public ClosedHash()
-
ClosedHash
public ClosedHash(ExpressionPool.ClosedHash parent)
-
-
Method Detail
-
getBinExp
public Expression getBinExp(Expression left, Expression right, java.lang.Class type)
-
getBinExp
private Expression getBinExp(int hash, Expression left, Expression right, java.lang.Class type)
-
get
public Expression get(int hash, Expression child, java.lang.Class type)
-
get
public Expression get(Expression key)
-
rehash
private void rehash()
rehash. It is possible for one thread to call get method while another thread is performing rehash. Keep this in mind.
-
put
public void put(Expression newExp)
put method. No two threads can call this method simulatenously, and it's the caller's responsibility to enforce it.
-
writeObject
private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException- Throws:
java.io.IOException
-
readObject
private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, java.lang.ClassNotFoundException- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
-