Class Table
java.lang.Object
algorithm.Table
A very minimal transposition table implementation for df-B*.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intbyteSizeOfTable(int keySize) voidclear()voidintgetKey(long hash) static TablegetTable()static TablegetTable(int keySize) static TablegetTable(SearchAlgorithm.Limits space_limit) booleanhasEntry(int key) longhash(int key) booleanisPresent(long hash) intkeySize()static intkeySizeForByteLimit(long byteLimit) static intkeySizeForLimit(int entryLimit) static intlog2fast(int x) doublelower(int key) doublelower(long hash) voidputInTable(long hash, double lower, double upper) voidsetExperimentalBoundsSaving(boolean set_value) Whether to save the tightest bounds among both entries when a collision leads to the same node.static intsizeOfTable(int keySize) doubleupper(int key) doubleupper(long hash)
-
Field Details
-
BYTES_PER_ENTRY
public static final int BYTES_PER_ENTRY- See Also:
-
-
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
-
getTable
-
getTable
-
clear
public void clear() -
getKey
public int getKey(long hash) -
isPresent
public boolean isPresent(long hash) - Parameters:
hash-- Returns:
trueif there is a value present with the same hash as the provided hash,falseotherwise
-
hasEntry
public boolean hasEntry(int key) - Parameters:
key-- Returns:
trueif there is a value present at the specified key,falseotherwise
-
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
-
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. Iffalse, we instead just save the entry with the smallest range.- Parameters:
set_value- defaults tofalse
-
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
0ifx < 1
-