An interface for typed dictionary-like implementations.
Inheritance Hierarchy
Remarks
IMapper<K, V>s are most prominently used when working with supplemental configuration for layout algorithms and custom data in GraphML.
Type Parameters
K
- The type of element this interface accepts as keys for the mapping.
V
- The type of element this interface accepts as values for the mapping.
See Also
- Using IMapper<K, V> is described in the section Associating Data with Graph Elements.
Developer's Guide
API
- Mapper
Demos
- Shows drag and drop of nodes, groups and labels.
Members
No filters for this type
Methods
Setting a value for an already existing key overwrites the previous value.
It depends on the specific implementation of the mapper whether a mapping can be removed. If an implementation provides a way to remove a mapping, that should be preferred over setting a null value. For example, Mapper<K, V> provides the delete method.
abstract
Parameters
- key: K
- The key of the mapping.
Return Value
- V
- The value.
See Also
Developer's Guide
API
- set
Setting a value for an already existing key overwrites the previous value.
It depends on the specific implementation of the mapper whether a mapping can be removed. If an implementation provides a way to remove a mapping, that should be preferred over setting a null value. For example, Mapper<K, V> provides the delete method.
abstract
Parameters
- key: K
- The key of the mapping.
- value: V
- The value.
See Also
Developer's Guide
API
- get
Static Methods
Creates an IMapper<K, V> instance from the given mapper-like object by performing automatic type conversion.
Creates an IMapper<K, V> instance from the given mapper-like object by performing automatic type conversion.
static
Parameters
- mapperLike: IMapper<K, V>
- The object to convert to a IMapper<K, V>
Return Value
- IMapper<K, V>
- An IMapper<K, V> instance, initialized with the values found in
mapperLike.
Creates a constant mapper that will always return the constant.
Creates a constant mapper that will always return the
constant.static
Parameters
- constant: V
- The constant to return in IMapper<K, V>'s indexer.
Return Value
- IMapper<K, V>
- A new instance that will always return the same constant.
See Also
Developer's Guide
Create an implementation of IMapper<K, V> that delegates IMapper<K, V> indexer calls to the provided getter and (optional) setter handlers.
Create an implementation of IMapper<K, V> that delegates IMapper<K, V> indexer calls to the provided getter and (optional) setter handlers.
The returned implementation silently ignores calls to the IMapper<K, V> indexer setter if no setter has been provided.
static
Parameters
- getter: function(K): V
- The delegate to delegate IMapper<K, V> indexer getter calls to.
- setter?: function(K, V): void
- The delegate to delegate IMapper<K, V> indexer setter calls to.
Return Value
- IMapper<K, V>
- An implementation that delegates to
getterandsetter.
See Also
Developer's Guide