Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 261603 Details for
Bug 493136
Dot Attributes inconsistent handling
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
DotImportTests clean-ups and extensions
493136-DotImportTests-clean-ups-and-extensions.patch (text/plain), 40.41 KB, created by
Tamas Miklossy
on 2016-05-10 11:09:36 EDT
(
hide
)
Description:
DotImportTests clean-ups and extensions
Filename:
MIME Type:
Creator:
Tamas Miklossy
Created:
2016-05-10 11:09:36 EDT
Size:
40.41 KB
patch
obsolete
>diff --git a/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotImportTests.java b/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotImportTests.java >index 2a1a1c2..cf190ef 100644 >--- a/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotImportTests.java >+++ b/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotImportTests.java >@@ -1,5 +1,6 @@ > /******************************************************************************* >- * Copyright (c) 2009, 2015 Fabian Steeg and others. >+ * Copyright (c) 2009, 2016 itemis AG and others. >+ * > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -7,10 +8,10 @@ > * > * Contributors: > * Fabian Steeg - initial API and implementation (see bug #277380) >+ * Tamas Miklossy (itemis AG) - implement additional test cases (bug #493136) > *******************************************************************************/ > package org.eclipse.gef4.dot.tests; > >-import static org.eclipse.gef4.dot.tests.DotTestUtils.RESOURCES_TESTS; > import static org.junit.Assert.assertEquals; > > import java.io.File; >@@ -18,6 +19,7 @@ > import org.eclipse.gef4.dot.internal.DotImport; > import org.eclipse.gef4.graph.Graph; > import org.junit.Assert; >+import org.junit.Ignore; > import org.junit.Test; > > /** >@@ -29,49 +31,124 @@ > // as DotExportTests and DotTemplateTests > public final class DotImportTests { > >- static Graph importFrom(final File dotFile) { >- Assert.assertTrue("DOT input file must exist: " + dotFile, //$NON-NLS-1$ >- dotFile.exists()); >- Graph graph = new DotImport().importDot(dotFile); >- Assert.assertNotNull("Resulting graph must not be null", graph); //$NON-NLS-1$ >- return graph; >+ @Test >+ public void testArrowShapesDeprecated() { >+ testFile("arrowshapes_deprecated.dot", >+ DotTestUtils.getArrowShapesDeprecatedGraph()); > } > >- /** >- * Test valid graphs can be imported without exceptions. >- */ > @Test >- public void testFileImport() { >- // simple graphs >- Graph graph = importFrom( >- new File(RESOURCES_TESTS + "simple_graph.dot")); //$NON-NLS-1$ >- Assert.assertEquals(DotTestUtils.getSimpleGraph().toString(), >- graph.toString()); >+ public void testArrowShapesDirectionBoth() { >+ testFile("arrowshapes_direction_both.dot", >+ DotTestUtils.getArrowShapesDirectionBothGraph()); >+ } > >- graph = importFrom(new File(RESOURCES_TESTS + "simple_digraph.dot")); //$NON-NLS-1$ >- Assert.assertEquals(DotTestUtils.getSimpleDiGraph().toString(), >- graph.toString()); >+ @Test >+ public void testArrowShapesInvalidModifiers() { >+ // TODO implement >+ } > >- graph = importFrom(new File(RESOURCES_TESTS + "labeled_graph.dot")); //$NON-NLS-1$ >- Assert.assertEquals(DotTestUtils.getLabeledGraph().toString(), >- graph.toString()); >+ @Test >+ public void testArrowShapesMultiple() { >+ testFile("arrowshapes_multiple.dot", >+ DotTestUtils.getArrowShapesMultipleGraph()); >+ } > >- graph = importFrom(new File(RESOURCES_TESTS + "styled_graph.dot")); //$NON-NLS-1$ >- Assert.assertEquals(DotTestUtils.getStyledGraph().toString(), >- graph.toString()); >+ @Test >+ public void testArrowShapesSingle() { >+ testFile("arrowshapes_single.dot", >+ DotTestUtils.getArrowShapesSingleGraph()); >+ } > >- // test import succeeds without exceptions >- importFrom(new File(RESOURCES_TESTS + "sample_input.dot")); //$NON-NLS-1$ >- importFrom(new File(RESOURCES_TESTS + "basic_directed_graph.dot")); //$NON-NLS-1$ >- importFrom(new File(RESOURCES_TESTS + "global_node_graph.dot")); //$NON-NLS-1$ >- importFrom(new File(RESOURCES_TESTS + "global_edge_graph.dot")); //$NON-NLS-1$ >- importFrom(new File(RESOURCES_TESTS + "attributes_graph.dot")); //$NON-NLS-1$ >- importFrom(new File(RESOURCES_TESTS + "node_groups.dot")); //$NON-NLS-1$ >- importFrom(new File(RESOURCES_TESTS + "id_matches_keyword.dot")); //$NON-NLS-1$ >- importFrom(new File(RESOURCES_TESTS + "layout_tree_graph.dot")); //$NON-NLS-1$ >- importFrom(new File(RESOURCES_TESTS + "layout_spring_graph.dot")); //$NON-NLS-1$ >- importFrom(new File(RESOURCES_TESTS + "layout_radial_graph.dot")); //$NON-NLS-1$ >- importFrom(new File(RESOURCES_TESTS + "layout_grid_graph.dot")); //$NON-NLS-1$ >+ @Ignore("graph label is not yet transfered properly") >+ @Test >+ public void testAttributesGraph() { >+ testFile("attributes_graph.dot", DotTestUtils.getAttributesGraph()); >+ } >+ >+ @Test >+ public void testBasicDirectedGraph() { >+ testFile("basic_directed_graph.dot", >+ DotTestUtils.getBasicDirectedGraph()); >+ } >+ >+ @Test >+ public void testGlobalEdgeGraph() { >+ testFile("global_edge_graph.dot", DotTestUtils.getGlobalEdgeGraph()); >+ } >+ >+ @Test >+ public void testGlobalNodeGraph() { >+ testFile("global_node_graph.dot", DotTestUtils.getGlobalNodeGraph()); >+ } >+ >+ @Test >+ public void testIdMatchesKeyword() { >+ testFile("id_matches_keyword.dot", >+ DotTestUtils.getIdMatchesKeywordGraph()); >+ } >+ >+ @Test >+ public void testLabeledGraph() { >+ testFile("labeled_graph.dot", DotTestUtils.getLabeledGraph()); >+ } >+ >+ @Test >+ public void testLayoutGridGraph() { >+ testFile("layout_grid_graph.dot", DotTestUtils.getLayoutGridGraph()); >+ } >+ >+ @Test >+ public void testLayoutRadialGraph() { >+ testFile("layout_radial_graph.dot", >+ DotTestUtils.getLayoutRadialGraph()); >+ } >+ >+ @Test >+ public void testLayoutSpringGraph() { >+ testFile("layout_spring_graph.dot", >+ DotTestUtils.getLayoutSpringGraph()); >+ } >+ >+ @Test >+ public void testLayoutTreeGraph() { >+ testFile("layout_tree_graph.dot", DotTestUtils.getLayoutTreeGraph()); >+ } >+ >+ @Test >+ public void testNodeShapesPolygonBased() { >+ // TODO implement >+ } >+ >+ @Ignore("multi edges are not yet handled properly") >+ @Test >+ public void testNodeGroups() { >+ testFile("node_groups.dot", DotTestUtils.getNodeGroupsGraph()); >+ } >+ >+ @Test >+ public void testSampleInput() { >+ testFile("sample_input.dot", DotTestUtils.getSampleInputGraph()); >+ } >+ >+ @Test >+ public void testSimpleDigraph() { >+ testFile("simple_digraph.dot", DotTestUtils.getSimpleDiGraph()); >+ } >+ >+ @Test >+ public void testSimpleGraph() { >+ testFile("simple_graph.dot", DotTestUtils.getSimpleGraph()); >+ } >+ >+ @Test >+ public void testStyledGraph() { >+ testFile("styled_graph.dot", DotTestUtils.getStyledGraph()); >+ } >+ >+ @Test >+ public void testStyledGraph2() { >+ // TODO implement > } > > /** >@@ -91,4 +168,12 @@ > assertEquals(2, graph.getEdges().size()); > } > >+ private void testFile(String fileName, Graph expected) { >+ File dotFile = new File(DotTestUtils.RESOURCES_TESTS + fileName); >+ Assert.assertTrue("DOT input file must exist: " + dotFile, //$NON-NLS-1$ >+ dotFile.exists()); >+ Graph graph = new DotImport().importDot(dotFile); >+ Assert.assertNotNull("Resulting graph must not be null", graph); //$NON-NLS-1$ >+ Assert.assertEquals(expected.toString(), graph.toString()); >+ } > } >diff --git a/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotTestUtils.java b/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotTestUtils.java >index df966a9..3edc915 100644 >--- a/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotTestUtils.java >+++ b/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotTestUtils.java >@@ -9,6 +9,7 @@ > * Contributors: > * Fabian Steeg - initial API and implementation (see bug #277380) > * Tamas Miklossy (itemis AG) - Add support for all dot attributes (bug #461506) >+ * - implement additional test cases (bug #493136) > * > *******************************************************************************/ > package org.eclipse.gef4.dot.tests; >@@ -85,6 +86,563 @@ > return dotFiles; > } > >+ public static Graph getArrowShapesDeprecatedGraph() { >+ /* Global settings: */ >+ Graph.Builder graph = new Graph.Builder() >+ .attr(DotAttributes._NAME__GNE, "ArrowShapes_Deprecated") >+ .attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH) >+ .attr(DotAttributes.RANKDIR__G, "LR"); >+ >+ /* Nodes: */ >+ Node[] n = new Node[14]; >+ for (int i = 0; i < n.length; i++) { >+ n[i] = new Node.Builder() >+ .attr(DotAttributes._NAME__GNE, Integer.toString(i + 1)) >+ .buildNode(); >+ } >+ >+ /* Connection from n1 to n2: */ >+ Edge e1 = new Edge.Builder(n[0], n[1]) >+ .attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "ediamond") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "ediamond") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n3 to n4: */ >+ Edge e2 = new Edge.Builder(n[2], n[3]) >+ .attr(DotAttributes._NAME__GNE, "3->4") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "open") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "open") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n5 to n6: */ >+ Edge e3 = new Edge.Builder(n[4], n[5]) >+ .attr(DotAttributes._NAME__GNE, "5->6") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "halfopen") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "halfopen") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n7 to n8: */ >+ Edge e4 = new Edge.Builder(n[6], n[7]) >+ .attr(DotAttributes._NAME__GNE, "7->8") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "empty") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "empty") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n9 to n10: */ >+ Edge e5 = new Edge.Builder(n[8], n[9]) >+ .attr(DotAttributes._NAME__GNE, "9->10") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "invempty") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "invempty") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n11 to n12: */ >+ Edge e6 = new Edge.Builder(n[10], n[11]) >+ .attr(DotAttributes._NAME__GNE, "11->12") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "ediamondinvempty") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "ediamondinvempty") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n13 to n14: */ >+ Edge e7 = new Edge.Builder(n[12], n[13]) >+ .attr(DotAttributes._NAME__GNE, "13->14") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "openbox") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "openbox") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ return graph.nodes(n).edges(e1, e2, e3, e4, e5, e6, e7).build(); >+ } >+ >+ public static Graph getArrowShapesDirectionBothGraph() { >+ /* Global settings: */ >+ Graph.Builder graph = new Graph.Builder() >+ .attr(DotAttributes._NAME__GNE, "ArrowShapes_Direction_Both") >+ .attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH) >+ .attr(DotAttributes.RANKDIR__G, "LR"); >+ >+ /* Nodes: */ >+ Node[] n = new Node[28]; >+ for (int i = 0; i < n.length; i++) { >+ n[i] = new Node.Builder() >+ .attr(DotAttributes._NAME__GNE, Integer.toString(i + 1)) >+ .buildNode(); >+ } >+ >+ /* Connection from n1 to n2: */ >+ Edge e1 = new Edge.Builder(n[0], n[1]) >+ .attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "box") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "obox") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "none") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "box") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n3 to n4: */ >+ Edge e2 = new Edge.Builder(n[2], n[3]) >+ .attr(DotAttributes._NAME__GNE, "3->4") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "lbox") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "olbox") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "lbox") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n5 to n6: */ >+ Edge e3 = new Edge.Builder(n[4], n[5]) >+ .attr(DotAttributes._NAME__GNE, "5->6") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "rbox") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "orbox") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "rbox") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n7 to n8: */ >+ Edge e4 = new Edge.Builder(n[6], n[7]) >+ .attr(DotAttributes._NAME__GNE, "7->8") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "diamond") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "odiamond") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "diamond") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n9 to n10: */ >+ Edge e5 = new Edge.Builder(n[8], n[9]) >+ .attr(DotAttributes._NAME__GNE, "9->10") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "ldiamond") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "oldiamond") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "ldiamond") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n11 to n12: */ >+ Edge e6 = new Edge.Builder(n[10], n[11]) >+ .attr(DotAttributes._NAME__GNE, "11->12") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "rdiamond") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "ordiamond") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "rdiamond") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n13 to n14: */ >+ Edge e7 = new Edge.Builder(n[12], n[13]) >+ .attr(DotAttributes._NAME__GNE, "13->14") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "dot") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "odot") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "dot") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n15 to n16: */ >+ Edge e8 = new Edge.Builder(n[14], n[15]) >+ .attr(DotAttributes._NAME__GNE, "15->16") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "inv") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "oinv") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "inv") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n17 to n18: */ >+ Edge e9 = new Edge.Builder(n[16], n[17]) >+ .attr(DotAttributes._NAME__GNE, "17->18") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "linv") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "olinv") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "linv") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n19 to n20: */ >+ Edge e10 = new Edge.Builder(n[18], n[19]) >+ .attr(DotAttributes._NAME__GNE, "19->20") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "rinv") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "orinv") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "rinv") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n21 to n22: */ >+ Edge e11 = new Edge.Builder(n[20], n[21]) >+ .attr(DotAttributes._NAME__GNE, "21->22") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "normal") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "onormal") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "normal") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n23 to n24: */ >+ Edge e12 = new Edge.Builder(n[22], n[23]) >+ .attr(DotAttributes._NAME__GNE, "23->24") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "lnormal") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "olnormal") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "lnormal") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n25 to n26: */ >+ Edge e13 = new Edge.Builder(n[24], n[25]) >+ .attr(DotAttributes._NAME__GNE, "25->26") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "rnormal") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "ornormal") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "rnormal") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n27 to n28: */ >+ Edge e14 = new Edge.Builder(n[26], n[27]) >+ .attr(DotAttributes._NAME__GNE, "27->28") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "back") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "default") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ return graph.nodes(n).edges(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, >+ e11, e12, e13, e14).build(); >+ } >+ >+ public static Graph getArrowShapesSingleGraph() { >+ String[] arrowTypes = { "box", "lbox", "rbox", "obox", "olbox", "orbox", >+ "crow", "lcrow", "rcrow", "diamond", "ldiamond", "rdiamond", >+ "odiamond", "oldiamond", "ordiamond", "dot", "odot", "inv", >+ "linv", "rinv", "oinv", "olinv", "orinv", "none", "normal", >+ "lnormal", "rnormal", "onormal", "olnormal", "ornormal", "tee", >+ "ltee", "rtee", "vee", "lvee", "rvee", "curve", "lcurve", >+ "rcurve", "icurve", "licurve", "ricurve" }; >+ >+ /* Global settings: */ >+ Graph.Builder graph = new Graph.Builder() >+ .attr(DotAttributes._NAME__GNE, "ArrowShapes_Single") >+ .attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH) >+ .attr(DotAttributes.RANKDIR__G, "LR"); >+ >+ /* Nodes: */ >+ Node[] n = new Node[86]; >+ for (int i = 0; i < n.length; i++) { >+ n[i] = new Node.Builder() >+ .attr(DotAttributes._NAME__GNE, Integer.toString(i + 1)) >+ .buildNode(); >+ } >+ >+ /* Edges: */ >+ Edge[] e = new Edge[43]; >+ for (int i = 0; i < arrowTypes.length; i++) { >+ e[i] = new Edge.Builder(n[2 * i], n[2 * i + 1]) >+ .attr(DotAttributes._NAME__GNE, >+ (2 * i + 1) + "->" + (2 * i + 2)) >+ .attr(DotAttributes.ARROWHEAD__E, arrowTypes[i]) >+ .attr(DotAttributes.LABEL__GNE, arrowTypes[i]).buildEdge(); >+ } >+ >+ e[42] = new Edge.Builder(n[84], n[85]) >+ .attr(DotAttributes._NAME__GNE, "85->86") >+ .attr(DotAttributes.LABEL__GNE, "default").buildEdge(); >+ return graph.nodes(n).edges(e).build(); >+ } >+ >+ public static Graph getArrowShapesMultipleGraph() { >+ /* Global settings: */ >+ Graph.Builder graph = new Graph.Builder() >+ .attr(DotAttributes._NAME__GNE, "ArrowShapes_Multiple") >+ .attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH) >+ .attr(DotAttributes.RANKDIR__G, "LR"); >+ >+ /* Nodes: */ >+ Node[] n = new Node[26]; >+ for (int i = 0; i < n.length; i++) { >+ n[i] = new Node.Builder() >+ .attr(DotAttributes._NAME__GNE, Integer.toString(i + 1)) >+ .buildNode(); >+ } >+ >+ /* Connection from n1 to n2: */ >+ Edge e1 = new Edge.Builder(n[0], n[1]) >+ .attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "invdot") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "1.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "invdot") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "invdot") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n3 to n4: */ >+ Edge e2 = new Edge.Builder(n[2], n[3]) >+ .attr(DotAttributes._NAME__GNE, "3->4") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "invodot") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "1.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "invodot") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "invodot") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n5 to n6: */ >+ Edge e3 = new Edge.Builder(n[4], n[5]) >+ .attr(DotAttributes._NAME__GNE, "5->6") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "boxbox") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "2.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "boxbox") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "boxbox") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n7 to n8: */ >+ Edge e4 = new Edge.Builder(n[6], n[7]) >+ .attr(DotAttributes._NAME__GNE, "7->8") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "nonenormal") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "2.5") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "nonenormal") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "nonenormal") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n9 to n10: */ >+ Edge e5 = new Edge.Builder(n[8], n[9]) >+ .attr(DotAttributes._NAME__GNE, "9->10") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "lteeoldiamond") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "1.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "lteeoldiamond") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "lteeoldiamond") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n11 to n12: */ >+ Edge e6 = new Edge.Builder(n[10], n[11]) >+ .attr(DotAttributes._NAME__GNE, "11->12") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "nonedot") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "1.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "nonedot") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "nonedot") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n13 to n14: */ >+ Edge e7 = new Edge.Builder(n[12], n[13]) >+ .attr(DotAttributes._NAME__GNE, "13->14") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "dotodotdot") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "1.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "dotodotdot") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "dotodotdot") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n15 to n16: */ >+ Edge e8 = new Edge.Builder(n[14], n[15]) >+ .attr(DotAttributes._NAME__GNE, "15->16") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "lveerveelvee") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "1.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "lveerveelvee") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "lveerveelvee") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n17 to n18: */ >+ Edge e9 = new Edge.Builder(n[16], n[17]) >+ .attr(DotAttributes._NAME__GNE, "17->18") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "nonenonedot") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "1.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "nonenonedot") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "nonenonedot") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n19 to n20: */ >+ Edge e10 = new Edge.Builder(n[18], n[19]) >+ .attr(DotAttributes._NAME__GNE, "19->20") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "onormalnormalonormalnormal") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "1.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "onormalnormalonormalnormal") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "onormalnormalonormalnormal") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n21 to n22: */ >+ Edge e11 = new Edge.Builder(n[20], n[21]) >+ .attr(DotAttributes._NAME__GNE, "21->22") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "nonenonenonedot") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "1.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "nonenonenonedot") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "nonenonenonedot") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n23 to n24: */ >+ Edge e12 = new Edge.Builder(n[22], n[23]) >+ .attr(DotAttributes._NAME__GNE, "23->24") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "noneboxnonedot") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "1.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "noneboxnonedot") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "noneboxnonedot") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n25 to n26: */ >+ Edge e13 = new Edge.Builder(n[24], n[25]) >+ .attr(DotAttributes._NAME__GNE, "25->26") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWHEAD__E, "boxnonenonedot") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWSIZE__E, "1.0") //$NON-NLS-1$ >+ .attr(DotAttributes.ARROWTAIL__E, "boxnonenonedot") //$NON-NLS-1$ >+ .attr(DotAttributes.DIR__E, "both") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "boxnonenonedot") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ return graph.nodes(n) >+ .edges(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13) >+ .build(); >+ } >+ >+ public static Graph getAttributesGraph() { >+ /* Global settings: */ >+ Graph.Builder graph = new Graph.Builder() >+ .attr(DotAttributes._NAME__GNE, "AttributesGraph") >+ .attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH) >+ .attr(DotAttributes.RANKDIR__G, "LR") >+ .attr(DotAttributes.LABEL__GNE, "Left-to-Right"); >+ >+ /* Nodes: */ >+ Node n1 = new Node.Builder().attr(DotAttributes._NAME__GNE, "1") //$NON-NLS-1$ >+ .buildNode(); >+ Node n2 = new Node.Builder().attr(DotAttributes._NAME__GNE, "2") //$NON-NLS-1$ >+ .buildNode(); >+ Node n3 = new Node.Builder().attr(DotAttributes._NAME__GNE, "3") //$NON-NLS-1$ >+ .buildNode(); >+ Node n4 = new Node.Builder().attr(DotAttributes._NAME__GNE, "4") //$NON-NLS-1$ >+ .buildNode(); >+ >+ /* Connection from n1 to n2: */ >+ Edge e1 = new Edge.Builder(n1, n2) >+ .attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n1 to n3: */ >+ Edge e2 = new Edge.Builder(n1, n3) >+ .attr(DotAttributes._NAME__GNE, "1->3") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n2 to n4: */ >+ Edge e3 = new Edge.Builder(n2, n4) >+ .attr(DotAttributes._NAME__GNE, "2->4").buildEdge(); >+ >+ return graph.nodes(n1, n2, n3, n4).edges(e1, e2, e3).build(); >+ } >+ >+ public static Graph getBasicDirectedGraph() { >+ /* Global settings: */ >+ Graph.Builder graph = new Graph.Builder() >+ .attr(DotAttributes._NAME__GNE, "BasicDirectedGraph") >+ .attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH); >+ >+ /* Nodes: */ >+ Node n1 = new Node.Builder().attr(DotAttributes._NAME__GNE, "1") //$NON-NLS-1$ >+ .buildNode(); >+ Node n2 = new Node.Builder().attr(DotAttributes._NAME__GNE, "2") //$NON-NLS-1$ >+ .buildNode(); >+ Node n3 = new Node.Builder().attr(DotAttributes._NAME__GNE, "3") //$NON-NLS-1$ >+ .buildNode(); >+ Node n4 = new Node.Builder().attr(DotAttributes._NAME__GNE, "4") //$NON-NLS-1$ >+ .buildNode(); >+ >+ /* Connection from n1 to n2: */ >+ Edge e1 = new Edge.Builder(n1, n2) >+ .attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "Edge") >+ .attr(DotAttributes.STYLE__E, "dashed").buildEdge(); >+ >+ /* Connection from n2 to n3: */ >+ Edge e2 = new Edge.Builder(n2, n3) >+ .attr(DotAttributes._NAME__GNE, "2->3") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "Edge") >+ .attr(DotAttributes.STYLE__E, "dashed").buildEdge(); >+ >+ /* Connection from n2 to n4: */ >+ Edge e3 = new Edge.Builder(n2, n4) >+ .attr(DotAttributes._NAME__GNE, "2->4") >+ .attr(DotAttributes.LABEL__GNE, "Dotted") >+ .attr(DotAttributes.STYLE__E, "dotted").buildEdge(); >+ >+ return graph.nodes(n1, n2, n3, n4).edges(e1, e2, e3).build(); >+ } >+ >+ public static Graph getGlobalEdgeGraph() { >+ /* Global settings: */ >+ Graph.Builder graph = new Graph.Builder() >+ .attr(DotAttributes._NAME__GNE, "GlobalEdgeGraph") >+ .attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH); >+ >+ /* Nodes: */ >+ Node n1 = new Node.Builder().attr(DotAttributes._NAME__GNE, "1") //$NON-NLS-1$ >+ .buildNode(); >+ Node n2 = new Node.Builder().attr(DotAttributes._NAME__GNE, "2") //$NON-NLS-1$ >+ .buildNode(); >+ Node n3 = new Node.Builder().attr(DotAttributes._NAME__GNE, "3") //$NON-NLS-1$ >+ .buildNode(); >+ Node n4 = new Node.Builder().attr(DotAttributes._NAME__GNE, "4") //$NON-NLS-1$ >+ .buildNode(); >+ >+ /* Connection from n1 to n2: */ >+ Edge e1 = new Edge.Builder(n1, n2) >+ .attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "Edge") >+ .attr(DotAttributes.STYLE__E, "dashed").buildEdge(); >+ >+ /* Connection from n2 to n3: */ >+ Edge e2 = new Edge.Builder(n2, n3) >+ .attr(DotAttributes._NAME__GNE, "2->3") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "Edge") >+ .attr(DotAttributes.STYLE__E, "dashed").buildEdge(); >+ >+ /* Connection from n2 to n4: */ >+ Edge e3 = new Edge.Builder(n2, n4) >+ .attr(DotAttributes._NAME__GNE, "2->4") >+ .attr(DotAttributes.LABEL__GNE, "Dotted") >+ .attr(DotAttributes.STYLE__E, "dotted").buildEdge(); >+ >+ return graph.nodes(n1, n2, n3, n4).edges(e1, e2, e3).build(); >+ } >+ >+ public static Graph getGlobalNodeGraph() { >+ /* Global settings: */ >+ Graph.Builder graph = new Graph.Builder() >+ .attr(DotAttributes._NAME__GNE, "GlobalNodeGraph") >+ .attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH); >+ >+ /* Nodes: */ >+ Node n1 = new Node.Builder().attr(DotAttributes._NAME__GNE, "1") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "Node").buildNode(); >+ Node n2 = new Node.Builder().attr(DotAttributes._NAME__GNE, "2") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "Node").buildNode(); >+ Node n3 = new Node.Builder().attr(DotAttributes._NAME__GNE, "3") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "Leaf").buildNode(); >+ >+ /* Connection from n1 to n2: */ >+ Edge e1 = new Edge.Builder(n1, n2) >+ .attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n2 to n3: */ >+ Edge e2 = new Edge.Builder(n2, n3) >+ .attr(DotAttributes._NAME__GNE, "2->3") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ return graph.nodes(n1, n2, n3).edges(e1, e2).build(); >+ } >+ >+ public static Graph getIdMatchesKeywordGraph() { >+ /* Global settings: */ >+ Graph.Builder graph = new Graph.Builder() >+ .attr(DotAttributes._NAME__GNE, "s") >+ .attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH); >+ >+ return graph.build(); >+ } >+ > public static Graph getLabeledGraph() { > /* Global settings: */ > Graph.Builder graph = new Graph.Builder() >@@ -118,6 +676,265 @@ > return graph.nodes(n1, n2, n3, n4).edges(e1, e2, e3).build(); > } > >+ public static Graph getLayoutGridGraph() { >+ /* Global settings: */ >+ Graph.Builder graph = new Graph.Builder() >+ .attr(DotAttributes._NAME__GNE, "LayoutGridGraph") >+ .attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH) >+ .attr(DotAttributes.LAYOUT__G, "osage"); >+ >+ /* Nodes: */ >+ Node n1 = new Node.Builder().attr(DotAttributes._NAME__GNE, "1") //$NON-NLS-1$ >+ .buildNode(); >+ Node n2 = new Node.Builder().attr(DotAttributes._NAME__GNE, "2") //$NON-NLS-1$ >+ .buildNode(); >+ Node n3 = new Node.Builder().attr(DotAttributes._NAME__GNE, "3") //$NON-NLS-1$ >+ .buildNode(); >+ Node n4 = new Node.Builder().attr(DotAttributes._NAME__GNE, "4") //$NON-NLS-1$ >+ .buildNode(); >+ Node n5 = new Node.Builder().attr(DotAttributes._NAME__GNE, "5") //$NON-NLS-1$ >+ .buildNode(); >+ >+ /* Connection from n1 to n2: */ >+ Edge e1 = new Edge.Builder(n1, n2) >+ .attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n2 to n3: */ >+ Edge e2 = new Edge.Builder(n2, n3) >+ .attr(DotAttributes._NAME__GNE, "2->3") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n2 to n4: */ >+ Edge e3 = new Edge.Builder(n2, n4) >+ .attr(DotAttributes._NAME__GNE, "2->4").buildEdge(); >+ >+ /* Connection from n4 to n5: */ >+ Edge e4 = new Edge.Builder(n4, n5) >+ .attr(DotAttributes._NAME__GNE, "4->5").buildEdge(); >+ >+ return graph.nodes(n1, n2, n3, n4, n5).edges(e1, e2, e3, e4).build(); >+ } >+ >+ public static Graph getLayoutRadialGraph() { >+ /* Global settings: */ >+ Graph.Builder graph = new Graph.Builder() >+ .attr(DotAttributes._NAME__GNE, "LayoutRadialGraph") >+ .attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH) >+ .attr(DotAttributes.LAYOUT__G, "twopi"); >+ >+ /* Nodes: */ >+ Node n1 = new Node.Builder().attr(DotAttributes._NAME__GNE, "1") //$NON-NLS-1$ >+ .buildNode(); >+ Node n2 = new Node.Builder().attr(DotAttributes._NAME__GNE, "2") //$NON-NLS-1$ >+ .buildNode(); >+ Node n3 = new Node.Builder().attr(DotAttributes._NAME__GNE, "3") //$NON-NLS-1$ >+ .buildNode(); >+ Node n4 = new Node.Builder().attr(DotAttributes._NAME__GNE, "4") //$NON-NLS-1$ >+ .buildNode(); >+ Node n5 = new Node.Builder().attr(DotAttributes._NAME__GNE, "5") //$NON-NLS-1$ >+ .buildNode(); >+ >+ /* Connection from n1 to n2: */ >+ Edge e1 = new Edge.Builder(n1, n2) >+ .attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n2 to n3: */ >+ Edge e2 = new Edge.Builder(n2, n3) >+ .attr(DotAttributes._NAME__GNE, "2->3") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n2 to n4: */ >+ Edge e3 = new Edge.Builder(n2, n4) >+ .attr(DotAttributes._NAME__GNE, "2->4").buildEdge(); >+ >+ /* Connection from n4 to n5: */ >+ Edge e4 = new Edge.Builder(n4, n5) >+ .attr(DotAttributes._NAME__GNE, "4->5").buildEdge(); >+ >+ return graph.nodes(n1, n2, n3, n4, n5).edges(e1, e2, e3, e4).build(); >+ } >+ >+ public static Graph getLayoutSpringGraph() { >+ /* Global settings: */ >+ Graph.Builder graph = new Graph.Builder() >+ .attr(DotAttributes._NAME__GNE, "LayoutSpringGraph") >+ .attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH) >+ .attr(DotAttributes.LAYOUT__G, "fdp"); >+ >+ /* Nodes: */ >+ Node n1 = new Node.Builder().attr(DotAttributes._NAME__GNE, "1") //$NON-NLS-1$ >+ .buildNode(); >+ Node n2 = new Node.Builder().attr(DotAttributes._NAME__GNE, "2") //$NON-NLS-1$ >+ .buildNode(); >+ Node n3 = new Node.Builder().attr(DotAttributes._NAME__GNE, "3") //$NON-NLS-1$ >+ .buildNode(); >+ Node n4 = new Node.Builder().attr(DotAttributes._NAME__GNE, "4") //$NON-NLS-1$ >+ .buildNode(); >+ Node n5 = new Node.Builder().attr(DotAttributes._NAME__GNE, "5") //$NON-NLS-1$ >+ .buildNode(); >+ >+ /* Connection from n1 to n2: */ >+ Edge e1 = new Edge.Builder(n1, n2) >+ .attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n2 to n3: */ >+ Edge e2 = new Edge.Builder(n2, n3) >+ .attr(DotAttributes._NAME__GNE, "2->3") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n2 to n4: */ >+ Edge e3 = new Edge.Builder(n2, n4) >+ .attr(DotAttributes._NAME__GNE, "2->4").buildEdge(); >+ >+ /* Connection from n4 to n5: */ >+ Edge e4 = new Edge.Builder(n4, n5) >+ .attr(DotAttributes._NAME__GNE, "4->5").buildEdge(); >+ >+ return graph.nodes(n1, n2, n3, n4, n5).edges(e1, e2, e3, e4).build(); >+ } >+ >+ public static Graph getLayoutTreeGraph() { >+ /* Global settings: */ >+ Graph.Builder graph = new Graph.Builder() >+ .attr(DotAttributes._NAME__GNE, "LayoutTreeGraph") >+ .attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH) >+ .attr(DotAttributes.LAYOUT__G, "dot"); >+ >+ /* Nodes: */ >+ Node n1 = new Node.Builder().attr(DotAttributes._NAME__GNE, "1") //$NON-NLS-1$ >+ .buildNode(); >+ Node n2 = new Node.Builder().attr(DotAttributes._NAME__GNE, "2") //$NON-NLS-1$ >+ .buildNode(); >+ Node n3 = new Node.Builder().attr(DotAttributes._NAME__GNE, "3") //$NON-NLS-1$ >+ .buildNode(); >+ Node n4 = new Node.Builder().attr(DotAttributes._NAME__GNE, "4") //$NON-NLS-1$ >+ .buildNode(); >+ Node n5 = new Node.Builder().attr(DotAttributes._NAME__GNE, "5") //$NON-NLS-1$ >+ .buildNode(); >+ >+ /* Connection from n1 to n2: */ >+ Edge e1 = new Edge.Builder(n1, n2) >+ .attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n2 to n3: */ >+ Edge e2 = new Edge.Builder(n2, n3) >+ .attr(DotAttributes._NAME__GNE, "2->3") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n2 to n4: */ >+ Edge e3 = new Edge.Builder(n2, n4) >+ .attr(DotAttributes._NAME__GNE, "2->4").buildEdge(); >+ >+ /* Connection from n4 to n5: */ >+ Edge e4 = new Edge.Builder(n4, n5) >+ .attr(DotAttributes._NAME__GNE, "4->5").buildEdge(); >+ >+ return graph.nodes(n1, n2, n3, n4, n5).edges(e1, e2, e3, e4).build(); >+ } >+ >+ public static Graph getNodeGroupsGraph() { >+ /* Global settings: */ >+ Graph.Builder graph = new Graph.Builder() >+ .attr(DotAttributes._NAME__GNE, "g1") >+ .attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH); >+ >+ /* Nodes: */ >+ Node n1 = new Node.Builder().attr(DotAttributes._NAME__GNE, "n1") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "Node 1").buildNode(); >+ Node n2 = new Node.Builder().attr(DotAttributes._NAME__GNE, "n2") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "Node 2").buildNode(); >+ Node n3 = new Node.Builder().attr(DotAttributes._NAME__GNE, "n3") //$NON-NLS-1$ >+ .buildNode(); >+ Node n4 = new Node.Builder().attr(DotAttributes._NAME__GNE, "n4") //$NON-NLS-1$ >+ .buildNode(); >+ Node n5 = new Node.Builder().attr(DotAttributes._NAME__GNE, "n5") //$NON-NLS-1$ >+ .buildNode(); >+ Node foo = new Node.Builder().attr(DotAttributes._NAME__GNE, "foo") //$NON-NLS-1$ >+ .buildNode(); >+ Node bar = new Node.Builder().attr(DotAttributes._NAME__GNE, "bar") //$NON-NLS-1$ >+ .buildNode(); >+ Node baz = new Node.Builder().attr(DotAttributes._NAME__GNE, "baz") //$NON-NLS-1$ >+ .buildNode(); >+ >+ /* Connection from n1 to n2: */ >+ Edge e1 = new Edge.Builder(n1, n2) >+ .attr(DotAttributes._NAME__GNE, "n1->n2") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "A dotted edge") >+ .attr(DotAttributes.STYLE__E, "dotted").buildEdge(); >+ >+ /* Connection from n1 to n4: */ >+ Edge e2 = new Edge.Builder(n1, n4) >+ .attr(DotAttributes._NAME__GNE, "n1->n4") //$NON-NLS-1$ >+ .buildEdge(); >+ >+ /* Connection from n2 to n3: */ >+ Edge e3 = new Edge.Builder(n2, n3) >+ .attr(DotAttributes._NAME__GNE, "n2->n3").buildEdge(); >+ >+ /* Connection from n3 to n5: */ >+ Edge e4 = new Edge.Builder(n3, n5) >+ .attr(DotAttributes._NAME__GNE, "n3->n5").buildEdge(); >+ >+ /* Connection from n4 to n5: */ >+ Edge e5 = new Edge.Builder(n3, n4) >+ .attr(DotAttributes._NAME__GNE, "n4->n5").buildEdge(); >+ >+ /* Connection from foo to bar: */ >+ Edge e6 = new Edge.Builder(foo, bar) >+ .attr(DotAttributes._NAME__GNE, "foo->bar").buildEdge(); >+ >+ /* Connection from foo to baz: */ >+ Edge e7 = new Edge.Builder(foo, baz) >+ .attr(DotAttributes._NAME__GNE, "foo->baz").buildEdge(); >+ >+ return graph.nodes(n1, n2, n4, n3, n5, foo, bar, baz) >+ .edges(e1, e2, e3, e4, e5, e6, e7).build(); >+ } >+ >+ public static Graph getSampleInputGraph() { >+ /* Global settings: */ >+ Graph.Builder graph = new Graph.Builder() >+ .attr(DotAttributes._NAME__GNE, "SampleGraph") >+ .attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__DIGRAPH) >+ .attr(DotAttributes.LAYOUT__G, "osage"); >+ >+ /* Nodes: */ >+ Node n1 = new Node.Builder().attr(DotAttributes._NAME__GNE, "1") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "one").buildNode(); >+ Node n2 = new Node.Builder().attr(DotAttributes._NAME__GNE, "2") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "two").buildNode(); >+ Node n3 = new Node.Builder().attr(DotAttributes._NAME__GNE, "3") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "Käse").buildNode(); >+ Node n4 = new Node.Builder().attr(DotAttributes._NAME__GNE, "4") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "Käse").buildNode(); >+ Node n5 = new Node.Builder().attr(DotAttributes._NAME__GNE, "5") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "Käse").buildNode(); >+ >+ /* Connection from n1 to n2: */ >+ Edge e1 = new Edge.Builder(n1, n2) >+ .attr(DotAttributes._NAME__GNE, "1->2") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "style=dashed") >+ .attr(DotAttributes.STYLE__E, "dashed").buildEdge(); >+ >+ /* Connection from n1 to n3: */ >+ Edge e2 = new Edge.Builder(n2, n3) >+ .attr(DotAttributes._NAME__GNE, "2->3") //$NON-NLS-1$ >+ .attr(DotAttributes.LABEL__GNE, "style=dotted") >+ .attr(DotAttributes.STYLE__E, "dotted").buildEdge(); >+ >+ /* Connection from n3 to n4: */ >+ Edge e3 = new Edge.Builder(n3, n4) >+ .attr(DotAttributes._NAME__GNE, "3->4") >+ .attr(DotAttributes.LABEL__GNE, "edge") >+ .attr(DotAttributes.STYLE__E, "dashed").buildEdge(); >+ >+ return graph.nodes(n1, n2, n3, n4, n5).edges(e1, e2, e3).build(); >+ } >+ > public static Graph getSimpleDiGraph() { > > /* Global settings, here we set the directed property: */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 493136
:
261510
|
261511
|
261535
|
261562
|
261603
|
261698
|
261715