class sap.ui.vtm.Lookup

Control sample: sap.ui.vtm.Lookup
Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/vtm/Lookup
Application Component:

A map that can contain multiple values per key value. This is a utility class that can be used as a data structure for:

A typical usage would be to use a sap.ui.vtm.Lookup that is keyed using a hash code constructed from some or all of the information needed to match a particular tree item or scene node. In this scenario the sap.ui.vtm.Lookup is used to return a set of possible matches which are then filtered to find the actual matches. The usage of the sap.ui.vtm.Lookup with a suitable key can drastically reduces the number of items that need to be compared when performing a search. This is important when there are large numbers of searches that need to be performed within a large set of items.


Constructor

Constructor for a new Lookup.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.

new sap.ui.vtm.Lookup(equalsFunc)
Param Type Default Value Description
equalsFunc function

A function to compare two values for equality (takes two values as parameters and returns true if they are equal).


Methods Overview

Method Description
addValue

Adds a value to the set of values stored against a given key.

clear

Clears the Lookup.

sap.ui.vtm.Lookup.extend

Creates a new subclass of class sap.ui.vtm.Lookup with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.Element.extend.

forEach

Loops over the key/value array pairs calling the callback function for each pair.

sap.ui.vtm.Lookup.getMetadata

Returns a metadata object for class sap.ui.vtm.Lookup.

getValues

Gets the values stored against a given key.

hasValue

Returns whether there are any values stored against the given key.

removeValue

Removes a particular value.

addValue

Adds a value to the set of values stored against a given key.

Param Type DefaultValue Description
key any

The key.

value any

The value.

clear

Clears the Lookup.

sap.ui.vtm.Lookup.extend

Creates a new subclass of class sap.ui.vtm.Lookup with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.Element.extend.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

forEach

Loops over the key/value array pairs calling the callback function for each pair.

Param Type DefaultValue Description
callback function

The callback function to call for each key/value array pair. The first argument to the callback function is the value array and the second parameter is the key.

sap.ui.vtm.Lookup.getMetadata

Returns a metadata object for class sap.ui.vtm.Lookup.

getValues

Gets the values stored against a given key.

Param Type DefaultValue Description
key any

The key to use to index the Lookup.

hasValue

Returns whether there are any values stored against the given key.

Param Type DefaultValue Description
key any

The key.

removeValue

Removes a particular value.

Param Type DefaultValue Description
key any

The key.

value any

The value.

equalsFunc function

A function to compare two values for equality (takes two values as parameters and returns true if they are equal).