-
Notifications
You must be signed in to change notification settings - Fork 1
Dictionary
Jump To | Go Back |
Methods | Variables |
---|
Implements: HashMap
Creates a dictionary-type structure. Unlike a hash table, a dictionary can be searched for a nearest match as well as specific entries, as well as iterate through entries forwards or backwards.
Jump To | top |
set | unset | lookup | peek | poke | first | last | next | previous | search | keys_to_array | from_JSON | size | clear |
---|
Returns: self
Throws: InvalidArgumentType
Name | Type | Purpose |
---|---|---|
key | string |
The key used to look up the value |
value | mixed |
The value to assign to the key |
Sets the given key in the dictionary to the provided value. If the key is not a string, InvalidArgumentType will be thrown.
Returns: self
Throws: InvalidArgumentType, ValueNotFound
Name | Type | Purpose |
---|---|---|
key | string |
The key to remove |
Removes the given key from the dictionary. If the key didn't exist, ValueNotFound will be thrown. If the key was not a string, InvalidArgumentType is thrown.
Returns: mixed
Throws: InvalidArgumentType, ValueNotFound
Name | Type | Purpose |
---|---|---|
key | string |
The key to look up |
Looks up the given key in the dictionary and returns its value. If the key is not a string, InvalidArgumentType is thrown. If the value does not exist, ValueNotFound will be thrown.
Returns: mixed
or ValueNotFound
Name | Type | Purpose |
---|---|---|
None |
Returns the value of the last read key, or ValueNotFound if it doesn't exist.
Returns: self
Throws: ValueNotFound
Name | Type | Purpose |
---|---|---|
value | mixed |
The value to assign |
Sets the last read key to the provided value. If there was no last value read, ValueNotFound is thrown.
Returns: mixed
or ValueNotFound
Name | Type | Purpose |
---|---|---|
None |
Returns the next key after the last key searched, or ValueNotFound if it doesn't exist.
Returns: mixed
or ValueNotFound
Name | Type | Purpose |
---|---|---|
None |
Returns the previous key after the last key searched, or ValueNotFound if it doesn't exist.
Returns: mixed
or ValueNotFound
Name | Type | Purpose |
---|---|---|
None |
Returns the next key after the last key searched, or ValueNotFound if it doesn't exist.
Returns: mixed
or ValueNotFound
Name | Type | Purpose |
---|---|---|
None |
Returns the previous key after the last key searched, or ValueNotFound if it doesn't exist.
Returns: string
or ValueNotFound
Name | Type | Purpose |
---|---|---|
pattern | string |
The search pattern to look for |
Searches for the nearest key to the given search pattern.
Returns: array
Name | Type | Purpose |
---|---|---|
None |
Returns the keys in the dictionary formatted as an array.
Returns: self
Throws: InvalidArgumentType, UnexpectedTypeMismatch
Name | Type | Purpose |
---|---|---|
JSON_string | string |
The string to convert into a dictionary |
Takes the provided string and uses it to populate the dictionary. If a string is not provided, InvalidArgumentType is thrown. If the string does not convert into a dictionary UnexpectedTypeMismatch will be thrown.
Returns: mixed
Name | Type | Purpose |
---|---|---|
None |
Returns the number of entries in the dictionary.
Name | Type | Purpose |
---|---|---|
None |
Empties the hash table
Jump To | top |
---|
Name | Type | Initial | Purpose |
---|---|---|---|
__Content | struct |
{} | The internal struct which holds the key/value pairs. |
__Keys | [ArrayList](arraylist) |
new ArrayList().order() | An ordered list of all the keys in the dictionary. |
__Last | int |
undefined | The last key that was looked up in the dictionary. |
Devon Mullane 2020