Class QNmSet

java.lang.Object
org.basex.util.hash.ASet
org.basex.query.util.hash.QNmSet
All Implemented Interfaces:
Iterable<QNm>
Direct Known Subclasses:
QNmMap

public class QNmSet extends ASet implements Iterable<QNm>
This is an efficient and memory-saving hash map for storing QNames.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Field Details

    • keys

      protected QNm[] keys
      Hashed keys.
    • hash

      protected int[] hash
      Hash values.
  • Constructor Details

    • QNmSet

      public QNmSet()
      Default constructor.
  • Method Details

    • add

      public final boolean add(QNm qnm)
      Stores the specified QName if it has not been stored before.
      Parameters:
      qnm - QName to add
      Returns:
      true if the QName did not exist yet and was stored
    • put

      public final int put(QNm qnm)
      Stores the specified QName and returns its id.
      Parameters:
      qnm - QName to put
      Returns:
      unique id of stored QName (larger than zero)
    • contains

      public final boolean contains(QNm qnm)
      Checks if the specified QName exists.
      Parameters:
      qnm - QName to look up
      Returns:
      result of check
    • id

      public final int id(QNm qnm)
      Returns the id of the specified QName, or 0 if the QName does not exist.
      Parameters:
      qnm - QName to look up
      Returns:
      id, or 0 if QName does not exist
    • hash

      protected final int hash(int id)
      Description copied from class: ASet
      Returns the hash value of the element with the specified id.
      Specified by:
      hash in class ASet
      Parameters:
      id - id of the element
      Returns:
      hash value
    • rehash

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

      public final Iterator<QNm> iterator()
      Specified by:
      iterator in interface Iterable<QNm>
    • toString

      public String toString()
      Overrides:
      toString in class Object