Packagecom.yworks.graph.model
Classpublic class YGraphAdapter
InheritanceYGraphAdapter Inheritance Object

Utility class that conveniently converts an IGraph instance to a Graph instance.

This class creates a structural copy of a given IGraph and provides convenience methods to convert entities from one instance to their corresponding representatives in the other instance.

See also

IGraph
Graph


Public Properties
 PropertyDefined By
  originalGraph : IGraph
[read-only] Gets the original graph instance.
YGraphAdapter
  yGraph : Graph
[read-only] Gets the graph instance that is created during the constructor call.
YGraphAdapter
Public Methods
 MethodDefined By
  
YGraphAdapter(originalGraph:IGraph)
Initializes a new instance of the YGraphAdapter class. This will create a copy of the originalGraph that has the same structure and makes it available via the yGraph property.
YGraphAdapter
  
createDataMap(mapper:IMapper):DataMap
Creates a DataMap that delegates to the provided IMapper when queried for items in the yGraph. This method is useful where algorithms require DataMaps as input and that input can be obtained from IMapper instances that provide and accept values for the original nodes and edges.
YGraphAdapter
  
Creates a DataProvider that delegates to the provided IMapper when queried for items in the yGraph. This method is useful where algorithms require DataProviders as input and that input can be obtained from IMapper instances that provide the values for the original nodes and original edges.
YGraphAdapter
  
Creates an Iterator of edges that maps the edges from the EdgeList to their original ones. This method is useful where algorithms yield EdgeList instances as results and the result needs to be interpreted in terms of the original graph.
YGraphAdapter
  
createEdgeList(edgeIt:Iterator):EdgeList
Creates an EdgeList that maps the edges from the Iterator to their copied ones. This method is useful where algorithms require EdgeList instances as input and those edges are available as Iterators in the originalGraph.
YGraphAdapter
  
createEdgeMap(mapper:IMapper):EdgeMap
Creates an EdgeMap that delegates to the provided IMapper when queried for Edges in the yGraph. This method is useful where algorithms require EdgeMaps as input and this can be mapped to corresponding IMapper instances that provide and accept values for the original edges.
YGraphAdapter
  
Creates an Iterator of nodes that maps the nodes from the NodeList to their original ones. This method is useful where algorithms yield NodeList instances as results and the result needs to be interpreted in terms of the original graph.
YGraphAdapter
  
createNodeList(nodeIt:Iterator):NodeList
Creates an NodeList that maps the nodes from the Iterator to their copied ones. This method is useful where algorithms require NodeList instances as input and those nodes are available as Iterators in the originalGraph.
YGraphAdapter
  
createNodeMap(mapper:IMapper):NodeMap
Creates a NodeMap that delegates to the provided IMapper when queried for Nodes in the yGraph. This method is useful where algorithms require NodeMaps as input and this can be mapped to corresponding IMapper instances that provide and accept values for the original nodes.
YGraphAdapter
  
Yields the edge that has been created as a copy in yGraph to represent the given edge.
YGraphAdapter
  
Yields the node that has been created as a copy in yGraph to represent the given node.
YGraphAdapter
  
getCopy(o:Object):Object
Yields the object that has been created as a copy in yGraph to represent the given object.
YGraphAdapter
  
getOriginal(o:Object):Object
Yields the original object from the originalGraph that the given object has been created for.
YGraphAdapter
  
Yields the original edge from the originalGraph that the given edge has been created for.
YGraphAdapter
  
Yields the original node from the originalGraph that the given node has been created for.
YGraphAdapter
Property Detail
originalGraphproperty
originalGraph:IGraph  [read-only]

Gets the original graph instance.


Implementation
    public function get originalGraph():IGraph
yGraphproperty 
yGraph:Graph  [read-only]

Gets the graph instance that is created during the constructor call.


Implementation
    public function get yGraph():Graph
Constructor Detail
YGraphAdapter()Constructor
public function YGraphAdapter(originalGraph:IGraph)

Initializes a new instance of the YGraphAdapter class.

This will create a copy of the originalGraph that has the same structure and makes it available via the yGraph property.

Parameters
originalGraph:IGraph — The original graph whose structure will be copied.
Method Detail
createDataMap()method
public function createDataMap(mapper:IMapper):DataMap

Creates a DataMap that delegates to the provided IMapper when queried for items in the yGraph.

This method is useful where algorithms require DataMaps as input and that input can be obtained from IMapper instances that provide and accept values for the original nodes and edges.

Parameters

mapper:IMapper — The mapper to direct requests to.

Returns
DataMap — A DataMap that will delegate the functionality to the mapper.

See also

createDataProvider()method 
public function createDataProvider(mapper:IMapper):DataProvider

Creates a DataProvider that delegates to the provided IMapper when queried for items in the yGraph.

This method is useful where algorithms require DataProviders as input and that input can be obtained from IMapper instances that provide the values for the original nodes and original edges.

Parameters

mapper:IMapper — The mapper to direct requests to.

Returns
DataProvider — A DataProvider that will delegate requests to the mapper.

See also

createEdgeIterator()method 
public function createEdgeIterator(el:EdgeList):Iterator

Creates an Iterator of edges that maps the edges from the EdgeList to their original ones.

This method is useful where algorithms yield EdgeList instances as results and the result needs to be interpreted in terms of the original graph.

Parameters

el:EdgeList — The edge list.

Returns
Iterator — An iterator that contains the original edges for the ones in the list.

See also

createEdgeList()method 
public function createEdgeList(edgeIt:Iterator):EdgeList

Creates an EdgeList that maps the edges from the Iterator to their copied ones.

This method is useful where algorithms require EdgeList instances as input and those edges are available as Iterators in the originalGraph.

Parameters

edgeIt:Iterator — The edges from the originalGraph.

Returns
EdgeList — An EdgeList that contains the copied edges for the ones in the iterator.

See also

createEdgeMap()method 
public function createEdgeMap(mapper:IMapper):EdgeMap

Creates an EdgeMap that delegates to the provided IMapper when queried for Edges in the yGraph.

This method is useful where algorithms require EdgeMaps as input and this can be mapped to corresponding IMapper instances that provide and accept values for the original edges.

Parameters

mapper:IMapper — The mapper to direct requests to.

Returns
EdgeMap — An EdgeMap that will delegate the functionality to the mapper.

See also

createNodeIterator()method 
public function createNodeIterator(nl:NodeList):Iterator

Creates an Iterator of nodes that maps the nodes from the NodeList to their original ones.

This method is useful where algorithms yield NodeList instances as results and the result needs to be interpreted in terms of the original graph.

Parameters

nl:NodeList — The node list.

Returns
Iterator — An iterator that contains the original nodes for the ones in the list.

See also

createNodeList()method 
public function createNodeList(nodeIt:Iterator):NodeList

Creates an NodeList that maps the nodes from the Iterator to their copied ones.

This method is useful where algorithms require NodeList instances as input and those nodes are available as Iterators in the originalGraph.

Parameters

nodeIt:Iterator — The nodes from the originalGraph.

Returns
NodeList — An NodeList that contains the copied nodes for the ones in the iterator.

See also

createNodeMap()method 
public function createNodeMap(mapper:IMapper):NodeMap

Creates a NodeMap that delegates to the provided IMapper when queried for Nodes in the yGraph.

This method is useful where algorithms require NodeMaps as input and this can be mapped to corresponding IMapper instances that provide and accept values for the original nodes.

Parameters

mapper:IMapper — The mapper to direct requests to.

Returns
NodeMap — A NodeMap that will delegate the functionality to the mapper.

See also

getCopiedEdge()method 
public function getCopiedEdge(e:IEdge):Edge

Yields the edge that has been created as a copy in yGraph to represent the given edge.

Parameters

e:IEdge — The edge for which the representation is returned.

Returns
Edge — The edge that represents e in yGraph.

See also

getCopiedNode()method 
public function getCopiedNode(n:INode):Node

Yields the node that has been created as a copy in yGraph to represent the given node.

Parameters

n:INode — The node for which the representation is returned.

Returns
Node — The node that represents n in yGraph.

See also

getCopy()method 
public function getCopy(o:Object):Object

Yields the object that has been created as a copy in yGraph to represent the given object.

Parameters

o:Object — The object for which the representation is returned.

Returns
Object — The object that represents o in yGraph.

See also

getOriginal()method 
public function getOriginal(o:Object):Object

Yields the original object from the originalGraph that the given object has been created for.

Parameters

o:Object — The object for which the original instance will be returned.

Returns
Object — The original instance.

See also

getOriginalEdge()method 
public function getOriginalEdge(e:Edge):IEdge

Yields the original edge from the originalGraph that the given edge has been created for.

Parameters

e:Edge — The edge for which the original instance will be returned.

Returns
IEdge — The original instance.

See also

getOriginalNode()method 
public function getOriginalNode(n:Node):INode

Yields the original node from the originalGraph that the given node has been created for.

Parameters

n:Node — The node for which the original instance will be returned.

Returns
INode — The original instance.

See also