Class AbstractOpenIntHashMap

java.lang.Object
org.hipparchus.util.AbstractOpenIntHashMap
Direct Known Subclasses:
OpenIntToDoubleHashMap, OpenIntToFieldHashMap

public abstract class AbstractOpenIntHashMap extends Object
Base class for open addressed map from int.
Since:
3.1
  • Field Details

    • DEFAULT_EXPECTED_SIZE

      protected static final int DEFAULT_EXPECTED_SIZE
      Default starting size.

      This must be a power of two for bit mask to work properly.

      See Also:
    • RESIZE_MULTIPLIER

      protected static final int RESIZE_MULTIPLIER
      Multiplier for size growth when map fills up.

      This must be a power of two for bit mask to work properly.

      See Also:
  • Constructor Details

    • AbstractOpenIntHashMap

      protected AbstractOpenIntHashMap()
      Build an empty map with default size.
    • AbstractOpenIntHashMap

      protected AbstractOpenIntHashMap(int expectedSize)
      Build an empty map with specified size.
      Parameters:
      expectedSize - expected number of elements in the map
    • AbstractOpenIntHashMap

      protected AbstractOpenIntHashMap(AbstractOpenIntHashMap source)
      Copy constructor.
      Parameters:
      source - map to copy
  • Method Details

    • getCapacity

      protected int getCapacity()
      Get capacity.
      Returns:
      capacity
      Since:
      3.1
    • getSize

      public int getSize()
      Get the number of elements stored in the map.
      Returns:
      number of elements stored in the map
    • resetCount

      protected void resetCount()
      Reset count.
      Since:
      3.1
    • containsKey

      public boolean containsKey(int key)
      Check if a value is associated with a key.
      Parameters:
      key - key to check
      Returns:
      true if a value is associated with key
    • size

      public int size()
      Get the number of elements stored in the map.
      Returns:
      number of elements stored in the map
    • containsKey

      public boolean containsKey(int key, int index)
      Check if the tables contain an element associated with specified key at specified index.
      Parameters:
      key - key to check
      index - index to check
      Returns:
      true if an element is associated with key at index
    • locate

      protected int locate(int key)
      Locate the index of value associated with the given key
      Parameters:
      key - key associated with the data
      Returns:
      index of value associated with the given key or negative if key not present
    • doRemove

      protected void doRemove(int index)
      Remove an element at specified index.
      Parameters:
      index - index of the element to remove
    • put

      protected AbstractOpenIntHashMap.InsertionHolder put(int key)
      Put a value associated with a key in the map.
      Parameters:
      key - key to which value is associated
      Returns:
      holder to manage insertion
    • growTable

      protected abstract int growTable(int oldIndex)
      Grow the tables.
      Parameters:
      oldIndex - index the entry being inserted should have used
      Returns:
      index the entry being inserted should really use
    • doGrowTable

      protected int doGrowTable(int oldIndex, AbstractOpenIntHashMap.ValueCopier valueCopier)
      Grow the tables.
      Parameters:
      oldIndex - index the entry being inserted should have used
      valueCopier - copier for existing values
      Returns:
      index the entry being inserted should really use
    • equalKeys

      protected boolean equalKeys(AbstractOpenIntHashMap other)
      Check if keys are equals.
      Parameters:
      other - other map
      Returns:
      true if keys are equals
    • equalStates

      protected boolean equalStates(AbstractOpenIntHashMap other)
      Check if states are equals.
      Parameters:
      other - other map
      Returns:
      true if states are equals
    • keysStatesHashCode

      protected int keysStatesHashCode()
      Compute partial hashcode on keys and states.
      Returns:
      partial hashcode on keys and states