Package org.basex.query.util.hash
Class HashItemSet
- java.lang.Object
-
- org.basex.util.hash.ASet
-
- org.basex.query.util.hash.HashItemSet
-
-
Constructor Summary
Constructors Constructor Description HashItemSet(boolean eq, InputInfo info)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(Item key)
Stores the specified key if it has not been stored before.boolean
contains(Item 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(Item key)
Returns the id of the specified key, or0
if the key does not exist.Iterator<Item>
iterator()
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
-
-
-
-
Constructor Detail
-
HashItemSet
public HashItemSet(boolean eq, InputInfo info)
Default constructor.- Parameters:
eq
- equality checkinfo
- input info (can benull
)
-
-
Method Detail
-
add
public boolean add(Item key) throws QueryException
Description copied from interface:ItemSet
Stores the specified key if it has not been stored before.- Specified by:
add
in interfaceItemSet
- Parameters:
key
- key to be added- Returns:
true
if the key did not exist yet and was stored- Throws:
QueryException
- query exception
-
contains
public boolean contains(Item key) throws QueryException
Checks if the set contains the specified key.- Parameters:
key
- key to be looked up- Returns:
- result of check
- Throws:
QueryException
- query exception
-
id
public int id(Item key) throws QueryException
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 - Throws:
QueryException
- query exception
-
hash
protected 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.
-
-