Search this API

y.util
Class GraphCopier.GraphDataCopyFactory

java.lang.Object
  extended by y.util.GraphCopier.GraphDataCopyFactory
All Implemented Interfaces:
GraphCopier.CopyFactory
Direct Known Subclasses:
Graph2DCopyFactory.HierarchicGraph2DCopyFactory, GraphCopier.DataProviderCopyFactory, GraphCopier.EdgeMapCopyFactory, GraphCopier.NodeMapCopyFactory, LayoutGraphCopyFactory.HierarchicGraphCopyFactory
Enclosing class:
GraphCopier

public abstract static class GraphCopier.GraphDataCopyFactory
extends java.lang.Object
implements GraphCopier.CopyFactory

An abstract base implementation of a delegating GraphCopier.GraphDataCopyFactory that copies data for items being copied. The actual copying will be performed by the wrapped delegate. Instances of this class should be used to wrap existing copy factories. Subclasses should override any or all of the copyData(y.base.Node,y.base.Node), copyData(y.base.Edge,y.base.Edge), preCopyData(y.base.Graph,y.base.Graph), and postCopyData(y.base.Graph,y.base.Graph,java.util.Map,java.util.Map) methods.

 
Your browser does not support SVG content.

Constructor Summary
protected GraphCopier.GraphDataCopyFactory(GraphCopier.CopyFactory delegatingFactory)
          Creates a new instance that delegates the actual copying process of the elements to the provided factory.
 
Method Summary
protected  void copyData(Edge src, Edge dst)
          Empty stub to be overwritten by subclass implementations.
protected  void copyData(Node src, Node dst)
          Empty stub to be overwritten by subclass implementations.
 Edge copyEdge(Graph graph, Node source, Node target, Edge hint)
          Delegates the copying of the data to copyData(y.base.Edge,y.base.Edge)
 Node copyNode(Graph graph, Node hint)
          Delegates the copying of the data to copyData(y.base.Node,y.base.Node)
 Graph createGraph()
          Creates a new graph instance that will be the target graph of the copy operation.
protected  void postCopyData(Graph src, Graph dst, java.util.Map nodeMap, java.util.Map edgeMap)
          Empty stub to be overwritten by subclass implementations.
 void postCopyGraphData(Graph srcGraph, Graph newGraph, java.util.Map nodeMap, java.util.Map edgeMap)
          Calls the delegate and then postCopyData(y.base.Graph,y.base.Graph,java.util.Map,java.util.Map).
protected  void preCopyData(Graph src, Graph dst)
          Empty stub to be overwritten by subclass implementations.
 void preCopyGraphData(Graph srcGraph, Graph newGraph)
          Calls preCopyData(y.base.Graph,y.base.Graph) and then the delegate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphCopier.GraphDataCopyFactory

protected GraphCopier.GraphDataCopyFactory(GraphCopier.CopyFactory delegatingFactory)
Creates a new instance that delegates the actual copying process of the elements to the provided factory.

Parameters:
delegatingFactory -
Method Detail

preCopyGraphData

public void preCopyGraphData(Graph srcGraph,
                             Graph newGraph)
Calls preCopyData(y.base.Graph,y.base.Graph) and then the delegate.

Specified by:
preCopyGraphData in interface GraphCopier.CopyFactory
Parameters:
srcGraph - 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 srcGraph,
                              Graph newGraph,
                              java.util.Map nodeMap,
                              java.util.Map edgeMap)
Calls the delegate and then postCopyData(y.base.Graph,y.base.Graph,java.util.Map,java.util.Map).

Specified by:
postCopyGraphData in interface GraphCopier.CopyFactory
Parameters:
srcGraph - 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 graph,
                     Node hint)
Delegates the copying of the data to copyData(y.base.Node,y.base.Node)

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

createGraph

public Graph createGraph()
Description copied from interface: GraphCopier.CopyFactory
Creates a new graph instance that will be the target graph of the copy operation. This method is called if no target graph is specified by the user.

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

preCopyData

protected void preCopyData(Graph src,
                           Graph dst)
Empty stub to be overwritten by subclass implementations.


postCopyData

protected void postCopyData(Graph src,
                            Graph dst,
                            java.util.Map nodeMap,
                            java.util.Map edgeMap)
Empty stub to be overwritten by subclass implementations.

Parameters:
nodeMap - a Map that maps old node instances to their new copies
edgeMap - a Map that maps old edge instances to their new copies

copyData

protected void copyData(Node src,
                        Node dst)
Empty stub to be overwritten by subclass implementations.

Parameters:
src - the old entity
dst - the new entity

copyData

protected void copyData(Edge src,
                        Edge dst)
Empty stub to be overwritten by subclass implementations.

Parameters:
src - the old entity
dst - the new entity

copyEdge

public Edge copyEdge(Graph graph,
                     Node source,
                     Node target,
                     Edge hint)
Delegates the copying of the data to copyData(y.base.Edge,y.base.Edge)

Specified by:
copyEdge in interface GraphCopier.CopyFactory
Parameters:
graph - 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
hint - the original edge from the source graph
Returns:
the newly created edge

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