Class Table

java.lang.Object
algorithm.Table

public class Table extends Object
A very minimal transposition table implementation for df-B*.
  • Field Details

  • Constructor Details

    • Table

      public Table(int keySize)
      Creates a transposition table with a specified size.
      Parameters:
      keySize - Determines the size of this table. Typically good between 18 and 25, depending on available memory. For practical reasons, this is capped at 30 and can not be less than 0.
  • Method Details

    • getTable

      public static Table getTable(SearchAlgorithm.Limits space_limit)
    • getTable

      public static Table getTable()
    • getTable

      public static Table getTable(int keySize)
    • clear

      public void clear()
    • getKey

      public int getKey(long hash)
    • isPresent

      public boolean isPresent(long hash)
      Parameters:
      hash -
      Returns:
      true if there is a value present with the same hash as the provided hash, false otherwise
    • hasEntry

      public boolean hasEntry(int key)
      Parameters:
      key -
      Returns:
      true if there is a value present at the specified key, false otherwise
    • lower

      public double lower(long hash)
    • lower

      public double lower(int key)
    • upper

      public double upper(long hash)
    • upper

      public double upper(int key)
    • hash

      public long hash(int key)
    • countRetrieval

      public void countRetrieval()
    • getMetrics

      public Table.Metrics getMetrics()
    • putInTable

      public void putInTable(long hash, double lower, double upper)
    • setExperimentalBoundsSaving

      public void setExperimentalBoundsSaving(boolean set_value)
      Whether to save the tightest bounds among both entries when a collision leads to the same node. If false, we instead just save the entry with the smallest range.
      Parameters:
      set_value - defaults to false
    • keySize

      public int keySize()
    • sizeOfTable

      public static int sizeOfTable(int keySize)
    • byteSizeOfTable

      public static int byteSizeOfTable(int keySize)
    • keySizeForLimit

      public static int keySizeForLimit(int entryLimit)
    • keySizeForByteLimit

      public static int keySizeForByteLimit(long byteLimit)
    • log2fast

      public static int log2fast(int x)
      Parameters:
      x - a positive number
      Returns:
      The integer logarithm of x (rounded down), or 0 if x < 1