An interface for typed dictionary-like implementations.
Inheritance Hierarchy
- IIMapper<K, V>
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 Mapper.delete<K, V> method.
abstract
Parameters
- key: K
- The key of the mapping.
Return Value
- V | null
- 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 Mapper.delete<K, V> method.
abstract
Parameters
- key: K
- The key of the mapping.
- value: V | null
- The value.
See Also
Developer's Guide
API
- get
Static Methods
static
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.
Parameters
- mapperLike: IMapper<K, V>conversion
- The object to convert to a IMapper<K, V>
Creates a constant mapper that will always return the constant.
Creates a constant mapper that will always return the
constant.The returned implementation silently ignores calls to the IMapper<K, V> indexer setter if no setter has been provided.
static
Type Parameters
K
- The type of the key to use.
V
- The type of the value to use.
Parameters
- getter: function(K): V
- The delegate to delegate IMapper<K, V> indexer getter calls to.
Function Details
A delegate that mimics the IMapper.get<K, V> access.Parameters- key: K
- The key of the mapping.
Return Value- V
- The value or a suitable default that is associated with
key.
- setter?: function(K, V): void
- The delegate to delegate IMapper<K, V> indexer setter calls to.
Function Details
A delegate that mimics IMapper<K, V>'s indexer write-access.Parameters- key: K
- The key of the mapping.
- value: V
- The new value of the mapping.
Return Value
- IMapper<K, V>
- An implementation that delegates to
getterandsetter.
See Also
Developer's Guide