Package io.milton.zsync
Class ChainingHash
java.lang.Object
io.milton.zsync.ChainingHash
Chaining hash table used to store block checksums loaded from metafile
- Author:
- Tomáš Hlavnička
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddelete(ChecksumPair pKey) Method used to delete an object from hash tablevoidSimple method used to write out the content of hash tablefind(ChecksumPair pKey) Method used to find an object in hash table using only weakSumfindMatch(ChecksumPair pKey) Method used to find an object in hash table using weakSum and strongSuminthashFunction(ChecksumPair pKey) Hashing functionvoidinsert(ChecksumPair pKey) Method inserting object into the table
-
Constructor Details
-
ChainingHash
public ChainingHash(int size) Initializing chaining hash table ofsize- Parameters:
size- Size of the hash table
-
-
Method Details
-
hashFunction
Hashing function- Parameters:
pKey- Key object that will be hashed into the table- Returns:
- Index in hash table where the object will be put
-
insert
Method inserting object into the table- Parameters:
pKey- Object we are inserting
-
delete
Method used to delete an object from hash table- Parameters:
pKey- Object we want to delete from table
-
find
Method used to find an object in hash table using only weakSum- Parameters:
pKey- Object that we are looking for- Returns:
- Object if found, null if not
-
findMatch
Method used to find an object in hash table using weakSum and strongSum- Parameters:
pKey- Object that we are looking for- Returns:
- Object if found, null if not
-
displayTable
public void displayTable()Simple method used to write out the content of hash table
-