Packagecom.yworks.support
Classpublic class DictionaryMapper
ImplementsIMapper

A dictionary-like mapper based on a Dictionary

See also

IMapper
flash.utils.Dictionary


Public Methods
 MethodDefined by
  
DictionaryMapper(weakKeys:Boolean = false)
Creates a new instance.
DictionaryMapper
  
clear():void
Removes all entries from this mapper.
DictionaryMapper
  
[static] Inverts a mapper so that its keys will become its values and its values will be used as keys.
DictionaryMapper
  
hasValue(key:Object):Boolean
Returns true if the given key has a value mapped to.
DictionaryMapper
  
Creates an Iterator over the keys.
DictionaryMapper
  
lookupValue(key:Object):Object
Finds the associated value for the given key in the map.
DictionaryMapper
  
mapValue(key:Object, value:Object):void
Associates the given key with the value provided, removing previous associations.
DictionaryMapper
  
unMapValue(key:Object):void
Removes a previously created association with the given key.
DictionaryMapper
  
Creates an Iterator over the values.
DictionaryMapper
Constructor detail
DictionaryMapper()constructor
public function DictionaryMapper(weakKeys:Boolean = false)

Creates a new instance.

Parameters
weakKeys:Boolean (default = false) — Instructs the Dictionary object to use "weak" references on object keys. If the only reference to an object is in the specified Dictionary object, the key is eligible for garbage collection and is removed from the table when the object is collected.
Method detail
clear()method
public function clear():void

Removes all entries from this mapper.

createInverse()method 
public static function createInverse(mapper:IMapper, keys:Iterator):DictionaryMapper

Inverts a mapper so that its keys will become its values and its values will be used as keys.

Uses a selection of keys to invert.

Parameters
mapper:IMapper — The mapper to invert.
 
keys:Iterator — An iterator over the keys to invert.

Returns
DictionaryMapper
hasValue()method 
public function hasValue(key:Object):Boolean

Returns true if the given key has a value mapped to.

Parameters
key:Object — The key to test.

Returns
Booleantrue if a value has been mapped to the given key.
keys()method 
public function keys():Iterator

Creates an Iterator over the keys.

Returns
Iterator — An Iterator over the keys.
lookupValue()method 
public function lookupValue(key:Object):Object

Finds the associated value for the given key in the map.

Implementations normally should not throw an error if there was no association found for the key provided. Instead they should return a default value depending on the context they are used in.

Parameters
key:Object — The key to find the value for.

Returns
Object — The value of an association or a default value if no such association exists.
mapValue()method 
public function mapValue(key:Object, value:Object):void

Associates the given key with the value provided, removing previous associations.

Parameters
key:Object — The key to associate with a value.
 
value:Object — The value to associate the key with.
unMapValue()method 
public function unMapValue(key:Object):void

Removes a previously created association with the given key.

Parameters
key:Object — The key to remove from the mapping.
values()method 
public function values():Iterator

Creates an Iterator over the values.

Returns
Iterator — An Iterator over the values.