CLASSES
TagsA - Z

ObservableStringDictionary

Description

class ObservableStringDictionary extends StringDictionary

Constructor

new ObservableStringDictionary(watchObjectsPropertyChange)

Parameters

Name Type Description
watchObjectsPropertyChange boolean

Members

propertyChanged : Observable<PropertyChangedInfo>

Methods

copyFrom(source) → void

This will clear this dictionary and copy the content from the 'source' one.

If the T value is a custom object, it won't be copied/cloned, the same object will be used

Parameters

Name Type Description
source StringDictionary<T> the dictionary to take the content from and copy to this dictionary

getOrAddWithFactory(key, factory) → T

Get a value from its key or add it if it doesn't exist.

This method will ensure you that a given key/data will be present in the dictionary.

The factory will only be invoked if there's no data for the given key.

@return the value corresponding to the key.

Parameters

Name Type Description
key string the given key to get the matching value from
factory (key: string) => T the factory that will create the value if the key is not present in the dictionary.

add(key, value) → boolean

Add a new key and its corresponding value

@return true if the operation completed successfully, false if we couldn't insert the key/value because there was already this key in the dictionary

Parameters

Name Type Description
key string the key to add
value T the value corresponding to the key

getAndRemove(key) → T

Parameters

Name Type Description
key string

set(key, value) → boolean

Parameters

Name Type Description
key string
value T

remove(key) → boolean

Remove a key/value from the dictionary.

@return true if the item was successfully deleted, false if no item with such key exist in the dictionary

Parameters

Name Type Description
key string the key to remove

clear() → void

Clear the whole content of the dictionary