Hash/Integer/Float
VHash, VInteger and VFloat are a group of lookup objects. Each operates on the basis of an index key and a stored value.
Values stored in these objects are always referenced by their key. When values are added, their keys are automatically placed into a key list in a sorted order, using Newtons method. When retrieved, keys are extracted using Newtons method. This scheme makes for a fast lookup of key value pairs. The underlying key list is actually a scalable array by necessity, and consequently additions and removals are not quite as fast as lookups.
Separate classes are implemented to allow combinations of key/value pair types. All combinations of the following key and value types are possible.
Key types
- Hash (string)
- Signed integer
- Unsigned integer
- Double
Value types
- VObject pointer
- Signed integer
- Unsigned integer
- Atom
For each value type except atom, key value pairs may be added, removed, replaced and extracted. An atom is essentially an unsigned integer but atoms may only be incremented or decremented. An atom may never be less than or equal to zero. A non existant atom which is incremented is automatically created and set to 1. An atom which is decremented to zero is automatically removed.
All of the above implementations work with the list type to allow keys to be retrieved in groups with unary and binary operators. One may request all keys, all keys greater, all keys greater than and less than, and so on. Objects with hash key types only support group retrieval where all keys are requested.
|