The builtin type dict.
A dict contains zero or more items of the item type specified in the
declaration, looked up by a key.
The key can be a number, string, enum, bool, status or an object. In
case of an object its identity is used, thus two different objects
with the exactly the same value function as different keys.
When getting an item by index with and the key does not
exist this throws an exception.
When setting an item by key with and the key
already exists the value is overwritten, just like with $set(). Use
$add() to throw an exception for this situation.
Optionally the dict can be created ordered. It then uses a list to
remember the order in which keys were added. ToString(), keys() and
values() will then have the items in the order they were added. This has
a small overhead. Without the list the order of items depends on the
hash value and the number of items, which is rather arbitrary.
|
NEW() @public | Create a new, empty dictionary.
|
|
NEW(ordered) @public | Create a new, empty dictionary.
|
|
$Size()
int @public | Return the number of items in the dict.
|
|
$isOrdered()
bool @public | Return whether this dict keeps ordering of items.
|
|
$copy()
dict<Tkey, Titem> @public | Return a shallow copy of the dict.
|
|
$ToString()
string @public | Return a string representation of the dict.
|
|
$ToString(format)
string @public | Return a string representation of the dict with specified formatting.
|
|
$Type()
type @public | Return the type of the dict.
|
|
$has(key)
bool @public | Return TRUE when there is an item with key key.
|
|
$get(key)
Titem @public | Return the value of the item with key key.
|
|
$get(key, default)
Titem @public | Return the value of the item with key key.
|
|
$getByIndex(idx)
Titem @public | Return the value of the item at index idx.
|
|
$getByIndex(idx, default)
Titem @public | Return the value of the item at index idx.
|
|
$add(key, value)
dict<Tkey, Titem> @public | Set the value of the item with key key to value.
Throws an exception when key is already present.
Use $set() if that is not wanted.
|
|
$set(key, value)
dict<Tkey, Titem> @public | Set the value of the item with key key to value.
|
|
$clear()
dict<Tkey, Titem> @public | Removes all items from the dict.
|
|
$clear(key)
dict<Tkey, Titem> @public | Removes the item with key key and returns the dict.
|
|
$remove(key)
Titem @public | Removes the item with key key and returns the removed value.
|
|
$keys()
list<Tkey> @public | Returns a list with all the keys of the dict.
|
|
$values()
list<Titem> @public | Returns a list with all the values of the dict.
|
|
$map(f)
dict<Tkey, Titem> @public | Execute function f on each item value. Each item is replaced by the
result of the function.
|
|
$keyMap(f)
dict<Tkey, Titem> @public | Execute function f on each item key and value. Each item is replaced
by the result of the function.
|
|
$mapTo(f)
dict<Tkey, Tresult> @public | Create a new dict where each item is the result of executing function f
on each item value of this dict.
|
|
$keyMapTo(f)
dict<Tkey, Tresult> @public | Create a new dict where each item is the result of executing function f
on each item key and value of this dict.
|
|
$forEach(f)
dict<Tkey, Titem> @public | Call method f for every item value in the dict.
|
|
$forKeyEach(f)
dict<Tkey, Titem> @public | Call method f for every item key and value in the dict.
|
|
|