Search this API

y.base
Class GraphCopyFactory

java.lang.Object
  extended by y.base.GraphCopyFactory
All Implemented Interfaces:
GraphCopier.CopyFactory

public class GraphCopyFactory
extends java.lang.Object
implements GraphCopier.CopyFactory

Very simple default implementation of a Copy Factory that creates Graph instances and simply delegates to the Graph.createNode() and Graph.createEdge(Node, Node) method.

 
Your browser does not support SVG content.

Constructor Summary
GraphCopyFactory()
           
 
Method Summary
 Edge copyEdge(Graph targetGraph, Node source, Node target, Edge originalEdge)
          Copies the originalEdge from the source graph to the new targetGraph using the specified new source and target node in the target graph.
 Node copyNode(Graph targetGraph, Node originalNode)
          Copies the originalNode from the source graph to the new targetGraph
 Graph createGraph()
          Creates a new Graph.
 void postCopyGraphData(Graph originalGraph, Graph newGraph, java.util.Map nodeMap, java.util.Map edgeMap)
          This implementation does nothing.
 void preCopyGraphData(Graph hint, Graph newGraph)
          This implementation does nothing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphCopyFactory

public GraphCopyFactory()
Method Detail

preCopyGraphData

public void preCopyGraphData(Graph hint,
                             Graph newGraph)
This implementation does nothing.

Specified by:
preCopyGraphData in interface GraphCopier.CopyFactory
Parameters:
hint - the graph that will be used to copy the entities from.
newGraph - the graph that will be used to copy the entities to.

postCopyGraphData

public void postCopyGraphData(Graph originalGraph,
                              Graph newGraph,
                              java.util.Map nodeMap,
                              java.util.Map edgeMap)
This implementation does nothing.

Specified by:
postCopyGraphData in interface GraphCopier.CopyFactory
Parameters:
originalGraph - the graph that was used to copy the entities from.
newGraph - the graph that was used to copy the entities to.
nodeMap - a map that contains a mapping between the nodes in the source graph to their corresponding nodes in the new graph.
edgeMap - a map that contains a mapping between the edges in the source graph to their corresponding edges in the new graph.

copyNode

public Node copyNode(Graph targetGraph,
                     Node originalNode)
Description copied from interface: GraphCopier.CopyFactory
Copies the originalNode from the source graph to the new targetGraph

Specified by:
copyNode in interface GraphCopier.CopyFactory
Parameters:
targetGraph - the graph to create the new node in
originalNode - the original node from the source graph
Returns:
the newly created node

copyEdge

public Edge copyEdge(Graph targetGraph,
                     Node source,
                     Node target,
                     Edge originalEdge)
Description copied from interface: GraphCopier.CopyFactory
Copies the originalEdge from the source graph to the new targetGraph using the specified new source and target node in the target graph.

Specified by:
copyEdge in interface GraphCopier.CopyFactory
Parameters:
targetGraph - the graph to create the new node in
source - the source node in the target graph to use for the newly created edge
target - the target node in the target graph to use for the newly created edge
originalEdge - the original edge from the source graph
Returns:
the newly created edge

createGraph

public Graph createGraph()
Creates a new Graph.

Specified by:
createGraph in interface GraphCopier.CopyFactory
Returns:
the graph to use as the target graph

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.