Nokia Maps API Reference

Contents

Class nokia.maps.util.OList

Class Summary

This class defines an observable list.

new nokia.maps.util.OList ([elements])
Method Summary
add (element, [idx]) : nokia.maps.util.OList This method adds a new element to the list.
addAll (elements, [idx]) : nokia.maps.util.OList This method adds multiple new elements to the list.
addObserver (callback, [context]) This method registers a new observer on the given instance of OList.
asArray () : Array This method gets the list as an array.
clear () This method clears all elements from the list.
get (idx) : Variant This method gets the value for the specified list element.
getLength () : Number This method getg the length of the list.
indexOf (obj) : Number This method retrieves the index of the first object in this list that matches the object supplied by the caller.
remove (obj) : Variant This method removes from the list the first element that matches the object supplied by the caller.
removeAll (elements) : nokia.maps.util.OList This method removes multiple elements from the list.
removeAt (idx) : Variant This method removes an element by a given index from the list.
removeObserver (callback, context) : nokia.maps.util.OObject This method unregisters an observer.
set (element, idx) : Variant This method sets (replaces) an element at the given index in the list.
Constructor Detail

This method initializes a new instance of the class.

new nokia.maps.util.OList([elements])
Parameters:
{Array} [elements]: The initial list elements to use; if omitted, an empty array is used
Method Detail
add (element, [idx]) : nokia.maps.util.OList
This method adds a new element to the list.
Parameters:
{Variant} element The new element to add
{Number} [idx]: The index where the new element should be inserted; if omitted or greater then the current size of the list, the element is added at the end of the list; a negative index is treated as being relative from the end of the list
Exceptions:
IllegalState if an observer triggers a rollback during an ongoing rollback
IllegaleArgument if the argument idx is not a number
Returns:
{nokia.maps.util.OList} The given instance of OList
addAll (elements, [idx]) : nokia.maps.util.OList
This method adds multiple new elements to the list.
Parameters:
{Variant[]} elements The new elements to add
{Number} [idx]: The index where the new elements should be inserted; if omitted or greater then the current size of the list, the elements are added at the end of the list; a negative index is treated as being relative from the end of the list
Exceptions:
IllegalState if an observer triggers a rollback during an ongoing rollback
Returns:
{nokia.maps.util.OList} The given instance of OList
addObserver (callback, [context])
This method registers a new observer on the given instance of OList. The observer is a callback to be invoked when the instance changes, typically when an element is added or removed.
Parameters:
{Function} callback The callback function to be invoked after the list has been modified; the callback must accept the following arguments:
  • (OList) oList - the OList instance itself
  • (String) method - the name of the method which triggered a change to the given instance of OList and therefore a call to the callback
  • (Variant) element - the element which was added or deleted
  • (Number) idx - the index of the element concerned
The callback can signal that a rollback should be triggered by returning true.
{Object} [context]: The context to use when the callback is invoked
asArray () : Array
This method gets the list as an array.
Returns:
{Array} The list as an array
clear ()
This method clears all elements from the list.
Exceptions:
IllegalState if an observer triggers a rollback during an ongoing rollback
get (idx) : Variant
This method gets the value for the specified list element.
Parameters:
{Number} idx The index of the element to get
Exceptions:
IllegaleArgument if an observer triggers a rollback during an ongoing rollback
Returns:
{Variant} The value of the element
getLength () : Number
This method getg the length of the list.
Returns:
{Number} The length of the list
indexOf (obj) : Number
This method retrieves the index of the first object in this list that matches the object supplied by the caller.
Parameters:
{Variant} obj The object for which to return the index.
Returns:
{Number} The index of the first matching object in this list or -1 if the object provided by the caller is not found in the list
remove (obj) : Variant
This method removes from the list the first element that matches the object supplied by the caller.
Parameters:
{Variant} obj The element to remove
Exceptions:
IllegalState if an observer triggers a rollback during an ongoing rollback.
Returns:
{Variant} The removed element
removeAll (elements) : nokia.maps.util.OList
This method removes multiple elements from the list.
Parameters:
{Variant[]} elements The elements to remove
Exceptions:
IllegalState if an observer triggers a rollback during an ongoing rollback
Returns:
{nokia.maps.util.OList} The given instance of OList
removeAt (idx) : Variant
This method removes an element by a given index from the list.
Parameters:
{Number} idx The index of the element which should be removed
Exceptions:
IllegalState if an observer triggers a rollback during an ongoing rollback
Returns:
{Variant} The removed element or null if a observer signaled a rollback
removeObserver (callback, context) : nokia.maps.util.OObject
This method unregisters an observer.
Parameters:
{Function} callback The observer method to be removed
{Object} context The context in which the given callback should be called
Returns:
{nokia.maps.util.OObject} The reference to the given OObject instance
set (element, idx) : Variant
This method sets (replaces) an element at the given index in the list.
Parameters:
{Variant} element The element to set at the index specified by idx
{Number} idx The index of the element which should be replaced
Exceptions:
IllegalState if an observer triggers a rollback during an ongoing rollback
Returns:
{Variant} The replaced element or undefined if an observer has triggered a rollback
Documentation generated on Thu Feb 09 2012 12:59:07 GMT+0100 (CET).