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 intThe total number of mappings in the hash table.private static final intprivate static final floatThe load factor for the hashtable.private ExpressionPool.ClosedHashThe parent hash table.private static final ObjectStreamField[]private static final longprivate Expression[]The hash table data.private intThe 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 ExpressiongetBinExp(int hash, Expression left, Expression right, Class type) getBinExp(Expression left, Expression right, Class type) voidput(Expression newExp) put method.private voidprivate voidrehash()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:
IOExceptionClassNotFoundException
-