From f07c144db9689ca48c3393fdc736e8d0b070ff75 Mon Sep 17 00:00:00 2001 From: dragonmacher <48328597+dragonmacher@users.noreply.github.com> Date: Tue, 21 Sep 2021 10:40:11 -0400 Subject: [PATCH] Fixed spelling mistake --- .../graph/visualization/LayoutFunction.java | 2 +- .../LayoutTransitionManager.java | 39 ++++++++----------- .../service/graph/LayoutAlgorithmNames.java | 4 +- 3 files changed, 20 insertions(+), 25 deletions(-) diff --git a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/LayoutFunction.java b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/LayoutFunction.java index 136b569035..d8103afe3f 100644 --- a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/LayoutFunction.java +++ b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/LayoutFunction.java @@ -124,7 +124,7 @@ class LayoutFunction case HIERACHICAL: return EdgeAwareTreeLayoutAlgorithm .edgeAwareBuilder(); - case COMPACT_HIERACHICAL: + case COMPACT_HIERARCHICAL: default: return TidierTreeLayoutAlgorithm . edgeAwareBuilder() diff --git a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/LayoutTransitionManager.java b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/LayoutTransitionManager.java index 720903e728..163b5abab1 100644 --- a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/LayoutTransitionManager.java +++ b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/LayoutTransitionManager.java @@ -62,18 +62,17 @@ class LayoutTransitionManager { * Create an instance with passed parameters * @param visualizationServer displays the graph * @param rootPredicate selects root vertices - * @param edgeTypePriorityList a {@code List} of EdgeType names in priority order - * @param favoredEdgePredicate q {@code Predicate} that will cause certain EdgeTypes to be favored during layout + * @param renderer the graph renderer */ public LayoutTransitionManager( VisualizationServer visualizationServer, - Predicate rootPredicate, - GraphRenderer renderer) { + Predicate rootPredicate, GraphRenderer renderer) { this.visualizationServer = visualizationServer; this.rootPredicate = rootPredicate; this.renderContext = visualizationServer.getRenderContext(); - this.vertexBoundsFunction = visualizationServer.getRenderContext().getVertexBoundsFunction(); + this.vertexBoundsFunction = + visualizationServer.getRenderContext().getVertexBoundsFunction(); this.layoutFunction = new LayoutFunction(renderer); } @@ -81,22 +80,22 @@ class LayoutTransitionManager { * set the layout in order to configure the requested {@link LayoutAlgorithm} * @param layoutName the name of the layout algorithm to use */ + @SuppressWarnings("unchecked") public void setLayout(String layoutName) { LayoutAlgorithm.Builder builder = layoutFunction.apply(layoutName); LayoutAlgorithm layoutAlgorithm = builder.build(); // layout algorithm considers the size of vertices if (layoutAlgorithm instanceof VertexBoundsFunctionConsumer) { ((VertexBoundsFunctionConsumer) layoutAlgorithm) - .setVertexBoundsFunction(vertexBoundsFunction); + .setVertexBoundsFunction(vertexBoundsFunction); } // mincross layouts are 'layered'. put some bounds on the number of // iterations of the level cross function based on the size of the graph // very large graphs do not improve enough to out-weigh the cost of // repeated iterations if (layoutAlgorithm instanceof Layered) { - ((Layered) layoutAlgorithm) - .setMaxLevelCrossFunction(g -> - Math.max(1, Math.min(10, 500 / g.vertexSet().size()))); + ((Layered) layoutAlgorithm).setMaxLevelCrossFunction( + g -> Math.max(1, Math.min(10, 500 / g.vertexSet().size()))); } // tree layouts need a way to determine which vertices are roots // especially when the graph is not a DAG @@ -108,22 +107,18 @@ class LayoutTransitionManager { removePaintable(radialLayoutRings); removePaintable(balloonLayoutRings); if (layoutAlgorithm instanceof BalloonLayoutAlgorithm) { - balloonLayoutRings = - new LayoutPaintable.BalloonRings<>( - visualizationServer, - (BalloonLayoutAlgorithm) layoutAlgorithm); + balloonLayoutRings = new LayoutPaintable.BalloonRings<>(visualizationServer, + (BalloonLayoutAlgorithm) layoutAlgorithm); visualizationServer.addPreRenderPaintable(balloonLayoutRings); } if (layoutAlgorithm instanceof RadialTreeLayout) { - radialLayoutRings = - new LayoutPaintable.RadialRings<>( - visualizationServer, (RadialTreeLayout) layoutAlgorithm); + radialLayoutRings = new LayoutPaintable.RadialRings<>(visualizationServer, + (RadialTreeLayout) layoutAlgorithm); visualizationServer.addPreRenderPaintable(radialLayoutRings); } // apply the layout algorithm - LayoutAlgorithmTransition.apply(visualizationServer, - layoutAlgorithm); + LayoutAlgorithmTransition.apply(visualizationServer, layoutAlgorithm); } private void removePaintable(VisualizationServer.Paintable paintable) { @@ -134,15 +129,15 @@ class LayoutTransitionManager { /** * Supplies the {@code LayoutAlgorithm} to be used for the initial @{code Graph} visualization - * @return + * @return the algorithm */ + @SuppressWarnings("unchecked") public LayoutAlgorithm getInitialLayoutAlgorithm() { LayoutAlgorithm initialLayoutAlgorithm = - layoutFunction.apply(LayoutAlgorithmNames.COMPACT_HIERACHICAL).build(); + layoutFunction.apply(LayoutAlgorithmNames.COMPACT_HIERARCHICAL).build(); if (initialLayoutAlgorithm instanceof TreeLayout) { - ((TreeLayout) initialLayoutAlgorithm) - .setRootPredicate(rootPredicate); + ((TreeLayout) initialLayoutAlgorithm).setRootPredicate(rootPredicate); } if (initialLayoutAlgorithm instanceof VertexBoundsFunctionConsumer) { ((VertexBoundsFunctionConsumer) initialLayoutAlgorithm) diff --git a/Ghidra/Framework/Graph/src/main/java/ghidra/service/graph/LayoutAlgorithmNames.java b/Ghidra/Framework/Graph/src/main/java/ghidra/service/graph/LayoutAlgorithmNames.java index 8153243f7b..63284f2997 100644 --- a/Ghidra/Framework/Graph/src/main/java/ghidra/service/graph/LayoutAlgorithmNames.java +++ b/Ghidra/Framework/Graph/src/main/java/ghidra/service/graph/LayoutAlgorithmNames.java @@ -26,7 +26,7 @@ public class LayoutAlgorithmNames { public static final String FORCED_BALANCED = "Force Balanced"; public static final String FORCE_DIRECTED = "Force Directed"; public static final String CIRCLE = "Circle"; - public static final String COMPACT_HIERACHICAL = "Compact Hierarchical"; + public static final String COMPACT_HIERARCHICAL = "Compact Hierarchical"; public static final String COMPACT_RADIAL = "Compact Radial"; public static final String MIN_CROSS_TOP_DOWN = "Hierarchical MinCross Top Down"; public static final String MIN_CROSS_LONGEST_PATH = "Hierarchical MinCross Longest Path"; @@ -44,7 +44,7 @@ public class LayoutAlgorithmNames { //@formatter:on public static List getLayoutAlgorithmNames() { - return Arrays.asList(COMPACT_HIERACHICAL, HIERACHICAL, + return Arrays.asList(COMPACT_HIERARCHICAL, HIERACHICAL, COMPACT_RADIAL, MIN_CROSS_TOP_DOWN, MIN_CROSS_LONGEST_PATH, MIN_CROSS_NETWORK_SIMPLEX, MIN_CROSS_COFFMAN_GRAHAM, CIRCLE, VERT_MIN_CROSS_TOP_DOWN,