Class: AbstractList

olympe.df. AbstractList

An 'AbstractList' is a ranked Map. Meaning it holds key-value pairs in an ordered list. Each key-value pair has also a rank (from 0 to n).


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

Creates a new AbstractList of the specified type.

Parameters:
Name Type Argument Description
valueType function <optional>

Constructor for the value of the entries

context olympe.df.ExecutionContext <optional>

Optional execution context.

Implements:

Extends

Members


<protected> orderedKeys :Array

Type:
  • Array

<protected> ranks :Object.<string, number>

Type:
  • Object.<string, number>

Methods


_clear()

Removes all values from the map.


<protected> _removeRank(key)

Remove the rank associated to a key/value pair. Use in conjunction with _remove().

Parameters:
Name Type Description
key string

Key of the item


<protected> _setRank(key, rank)

Update an item's rank and related proxies.

Parameters:
Name Type Description
key string
rank number

<protected> _updateOrderedItems()

Updates the ordered items array if needed


_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

forEachCurrentValue()

Executes the specified callback on each current item ordered by rank. Notes:

  • This method does not create a node for each callback call. It is just a simple iteration on all values present in the enumerable at the time of the method call.
  • It is possible to break out of the iteration by having the callback return false.

forEachLimited(start, count, onAdd [, onRemove])

Registers callbacks to be called every time an entry whose rank is greater than or equal to start and smaller than start plus count 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
start olympe.df.PONumber | number

starting rank for the selection

count olympe.df.PONumber | number

number of entries in the selection

onAdd function

The callback to invoke when an entry is added.

onRemove function <optional>

The callback to invoke when an entry is removed.


getAt(rank)

Gets the value of the entry at the specified rank.

Parameters:
Name Type Description
rank olympe.df.PONumber | number

the rank of the entry

Returns:

the value of the entry at that rank

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

getCurrentAt(rank)

Gets the value of the entry at the specified rank at the time of the method call.

Parameters:
Name Type Description
rank olympe.df.ONumber | number

the rank of the entry

Returns:

the value of the entry at that rank

Type
T | undefined

getCurrentKeyAt(rank)

Gets the key of the item at the specified rank at the time of the method call.

Parameters:
Name Type Description
rank olympe.df.ONumber | number

the rank of the entry

Returns:

the key of the entry at that rank

Type
string | undefined

getCurrentRank()

Gets the rank of the specified entry at the time of the method call.


getFirst()

Gets the value of the first entry in the list.

Returns:

the value of the first entry.

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

getFirstKey()

Gets the key for the first entry in the list.

Returns:

the number of key-value mappings in this list.

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

getKeyAt(rank)

Gets the key of the entry at the specified rank.

Parameters:
Name Type Description
rank olympe.df.PONumber | number

the rank of the entry

Returns:

the key of the entry at that rank

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

getKeys()

Gets an array containing all the keys ordered by rank.

Returns:

an Array of the keys

Type
Array | olympe.df.Proxy

getRank(key)

Gets the rank of of the entry associated with a specific key.

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

the key of the entry

Returns:

the rank of the entry

Type
olympe.df.PONumber

setValueType()