Package org.basex.query.util.hash
Class QNmSet
java.lang.Object
org.basex.util.hash.ASet
org.basex.query.util.hash.QNmSet
- Direct Known Subclasses:
QNmMap
This is an efficient and memory-saving hash map for storing QNames.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanStores the specified QName if it has not been stored before.final booleanChecks if the specified QName exists.protected final inthash(int id) Returns the hash value of the element with the specified id.final intReturns the id of the specified QName, or0if the QName does not exist.iterator()final intStores the specified QName and returns its id.protected voidrehash(int newSize) Rehashes all entries.toString()Methods inherited from class org.basex.util.hash.ASet
capacity, checkSize, clear, isEmpty, size, toString, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
keys
Hashed keys. -
hash
protected int[] hashHash values.
-
-
Constructor Details
-
QNmSet
public QNmSet()Default constructor.
-
-
Method Details
-
add
Stores the specified QName if it has not been stored before.- Parameters:
qnm- QName to add- Returns:
trueif the QName did not exist yet and was stored
-
put
Stores the specified QName and returns its id.- Parameters:
qnm- QName to put- Returns:
- unique id of stored QName (larger than zero)
-
contains
Checks if the specified QName exists.- Parameters:
qnm- QName to look up- Returns:
- result of check
-
id
Returns the id of the specified QName, or0if the QName does not exist.- Parameters:
qnm- QName to look up- Returns:
- id, or
0if QName does not exist
-
hash
protected final int hash(int id) Description copied from class:ASetReturns the hash value of the element with the specified id. -
rehash
protected void rehash(int newSize) Description copied from class:ASetRehashes all entries. -
iterator
-
toString
-