93 template<
class I,
class E,
class H = DefHashFunc<I> >
106 explicit HashArray(
const E &defaultValue,
const H &hashFunc =
H())
107 :
Hashing<I,E,
H>(256, hashFunc), m_defaultValue(defaultValue) { }
125 if (pElement)
return pElement->
info();
133 return pElement->
info();
HashElement< K, I > * lookup(const K &key) const
Returns the hash element with key key in the hash table; returns nullptr if no such element exists...
bool member(const K &key) const
Returns true iff the hash table contains an element with key key.
bool empty() const
Returns true iff the table is empty, i.e., contains no elements.
Indexed arrays using hashing for element access.
const I & info() const
Returns the information value.
Declaration of classes used for hashing.
int size() const
Returns the number of elements in the hash table.
bool isDefined(const I &i) const
Returns true iff index i is defined.
const E & operator[](const I &i) const
Returns the element with index i.
int size() const
Returns the number of defined indices (= number of elements in hash table).
HashConstIterator< K, I, H > begin() const
Returns an hash iterator to the first element in the list of all elements.
HashArray(const E &defaultValue, const H &hashFunc=H())
Creates a hashing array with default value defaultValue.
void clear()
Undefines all indices.
Iterators for hash tables.
void undefine(const I &i)
Undefines index i.
Representation of elements in a hash table.
HashArray(const HashArray< I, E, H > &A)
Copy constructor.
Hashing< K, I, H > & operator=(const Hashing< K, I, H > &hashing)=default
Assignment operator.
HashArray< I, E, H > & operator=(const HashArray< I, E, H > &A)
Assignment operator.
HashElement< K, I > * fastInsert(const K &key, const I &info)
Inserts a new element with key key and information info into the hash table.
HashConstIterator< I, E, H > begin() const
Returns an iterator to the first element in the list of all elements.
Hashing with chaining and table doubling.
The namespace for all OGDF objects.
void clear()
Removes all elements from the hash table.
HashArray()
Creates a hashing array; the default value is the default value of the element type.
E & operator[](const I &i)
Returns a reference to the element with index i.
int empty() const
Returns if any indices are defined (= if the hash table is empty)
void del(const K &key)
Removes the element with key key from the hash table (does nothing if no such element).