new ListDef(baseTag [, transformers] [, valueType])
Creates an instance of ListDef
.
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
baseTag |
olympe.dc.InstanceTag | Starting instance tag. |
||
transformers |
!Array.<!olympe.dc.Transformer> | olympe.dc.Transformer |
<optional> |
Initial set of transformers. |
|
valueType |
function |
<optional> <nullable> |
olympe.dc.CloudObject | Type of the expected results. |
- Implements:
Members
-
<non-null> subscription :olympe.dc.query.Subscription
-
Type:
Methods
-
builder()
-
Creates the
ListDefBuilder
for thisListDef
.Returns:
The created builder.
-
dump()
-
Gets a string representation of the inner subscription.
Returns:
The string representation.
- Type
- string
-
execute()
-
Sends the listdef to the query engine to execute it.
Returns:
this listDef
- Type
- olympe.dc.ListDef
-
filter(predicate)
-
Creates a new
ListDef
which is the filtered version of this one.Example:
const lst = oldList.filter( new olympe.dc.predicates.Equals( new olympe.dc.valuedefs.StringProperty(colorProp), new olympe.dc.valuedefs.Constant("red") ) );
Parameters:
Name Type Description predicate
olympe.dc.Predicate The
Predicate
to filter on.Returns:
The created
ListDef
.- Type
- olympe.dc.ListDef
-
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.
- Inherited From:
- Overrides:
- Implements:
-
forEachCurrentValue(callback)
-
Executes the specified callback on each current item. If the callbacks returns
false
then it will break out of the loop.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.
Parameters:
Name Type Description callback
function The function to invoke on each value.
- Inherited From:
- Overrides:
- Implements:
-
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 immediately 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.
- Implements:
-
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.
- Inherited From:
- Overrides:
- Implements:
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
-
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.
- Implements:
Returns:
the value of the entry at that rank.
- Type
- olympe.df.Proxy.<T> | T
-
getBaseTag()
-
Gets this
ListDef
base tag.Returns:
The tag.
- Type
- !olympe.df.Proxy.<string> | string
-
getCurrent(key)
-
Gets the current value associated with a specific key, that is the value at the time of the method call.
Parameters:
Name Type Description key
string | olympe.df.POString the key whose associated value is to be returned.
- Inherited From:
- Overrides:
- Implements:
Returns:
the current value to which the specified key is mapped, or undefined if this map contains no mapping for the key.
- Type
- T | undefined
-
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.
- Implements:
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.
- Implements:
Returns:
the key of the entry at that rank.
- Type
- string | undefined
-
getCurrentRank(key)
-
Gets the rank of the specified entry at the time of the method call.
Parameters:
Name Type Description key
string the key of the entry.
- Implements:
Returns:
the rank of the entry.
- Type
- number | undefined
-
getCurrentSize()
-
Gets the number of key-value mappings in this map at the time of the method call.
- Inherited From:
- Overrides:
- Implements:
Returns:
the current number of key-value mappings in this map
- Type
- number
-
getFirst()
-
Gets the value of the first entry in the collection.
- Inherited From:
- Overrides:
- Implements:
Returns:
the value of the first entry.
- Type
- olympe.df.Proxy.<T> | T
-
getFirstKey()
-
Gets the key for the first entry in the collection.
- Inherited From:
- Overrides:
- Implements:
Returns:
the key for the first entry
- 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.
- Implements:
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.
- Implements:
Returns:
an Array of the keys.
- Type
- Array | olympe.df.Proxy
-
getManager()
-
Get the DC manager attached to this
ListDef
.Returns:
- Type
- olympe.dc.Manager
-
getQuery()
-
Gets the
ListDef
query (the array of transformers).Returns:
The transformers, or
null
if empty.- Type
- Array.<!olympe.dc.Transformer>
-
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.
- Implements:
Returns:
the rank of the entry.
- Type
- olympe.df.PONumber
-
getSize()
-
Gets the number of key-value mappings in this collection.
- Inherited From:
- Overrides:
- Implements:
Returns:
the number of key-value mappings in this map
- Type
- olympe.df.PONumber
-
getSubscription()
-
Get the underlying Subscription from the DataCloud Manager.
Returns:
The subscription.
-
getValueType()
-
Gets the type of the objects stored in this Map.
- Inherited From:
- Overrides:
- Implements:
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.
- Inherited From:
- Overrides:
- Implements:
Returns:
true if this map contains a mapping for the specified key.
- Type
- olympe.df.POBoolean
-
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.
- Inherited From:
- Overrides:
- Implements:
Returns:
true if this map contains a mapping for the specified key.
- Type
- boolean
-
isCurrentlyReady()
-
Returns true if the list is currently ready.
Returns:
true
if the list is ready.- Type
- boolean
-
isReady()
-
Checks whether the list is ready (ie. all instances have been added and have ranks)
Returns:
true
if the list is ready.- Type
- olympe.df.POBoolean
-
observeAt(rank)
-
Return an observable to the object at the specified rank position.
Parameters:
Name Type Description rank
number Returns:
- Type
- rxjs.Observable.<olympe.dc.CloudObject>
-
observeFirst()
-
Return an observable to the Sync at the first position.
Returns:
- Type
- rxjs.Observable.<olympe.dc.CloudObject>
-
observeRank(key)
-
Return an observable to the rank of the object associated to the specified key.
Parameters:
Name Type Description key
string Returns:
- Type
- rxjs.Observable.<number>
-
observeSize()
-
Return an observable to the size of this listdef.
Returns:
- Type
- rxjs.Observable.<number>
-
offReady(id)
-
Unregisters a specific 'onReady' callback.
Parameters:
Name Type Description id
string The id of the callback, as returned by
onReady(callback, id)
. -
onReady(callback [, id])
-
Registers a callback that will be triggered when the subscription becomes 'ready'.
Parameters:
Name Type Argument Description callback
olympe.dc.query.Subscription.ReadyCallback The callback to invoke.
id
string <optional>
The id for this callback. A unique ID will be created if this is omitted.
- See:
Returns:
Callback The id for this callback.
- Type
- string
-
setValueType(valueType)
-
Sets the type of the objects that can be stored in this Map.
Parameters:
Name Type Description valueType
function Value type constructor.
- Inherited From:
- Overrides:
- Implements:
-
toOString()
-
Convert current object to a string representation (a concatenation of List's object own representations).
Returns:
The string representation.
- Type
- olympe.df.POString
-
toString()
-
Gets a string representation of the
ListDef
.Returns:
The string representation.
- Type
- string
-
transform(additionalTransformers)
-
Creates a new
ListDef
that is the result of the specified transformers being applied to thisListDef
.Parameters:
Name Type Argument Description additionalTransformers
!Array.<!olympe.dc.Transformer> | olympe.dc.Transformer <repeatable>
Any number of transformers, as a ...list or as a single array (an error is thrown if the two methods are combined)
Returns:
A new ListDef with the specified transformations.
- Type
- olympe.dc.ListDef
-
union(listDef)
-
Creates a new
ListDef
which is the union of this one and the specified one.Parameters:
Name Type Description listDef
olympe.dc.ListDef The
ListDef
to merge with.Returns:
The resulting
ListDef
.- Type
- olympe.dc.ListDef