Package com.sun.msv.grammar
Class ExpressionPool.ClosedHash
java.lang.Object
com.sun.msv.grammar.ExpressionPool.ClosedHash
- All Implemented Interfaces:
Serializable
- Enclosing class:
- ExpressionPool
expression 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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
The total number of mappings in the hash table.private static final int
private static final float
The load factor for the hashtable.private ExpressionPool.ClosedHash
The parent hash table.private static final ObjectStreamField[]
private static final long
private Expression[]
The hash table data.private int
The table is rehashed when its size exceeds this threshold. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget
(int hash, Expression child, Class type) get
(Expression key) private Expression
getBinExp
(int hash, Expression left, Expression right, Class type) getBinExp
(Expression left, Expression right, Class type) void
put
(Expression newExp) put method.private void
private void
rehash()
rehash.private void
-
Field Details
-
table
The hash table data. -
count
private int countThe total number of mappings in the hash table. -
threshold
private int thresholdThe table is rehashed when its size exceeds this threshold. (The value of this field is (int)(capacity * loadFactor).) -
loadFactor
private static final float loadFactorThe load factor for the hashtable.- See Also:
-
initialCapacity
private static final int initialCapacity- See Also:
-
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:
-
serialPersistentFields
-
-
Constructor Details
-
ClosedHash
public ClosedHash() -
ClosedHash
-
-
Method Details
-
getBinExp
-
getBinExp
-
get
-
get
-
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
put method. No two threads can call this method simulatenously, and it's the caller's responsibility to enforce it. -
writeObject
- Throws:
IOException
-
readObject
- Throws:
IOException
ClassNotFoundException
-