Package org.htmlunit.corejs.javascript
Class UintMap
- java.lang.Object
-
- org.htmlunit.corejs.javascript.UintMap
-
- All Implemented Interfaces:
java.io.Serializable
public class UintMap extends java.lang.Object implements java.io.Serializable
Map to associate non-negative integers to objects or 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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static int
A
private static boolean
check
private static int
DELETED
private static int
EMPTY
private int
ivaluesShift
private int
keyCount
private int[]
keys
private int
occupiedCount
private int
power
private static long
serialVersionUID
private java.lang.Object[]
values
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
private int
ensureIndex(int key, boolean intType)
private int
findIndex(int key)
int
getExistingInt(int key)
Get integer value assigned with key.int
getInt(int key, int defaultValue)
Get integer value assigned with key.int[]
getKeys()
Return array of present keysjava.lang.Object
getObject(int key)
Get object value assigned with key.boolean
has(int key)
private int
insertNewKey(int key)
boolean
isEmpty()
void
put(int key, int value)
Set int value of the key.void
put(int key, java.lang.Object value)
Set object value of the key.private void
readObject(java.io.ObjectInputStream in)
private void
rehashTable(boolean ensureIntSpace)
void
remove(int key)
int
size()
private static int
tableLookupStep(int fraction, int mask, int power)
private void
writeObject(java.io.ObjectOutputStream out)
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
A
private static final int A
- See Also:
- Constant Field Values
-
EMPTY
private static final int EMPTY
- See Also:
- Constant Field Values
-
DELETED
private static final int DELETED
- See Also:
- Constant Field Values
-
keys
private transient int[] keys
-
values
private transient java.lang.Object[] values
-
power
private int power
-
keyCount
private int keyCount
-
occupiedCount
private transient int occupiedCount
-
ivaluesShift
private transient int ivaluesShift
-
check
private static final boolean check
- See Also:
- Constant Field Values
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
-
size
public int size()
-
has
public boolean has(int key)
-
getObject
public java.lang.Object getObject(int key)
Get object value assigned with key.- Returns:
- key object value or null if key is absent
-
getInt
public int getInt(int key, int defaultValue)
Get integer value assigned with key.- Returns:
- key integer value or defaultValue if key is absent
-
getExistingInt
public int getExistingInt(int key)
Get integer value assigned with key.- Returns:
- key integer value or defaultValue if key does not exist or does not have int value
- Throws:
java.lang.RuntimeException
- if key does not exist
-
put
public void put(int key, java.lang.Object value)
Set object value of the key. If key does not exist, also set its int value to 0.
-
put
public void put(int key, int value)
Set int value of the key. If key does not exist, also set its object value to null.
-
remove
public void remove(int key)
-
clear
public void clear()
-
getKeys
public int[] getKeys()
Return array of present keys
-
tableLookupStep
private static int tableLookupStep(int fraction, int mask, int power)
-
findIndex
private int findIndex(int key)
-
insertNewKey
private int insertNewKey(int key)
-
rehashTable
private void rehashTable(boolean ensureIntSpace)
-
ensureIndex
private int ensureIndex(int key, boolean intType)
-
writeObject
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException
- Throws:
java.io.IOException
-
readObject
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
-