Class ObjToIntMap

java.lang.Object
org.mozilla.javascript.ObjToIntMap
All Implemented Interfaces:
Serializable

public class ObjToIntMap extends Object implements 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:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • A

      private static final int A
      See Also:
    • DELETED

      private static final Object DELETED
    • keys

      private transient Object[] 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

      public boolean has(Object key)
    • get

      public int get(Object key, int defaultValue)
      Get integer value assigned with key.
      Returns:
      key integer value or defaultValue if key is absent
    • getExisting

      public int getExisting(Object key)
      Get integer value assigned with key.
      Returns:
      key integer value
      Throws:
      RuntimeException - if key does not exist
    • put

      public void put(Object key, int value)
    • intern

      public Object intern(Object keyArg)
      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

      public void remove(Object key)
    • clear

      public void clear()
    • newIterator

      public ObjToIntMap.Iterator newIterator()
    • initIterator

      final void initIterator(ObjToIntMap.Iterator i)
    • getKeys

      public Object[] getKeys()
      Return array of present keys
    • getKeys

      public void getKeys(Object[] array, int offset)
    • tableLookupStep

      private static int tableLookupStep(int fraction, int mask, int power)
    • findIndex

      private int findIndex(Object key)
    • insertNewKey

      private int insertNewKey(Object key, int hash)
    • rehashTable

      private void rehashTable()
    • ensureIndex

      private int ensureIndex(Object key)
    • writeObject

      private void writeObject(ObjectOutputStream out) throws IOException
      Throws:
      IOException
    • readObject

      private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
      Throws:
      IOException
      ClassNotFoundException