Package org.basex.query.util.hash
Class QNmSet
- java.lang.Object
-
- org.basex.util.hash.ASet
-
- org.basex.query.util.hash.QNmSet
-
-
Constructor Summary
Constructors Constructor Description QNmSet()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(QNm key)
Stores the specified key if it has not been stored before.boolean
contains(QNm key)
Checks if the set contains the specified key.protected int
hash(int id)
Returns the hash value of the element with the specified id.int
id(QNm key)
Returns the id of the specified key, or0
if the key does not exist.Iterator<QNm>
iterator()
QNm
key(int id)
Returns the key with the specified id.int
put(QNm key)
Stores the specified key and returns its id.protected void
rehash(int newSize)
Rehashes all entries.String
toString()
-
Methods inherited from class org.basex.util.hash.ASet
capacity, checkCapacity, checkCapacity, clear, isEmpty, size, toString, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
keys
protected QNm[] keys
Hashed keys.
-
-
Method Detail
-
add
public final boolean add(QNm key)
Stores the specified key if it has not been stored before.- Parameters:
key
- key to be added- Returns:
true
if the key did not exist yet and was stored
-
put
public final int put(QNm key)
Stores the specified key and returns its id.- Parameters:
key
- key to be added- Returns:
- unique id of stored key (larger than zero)
-
contains
public final boolean contains(QNm key)
Checks if the set contains the specified key.- Parameters:
key
- key to be looked up- Returns:
- result of check
-
id
public final int id(QNm key)
Returns the id of the specified key, or0
if the key does not exist.- Parameters:
key
- key to be looked up- Returns:
- id, or
0
if key does not exist
-
key
public final QNm key(int id)
Returns the key with the specified id. All ids start with1
instead of0
.- Parameters:
id
- id of the key to return- Returns:
- key
-
hash
protected final int hash(int id)
Description copied from class:ASet
Returns the hash value of the element with the specified id.
-
rehash
protected void rehash(int newSize)
Description copied from class:ASet
Rehashes all entries.
-
-