Class Index | File Index

Classes


Class Dictionary


Defined in: dictionary.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
A dictionary (or map) for key-value storage and access.
Method Summary
Method Attributes Method Name and Description
 
Remove all entries from the dictionary.
 
Check if the dictionary contains an entry for a key.
 
containsValue(value, useStrict)
Check if the dictionary contains an entry with the value.
 
get(key)
Get the value for a key.
 
Get a list of the keys for all entries in the dictionary.
<private>  
lookupKey(key)
Helper function that creates the actual lookup key.
 
put(key, value)
Put / add an entry to the dictionary.
 
remove(key)
Remove an entry from the dictionary.
 
size()
Get the size of the dictionary.
Class Detail
Dictionary()
A dictionary (or map) for key-value storage and access.
Method Detail
clear()
Remove all entries from the dictionary.

NOTE that this may execute rather slowly, with O(n).


{Boolean} containsKey(key)
Check if the dictionary contains an entry for a key.
Parameters:
{String} key
the lookup key to check
Returns:
{Boolean} true if an entry exists, otherwise false

{Boolean} containsValue(value, useStrict)
Check if the dictionary contains an entry with the value.

NOTE that this function may execute rather slowly, with O(n).

Parameters:
{any} value
the value to check
{Boolean} useStrict Optional
if true entry-values are checked against param value with ===. If false or omitted, values are compared with each other using ==.
Returns:
{Boolean} true if an entry exists, otherwise false

{any} get(key)
Get the value for a key.
Parameters:
{String} key
the lookup key with was used to store the entry/value.
Returns:
{any} the value for the key, or undefined if the dictionary has no entry for the key.

{Array} getKeys()
Get a list of the keys for all entries in the dictionary.

The returned list has no specific ordering.

NOTE that this may execute rather slowly, with O(n).

NOTE that the returned list is no "view" for the keys, i.e. changes on this list will not be reflected by the dictionary's key-list.

Returns:
{Array} a list of all keys

<private> {String} lookupKey(key)
Helper function that creates the actual lookup key. The "lookup key" is original key with applied key-prefix.
Parameters:
{String} key
the key (without the internal key prefix)
Returns:
{String} the key prefixed with the internal key prefix

put(key, value)
Put / add an entry to the dictionary.
Parameters:
{String} key
the lookup key for the value
{any} value
the value to store

{Boolean} remove(key)
Remove an entry from the dictionary.

NOTE that this may execute rather slowly, with O(n).

Parameters:
{String} key
the lookup key for the entry to remove
Returns:
{Boolean} true if the entry was removed. If there was no entry for the key and nothing was removed, false is returned.

{Number} size()
Get the size of the dictionary.
Returns:
{Number} the count of entries in the dictionary

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Feb 26 2016 21:44:43 GMT+0100 (Mitteleuropäische Zeit)