|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objecty25.base.GraphTools
A utility class which provides means to duplicate entire Graphs
or Graph2Ds. This is necessary, because the
clone methods provided by those classes do not take into
account DataProviders that are associated to the respective
graphs and therefore remain uncopied.
To copy a Graph, you call DuplicateGraph,
DuplicateGraph2D or
ConvertGraphToGraph2D and specify the
DataProviders that should be copied. This is accomplished via
the GraphTools.GraphDataInfo class.
| Nested Class Summary | |
static class |
GraphTools.GraphDataInfo
Stores information about a DataProvider. |
static interface |
GraphTools.RealizerFactory
An interface for creation of node and edge realizers. |
| Constructor Summary | |
GraphTools()
|
|
| Method Summary | |
static Graph2D |
ConvertGraphToGraph2D(Graph graph,
GraphTools.GraphDataInfo[] dataInfo,
NodeRealizer defaultNodeRealizer,
EdgeRealizer defaultEdgeRealizer)
Creates a copy of the given Graph. |
static Graph |
DuplicateGraph(Graph graph,
GraphTools.GraphDataInfo[] dataInfo)
Creates a copy of the given Graph. |
static Graph2D |
DuplicateGraph2D(Graph2D graph,
GraphTools.GraphDataInfo[] dataInfo,
GraphTools.RealizerFactory realizerFactory)
Creates a copy of the given Graph2D. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public GraphTools()
| Method Detail |
public static Graph DuplicateGraph(Graph graph,
GraphTools.GraphDataInfo[] dataInfo)
All nodes and edges of the given graph are copied. The index of a both nodes and edges is the same in the duplicate graph. The in/out order of edges is kept as well (! This is not true yet !).
Furthermore, the user can specify which DataProviders should be copied by
providing their respective keys. For each data provider, the user also
has to specify if it assigns values to nodes or to edges and the type of
the values. This is done via the GraphDataInfo
class.
Implementation Details: In order to copy DataProviders, new Node/EdgeMaps are created for each of them. Then each DataProvider is asked for the value of all nodes/edges and the result is stored in the appropriate Node/Edgemap. Then these Node/Edgemaps are registered as new DataProviders in the new graph. Therefore, dynamic DataProviders will not be copied correctly, since the values they return will be made constant through the copy process.
graph - the source graph that is to be duplicateddataInfo - holds information about which DataProviders should be copied
graph is null,
no copying takes place and null is returned.
public static Graph2D ConvertGraphToGraph2D(Graph graph,
GraphTools.GraphDataInfo[] dataInfo,
NodeRealizer defaultNodeRealizer,
EdgeRealizer defaultEdgeRealizer)
All nodes and edges of the given graph are copied. The index of a both nodes and edges is the same in the duplicate graph. The in/out order of edges is kept as well (! This is not true yet !).
Furthermore, the user can specify which DataProviders should be copied by
providing their respective keys. For each data provider, the user also
has to specify if it assigns values to nodes or to edges and the type of
the values. This is done via the GraphDataInfo
class.
Implementation Details: In order to copy DataProviders, new Node/EdgeMaps are created for each of them. Then each DataProvider is asked for the value of all nodes/edges and the result is stored in the appropriate Node/Edgemap. Then these Node/Edgemaps are registered as new DataProviders in the new graph. Therefore, dynamic DataProviders will not be copied correctly, since the values they return will be made constant through the copy process.
graph - the source graph that is to be duplicateddataInfo - holds information about which DataProviders should be copied
graph is null,
no copying takes place and null is returned.
public static Graph2D DuplicateGraph2D(Graph2D graph,
GraphTools.GraphDataInfo[] dataInfo,
GraphTools.RealizerFactory realizerFactory)
All nodes and edges of the given graph are copied. The index of a both nodes and edges is the same in the duplicate graph. The in/out order of edges is kept as well (! This is not true yet !).
Furthermore, the user can specify which DataProviders should be copied by
providing their respective keys. For each data provider, the user also
has to specify if it assigns values to nodes or to edges and the type of
the values. This is done via the GraphDataInfo
class.
A Graph2D stores Realizers for its Nodes and Edges. Each
Realizer has to provide a createCopy method that creates
an appropriate copy of the Realizer. So, when duplicating a Graph2D, one
could just call these methods. This method takes another approach though.
Instead of calling the createCopy methods directly, it
lets the user specify a RelizerFactory that will
handle the copying process for Realizers. For every NodeRealizer in the
source graph,
RealizerFactory.copyNodeRealizer
is called and for every EdgeRealizer in the source graph
RealizerFactory.copyEdgeRealizer
is called. This way, the user can provide a specific
RealizerFactory implementation that doesn't simply copy
the Realizers but also modifies them or returns a Realizer type that is
different from the source. (This is extremely useful in the context
adding existing Graph2D objects to a
Graph25D. There, all Node- and EdgeRealizers
have to be converted to their 25D counterparts in order to provide
correct OpenGL rendering. This is done internally by passing a
Realizer25DFactory object to
this routine.)
Implementation Details: In order to copy DataProviders, new Node/EdgeMaps are created for each of them. Then each DataProvider is asked for the value of all nodes/edges and the result is stored in the appropriate Node/Edgemap. Then these Node/Edgemaps are registered as new DataProviders in the new graph. Therefore, dynamic DataProviders will not be copied correctly, since the values they return will be made constant through the copy process.
graph - the source graph that is to be duplicateddataInfo - holds information about which DataProviders should be copiedrealizerFactory - responsible for copying all Node- and EdgeRealizers
graph is null,
no copying takes place and null is returned.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||