Class ChainingHash

java.lang.Object
io.milton.zsync.ChainingHash

public class ChainingHash extends Object
Chaining hash table used to store block checksums loaded from metafile
Author:
Tomáš Hlavnička
  • Constructor Details

    • ChainingHash

      public ChainingHash(int size)
      Initializing chaining hash table of size
      Parameters:
      size - Size of the hash table
  • Method Details

    • hashFunction

      public int hashFunction(ChecksumPair pKey)
      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

      public void insert(ChecksumPair pKey)
      Method inserting object into the table
      Parameters:
      pKey - Object we are inserting
    • delete

      public void delete(ChecksumPair pKey)
      Method used to delete an object from hash table
      Parameters:
      pKey - Object we want to delete from table
    • find

      public ChecksumPair find(ChecksumPair pKey)
      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

      public ChecksumPair findMatch(ChecksumPair pKey)
      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