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-24, BSD License, Christian Gruen
    • Constructor Detail

      • TokenIntMap

        public TokenIntMap()
        Constructor.
    • Method Detail

      • 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
      • 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