Class EntryMap<T>

java.lang.Object
org.glavo.classfile.impl.EntryMap<T>

public abstract class EntryMap<T> extends Object
An open-chain multimap used to map nonzero hashes to indexes (of either CP elements or BSM entries). Code transformed from public domain implementation (http://java-performance.info/). The internal data structure is an array of 2N int elements, where the first element is the hash and the second is the mapped index. To look something up in the map, provide a hash value and an index to map it to, and invoke firstToken(hash). This returns an opaque token that can be provided to nextToken(hash, token) to get the next candidate, or to getElementByToken(token) or getIndexByToken to get the mapped element or index.
  • Field Details

  • Constructor Details

    • EntryMap

      public EntryMap(int size, float fillFactor)
  • Method Details

    • fetchElement

      protected abstract T fetchElement(int index)
    • firstToken

      public int firstToken(int hash)
    • nextToken

      public int nextToken(int hash, int token)
    • getIndexByToken

      public int getIndexByToken(int token)
    • getElementByToken

      public T getElementByToken(int token)
    • put

      public void put(int hash, int index)
    • size

      public int size()
    • nextPowerOfTwo

      public static long nextPowerOfTwo(long x)
    • arraySize

      public static int arraySize(int expected, float f)