Package org.htmlunit.corejs.javascript
Class ObjToIntMap
java.lang.Object
org.htmlunit.corejs.javascript.ObjToIntMap
- All Implemented Interfaces:
Serializable
Map to associate objects to integers. The map does not synchronize any of its operation, so
either use it from a single thread or do own synchronization or perform all mutation operations
on one thread before passing the map to others
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
private int
ensureIndex
(Object key) private int
int
Get integer value assigned with key.int
getExisting
(Object key) Get integer value assigned with key.Object[]
getKeys()
Return array of present keysvoid
boolean
(package private) final void
private int
insertNewKey
(Object key, int hash) If table already contains a key that equals to keyArg, return that key while setting its value to zero, otherwise add keyArg with 0 value to the table and return it.boolean
isEmpty()
void
private void
private void
void
int
size()
private static int
tableLookupStep
(int fraction, int mask, int power) private void
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
A
private static final int A- See Also:
-
DELETED
-
keys
-
values
private transient int[] values -
power
private int power -
keyCount
private int keyCount -
occupiedCount
private transient int occupiedCount -
check
private static final boolean check- See Also:
-
-
Constructor Details
-
ObjToIntMap
public ObjToIntMap() -
ObjToIntMap
public ObjToIntMap(int keyCountHint)
-
-
Method Details
-
isEmpty
public boolean isEmpty() -
size
public int size() -
has
-
get
Get integer value assigned with key.- Returns:
- key integer value or defaultValue if key is absent
-
getExisting
Get integer value assigned with key.- Returns:
- key integer value
- Throws:
RuntimeException
- if key does not exist
-
put
-
intern
If table already contains a key that equals to keyArg, return that key while setting its value to zero, otherwise add keyArg with 0 value to the table and return it. -
remove
-
clear
public void clear() -
newIterator
-
initIterator
-
getKeys
Return array of present keys -
getKeys
-
tableLookupStep
private static int tableLookupStep(int fraction, int mask, int power) -
findIndex
-
insertNewKey
-
rehashTable
private void rehashTable() -
ensureIndex
-
writeObject
- Throws:
IOException
-
readObject
- Throws:
IOException
ClassNotFoundException
-