Class TokenIntMap

All Implemented Interfaces:
Iterable<byte[]>

public final class TokenIntMap extends TokenSet
This is an efficient and memory-saving hash map for storing tokens and integers.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Constructor Details

    • TokenIntMap

      public TokenIntMap()
      Constructor.
    • TokenIntMap

      public TokenIntMap(DataInput in) throws IOException
      Constructor.
      Parameters:
      in - input stream
      Throws:
      IOException - I/O exception
  • Method Details

    • read

      public void read(DataInput in) throws IOException
      Description copied from class: TokenSet
      Reads the data structure from the specified input.
      Overrides:
      read in class TokenSet
      Parameters:
      in - input stream
      Throws:
      IOException - I/O exception
    • write

      public void write(DataOutput out) throws IOException
      Description copied from class: TokenSet
      Writes the data structure to the specified output.
      Overrides:
      write in class TokenSet
      Parameters:
      out - output stream
      Throws:
      IOException - I/O exception
    • put

      public void put(byte[] key, int value)
      Indexes the specified key and stores the associated value. If the key already exists, the value is updated.
      Parameters:
      key - key
      value - value
    • get

      public int get(byte[] key)
      Returns the value for the specified key.
      Parameters:
      key - key to be looked up
      Returns:
      value, or -1 if the key was not found
    • remove

      public int remove(byte[] key)
      Description copied from class: TokenSet
      Removes the entry with the specified key. The deletion of keys will lead to empty entries. If ASet.size is called after deletions, the original number of entries will be returned.
      Overrides:
      remove in class TokenSet
      Parameters:
      key - key
      Returns:
      id of the deleted key, or 0 if the key did not exist
    • rehash

      protected void rehash(int newSize)
      Description copied from class: ASet
      Rehashes all entries.
      Overrides:
      rehash in class TokenSet
      Parameters:
      newSize - new hash size
    • toString

      public String toString()
      Overrides:
      toString in class TokenSet