![]() |
Murl Engine Lua Addon API
Version 1.0 beta
|
A hash class.
The hash class stores indices accessable by a hash value.
This class is based on the NTL Hash container, see http://www.ultimatepp.org
The default constructor. Create an empty hash object.
Murl.Hash new()
The copy constructor.
hash | The hash object to copy. |
Clear the hash object.
Clear()
Clear the index.
ClearIndex()
Clear and rebuild the index.
Reindex()
Clear and rebuild the index for a given number of items.
Reindex(Integer n)
n | The number of items to rebuild. |
Shrink the hash object so that the underlying storage is only as large as necessary.
Shrink()
Reduce the hash object to a given number of items.
n | The new number of items in the hash object, must be smaller than the current item count. |
Reduce the hash object by removing a given number of items from the end.
n | The number of items to remove from the end. |
Reserve storage space. If the given size is less than the actual size, nothing is done.
Reserve(Integer n)
n | The number of items the underlying storage should hold. |
Unlink a given index. Unlinked items remain in the hash object, but are ignored by any search operations.
index | The index to unlink. |
Check if the given index is unlinked.
Boolean IsUnlinked(Integer index)
index | The index to check. |
Get an array of unlinked indices.
Murl.Array.SInt32 GetUnlinked()
Replace the index for a specified hash value.
Set(Integer index, Integer hash)
index | The index to set. |
hash | The hash value to set. |
Replace the hash value at a specified index without consideration of multiple entries per hash value.
SetUn(Integer index, Integer hash)
index | The index to set. |
hash | The hash value to set. |
Add a hash value.
Add(Integer hash)
hash | The hash value to add. |
Put a hash value by replacing an unlinked index if present.
hash | The hash value to add. |
Insert an index for a given hash value.
Insert(Integer index, Integer hash)
index | The index to insert. |
hash | The hash value to insert. |
Remove the hash value at a given position.
Remove(Integer index)
index | The index from where to remove the hash value. |
Remove a number of hash values at a given starting position.
Remove(Integer index, Integer count)
index | The index from where to start removing the hash values. |
count | The number of subsequent hash values to remove. |
Find the first index of a given hash value.
hash | The hash value to search for. |
Find the next occurrence of a hash value that is specified by a given index.
Integer FindNext(Integer index)
index | The index of the hash value to search for. |
Find the previous occurrence of a hash value that is specified by a given index.
Integer FindPrev(Integer index)
index | The index of the hash value to search for. |
Find the last occurrence of a hash value.
Integer FindLast(Integer hash)
hash | The hash value to search for. |
Get the number of items.
Integer GetCount()
Exchange the content of the hash object with a given second one.
Murl.Hash Swap(Murl.Hash other)
other | The second hash object. |
The length operator is denoted by the unary prefix operator #.
Get the hash value for a given index. If the index is out of range, the behaviour is undefined.
index | The index of the hash value to retrieve. |