Packagecom.yworks.support
Classpublic class DictionaryMapper
InheritanceDictionaryMapper Inheritance Object
Implements IRoundtripMapper

A dictionary-like mapper based on a Dictionary

See also

IMapper
flash.utils.Dictionary


Public Properties
 PropertyDefined By
  autoSerialize : Boolean
Whether this mapper should be serialized when the graph it is registered with is sent to the server.
DictionaryMapper
  defaultValue : *
DictionaryMapper
  name : String
[read-only] The attribute name.
DictionaryMapper
  scope : String
[read-only] One of GraphMLConstants.SCOPE_ALL GraphMLConstants.SCOPE_NODE GraphMLConstants.SCOPE_EDGE GraphMLConstants.SCOPE_GRAPH GraphMLConstants.SCOPE_PORT
DictionaryMapper
  valueType : String
[read-only] One of GraphMLConstants.TYPE_INT GraphMLConstants.TYPE_LONG GraphMLConstants.TYPE_FLOAT GraphMLConstants.TYPE_DOUBLE GraphMLConstants.TYPE_BOOLEAN GraphMLConstants.TYPE_STRING GraphMLConstants.TYPE_COMPLEX
DictionaryMapper
Public Methods
 MethodDefined By
  
DictionaryMapper(weakKeys:Boolean = false, name:String = null, scope:String = null, valueType:String = null, autoSerialize: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
  
DictionaryMapper
  
unMapValue(key:Object):void
Removes a previously created association with the given key.
DictionaryMapper
  
Creates an Iterator over the values.
DictionaryMapper
Property Detail
autoSerializeproperty
autoSerialize:Boolean

Whether this mapper should be serialized when the graph it is registered with is sent to the server.


Implementation
    public function get autoSerialize():Boolean
    public function set autoSerialize(value:Boolean):void
defaultValueproperty 
defaultValue:*


Implementation
    public function get defaultValue():*
    public function set defaultValue(value:any):void
nameproperty 
name:String  [read-only]

The attribute name. Used both as a key for the graph's IMapperRegistry and for GraphML serialization.


Implementation
    public function get name():String
scopeproperty 
scope:String  [read-only]

One of


Implementation
    public function get scope():String
valueTypeproperty 
valueType:String  [read-only]

One of


Implementation
    public function get valueType():String
Constructor Detail
DictionaryMapper()Constructor
public function DictionaryMapper(weakKeys:Boolean = false, name:String = null, scope:String = null, valueType:String = null, autoSerialize: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.
 
name:String (default = null) — The name of the attribute mapper with which the dictionary is registered if it is marked for auto serialization.
 
scope:String (default = null) — The scope of the auto serialized attribute mapper as defined in the GraphMLConstants.SCOPE constants.
 
valueType:String (default = null) — The type of the auto serialized attribute mapper as defined in the GraphMLConstants.TYPE constants.
 
autoSerialize:Boolean (default = false) — If this mapper is registered to a graph's mapperRegistry and autoSerialize is set to true, this mapper will be automatically serialized as attribute mapper
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.

register()method 
public function register(graph:IGraph):DictionaryMapper

Parameters

graph:IGraph

Returns
DictionaryMapperthis, for chaining
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.