Class: AbstractMap

olympe.df. AbstractMap

An AbstractMap is collection that contains key-value mappings. Keys are always strings, while the type of the values is defined at creation time.


<abstract, protected> new AbstractMap( [valueType] [, context])

Creates a Map specifying the type of the value of entries.

Parameters:
Name Type Argument Description
valueType function | Object <optional>

Entries value type constructor

context olympe.df.ExecutionContext <optional>

Optional execution context.

Implements:

Members


<protected> context :olympe.df.ExecutionContext

Type:

getCreatorNode :function

Type:
  • function
Deprecated:

<protected> size :number

Type:
  • number

<protected, nullable> sizeProxy :olympe.df.PONumber

Type:

<protected> values :Object.<T>

The actual map values

Type:
  • Object.<T>

Methods


<protected> _clear()

Removes all values from the map.


<protected> _forEachInternal(foreachId, internalCallback)

Registers and executed the internalOnAdd callback for each value

Parameters:
Name Type Description
foreachId string
internalCallback function

<protected> _getForeachId()

Gets a new foreach identifier

Returns:
Type
string

<protected> _makeForEachInternalCallback(foreachId, onAdd [, onRemove])

Creates an internal onAdd callback for the specified callbacks

Parameters:
Name Type Argument Description
foreachId string
onAdd olympe.df.Enumerable.AddItemCallback
onRemove olympe.df.Enumerable.RemoveItemCallback <optional>
Returns:
Type
function

<protected> _remove(key [, noSizeUpdate])

Removes an item from the map

Parameters:
Name Type Argument Default Description
key string

Key of the item

noSizeUpdate boolean <optional>
false

Do not update the size proxy

Returns:

Removed item's value

Type
T | undefined

<protected> _set(key, value)

Adds an item to the map. Note: this method does not update the size proxy, #_updateSize() must be manually called by any implementor

Parameters:
Name Type Description
key string

Key of the item

value T

Item's value


<protected> _storeForeachNode(foreachId, index, node)

Stores the node created by an iteration of a foreach call

Parameters:
Name Type Description
foreachId string
index string
node olympe.df.Node.<?>

<protected> _updateSize()

Refreshes the size proxy.


dump()

Gets a debug string representation of the content of the list (at the time of the method call)

Returns:
Type
string

forEach(onAdd [, onRemove])

Registers callbacks to be called every time an entry is added or removed from this collection. Note: If the collection is not empty, the 'onAdd' callback will be invoked for each existing entry.

Parameters:
Name Type Argument Description
onAdd function

The callback to invoke when an entry is added.

onRemove function <optional>

The callback to invoke when an entry is removed.


forEachCurrentValue()

Executes the specified callback on each current item. Note: this method does not create a node for each callback call. It is just simple iteration on all values present in the enumerable at the time of the method call. Note: it is possible to break the iteration by returning exactly false from the callback


get(key)

Gets the value associated with a specific key.

Parameters:
Name Type Description
key string | olympe.df.POString

the key whose associated value is to be returned.

Returns:

the value to which the specified key is mapped, or undefined if this map contains no mapping for the key.

Type
olympe.df.Proxy.<T> | T

getContext()

Gets the execution context of this map.

Returns:

The execution context.

Type
olympe.df.ExecutionContext

<protected> getCreateProxy(proxies, index, value, valueType [, debugName])

Gets or creates a proxy for the specified value

Parameters:
Name Type Argument Description
proxies Object

Proxy map

index string

Value proxy index

value *
valueType function
debugName string <optional>
Returns:
Type
olympe.df.Proxy.<T>

getCurrent()

Gets the current value associated with a specific key, that is the value at the time of the method call.


getCurrentSize()

Gets the number of key-value mappings in this map at the time of the method call.

Returns:

the current number of key-value mappings in this map

Type
number

<abstract> getFirst()

Gets the value of the first entry in the collection.

Returns:

the value of the first entry.

Type
olympe.df.Proxy.<T> | T

<abstract> getFirstKey()

Gets the key for the first entry in the collection.

Returns:

the number of key-value mappings in this map

Type
olympe.df.Proxy.<string> | string

getSize()

Gets the number of key-value mappings in this map.

Returns:

the number of key-value mappings in this map

Type
olympe.df.PONumber

getValueType()

Gets the type of the objects stored in this Map.

Returns:

Value type constructor.

Type
function

has(key)

Checks whether the specified key is present in the collection.

Parameters:
Name Type Description
key string | olympe.df.POString

the key whose presence in this map is to be tested.

Returns:

true if this map contains a mapping for the specified key.

Type
olympe.df.OBoolean | olympe.df.Proxy

hasCurrent(key)

Checks whether the specified key is present in the collection at the time of the method call.

Parameters:
Name Type Description
key string

the key whose presence in this map is to be tested.

Returns:

true if this map contains a mapping for the specified key.

Type
boolean

setValueType(valueType)

Sets the type of the objects that can be stored in this Map.

Parameters:
Name Type Description
valueType function

Value type constructor.