# HG changeset patch # User Thomas Wuerthinger # Date 1327706177 -3600 # Node ID f22dc0a63f03ca370987f805ad6c60896d189906 # Parent 1b95885bc1e4648828e4d2da5ad390284f4c4915 Removed old hierarchical layout manager; start removing cluster layout. apply diamond operator to whole source. diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeNode.java --- a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeNode.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeNode.java Sat Jan 28 00:16:17 2012 +0100 @@ -54,11 +54,11 @@ bciValue = bytecode.getBci() + " " + bciValue; bciValue = bciValue.trim(); - Properties.PropertySelector selector = new Properties.PropertySelector(graph.getNodes()); + Properties.PropertySelector selector = new Properties.PropertySelector<>(graph.getNodes()); StringPropertyMatcher matcher = new StringPropertyMatcher("bci", bciValue); List nodeList = selector.selectMultiple(matcher); if (nodeList.size() > 0) { - nodes = new LinkedHashSet(); + nodes = new LinkedHashSet<>(); for (InputNode n : nodeList) { nodes.add(n); } diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.java --- a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.java Sat Jan 28 00:16:17 2012 +0100 @@ -128,7 +128,7 @@ @Override public void componentOpened() { - Lookup.Template tpl = new Lookup.Template(InputGraphProvider.class); + Lookup.Template tpl = new Lookup.Template<>(InputGraphProvider.class); result = Utilities.actionsGlobalContext().lookup(tpl); result.addLookupListener(this); } diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/BlockConnectionWidget.java --- a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/BlockConnectionWidget.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/BlockConnectionWidget.java Sat Jan 28 00:16:17 2012 +0100 @@ -61,7 +61,7 @@ this.to = (BlockWidget) scene.findWidget(edge.getTo()); inputSlot = to.getInputSlot(); outputSlot = from.getOutputSlot(); - points = new ArrayList(); + points = new ArrayList<>(); } public InputBlockEdge getEdge() { diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/BlockWidget.java --- a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/BlockWidget.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/BlockWidget.java Sat Jan 28 00:16:17 2012 +0100 @@ -67,17 +67,21 @@ final BlockWidget widget = this; inputSlot = new Port() { + @Override public Point getRelativePosition() { return new Point((int) (getSize().getWidth() / 2), (int) (getSize().getHeight() / 2)); } + @Override public Vertex getVertex() { return widget; } }; outputSlot = new Port() { + @Override public Point getRelativePosition() { return new Point((int) (getSize().getWidth() / 2), (int) (getSize().getHeight() / 2)); } + @Override public Vertex getVertex() { return widget; } diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowScene.java --- a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowScene.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowScene.java Sat Jan 28 00:16:17 2012 +0100 @@ -69,7 +69,7 @@ private WidgetAction moveAction = ActionFactory.createMoveAction(null, this); public ControlFlowScene() { - selection = new HashSet(); + selection = new HashSet<>(); this.getInputBindings().setZoomActionModifiers(0); this.setLayout(LayoutFactory.createAbsoluteLayout()); @@ -95,12 +95,12 @@ } oldGraph = g; - ArrayList blocks = new ArrayList(this.getNodes()); + ArrayList blocks = new ArrayList<>(this.getNodes()); for (InputBlock b : blocks) { removeNode(b); } - ArrayList edges = new ArrayList(this.getEdges()); + ArrayList edges = new ArrayList<>(this.getEdges()); for (InputBlockEdge e : edges) { removeEdge(e); } @@ -117,7 +117,7 @@ this.setEdgeTarget(e, e.getTo()); } - GraphLayout layout = new HierarchicalGraphLayout();//GridGraphLayout(); + GraphLayout layout = new HierarchicalGraphLayout<>();//GridGraphLayout(); SceneLayout sceneLayout = LayoutFactory.createSceneGraphLayout(this, layout); sceneLayout.invokeLayout(); @@ -135,7 +135,7 @@ public void selectionChanged() { InputGraphProvider p = LookupHistory.getLast(InputGraphProvider.class);//)Utilities.actionsGlobalContext().lookup(InputGraphProvider.class); if (p != null) { - Set inputNodes = new HashSet(); + Set inputNodes = new HashSet<>(); for (BlockWidget w : selection) { inputNodes.addAll(w.getBlock().getNodes()); } diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.java --- a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.java Sat Jan 28 00:16:17 2012 +0100 @@ -123,7 +123,7 @@ @Override public void componentOpened() { - Lookup.Template tpl = new Lookup.Template(InputGraphProvider.class); + Lookup.Template tpl = new Lookup.Template<>(InputGraphProvider.class); result = Utilities.actionsGlobalContext().lookup(tpl); result.addLookupListener(this); } diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/HierarchicalGraphLayout.java --- a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/HierarchicalGraphLayout.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/HierarchicalGraphLayout.java Sat Jan 28 00:16:17 2012 +0100 @@ -70,7 +70,7 @@ } public List getControlPoints() { - return new ArrayList(); + return new ArrayList<>(); } public void setControlPoints(List list) { @@ -139,9 +139,9 @@ protected void performGraphLayout(UniversalGraph graph) { - Set links = new LinkedHashSet(); - Set vertices = new LinkedHashSet(); - Map vertexMap = new HashMap(); + Set links = new LinkedHashSet<>(); + Set vertices = new LinkedHashSet<>(); + Map vertexMap = new HashMap<>(); for (N node : graph.getNodes()) { VertexWrapper v = new VertexWrapper(node, graph); diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Event.java --- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Event.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Event.java Sat Jan 28 00:16:17 2012 +0100 @@ -37,7 +37,7 @@ private boolean eventWasFired; public Event() { - listener = new ArrayList(); + listener = new ArrayList<>(); fireEvents = true; } @@ -55,7 +55,7 @@ public void fire() { if(fireEvents) { - List tmpList = new ArrayList(listener); + List tmpList = new ArrayList<>(listener); for (L l : tmpList) { fire(l); } diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Group.java --- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Group.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Group.java Sat Jan 28 00:16:17 2012 +0100 @@ -85,7 +85,7 @@ } public Set getAllNodes() { - Set result = new HashSet(); + Set result = new HashSet<>(); for (FolderElement e : elements) { if (e instanceof InputGraph) { InputGraph g = (InputGraph) e; diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputBlock.java --- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputBlock.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputBlock.java Sat Jan 28 00:16:17 2012 +0100 @@ -63,7 +63,7 @@ return false; } - final HashSet s = new HashSet(); + final HashSet s = new HashSet<>(); for (InputBlock succ : successors) { s.add(succ.name); } @@ -80,8 +80,8 @@ InputBlock(InputGraph graph, String name) { this.graph = graph; this.name = name; - nodes = new ArrayList(); - successors = new LinkedHashSet(2); + nodes = new ArrayList<>(); + successors = new LinkedHashSet<>(2); } public String getName() { diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputGraph.java --- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputGraph.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputGraph.java Sat Jan 28 00:16:17 2012 +0100 @@ -90,7 +90,7 @@ public Map> findAllOutgoingEdges() { - Map> result = new HashMap>(getNodes().size()); + Map> result = new HashMap<>(getNodes().size()); for(InputNode n : this.getNodes()) { result.put(n, new ArrayList()); } @@ -113,7 +113,7 @@ public Map> findAllIngoingEdges() { - Map> result = new HashMap>(getNodes().size()); + Map> result = new HashMap<>(getNodes().size()); for(InputNode n : this.getNodes()) { result.put(n, new ArrayList()); } @@ -135,7 +135,7 @@ } public List findOutgoingEdges(InputNode n) { - List result = new ArrayList(); + List result = new ArrayList<>(); for(InputEdge e : this.edges) { if(e.getFrom() == n.getId()) { @@ -165,7 +165,7 @@ public void ensureNodesInBlocks() { InputBlock noBlock = null; - Set scheduledNodes = new HashSet(); + Set scheduledNodes = new HashSet<>(); for (InputBlock b : getBlocks()) { for (InputNode n : b.getNodes()) { diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Properties.java --- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Properties.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Properties.java Sat Jan 28 00:16:17 2012 +0100 @@ -244,7 +244,7 @@ @Override public String toString() { - List pairs = new ArrayList(); + List pairs = new ArrayList<>(); for (int i = 0; i < map.length; i += 2) { if (map[i + 1] != null) { pairs.add(new String[]{map[i], map[i + 1]}); @@ -294,7 +294,7 @@ } public List selectMultiple(PropertyMatcher matcher) { - List result = new ArrayList(); + List result = new ArrayList<>(); for (T t : objects) { Property p = t.getProperties().selectSingle(matcher); diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Source.java --- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Source.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Source.java Sat Jan 28 00:16:17 2012 +0100 @@ -39,8 +39,8 @@ private Set set; public Source() { - sourceNodes = new ArrayList(1); - set = new LinkedHashSet(1); + sourceNodes = new ArrayList<>(1); + set = new LinkedHashSet<>(1); } public List getSourceNodes() { diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Parser.java --- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Parser.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Parser.java Sat Jan 28 00:16:17 2012 +0100 @@ -186,7 +186,7 @@ } }; // - private HandoverElementHandler inlinedHandler = new XMLParser.HandoverElementHandler(INLINE_ELEMENT); + private HandoverElementHandler inlinedHandler = new XMLParser.HandoverElementHandler<>(INLINE_ELEMENT); // private ElementHandler inlinedMethodHandler = new XMLParser.ElementHandler(METHOD_ELEMENT) { @@ -281,9 +281,9 @@ } }; // - private HandoverElementHandler nodesHandler = new HandoverElementHandler(NODES_ELEMENT); + private HandoverElementHandler nodesHandler = new HandoverElementHandler<>(NODES_ELEMENT); // - private HandoverElementHandler controlFlowHandler = new HandoverElementHandler(CONTROL_FLOW_ELEMENT); + private HandoverElementHandler controlFlowHandler = new HandoverElementHandler<>(CONTROL_FLOW_ELEMENT); // private ElementHandler blockHandler = new ElementHandler(BLOCK_ELEMENT) { @@ -299,7 +299,7 @@ } }; // - private HandoverElementHandler blockNodesHandler = new HandoverElementHandler(NODES_ELEMENT); + private HandoverElementHandler blockNodesHandler = new HandoverElementHandler<>(NODES_ELEMENT); // private ElementHandler blockNodeHandler = new ElementHandler(NODE_ELEMENT) { @@ -318,14 +318,14 @@ } }; // - private HandoverElementHandler successorsHandler = new HandoverElementHandler(SUCCESSORS_ELEMENT); + private HandoverElementHandler successorsHandler = new HandoverElementHandler<>(SUCCESSORS_ELEMENT); // private ElementHandler successorHandler = new ElementHandler(SUCCESSOR_ELEMENT) { @Override protected InputBlock start() throws SAXException { String name = readRequiredAttribute(BLOCK_NAME_PROPERTY); - blockConnections.add(new Pair(getParentObject().getName(), name)); + blockConnections.add(new Pair<>(getParentObject().getName(), name)); return getParentObject(); } }; @@ -362,7 +362,7 @@ } }; // - private HandoverElementHandler edgesHandler = new HandoverElementHandler(EDGES_ELEMENT); + private HandoverElementHandler edgesHandler = new HandoverElementHandler<>(EDGES_ELEMENT); // Local class for edge elements private class EdgeElementHandler extends ElementHandler { @@ -428,7 +428,7 @@ } }; // - private HandoverElementHandler propertiesHandler = new HandoverElementHandler(PROPERTIES_ELEMENT); + private HandoverElementHandler propertiesHandler = new HandoverElementHandler<>(PROPERTIES_ELEMENT); // private HandoverElementHandler groupPropertiesHandler = new HandoverElementHandler(PROPERTIES_ELEMENT) { diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Printer.java --- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Printer.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Printer.java Sat Jan 28 00:16:17 2012 +0100 @@ -111,8 +111,8 @@ writer.writeProperties(graph.getProperties()); writer.startTag(Parser.NODES_ELEMENT); - Set removed = new HashSet(); - Set equal = new HashSet(); + Set removed = new HashSet<>(); + Set equal = new HashSet<>(); if (previous != null) { for (InputNode n : previous.getNodes()) { @@ -143,8 +143,8 @@ writer.endTag(); writer.startTag(Parser.EDGES_ELEMENT); - Set removedEdges = new HashSet(); - Set equalEdges = new HashSet(); + Set removedEdges = new HashSet<>(); + Set equalEdges = new HashSet<>(); if (previous != null) { for (InputEdge e : previous.getEdges()) { diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLWriter.java --- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLWriter.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLWriter.java Sat Jan 28 00:16:17 2012 +0100 @@ -41,7 +41,7 @@ public XMLWriter(Writer inner) { this.inner = inner; - elementStack = new Stack(); + elementStack = new Stack<>(); } @Override diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/ChangedEventTest.java --- a/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/ChangedEventTest.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/ChangedEventTest.java Sat Jan 28 00:16:17 2012 +0100 @@ -62,7 +62,7 @@ @Test public void testBase() { - ChangedEvent e = new ChangedEvent(5); + ChangedEvent e = new ChangedEvent<>(5); final int[] fireCount = new int[1]; e.addListener(new ChangedListener() { diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/PropertiesTest.java --- a/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/PropertiesTest.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/PropertiesTest.java Sat Jan 28 00:16:17 2012 +0100 @@ -246,7 +246,7 @@ * Test property selector */ public void testPropertySelector() { - final Collection c = new ArrayList(); + final Collection c = new ArrayList<>(); final Properties.Entity e1 = new Properties.Entity(); e1.getProperties().setProperty("p1", "1"); @@ -264,7 +264,7 @@ e3.getProperties().setProperty("p4", "4"); c.add(e3); - final PropertySelector sel = new PropertySelector(c); + final PropertySelector sel = new PropertySelector<>(c); final StringPropertyMatcher matcher1 = new StringPropertyMatcher("p2", "2"); assertTrue(sel.selectMultiple(matcher1).size() == 2); diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/SourceTest.java --- a/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/SourceTest.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/SourceTest.java Sat Jan 28 00:16:17 2012 +0100 @@ -75,14 +75,14 @@ s.addSourceNode(N1); assertEquals(s.getSourceNodes(), Arrays.asList(N1)); - assertEquals(s.getSourceNodesAsSet(), new LinkedHashSet(Arrays.asList(1))); + assertEquals(s.getSourceNodesAsSet(), new LinkedHashSet<>(Arrays.asList(1))); s.addSourceNode(N2); assertEquals(s.getSourceNodes(), Arrays.asList(N1, N2)); - assertEquals(s.getSourceNodesAsSet(), new LinkedHashSet(Arrays.asList(1, 2))); + assertEquals(s.getSourceNodesAsSet(), new LinkedHashSet<>(Arrays.asList(1, 2))); s.addSourceNode(N1); assertEquals(s.getSourceNodes(), Arrays.asList(N1, N2)); - assertEquals(s.getSourceNodesAsSet(), new LinkedHashSet(Arrays.asList(1, 2))); + assertEquals(s.getSourceNodesAsSet(), new LinkedHashSet<>(Arrays.asList(1, 2))); } } \ No newline at end of file diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Difference/src/com/sun/hotspot/igv/difference/Difference.java --- a/src/share/tools/IdealGraphVisualizer/Difference/src/com/sun/hotspot/igv/difference/Difference.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Difference/src/com/sun/hotspot/igv/difference/Difference.java Sat Jan 28 00:16:17 2012 +0100 @@ -66,14 +66,14 @@ } private static InputGraph createDiffSameGroup(InputGraph a, InputGraph b) { - Map keyMapB = new HashMap(b.getNodes().size()); + Map keyMapB = new HashMap<>(b.getNodes().size()); for (InputNode n : b.getNodes()) { Integer key = n.getId(); assert !keyMapB.containsKey(key); keyMapB.put(key, n); } - Set pairs = new HashSet(); + Set pairs = new HashSet<>(); for (InputNode n : a.getNodes()) { Integer key = n.getId(); @@ -119,7 +119,7 @@ InputGraph graph = new InputGraph(a.getName() + ", " + b.getName()); g.addElement(graph); - Map blocksMap = new HashMap(); + Map blocksMap = new HashMap<>(); for (InputBlock blk : a.getBlocks()) { InputBlock diffblk = graph.addBlock(blk.getName()); blocksMap.put(blk, diffblk); @@ -133,14 +133,14 @@ } // Difference between block edges - Set> aEdges = new HashSet>(); + Set> aEdges = new HashSet<>(); for (InputBlockEdge edge : a.getBlockEdges()) { - aEdges.add(new Pair(edge.getFrom().getName(), edge.getTo().getName())); + aEdges.add(new Pair<>(edge.getFrom().getName(), edge.getTo().getName())); } for (InputBlockEdge bEdge : b.getBlockEdges()) { InputBlock from = bEdge.getFrom(); InputBlock to = bEdge.getTo(); - Pair pair = new Pair(from.getName(), to.getName()); + Pair pair = new Pair<>(from.getName(), to.getName()); if (aEdges.contains(pair)) { // same graph.addBlockEdge(blocksMap.get(from), blocksMap.get(to)); @@ -159,10 +159,10 @@ edge.setState(InputBlockEdge.State.DELETED); } - Set nodesA = new HashSet(a.getNodes()); - Set nodesB = new HashSet(b.getNodes()); + Set nodesA = new HashSet<>(a.getNodes()); + Set nodesB = new HashSet<>(b.getNodes()); - Map inputNodeMap = new HashMap(pairs.size()); + Map inputNodeMap = new HashMap<>(pairs.size()); for (NodePair p : pairs) { InputNode n = p.getLeft(); assert nodesA.contains(n); @@ -209,7 +209,7 @@ Collection edgesA = a.getEdges(); Collection edgesB = b.getEdges(); - Set newEdges = new HashSet(); + Set newEdges = new HashSet<>(); for (InputEdge e : edgesA) { int from = e.getFrom(); @@ -291,9 +291,9 @@ private static InputGraph createDiff(InputGraph a, InputGraph b) { - Set matched = new HashSet(); + Set matched = new HashSet<>(); - Set pairs = new HashSet(); + Set pairs = new HashSet<>(); for (InputNode n : a.getNodes()) { String s = n.getProperties().get(MAIN_PROPERTY); if (s == null) { @@ -312,7 +312,7 @@ } } - Set selectedPairs = new HashSet(); + Set selectedPairs = new HashSet<>(); while (pairs.size() > 0) { double min = Double.MAX_VALUE; @@ -330,7 +330,7 @@ } else { selectedPairs.add(minPair); - Set toRemove = new HashSet(); + Set toRemove = new HashSet<>(); for (NodePair p : pairs) { if (p.getLeft() == minPair.getLeft() || p.getRight() == minPair.getRight()) { toRemove.add(p); diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/ColorFilter.java --- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/ColorFilter.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/ColorFilter.java Sat Jan 28 00:16:17 2012 +0100 @@ -45,7 +45,7 @@ public ColorFilter(String name) { this.name = name; - colorRules = new ArrayList(); + colorRules = new ArrayList<>(); } public String getName() { @@ -54,7 +54,7 @@ public void apply(Diagram diagram) { - Properties.PropertySelector
selector = new Properties.PropertySelector
(diagram.getFigures()); + Properties.PropertySelector
selector = new Properties.PropertySelector<>(diagram.getFigures()); for (ColorRule rule : colorRules) { if (rule.getSelector() != null) { List
figures = rule.getSelector().selected(diagram); diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/CombineFilter.java --- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/CombineFilter.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/CombineFilter.java Sat Jan 28 00:16:17 2012 +0100 @@ -46,7 +46,7 @@ public CombineFilter(String name) { this.name = name; - rules = new ArrayList(); + rules = new ArrayList<>(); } public String getName() { @@ -55,14 +55,14 @@ public void apply(Diagram diagram) { - Properties.PropertySelector
selector = new Properties.PropertySelector
(diagram.getFigures()); + Properties.PropertySelector
selector = new Properties.PropertySelector<>(diagram.getFigures()); for (CombineRule r : rules) { List
list = selector.selectMultiple(r.getFirstMatcher()); - Set
figuresToRemove = new HashSet
(); + Set
figuresToRemove = new HashSet<>(); for (Figure f : list) { - List
successors = new ArrayList
(f.getSuccessors()); + List
successors = new ArrayList<>(f.getSuccessors()); if (r.isReversed()) { if (successors.size() == 1) { Figure succ = successors.get(0); diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/ConnectionFilter.java --- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/ConnectionFilter.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/ConnectionFilter.java Sat Jan 28 00:16:17 2012 +0100 @@ -44,7 +44,7 @@ public ConnectionFilter(String name) { this.name = name; - connectionStyleRules = new ArrayList(); + connectionStyleRules = new ArrayList<>(); } public String getName() { @@ -53,7 +53,7 @@ public void apply(Diagram diagram) { - Properties.PropertySelector
selector = new Properties.PropertySelector
(diagram.getFigures()); + Properties.PropertySelector
selector = new Properties.PropertySelector<>(diagram.getFigures()); for (ConnectionStyleRule rule : connectionStyleRules) { List
figures = null; if (rule.getSelector() != null) { diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/FilterChain.java --- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/FilterChain.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/FilterChain.java Sat Jan 28 00:16:17 2012 +0100 @@ -47,13 +47,13 @@ }; public FilterChain() { - filters = new ArrayList(); - changedEvent = new ChangedEvent(this); + filters = new ArrayList<>(); + changedEvent = new ChangedEvent<>(this); } public FilterChain(FilterChain f) { - this.filters = new ArrayList(f.filters); - changedEvent = new ChangedEvent(this); + this.filters = new ArrayList<>(f.filters); + changedEvent = new ChangedEvent<>(this); } public ChangedEvent getChangedEvent() { @@ -72,7 +72,7 @@ } public void apply(Diagram d, FilterChain sequence) { - List applied = new ArrayList(); + List applied = new ArrayList<>(); for (Filter f : sequence.getFilters()) { if (filters.contains(f)) { f.apply(d); diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/FilterSetting.java --- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/FilterSetting.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/FilterSetting.java Sat Jan 28 00:16:17 2012 +0100 @@ -42,7 +42,7 @@ public FilterSetting(String name) { this.name = name; - filters = new HashSet(); + filters = new HashSet<>(); } public Set getFilters() { diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/RemoveFilter.java --- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/RemoveFilter.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/RemoveFilter.java Sat Jan 28 00:16:17 2012 +0100 @@ -42,7 +42,7 @@ public RemoveFilter(String name) { this.name = name; - rules = new ArrayList(); + rules = new ArrayList<>(); } public String getName() { @@ -52,7 +52,7 @@ public void apply(Diagram diagram) { for (RemoveRule r : rules) { List
selected = r.getSelector().selected(diagram); - Set
toRemove = new HashSet
(selected); + Set
toRemove = new HashSet<>(selected); if (r.getRemoveOrphans()) { boolean changed; diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/RemoveInputsFilter.java --- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/RemoveInputsFilter.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/RemoveInputsFilter.java Sat Jan 28 00:16:17 2012 +0100 @@ -43,7 +43,7 @@ public RemoveInputsFilter(String name) { this.name = name; - rules = new ArrayList(); + rules = new ArrayList<>(); } public String getName() { @@ -57,7 +57,7 @@ List
list = r.getSelector().selected(diagram); for (Figure f : list) { int z = 0; - List last = new ArrayList(); + List last = new ArrayList<>(); for (InputSlot is : f.getInputSlots()) { if (z >= r.getStartingIndex() && z <= r.getEndIndex() && is.getConnections().size() > 0) { StringBuilder sb = new StringBuilder(); diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/RemoveSelfLoopsFilter.java --- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/RemoveSelfLoopsFilter.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/RemoveSelfLoopsFilter.java Sat Jan 28 00:16:17 2012 +0100 @@ -54,7 +54,7 @@ for (InputSlot is : f.getInputSlots()) { - List toRemove = new ArrayList(); + List toRemove = new ArrayList<>(); for (Connection c : is.getConnections()) { if (c.getOutputSlot().getFigure() == f) { diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/UnconnectedSlotFilter.java --- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/UnconnectedSlotFilter.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/UnconnectedSlotFilter.java Sat Jan 28 00:16:17 2012 +0100 @@ -55,7 +55,7 @@ List
figures = d.getFigures(); for (Figure f : figures) { - List remove = new ArrayList(); + List remove = new ArrayList<>(); if (removeInputs) { for (InputSlot is : f.getInputSlots()) { if (is.getConnections().isEmpty()) { diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/CheckNode.java --- a/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/CheckNode.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/CheckNode.java Sat Jan 28 00:16:17 2012 +0100 @@ -40,7 +40,7 @@ public CheckNode(Children c, Lookup lookup) { super(c, lookup); - selectionChangedEvent = new ChangedEvent(this); + selectionChangedEvent = new ChangedEvent<>(this); selected = false; enabled = true; } diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/FilterNode.java --- a/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/FilterNode.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/FilterNode.java Sat Jan 28 00:16:17 2012 +0100 @@ -69,7 +69,7 @@ update(); - Lookup.Template tpl = new Lookup.Template(FilterChain.class); + Lookup.Template tpl = new Lookup.Template<>(FilterChain.class); result = Utilities.actionsGlobalContext().lookup(tpl); result.addLookupListener(this); diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/FilterTopComponent.java --- a/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/FilterTopComponent.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/FilterTopComponent.java Sat Jan 28 00:16:17 2012 +0100 @@ -141,7 +141,7 @@ if (s != customFilterSetting) { FilterChain chain = getFilterChain(); chain.getChangedEvent().beginAtomic(); - List toRemove = new ArrayList(); + List toRemove = new ArrayList<>(); for (Filter f : chain.getFilters()) { if (!s.containsFilter(f)) { toRemove.add(f); @@ -270,7 +270,7 @@ private class FilterChildren extends Children.Keys implements ChangedListener { - private HashMap nodeHash = new HashMap(); + private HashMap nodeHash = new HashMap<>(); protected Node[] createNodes(Filter filter) { if (nodeHash.containsKey(filter)) { @@ -324,7 +324,7 @@ } private FilterTopComponent() { - filterSettingsChangedEvent = new ChangedEvent(this); + filterSettingsChangedEvent = new ChangedEvent<>(this); initComponents(); setName(NbBundle.getMessage(FilterTopComponent.class, "CTL_FilterTopComponent")); setToolTipText(NbBundle.getMessage(FilterTopComponent.class, "HINT_FilterTopComponent")); @@ -354,7 +354,7 @@ toolBar.add(MoveFilterDownAction.get(MoveFilterDownAction.class).createContextAwareInstance(this.getLookup())); this.add(view, BorderLayout.CENTER); - filterSettings = new ArrayList(); + filterSettings = new ArrayList<>(); updateComboBox(); comboBox.addActionListener(comboBoxActionListener); @@ -423,10 +423,10 @@ FileObject folder = FileUtil.getConfigRoot().getFileObject(FOLDER_ID); FileObject[] children = folder.getChildren(); - List customFilters = new ArrayList(); - HashMap afterMap = new HashMap(); - Set enabledSet = new HashSet(); - HashMap map = new HashMap(); + List customFilters = new ArrayList<>(); + HashMap afterMap = new HashMap<>(); + Set enabledSet = new HashSet<>(); + HashMap map = new HashMap<>(); for (final FileObject fo : children) { InputStream is = null; @@ -478,7 +478,7 @@ for (int j = 0; j < customFilters.size(); j++) { for (int i = 0; i < customFilters.size(); i++) { - List copiedList = new ArrayList(customFilters); + List copiedList = new ArrayList<>(customFilters); for (CustomFilter cf : copiedList) { String after = afterMap.get(cf); @@ -562,7 +562,7 @@ @Override public void componentOpened() { - Lookup.Template tpl = new Lookup.Template(FilterChain.class); + Lookup.Template tpl = new Lookup.Template<>(FilterChain.class); result = Utilities.actionsGlobalContext().lookup(tpl); result.addLookupListener(this); } diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/filters/GraalCFGFilter.java --- a/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/filters/GraalCFGFilter.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/filters/GraalCFGFilter.java Sat Jan 28 00:16:17 2012 +0100 @@ -39,8 +39,8 @@ } public void apply(Diagram d) { - Set
figuresToRemove = new HashSet
(); - Set connectionsToRemove = new HashSet(); + Set
figuresToRemove = new HashSet<>(); + Set connectionsToRemove = new HashSet<>(); for (Figure f : d.getFigures()) { final String prop = f.getProperties().get("probability"); diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/AndSelector.java --- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/AndSelector.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/AndSelector.java Sat Jan 28 00:16:17 2012 +0100 @@ -43,7 +43,7 @@ public List
selected(Diagram d) { List
l1 = selector1.selected(d); List
l2 = selector2.selected(d); - List
result = new ArrayList
(); + List
result = new ArrayList<>(); for (Figure f : l2) { if (l1.contains(f)) { result.add(f); diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Block.java --- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Block.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Block.java Sat Jan 28 00:16:17 2012 +0100 @@ -53,7 +53,7 @@ } public Set getSuccessors() { - Set succs = new HashSet(); + Set succs = new HashSet<>(); for (InputBlock b : inputBlock.getSuccessors()) { succs.add(diagram.getBlock(b)); } diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Connection.java --- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Connection.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Connection.java Sat Jan 28 00:16:17 2012 +0100 @@ -57,7 +57,7 @@ this.label = label; this.inputSlot.connections.add(this); this.outputSlot.connections.add(this); - controlPoints = new ArrayList(); + controlPoints = new ArrayList<>(); Figure sourceFigure = this.outputSlot.getFigure(); Figure destFigure = this.inputSlot.getFigure(); sourceFigure.addSuccessor(destFigure); diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Diagram.java --- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Diagram.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Diagram.java Sat Jan 28 00:16:17 2012 +0100 @@ -65,8 +65,8 @@ } private Diagram() { - figures = new ArrayList
(); - blocks = new LinkedHashMap(8); + figures = new ArrayList<>(); + blocks = new LinkedHashMap<>(8); this.nodeText = ""; this.font = new Font("Arial", Font.PLAIN, 13); this.slotFont = new Font("Arial", Font.PLAIN, 10); @@ -119,7 +119,7 @@ } public Map> calcSourceToFigureRelation() { - Map> map = new HashMap>(); + Map> map = new HashMap<>(); for(InputNode node : this.getGraph().getNodes()) { map.put(node, new HashSet
()); @@ -146,7 +146,7 @@ d.updateBlocks(); Collection nodes = graph.getNodes(); - Hashtable figureHash = new Hashtable(); + Hashtable figureHash = new Hashtable<>(); for (InputNode n : nodes) { Figure f = d.createFigure(); f.getSource().addSourceNode(n); @@ -194,7 +194,7 @@ freeFigure(f); } - ArrayList
newFigures = new ArrayList
(); + ArrayList
newFigures = new ArrayList<>(); for (Figure f : this.figures) { if (!figuresToRemove.contains(f)) { newFigures.add(f); @@ -205,12 +205,12 @@ private void freeFigure(Figure succ) { - List inputSlots = new ArrayList(succ.getInputSlots()); + List inputSlots = new ArrayList<>(succ.getInputSlots()); for (InputSlot s : inputSlots) { succ.removeInputSlot(s); } - List outputSlots = new ArrayList(succ.getOutputSlots()); + List outputSlots = new ArrayList<>(succ.getOutputSlots()); for (OutputSlot s : outputSlots) { succ.removeOutputSlot(s); } @@ -239,7 +239,7 @@ public Set getConnections() { - Set connections = new HashSet(); + Set connections = new HashSet<>(); for (Figure f : figures) { for (InputSlot s : f.getInputSlots()) { @@ -251,7 +251,7 @@ } public Figure getRootFigure() { - Properties.PropertySelector
selector = new Properties.PropertySelector
(figures); + Properties.PropertySelector
selector = new Properties.PropertySelector<>(figures); Figure root = selector.selectSingle(new StringPropertyMatcher("name", "Root")); if (root == null) { root = selector.selectSingle(new StringPropertyMatcher("name", "Start")); @@ -278,7 +278,7 @@ System.out.println("Number of figures: " + tmpFigures.size()); System.out.println("Number of connections: " + connections.size()); - List
figuresSorted = new ArrayList
(tmpFigures); + List
figuresSorted = new ArrayList<>(tmpFigures); Collections.sort(figuresSorted, new Comparator
() { public int compare(Figure a, Figure b) { @@ -303,7 +303,7 @@ } public List
getRootFigures() { - ArrayList
rootFigures = new ArrayList
(); + ArrayList
rootFigures = new ArrayList<>(); for (Figure f : figures) { if (f.getPredecessors().size() == 0) { rootFigures.add(f); diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Figure.java --- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Figure.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Figure.java Sat Jan 28 00:16:17 2012 +0100 @@ -29,12 +29,7 @@ import com.sun.hotspot.igv.layout.Cluster; import com.sun.hotspot.igv.layout.Vertex; import com.sun.hotspot.igv.data.Properties; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Graphics; -import java.awt.Point; +import java.awt.*; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.Collection; @@ -82,7 +77,7 @@ } public static List getAllBefore(List inputList, T tIn) { - List result = new ArrayList(); + List result = new ArrayList<>(); for(T t : inputList) { if(t.equals(tIn)) { break; @@ -123,10 +118,10 @@ protected Figure(Diagram diagram, int id) { this.diagram = diagram; this.source = new Source(); - inputSlots = new ArrayList(5); - outputSlots = new ArrayList(1); - predecessors = new ArrayList
(6); - successors = new ArrayList
(6); + inputSlots = new ArrayList<>(5); + outputSlots = new ArrayList<>(1); + predecessors = new ArrayList<>(6); + successors = new ArrayList<>(6); this.id = id; idString = Integer.toString(id); @@ -151,7 +146,7 @@ } public Set
getPredecessorSet() { - Set
result = new HashSet
(); + Set
result = new HashSet<>(); for (Figure f : getPredecessors()) { result.add(f); } @@ -159,7 +154,7 @@ } public Set
getSuccessorSet() { - Set
result = new HashSet
(); + Set
result = new HashSet<>(); for (Figure f : getSuccessors()) { result.add(f); } @@ -221,7 +216,7 @@ assert inputSlots.contains(s) || outputSlots.contains(s); - List connections = new ArrayList(s.getConnections()); + List connections = new ArrayList<>(s.getConnections()); for (Connection c : connections) { c.remove(); } @@ -251,7 +246,7 @@ } public Set getSlots() { - Set result = new HashSet(); + Set result = new HashSet<>(); result.addAll(getInputSlots()); result.addAll(getOutputSlots()); return result; @@ -363,7 +358,12 @@ } } + @Override public int compareTo(Vertex f) { return toString().compareTo(f.toString()); } + + public Rectangle getBounds() { + return new Rectangle(this.getPosition(), new Dimension(this.getWidth(), this.getHeight())); + } } diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/InvertSelector.java --- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/InvertSelector.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/InvertSelector.java Sat Jan 28 00:16:17 2012 +0100 @@ -40,7 +40,7 @@ public List
selected(Diagram d) { - List
result = new ArrayList
(); + List
result = new ArrayList<>(); List
otherResult = selector.selected(d); for (Figure f : d.getFigures()) { if (!otherResult.contains(f)) { diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/MatcherSelector.java --- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/MatcherSelector.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/MatcherSelector.java Sat Jan 28 00:16:17 2012 +0100 @@ -40,7 +40,7 @@ } public List
selected(Diagram d) { - Properties.PropertySelector
selector = new Properties.PropertySelector
(d.getFigures()); + Properties.PropertySelector
selector = new Properties.PropertySelector<>(d.getFigures()); List
list = selector.selectMultiple(matcher); return list; } diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/PredecessorSelector.java --- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/PredecessorSelector.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/PredecessorSelector.java Sat Jan 28 00:16:17 2012 +0100 @@ -40,7 +40,7 @@ public List
selected(Diagram d) { List
inner = innerSelector.selected(d); - List
result = new ArrayList
(); + List
result = new ArrayList<>(); for (Figure f : d.getFigures()) { boolean saved = false; for (Figure f2 : f.getSuccessors()) { diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Slot.java --- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Slot.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Slot.java Sat Jan 28 00:16:17 2012 +0100 @@ -55,7 +55,7 @@ protected Slot(Figure figure, int wantedIndex) { this.figure = figure; - connections = new ArrayList(2); + connections = new ArrayList<>(2); source = new Source(); this.wantedIndex = wantedIndex; text = ""; @@ -173,7 +173,7 @@ } public void removeAllConnections() { - List connectionsCopy = new ArrayList(this.connections); + List connectionsCopy = new ArrayList<>(this.connections); for (Connection c : connectionsCopy) { c.remove(); } diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/SuccessorSelector.java --- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/SuccessorSelector.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/SuccessorSelector.java Sat Jan 28 00:16:17 2012 +0100 @@ -40,7 +40,7 @@ public List
selected(Diagram d) { List
inner = innerSelector.selected(d); - List
result = new ArrayList
(); + List
result = new ArrayList<>(); for (Figure f : d.getFigures()) { boolean saved = false; for (Figure f2 : f.getPredecessors()) { diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/ClusterIngoingConnection.java --- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/ClusterIngoingConnection.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/ClusterIngoingConnection.java Sat Jan 28 00:16:17 2012 +0100 @@ -44,7 +44,7 @@ public ClusterIngoingConnection(ClusterInputSlotNode inputSlotNode, Link c) { this.inputSlotNode = inputSlotNode; this.connection = c; - this.controlPoints = new ArrayList(); + this.controlPoints = new ArrayList<>(); inputSlot = c.getTo(); outputSlot = inputSlotNode.getOutputSlot(); diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/ClusterNode.java --- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/ClusterNode.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/ClusterNode.java Sat Jan 28 00:16:17 2012 +0100 @@ -54,8 +54,8 @@ public static final int BORDER = 20; public ClusterNode(Cluster cluster, String name) { - this.subNodes = new HashSet(); - this.subEdges = new HashSet(); + this.subNodes = new HashSet<>(); + this.subEdges = new HashSet<>(); this.cluster = cluster; position = new Point(0, 0); this.name = name; @@ -142,7 +142,7 @@ } for (Link l : subEdges) { - List points = new ArrayList(l.getControlPoints()); + List points = new ArrayList<>(l.getControlPoints()); for (Point p : points) { p.x -= minX; p.y -= minY; @@ -183,7 +183,7 @@ for (Link e : subEdges) { List arr = e.getControlPoints(); - ArrayList newArr = new ArrayList(arr.size()); + ArrayList newArr = new ArrayList<>(arr.size()); for (Point p : arr) { if (p != null) { Point p2 = new Point(p); diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/ClusterOutgoingConnection.java --- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/ClusterOutgoingConnection.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/ClusterOutgoingConnection.java Sat Jan 28 00:16:17 2012 +0100 @@ -44,7 +44,7 @@ public ClusterOutgoingConnection(ClusterOutputSlotNode outputSlotNode, Link c) { this.outputSlotNode = outputSlotNode; this.connection = c; - this.intermediatePoints = new ArrayList(); + this.intermediatePoints = new ArrayList<>(); outputSlot = c.getFrom(); inputSlot = outputSlotNode.getInputSlot(); diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/Graph.java --- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/Graph.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/Graph.java Sat Jan 28 00:16:17 2012 +0100 @@ -42,13 +42,13 @@ private List> nodeList; public Graph() { - nodes = new HashMap>(); - edges = new HashMap>(); - nodeList = new ArrayList>(); + nodes = new HashMap<>(); + edges = new HashMap<>(); + nodeList = new ArrayList<>(); } public Node createNode(N data, Object key) { - Node n = new Node(this, data); + Node n = new Node<>(this, data); assert key == null || !nodes.containsKey(key); if (key != null) { nodes.put(key, n); @@ -58,7 +58,7 @@ } public Edge createEdge(Node source, Node dest, E data, Object key) { - Edge e = new Edge(this, source, dest, data); + Edge e = new Edge<>(this, source, dest, data); source.addOutEdge(e); dest.addInEdge(e); if (key != null) { @@ -114,7 +114,7 @@ public List> getNodesWithInDegree(int x, boolean countSelfLoops) { - List> result = new ArrayList>(); + List> result = new ArrayList<>(); for (Node n : getNodes()) { if (n.getInDegree(countSelfLoops) == x) { result.add(n); @@ -126,7 +126,7 @@ } private void markReachable(Node startingNode) { - ArrayList> arr = new ArrayList>(); + ArrayList> arr = new ArrayList<>(); arr.add(startingNode); for (Node n : getNodes()) { n.setReachable(false); @@ -151,7 +151,7 @@ n.setActive(false); } - Queue> queue = new LinkedList>(); + Queue> queue = new LinkedList<>(); queue.add(startingNode); startingNode.setVisited(true); int layer = 0; diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/HierarchicalClusterLayoutManager.java --- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/HierarchicalClusterLayoutManager.java Fri Jan 27 23:57:47 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,247 +0,0 @@ -/* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ -package com.sun.hotspot.igv.hierarchicallayout; - -import java.awt.Point; -import java.awt.Rectangle; -import java.util.HashMap; -import java.util.List; -import java.util.Set; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.TreeSet; -import com.sun.hotspot.igv.layout.Cluster; -import com.sun.hotspot.igv.layout.LayoutGraph; -import com.sun.hotspot.igv.layout.LayoutManager; -import com.sun.hotspot.igv.layout.Link; -import com.sun.hotspot.igv.layout.Port; -import com.sun.hotspot.igv.layout.Vertex; - -/** - * - * @author Thomas Wuerthinger - */ -public class HierarchicalClusterLayoutManager implements LayoutManager { - - private OldHierarchicalLayoutManager.Combine combine; - private LayoutManager subManager = new OldHierarchicalLayoutManager(combine); - private LayoutManager manager = new OldHierarchicalLayoutManager(combine, 150); - private static final boolean TRACE = false; - - public HierarchicalClusterLayoutManager(OldHierarchicalLayoutManager.Combine combine) { - this.combine = combine; - } - - public void doLayout(LayoutGraph graph) { - doLayout(graph, new HashSet(), new HashSet(), new HashSet()); - } - - public void setSubManager(LayoutManager manager) { - this.subManager = manager; - } - - public void setManager(LayoutManager manager) { - this.manager = manager; - } - - public void doLayout(LayoutGraph graph, Set firstLayerHint, Set lastLayerHint, Set importantLinks) { - - assert graph.verify(); - - HashMap> lists = new HashMap>(); - HashMap> listsConnection = new HashMap>(); - HashMap> clusterInputSlotHash = new HashMap>(); - HashMap> clusterOutputSlotHash = new HashMap>(); - - HashMap clusterNodes = new HashMap(); - HashMap> clusterInputSlotSet = new HashMap>(); - HashMap> clusterOutputSlotSet = new HashMap>(); - Set clusterEdges = new HashSet(); - Set interClusterEdges = new HashSet(); - HashMap linkClusterOutgoingConnection = new HashMap(); - HashMap linkInterClusterConnection = new HashMap(); - HashMap linkClusterIngoingConnection = new HashMap(); - Set clusterNodeSet = new HashSet(); - - Set cluster = graph.getClusters(); - int z = 0; - for (Cluster c : cluster) { - lists.put(c, new ArrayList()); - listsConnection.put(c, new ArrayList()); - clusterInputSlotHash.put(c, new HashMap()); - clusterOutputSlotHash.put(c, new HashMap()); - clusterOutputSlotSet.put(c, new TreeSet()); - clusterInputSlotSet.put(c, new TreeSet()); - ClusterNode cn = new ClusterNode(c, "" + z); - clusterNodes.put(c, cn); - clusterNodeSet.add(cn); - z++; - } - - // Add cluster edges - for (Cluster c : cluster) { - - ClusterNode start = clusterNodes.get(c); - - for (Cluster succ : c.getSuccessors()) { - ClusterNode end = clusterNodes.get(succ); - if (end != null && start != end) { - ClusterEdge e = new ClusterEdge(start, end); - clusterEdges.add(e); - interClusterEdges.add(e); - } - } - } - - for (Vertex v : graph.getVertices()) { - Cluster c = v.getCluster(); - assert c != null : "Cluster of vertex " + v + " is null!"; - clusterNodes.get(c).addSubNode(v); - } - - for (Link l : graph.getLinks()) { - - Port fromPort = l.getFrom(); - Port toPort = l.getTo(); - Vertex fromVertex = fromPort.getVertex(); - Vertex toVertex = toPort.getVertex(); - Cluster fromCluster = fromVertex.getCluster(); - Cluster toCluster = toVertex.getCluster(); - - Port samePort = null; - if (combine == OldHierarchicalLayoutManager.Combine.SAME_INPUTS) { - samePort = toPort; - } else if (combine == OldHierarchicalLayoutManager.Combine.SAME_OUTPUTS) { - samePort = fromPort; - } - - assert listsConnection.containsKey(fromCluster); - assert listsConnection.containsKey(toCluster); - - if (fromCluster == toCluster) { - listsConnection.get(fromCluster).add(l); - clusterNodes.get(fromCluster).addSubEdge(l); - } else { - ClusterInputSlotNode inputSlotNode = null; - ClusterOutputSlotNode outputSlotNode = null; - - if (samePort != null) { - outputSlotNode = clusterOutputSlotHash.get(fromCluster).get(samePort); - inputSlotNode = clusterInputSlotHash.get(toCluster).get(samePort); - } - - if (outputSlotNode == null) { - outputSlotNode = new ClusterOutputSlotNode(clusterNodes.get(fromCluster), "Out " + fromCluster.toString() + " " + samePort.toString()); - clusterOutputSlotSet.get(fromCluster).add(outputSlotNode); - ClusterOutgoingConnection conn = new ClusterOutgoingConnection(outputSlotNode, l); - outputSlotNode.setOutgoingConnection(conn); - clusterNodes.get(fromCluster).addSubEdge(conn); - if (samePort != null) { - clusterOutputSlotHash.get(fromCluster).put(samePort, outputSlotNode); - } - - linkClusterOutgoingConnection.put(l, conn); - } else { - linkClusterOutgoingConnection.put(l, outputSlotNode.getOutgoingConnection()); - } - - if (inputSlotNode == null) { - inputSlotNode = new ClusterInputSlotNode(clusterNodes.get(toCluster), "In " + toCluster.toString() + " " + samePort.toString()); - clusterInputSlotSet.get(toCluster).add(inputSlotNode); - } - - ClusterIngoingConnection conn = new ClusterIngoingConnection(inputSlotNode, l); - inputSlotNode.setIngoingConnection(conn); - clusterNodes.get(toCluster).addSubEdge(conn); - if (samePort != null) { - clusterInputSlotHash.get(toCluster).put(samePort, inputSlotNode); - } - - linkClusterIngoingConnection.put(l, conn); - - - InterClusterConnection interConn = new InterClusterConnection(outputSlotNode, inputSlotNode); - linkInterClusterConnection.put(l, interConn); - clusterEdges.add(interConn); - } - } - - Timing t = null; - - if (TRACE) { - new Timing("Child timing"); - t.start(); - } - - for (Cluster c : cluster) { - ClusterNode n = clusterNodes.get(c); - subManager.doLayout(new LayoutGraph(n.getSubEdges(), n.getSubNodes()), clusterInputSlotSet.get(c), clusterOutputSlotSet.get(c), new HashSet()); - n.updateSize(); - } - - Set roots = new LayoutGraph(interClusterEdges).findRootVertices(); - for (Vertex v : roots) { - assert v instanceof ClusterNode; - ((ClusterNode) v).setRoot(true); - } - - manager.doLayout(new LayoutGraph(clusterEdges, clusterNodeSet), new HashSet(), new HashSet(), interClusterEdges); - - for (Cluster c : cluster) { - ClusterNode n = clusterNodes.get(c); - c.setBounds(new Rectangle(n.getPosition(), n.getSize())); - } - - // TODO: handle case where blocks are not fully connected - - if (TRACE) { - t.stop(); - t.print(); - } - - for (Link l : graph.getLinks()) { - - if (linkInterClusterConnection.containsKey(l)) { - ClusterOutgoingConnection conn1 = linkClusterOutgoingConnection.get(l); - InterClusterConnection conn2 = linkInterClusterConnection.get(l); - ClusterIngoingConnection conn3 = linkClusterIngoingConnection.get(l); - - assert conn1 != null; - assert conn2 != null; - assert conn3 != null; - - List points = new ArrayList(); - - points.addAll(conn1.getControlPoints()); - points.addAll(conn2.getControlPoints()); - points.addAll(conn3.getControlPoints()); - - l.setControlPoints(points); - } - } - } - - public void doRouting(LayoutGraph graph) { - } -} diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/HierarchicalLayoutManager.java --- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/HierarchicalLayoutManager.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/HierarchicalLayoutManager.java Sat Jan 28 00:16:17 2012 +0100 @@ -103,10 +103,10 @@ public int bottomYOffset; public Vertex vertex; // Only used for non-dummy nodes, otherwise null - public List preds = new ArrayList(); - public List succs = new ArrayList(); - public HashMap outOffsets = new HashMap(); - public HashMap inOffsets = new HashMap(); + public List preds = new ArrayList<>(); + public List succs = new ArrayList<>(); + public HashMap outOffsets = new HashMap<>(); + public HashMap inOffsets = new HashMap<>(); public int pos = -1; // Position within layer public int crossingNumber; @@ -174,7 +174,7 @@ this.layerOffset = LAYER_OFFSET; this.maxLayerLength = MAX_LAYER_LENGTH; this.minLayerDifference = MIN_LAYER_DIFFERENCE; - this.linksToFollow = new HashSet(); + this.linksToFollow = new HashSet<>(); } public int getMaxLayerLength() { @@ -201,14 +201,14 @@ this.firstLayerHint = firstLayerHint; this.lastLayerHint = lastLayerHint; - vertexToLayoutNode = new HashMap(); - reversedLinks = new HashSet(); - reversedLinkStartPoints = new HashMap>(); - reversedLinkEndPoints = new HashMap>(); - bottomEdgeHash = new HashMap(); - nodes = new ArrayList(); - splitStartPoints = new HashMap>(); - splitEndPoints = new HashMap>(); + vertexToLayoutNode = new HashMap<>(); + reversedLinks = new HashSet<>(); + reversedLinkStartPoints = new HashMap<>(); + reversedLinkEndPoints = new HashMap<>(); + bottomEdgeHash = new HashMap<>(); + nodes = new ArrayList<>(); + splitStartPoints = new HashMap<>(); + splitEndPoints = new HashMap<>(); // ############################################################# // Step 1: Build up data structure @@ -219,7 +219,7 @@ new ReverseEdges().start(); for (LayoutNode n : nodes) { - ArrayList tmpArr = new ArrayList(); + ArrayList tmpArr = new ArrayList<>(); for (LayoutEdge e : n.succs) { if (importantLinks.contains(e.link)) { tmpArr.add(e); @@ -265,8 +265,8 @@ protected void run() { - HashMap vertexPositions = new HashMap(); - HashMap> linkPositions = new HashMap>(); + HashMap vertexPositions = new HashMap<>(); + HashMap> linkPositions = new HashMap<>(); for (Vertex v : graph.getVertices()) { LayoutNode n = vertexToLayoutNode.get(v); assert !vertexPositions.containsKey(v); @@ -277,7 +277,7 @@ for (LayoutEdge e : n.preds) { if (e.link != null) { - ArrayList points = new ArrayList(); + ArrayList points = new ArrayList<>(); Point p = new Point(e.to.x + e.relativeTo, e.to.y + e.to.yOffset + e.link.getTo().getRelativePosition().y); points.add(p); @@ -362,7 +362,7 @@ for (LayoutEdge e : n.succs) { if (e.link != null) { - ArrayList points = new ArrayList(); + ArrayList points = new ArrayList<>(); Point p = new Point(e.from.x + e.relativeFrom, e.from.y + e.from.height - e.from.bottomYOffset + e.link.getFrom().getRelativePosition().y); points.add(p); if (e.from.outOffsets.containsKey(e.relativeFrom)) { @@ -498,9 +498,9 @@ public float d; public int orderNumber = -1; - public ArrayList nodes = new ArrayList(); - public HashSet succs = new HashSet(); - public HashSet preds = new HashSet(); + public ArrayList nodes = new ArrayList<>(); + public HashSet succs = new HashSet<>(); + public HashSet preds = new HashSet<>(); public Region region; } private static final Comparator segmentComparator = new Comparator() { @@ -514,9 +514,9 @@ public float d; public int minOrderNumber; - public SortedSet segments = new TreeSet(segmentComparator); - public HashSet succs = new HashSet(4); - public HashSet preds = new HashSet(4); + public SortedSet segments = new TreeSet<>(segmentComparator); + public HashSet succs = new HashSet<>(4); + public HashSet preds = new HashSet<>(4); } private static final Comparator regionComparator = new Comparator() { @@ -583,9 +583,9 @@ createArrays(); for (int i = 0; i < layers.length; i++) { - space[i] = new ArrayList(); - downProcessingOrder[i] = new ArrayList(); - upProcessingOrder[i] = new ArrayList(); + space[i] = new ArrayList<>(); + downProcessingOrder[i] = new ArrayList<>(); + upProcessingOrder[i] = new ArrayList<>(); int curX = 0; for (LayoutNode n : layers[i]) { @@ -710,7 +710,7 @@ private ArrayList space; public NodeRow(ArrayList space) { - treeSet = new TreeSet(nodePositionComparator); + treeSet = new TreeSet<>(nodePositionComparator); this.space = space; } @@ -758,8 +758,8 @@ private class AssignXCoordinates extends AlgorithmPart { - HashMap hashMap = new HashMap(); - ArrayList segments = new ArrayList(); + HashMap hashMap = new HashMap<>(); + ArrayList segments = new ArrayList<>(); private void generateSegments() { @@ -819,10 +819,10 @@ private void topologicalSorting() { - Queue queue = new LinkedList(); + Queue queue = new LinkedList<>(); int index = 0; - ArrayList newList = new ArrayList(); + ArrayList newList = new ArrayList<>(); for (Segment s : segments) { if (s.preds.size() == 0) { s.orderNumber = index; @@ -946,7 +946,7 @@ upValues(); } - SortedSet regions = new TreeSet(regionComparator); + SortedSet regions = new TreeSet<>(regionComparator); for (Segment s : segments) { s.region = new Region(); s.region.minOrderNumber = s.orderNumber; @@ -997,7 +997,7 @@ - ArrayList reversedRegions = new ArrayList(); + ArrayList reversedRegions = new ArrayList<>(); for (Region r : regions) { if (r.d < 0) { processRegion(r, down); @@ -1019,7 +1019,7 @@ return; } - ArrayList arr = new ArrayList(); + ArrayList arr = new ArrayList<>(); for (Segment s : r.segments) { arr.add(s); } @@ -1119,7 +1119,7 @@ layers = new List[layerCount]; for (int i = 0; i < layerCount; i++) { - layers[i] = new ArrayList(); + layers[i] = new ArrayList<>(); } } @@ -1127,7 +1127,7 @@ createLayers(); // Generate initial ordering - HashSet visited = new HashSet(); + HashSet visited = new HashSet<>(); for (LayoutNode n : nodes) { if (n.layer == 0) { layers[0].add(n); @@ -1310,7 +1310,7 @@ @Override public void postCheck() { - HashSet visited = new HashSet(); + HashSet visited = new HashSet<>(); for (int i = 0; i < layers.length; i++) { for (LayoutNode n : layers[i]) { assert !visited.contains(n); @@ -1392,14 +1392,14 @@ return e1.to.layer - e2.to.layer; } }; - HashMap> portHash = new HashMap>(); - ArrayList currentNodes = new ArrayList(nodes); + HashMap> portHash = new HashMap<>(); + ArrayList currentNodes = new ArrayList<>(nodes); for (LayoutNode n : currentNodes) { portHash.clear(); - ArrayList succs = new ArrayList(n.succs); - HashMap topNodeHash = new HashMap(); - HashMap> bottomNodeHash = new HashMap>(); + ArrayList succs = new ArrayList<>(n.succs); + HashMap topNodeHash = new HashMap<>(); + HashMap> bottomNodeHash = new HashMap<>(); for (LayoutEdge e : succs) { assert e.from.layer < e.to.layer; if (e.from.layer != e.to.layer - 1) { @@ -1474,7 +1474,7 @@ } } - succs = new ArrayList(n.succs); + succs = new ArrayList<>(n.succs); for (LayoutEdge e : succs) { Integer i = e.relativeFrom; @@ -1541,7 +1541,7 @@ } else if (combine == Combine.SAME_INPUTS) { throw new UnsupportedOperationException("Currently not supported"); } else { - ArrayList currentNodes = new ArrayList(nodes); + ArrayList currentNodes = new ArrayList<>(nodes); for (LayoutNode n : currentNodes) { for (LayoutEdge e : n.succs) { processSingleEdge(e); @@ -1587,7 +1587,7 @@ @Override public void postCheck() { - ArrayList currentNodes = new ArrayList(nodes); + ArrayList currentNodes = new ArrayList<>(nodes); for (LayoutNode n : currentNodes) { for (LayoutEdge e : n.succs) { assert e.from.layer == e.to.layer - 1; @@ -1614,9 +1614,9 @@ protected void run() { - List insertOrder = new ArrayList(); + List insertOrder = new ArrayList<>(); - HashSet set = new HashSet(); + HashSet set = new HashSet<>(); for (LayoutNode n : nodes) { if (n.preds.size() == 0) { set.add(n); @@ -1626,8 +1626,8 @@ } int z = minLayerDifference; - HashSet newSet = new HashSet(); - HashSet failed = new HashSet(); + HashSet newSet = new HashSet<>(); + HashSet failed = new HashSet<>(); while (!set.isEmpty()) { newSet.clear(); @@ -1722,7 +1722,7 @@ // Remove self-edges for (LayoutNode node : nodes) { - ArrayList succs = new ArrayList(node.succs); + ArrayList succs = new ArrayList<>(node.succs); for (LayoutEdge e : succs) { assert e.from == node; if (e.to == node) { @@ -1750,8 +1750,8 @@ // Start DFS and reverse back edges - visited = new HashSet(); - active = new HashSet(); + visited = new HashSet<>(); + active = new HashSet<>(); for (LayoutNode node : nodes) { DFS(node); } @@ -1759,7 +1759,7 @@ for (LayoutNode node : nodes) { - SortedSet reversedDown = new TreeSet(); + SortedSet reversedDown = new TreeSet<>(); for (LayoutEdge e : node.succs) { if (reversedLinks.contains(e.link)) { @@ -1770,9 +1770,9 @@ SortedSet reversedUp = null; if (reversedDown.size() == 0) { - reversedUp = new TreeSet(Collections.reverseOrder()); + reversedUp = new TreeSet<>(Collections.reverseOrder()); } else { - reversedUp = new TreeSet(); + reversedUp = new TreeSet<>(); } for (LayoutEdge e : node.preds) { @@ -1786,7 +1786,7 @@ int curX = 0; int curWidth = node.width + reversedDown.size() * offset; for (int pos : reversedDown) { - ArrayList reversedSuccs = new ArrayList(); + ArrayList reversedSuccs = new ArrayList<>(); for (LayoutEdge e : node.succs) { if (e.relativeFrom == pos && reversedLinks.contains(e.link)) { reversedSuccs.add(e); @@ -1794,7 +1794,7 @@ } } - ArrayList startPoints = new ArrayList(); + ArrayList startPoints = new ArrayList<>(); startPoints.add(new Point(curWidth, curX)); startPoints.add(new Point(pos, curX)); startPoints.add(new Point(pos, reversedDown.size() * offset)); @@ -1824,7 +1824,7 @@ int oldNodeHeight = node.height; for (int pos : reversedUp) { - ArrayList reversedPreds = new ArrayList(); + ArrayList reversedPreds = new ArrayList<>(); for (LayoutEdge e : node.preds) { if (e.relativeTo == pos && reversedLinks.contains(e.link)) { if (reversedDown.size() == 0) { @@ -1837,7 +1837,7 @@ } } node.height += offset; - ArrayList endPoints = new ArrayList(); + ArrayList endPoints = new ArrayList<>(); if (reversedDown.size() == 0) { @@ -1885,7 +1885,7 @@ return; } - Stack stack = new Stack(); + Stack stack = new Stack<>(); stack.push(startNode); while (!stack.empty()) { @@ -1902,7 +1902,7 @@ visited.add(node); active.add(node); - ArrayList succs = new ArrayList(node.succs); + ArrayList succs = new ArrayList<>(node.succs); for (LayoutEdge e : succs) { if (active.contains(e.to)) { assert visited.contains(e.to); @@ -1957,8 +1957,8 @@ for (LayoutNode n : nodes) { - HashSet curVisited = new HashSet(); - Queue queue = new LinkedList(); + HashSet curVisited = new HashSet<>(); + Queue queue = new LinkedList<>(); for (LayoutEdge e : n.succs) { LayoutNode s = e.to; queue.add(s); @@ -2004,7 +2004,7 @@ protected void run() { // Set up nodes - List vertices = new ArrayList(graph.getVertices()); + List vertices = new ArrayList<>(graph.getVertices()); Collections.sort(vertices); for (Vertex v : vertices) { @@ -2018,7 +2018,7 @@ } // Set up edges - List links = new ArrayList(graph.getLinks()); + List links = new ArrayList<>(graph.getLinks()); Collections.sort(links, linkComparator); for (Link l : links) { LayoutEdge edge = new LayoutEdge(); diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/InterClusterConnection.java --- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/InterClusterConnection.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/InterClusterConnection.java Sat Jan 28 00:16:17 2012 +0100 @@ -46,7 +46,7 @@ this.inputSlotNode = inputSlotNode; this.inputSlot = inputSlotNode.getInputSlot(); this.outputSlot = outputSlotNode.getOutputSlot(); - intermediatePoints = new ArrayList(); + intermediatePoints = new ArrayList<>(); } public ClusterOutputSlotNode getOutputSlotNode() { diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/Node.java --- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/Node.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/Node.java Sat Jan 28 00:16:17 2012 +0100 @@ -90,8 +90,8 @@ protected Node(Graph graph, N data) { setData(data); this.graph = graph; - inEdges = new ArrayList>(); - outEdges = new ArrayList>(); + inEdges = new ArrayList<>(); + outEdges = new ArrayList<>(); } protected void addInEdge(Edge e) { @@ -125,7 +125,7 @@ } public List> getSuccessors() { - ArrayList> succ = new ArrayList>(); + ArrayList> succ = new ArrayList<>(); for (Edge e : getOutEdges()) { Node n = e.getDest(); if (!succ.contains(n)) { @@ -136,7 +136,7 @@ } public List> getPredecessors() { - ArrayList> pred = new ArrayList>(); + ArrayList> pred = new ArrayList<>(); for (Edge e : getInEdges()) { Node n = e.getSource(); if (!pred.contains(n)) { diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/OldHierarchicalLayoutManager.java --- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/OldHierarchicalLayoutManager.java Fri Jan 27 23:57:47 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1222 +0,0 @@ -/* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ -package com.sun.hotspot.igv.hierarchicallayout; - -import java.awt.Point; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import com.sun.hotspot.igv.layout.LayoutGraph; -import com.sun.hotspot.igv.layout.LayoutManager; -import com.sun.hotspot.igv.layout.Link; -import com.sun.hotspot.igv.layout.Port; -import com.sun.hotspot.igv.layout.Vertex; - -/** - * - * @author Thomas Wuerthinger - */ -public class OldHierarchicalLayoutManager implements LayoutManager { - - public static final int DUMMY_WIDTH = 0; - public static final int DUMMY_HEIGHT = 0; - public static final int LAYER_OFFSET = 50; - public static final int OFFSET = 8; - public static final boolean VERTICAL_LAYOUT = true; - public static final boolean ASSERT = false; - public static final boolean TRACE = false; - public static final Timing initTiming = new Timing("init"); - public static final Timing removeCyclesTiming = new Timing("removeCycles"); - public static final Timing reversedEdgesTiming = new Timing("reversedEdges"); - public static final Timing assignLayersTiming = new Timing("assignLayers"); - public static final Timing dummyNodesTiming = new Timing("dummyNodes"); - public static final Timing crossingReductionTiming = new Timing("crossingReduction"); - public static final Timing assignCoordinatesTiming = new Timing("assignCoordinates"); - public static final Timing assignRealTiming = new Timing("assignReal"); - public static final Timing rootVertexTiming = new Timing("rootVertex"); - public static final Timing createEdgesTiming = new Timing("createEdges"); - public static final Timing optimizeMedianTiming = new Timing("optimizeMedian"); - private Combine combine; - - public enum Combine { - - NONE, - SAME_INPUTS, - SAME_OUTPUTS - } - - private class NodeData { - - private Map reversePositions; - private Vertex node; - private Link edge; - private int layer; - private int x; - private int y; - private int width; - - public NodeData(Vertex node) { - reversePositions = new HashMap(); - layer = -1; - this.node = node; - assert node != null; - - if (VERTICAL_LAYOUT) { - width = node.getSize().width; - } else { - width = node.getSize().height; - } - } - - public NodeData(Link edge) { - layer = -1; - this.edge = edge; - assert edge != null; - - if (VERTICAL_LAYOUT) { - width = DUMMY_WIDTH; - } else { - width = DUMMY_HEIGHT; - } - } - - public Vertex getNode() { - return node; - } - - public Link getEdge() { - return edge; - } - - public int getCoordinate() { - return x; - } - - public void setCoordinate(int x) { - this.x = x; - } - - public int getX() { - if (VERTICAL_LAYOUT) { - return x; - } else { - return y; - } - } - - public int getY() { - if (VERTICAL_LAYOUT) { - return y; - } else { - return x; - } - } - - public void setLayerCoordinate(int y) { - this.y = y; - } - - public void setLayer(int x) { - layer = x; - } - - public int getLayer() { - return layer; - } - - public boolean isDummy() { - return edge != null; - } - - public int getWidth() { - return width; - } - - public void addReversedStartEdge(Edge e) { - assert e.getData().isReversed(); - Port port = e.getData().getEdge().getTo(); - int pos = addReversedPort(port); - Point start = e.getData().getRelativeStart(); - e.getData().addStartPoint(start); - int yCoord = node.getSize().height + width - node.getSize().width; - e.getData().addStartPoint(new Point(start.x, yCoord)); - e.getData().addStartPoint(new Point(pos, yCoord)); - e.getData().setRelativeStart(new Point(pos, 0)); - } - - private int addReversedPort(Port p) { - if (reversePositions.containsKey(p)) { - return reversePositions.get(p); - } else { - width += OFFSET; - reversePositions.put(p, width); - return width; - } - } - - public void addReversedEndEdge(Edge e) { - assert e.getData().isReversed(); - int pos = addReversedPort(e.getData().getEdge().getFrom()); - Point end = e.getData().getRelativeEnd(); - e.getData().setRelativeEnd(new Point(pos, node.getSize().height)); - int yCoord = 0 - width + node.getSize().width; - e.getData().addEndPoint(new Point(pos, yCoord)); - e.getData().addEndPoint(new Point(end.x, yCoord)); - e.getData().addEndPoint(end); - } - - public int getHeight() { - if (isDummy()) { - if (VERTICAL_LAYOUT) { - return DUMMY_HEIGHT; - } else { - return DUMMY_WIDTH; - } - - } else { - if (VERTICAL_LAYOUT) { - return node.getSize().height; - } else { - return node.getSize().width; - } - } - } - - @Override - public String toString() { - if (isDummy()) { - return edge.toString() + "(layer=" + layer + ")"; - } else { - return node.toString() + "(layer=" + layer + ")"; - } - } - } - - private class EdgeData { - - private Point relativeEnd; - private Point relativeStart; - private List startPoints; - private List endPoints; - private boolean important; - private boolean reversed; - private Link edge; - - public EdgeData(Link edge) { - this(edge, false); - } - - public EdgeData(Link edge, boolean rev) { - this.edge = edge; - reversed = rev; - relativeStart = edge.getFrom().getRelativePosition(); - relativeEnd = edge.getTo().getRelativePosition(); - assert relativeStart.x >= 0 && relativeStart.x <= edge.getFrom().getVertex().getSize().width; - assert relativeStart.y >= 0 && relativeStart.y <= edge.getFrom().getVertex().getSize().height; - assert relativeEnd.x >= 0 && relativeEnd.x <= edge.getTo().getVertex().getSize().width; - assert relativeEnd.y >= 0 && relativeEnd.y <= edge.getTo().getVertex().getSize().height; - startPoints = new ArrayList(); - endPoints = new ArrayList(); - this.important = true; - } - - public boolean isImportant() { - return important; - } - - public void setImportant(boolean b) { - this.important = b; - } - - public List getStartPoints() { - return startPoints; - } - - public List getEndPoints() { - return endPoints; - } - - public List getAbsoluteEndPoints() { - if (endPoints.size() == 0) { - return endPoints; - } - - List result = new ArrayList(); - Point point = edge.getTo().getVertex().getPosition(); - for (Point p : endPoints) { - Point p2 = new Point(p.x + point.x, p.y + point.y); - result.add(p2); - } - - return result; - } - - public List getAbsoluteStartPoints() { - if (startPoints.size() == 0) { - return startPoints; - } - - List result = new ArrayList(); - Point point = edge.getFrom().getVertex().getPosition(); - for (Point p : startPoints) { - Point p2 = new Point(p.x + point.x, p.y + point.y); - result.add(p2); - } - - return result; - } - - public void addEndPoint(Point p) { - endPoints.add(p); - } - - public void addStartPoint(Point p) { - startPoints.add(p); - } - - public Link getEdge() { - return edge; - } - - public void setRelativeEnd(Point p) { - relativeEnd = p; - } - - public void setRelativeStart(Point p) { - relativeStart = p; - } - - public Point getRelativeEnd() { - return relativeEnd; - } - - public Point getRelativeStart() { - return relativeStart; - } - - public boolean isReversed() { - return reversed; - } - - public void setReversed(boolean b) { - reversed = b; - } - - @Override - public String toString() { - return "EdgeData[reversed=" + reversed + "]"; - } - } - private Graph graph; - private Map> nodeMap; - private int layerOffset; - - /** Creates a new instance of HierarchicalPositionManager */ - public OldHierarchicalLayoutManager(Combine combine) { - this(combine, LAYER_OFFSET); - } - - public OldHierarchicalLayoutManager(Combine combine, int layerOffset) { - this.combine = combine; - this.layerOffset = layerOffset; - } - - public void doRouting(LayoutGraph graph) { - } - - //public void setPositions(PositionedNode rootNode, List nodes, List edges) { - public void doLayout(LayoutGraph layoutGraph) { - doLayout(layoutGraph, new HashSet(), new HashSet()); - } - - public void doLayout(LayoutGraph layoutGraph, Set firstLayerHint, Set lastLayerHint) { - doLayout(layoutGraph, firstLayerHint, lastLayerHint, new HashSet()); - } - - public void doLayout(LayoutGraph layoutGraph, Set firstLayerHint, Set lastLayerHint, Set importantLinksHint) { - - if (TRACE) { - System.out.println("HierarchicalPositionManager.doLayout called"); - System.out.println("Vertex count = " + layoutGraph.getVertices().size() + " Link count = " + layoutGraph.getLinks().size()); - } - - // Nothing to do => quit immediately - if (layoutGraph.getVertices().size() == 0) { - return; - } - - initTiming.start(); - - // Mapping vertex to Node in graph - nodeMap = new HashMap>(); - - graph = new Graph(); - - Set> rootNodes = new HashSet>(); - Set startRootVertices = new HashSet(); - - for (Vertex v : layoutGraph.getVertices()) { - if (v.isRoot()) { - startRootVertices.add(v); - } - } - - rootVertexTiming.start(); - Set rootVertices = layoutGraph.findRootVertices(startRootVertices); - rootVertexTiming.stop(); - - - for (Vertex node : layoutGraph.getVertices()) { - - NodeData data = new NodeData(node); - Node n = graph.createNode(data, node); - nodeMap.put(node, n); - - if (rootVertices.contains(node)) { - rootNodes.add(n); - } - } - - Set links = layoutGraph.getLinks(); - Link[] linkArr = new Link[links.size()]; - links.toArray(linkArr); - - List linkList = new ArrayList(); - for (Link l : linkArr) { - linkList.add(l); - } - - createEdgesTiming.start(); - Collections.sort(linkList, new Comparator() { - - public int compare(Link o1, Link o2) { - int result = o1.getFrom().getVertex().compareTo(o2.getFrom().getVertex()); - if (result == 0) { - return o1.getTo().getVertex().compareTo(o2.getTo().getVertex()); - } else { - return result; - } - } - }); - - for (Link edge : linkList) { - EdgeData data = new EdgeData(edge); - graph.createEdge(graph.getNode(edge.getFrom().getVertex()), graph.getNode(edge.getTo().getVertex()), data, data); - if (importantLinksHint.size() > 0 && !importantLinksHint.contains(edge)) { - data.setImportant(false); - } - } - createEdgesTiming.stop(); - - initTiming.stop(); - - removeCyclesTiming.start(); - - // STEP 1: Remove cycles! - removeCycles(rootNodes); - if (ASSERT) { - assert checkRemoveCycles(); - } - - removeCyclesTiming.stop(); - - reversedEdgesTiming.start(); - - for (Node n : graph.getNodes()) { - List> edges = new ArrayList>(n.getOutEdges()); - Collections.sort(edges, new Comparator>() { - - public int compare(Edge o1, Edge o2) { - return o2.getData().getRelativeEnd().x - o1.getData().getRelativeEnd().x; - } - }); - - - for (Edge e : edges) { - - if (e.getData().isReversed()) { - e.getSource().getData().addReversedEndEdge(e); - } - } - } - - for (Node n : graph.getNodes()) { - List> edges = new ArrayList>(n.getInEdges()); - Collections.sort(edges, new Comparator>() { - - public int compare(Edge o1, Edge o2) { - return o2.getData().getRelativeStart().x - o1.getData().getRelativeStart().x; - } - }); - - - for (Edge e : edges) { - if (e.getData().isReversed()) { - e.getDest().getData().addReversedStartEdge(e); - } - } - } - - reversedEdgesTiming.stop(); - - assignLayersTiming.start(); - // STEP 2: Assign layers! - int maxLayer = assignLayers(rootNodes, firstLayerHint, lastLayerHint); - if (ASSERT) { - assert checkAssignLayers(); - } - - // Put into layer array - //int maxLayer = 0; - //for(Node n : graph.getNodes()) { - // maxLayer = Math.max(maxLayer, n.getData().getLayer()); - //} - - - @SuppressWarnings("unchecked") - ArrayList> layers[] = (ArrayList>[]) new ArrayList[maxLayer + 1]; - int layerSizes[] = new int[maxLayer + 1]; - for (int i = 0; i < maxLayer + 1; i++) { - layers[i] = new ArrayList>(); - } - - for (Node n : graph.getNodes()) { - int curLayer = n.getData().getLayer(); - layers[curLayer].add(n); - } - - assignLayersTiming.stop(); - - // STEP 3: Insert dummy nodes! - dummyNodesTiming.start(); - insertDummyNodes(layers); - if (ASSERT) { - assert checkDummyNodes(); - } - dummyNodesTiming.stop(); - - crossingReductionTiming.start(); - // STEP 4: Assign Y coordinates - assignLayerCoordinates(layers, layerSizes); - - // STEP 5: Crossing reduction - crossingReduction(layers); - crossingReductionTiming.stop(); - - // STEP 6: Assign Y coordinates - assignCoordinatesTiming.start(); - assignCoordinates(layers); - assignCoordinatesTiming.stop(); - - assignRealTiming.start(); - - // Assign coordinates of nodes to real objects - for (Node n : graph.getNodes()) { - if (!n.getData().isDummy()) { - - Vertex node = n.getData().getNode(); - node.setPosition(new Point(n.getData().getX(), n.getData().getY())); - } - } - - for (Node n : graph.getNodes()) { - if (!n.getData().isDummy()) { - - Vertex node = n.getData().getNode(); - - List> outEdges = n.getOutEdges(); - for (Edge e : outEdges) { - Node succ = e.getDest(); - if (succ.getData().isDummy()) { - //PositionedEdge edge = succ.getData().getEdge(); - List points = new ArrayList(); - assignToRealObjects(layerSizes, succ, points); - } else { - List points = new ArrayList(); - - EdgeData otherEdgeData = e.getData(); - points.addAll(otherEdgeData.getAbsoluteStartPoints()); - Link otherEdge = otherEdgeData.getEdge(); - Point relFrom = new Point(otherEdgeData.getRelativeStart()); - Point from = otherEdge.getFrom().getVertex().getPosition(); - relFrom.move(relFrom.x + from.x, relFrom.y + from.y); - points.add(relFrom); - - Point relTo = new Point(otherEdgeData.getRelativeEnd()); - Point to = otherEdge.getTo().getVertex().getPosition(); - relTo.move(relTo.x + to.x, relTo.y + to.y); - assert from != null; - assert to != null; - points.add(relTo); - points.addAll(otherEdgeData.getAbsoluteEndPoints()); - e.getData().getEdge().setControlPoints(points); - } - } - } - } - - assignRealTiming.stop(); - - initTiming.print(); - removeCyclesTiming.print(); - reversedEdgesTiming.print(); - assignLayersTiming.print(); - dummyNodesTiming.print(); - crossingReductionTiming.print(); - assignCoordinatesTiming.print(); - assignRealTiming.print(); - rootVertexTiming.print(); - createEdgesTiming.print(); - optimizeMedianTiming.print(); - } - - public boolean onOneLine(Point p1, Point p2, Point p3) { - int xoff1 = p1.x - p2.x; - int yoff1 = p1.y - p2.y; - int xoff2 = p3.x - p2.x; - int yoff2 = p3.y - p2.x; - - return (xoff1 * yoff2 - yoff1 * xoff2 == 0); - } - - private void assignToRealObjects(int layerSizes[], Node cur, List points) { - assert cur.getData().isDummy(); - - ArrayList otherPoints = new ArrayList(points); - - int size = layerSizes[cur.getData().getLayer()]; - otherPoints.add(new Point(cur.getData().getX(), cur.getData().getY() - size / 2)); - if (otherPoints.size() >= 3 && onOneLine(otherPoints.get(otherPoints.size() - 1), otherPoints.get(otherPoints.size() - 2), otherPoints.get(otherPoints.size() - 3))) { - otherPoints.remove(otherPoints.size() - 2); - } - otherPoints.add(new Point(cur.getData().getX(), cur.getData().getY() + size / 2)); - if (otherPoints.size() >= 3 && onOneLine(otherPoints.get(otherPoints.size() - 1), otherPoints.get(otherPoints.size() - 2), otherPoints.get(otherPoints.size() - 3))) { - otherPoints.remove(otherPoints.size() - 2); - } - - for (int i = 0; i < cur.getOutEdges().size(); i++) { - Node otherSucc = cur.getOutEdges().get(i).getDest(); - - if (otherSucc.getData().isDummy()) { - assignToRealObjects(layerSizes, otherSucc, otherPoints); - } else { - EdgeData otherEdgeData = cur.getOutEdges().get(i).getData(); - Link otherEdge = otherEdgeData.getEdge(); - - List middlePoints = new ArrayList(otherPoints); - if (cur.getOutEdges().get(i).getData().isReversed()) { - Collections.reverse(middlePoints); - } - - ArrayList copy = new ArrayList(); - Point relFrom = new Point(otherEdgeData.getRelativeStart()); - Point from = otherEdge.getFrom().getVertex().getPosition(); - //int moveUp = (size - otherEdge.getFrom().getVertex().getSize().height) / 2; - relFrom.move(relFrom.x + from.x, relFrom.y + from.y); - copy.addAll(otherEdgeData.getAbsoluteStartPoints()); - copy.add(relFrom); - copy.addAll(middlePoints); - - Point relTo = new Point(otherEdgeData.getRelativeEnd()); - Point to = otherEdge.getTo().getVertex().getPosition(); - relTo.move(relTo.x + to.x, relTo.y + to.y); - copy.add(relTo); - - copy.addAll(otherEdgeData.getAbsoluteEndPoints()); - - - otherEdge.setControlPoints(copy); - } - } - } - - private boolean checkDummyNodes() { - for (Edge e : graph.getEdges()) { - if (e.getSource().getData().getLayer() != e.getDest().getData().getLayer() - 1) { - return false; - } - } - - return true; - } - - private void insertDummyNodes(ArrayList> layers[]) { - - int sum = 0; - List> nodes = new ArrayList>(graph.getNodes()); - int edgeCount = 0; - int innerMostLoop = 0; - - for (Node n : nodes) { - List> edges = new ArrayList>(n.getOutEdges()); - for (Edge e : edges) { - - edgeCount++; - Link edge = e.getData().getEdge(); - Node destNode = e.getDest(); - Node lastNode = n; - Edge lastEdge = e; - - boolean searchForNode = (combine != Combine.NONE); - for (int i = n.getData().getLayer() + 1; i < destNode.getData().getLayer(); i++) { - - Node foundNode = null; - if (searchForNode) { - for (Node sameLayerNode : layers[i]) { - innerMostLoop++; - - if (combine == Combine.SAME_OUTPUTS) { - if (sameLayerNode.getData().isDummy() && sameLayerNode.getData().getEdge().getFrom() == edge.getFrom()) { - foundNode = sameLayerNode; - break; - } - } else if (combine == Combine.SAME_INPUTS) { - if (sameLayerNode.getData().isDummy() && sameLayerNode.getData().getEdge().getTo() == edge.getTo()) { - foundNode = sameLayerNode; - break; - } - } - } - } - - if (foundNode == null) { - searchForNode = false; - NodeData intermediateData = new NodeData(edge); - Node curNode = graph.createNode(intermediateData, null); - curNode.getData().setLayer(i); - layers[i].add(0, curNode); - sum++; - lastEdge.remove(); - graph.createEdge(lastNode, curNode, e.getData(), null); - assert lastNode.getData().getLayer() == curNode.getData().getLayer() - 1; - lastEdge = graph.createEdge(curNode, destNode, e.getData(), null); - lastNode = curNode; - } else { - lastEdge.remove(); - lastEdge = graph.createEdge(foundNode, destNode, e.getData(), null); - lastNode = foundNode; - } - - } - } - } - - if (TRACE) { - System.out.println("Number of edges: " + edgeCount); - } - if (TRACE) { - System.out.println("Dummy nodes inserted: " + sum); - } - } - - private void assignLayerCoordinates(ArrayList> layers[], int layerSizes[]) { - int cur = 0; - for (int i = 0; i < layers.length; i++) { - int maxHeight = 0; - for (Node n : layers[i]) { - maxHeight = Math.max(maxHeight, n.getData().getHeight()); - } - - layerSizes[i] = maxHeight; - for (Node n : layers[i]) { - int curCoordinate = cur + (maxHeight - n.getData().getHeight()) / 2; - n.getData().setLayerCoordinate(curCoordinate); - } - cur += maxHeight + layerOffset; - - } - } - - private void assignCoordinates(ArrayList> layers[]) { - - for (int i = 0; i < layers.length; i++) { - ArrayList> curArray = layers[i]; - int curY = 0; - for (Node n : curArray) { - - n.getData().setCoordinate(curY); - if (!n.getData().isDummy()) { - curY += n.getData().getWidth(); - } - curY += OFFSET; - - } - } - - int curSol = evaluateSolution(); - if (TRACE) { - System.out.println("First coordinate solution found: " + curSol); - } - - // Sort to correct order - for (int i = 0; i < layers.length; i++) { - Collections.sort(layers[i], new Comparator>() { - - public int compare(Node o1, Node o2) { - if (o2.getData().isDummy()) { - return 1; - } else if (o1.getData().isDummy()) { - return -1; - } - return o2.getInEdges().size() + o2.getOutEdges().size() - o1.getInEdges().size() - o1.getOutEdges().size(); - } - }); - } - - - optimizeMedianTiming.start(); - for (int i = 0; i < 2; i++) { - optimizeMedian(layers); - curSol = evaluateSolution(); - if (TRACE) { - System.out.println("Current coordinate solution found: " + curSol); - } - } - optimizeMedianTiming.stop(); - normalizeCoordinate(); - - } - - private void normalizeCoordinate() { - - int min = Integer.MAX_VALUE; - for (Node n : graph.getNodes()) { - min = Math.min(min, n.getData().getCoordinate()); - } - - for (Node n : graph.getNodes()) { - n.getData().setCoordinate(n.getData().getCoordinate() - min); - } - - } - - private void optimizeMedian(ArrayList> layers[]) { - - // Downsweep - for (int i = 1; i < layers.length; i++) { - - ArrayList> processingList = layers[i]; - ArrayList> alreadyAssigned = new ArrayList>(); - for (Node n : processingList) { - - - ArrayList> preds = new ArrayList>(n.getPredecessors()); - int pos = n.getData().getCoordinate(); - if (preds.size() > 0) { - - Collections.sort(preds, new Comparator>() { - - public int compare(Node o1, Node o2) { - return o1.getData().getCoordinate() - o2.getData().getCoordinate(); - } - }); - - if (preds.size() % 2 == 0) { - assert preds.size() >= 2; - pos = (preds.get(preds.size() / 2).getData().getCoordinate() - calcRelativeCoordinate(preds.get(preds.size() / 2), n) + preds.get(preds.size() / 2 - 1).getData().getCoordinate() - calcRelativeCoordinate(preds.get(preds.size() / 2 - 1), n)) / 2; - } else { - assert preds.size() >= 1; - pos = preds.get(preds.size() / 2).getData().getCoordinate() - calcRelativeCoordinate(preds.get(preds.size() / 2), n); - } - } - - tryAdding(alreadyAssigned, n, pos); - } - } - // Upsweep - for (int i = layers.length - 2; i >= 0; i--) { - ArrayList> processingList = layers[i]; - ArrayList> alreadyAssigned = new ArrayList>(); - for (Node n : processingList) { - - ArrayList> succs = new ArrayList>(n.getSuccessors()); - int pos = n.getData().getCoordinate(); - if (succs.size() > 0) { - - Collections.sort(succs, new Comparator>() { - - public int compare(Node o1, Node o2) { - return o1.getData().getCoordinate() - o2.getData().getCoordinate(); - } - }); - - if (succs.size() % 2 == 0) { - assert succs.size() >= 2; - pos = (succs.get(succs.size() / 2).getData().getCoordinate() - calcRelativeCoordinate(n, succs.get(succs.size() / 2)) + succs.get(succs.size() / 2 - 1).getData().getCoordinate() - calcRelativeCoordinate(n, succs.get(succs.size() / 2 - 1))) / 2; - } else { - assert succs.size() >= 1; - pos = succs.get(succs.size() / 2).getData().getCoordinate() - calcRelativeCoordinate(n, succs.get(succs.size() / 2)); - } - } - - tryAdding(alreadyAssigned, n, pos); - } - } - } - - private int median(ArrayList arr) { - assert arr.size() > 0; - Collections.sort(arr); - if (arr.size() % 2 == 0) { - return (arr.get(arr.size() / 2) + arr.get(arr.size() / 2 - 1)) / 2; - } else { - return arr.get(arr.size() / 2); - } - } - - private int calcRelativeCoordinate(Node n, Node succ) { - - if (n.getData().isDummy() && succ.getData().isDummy()) { - return 0; - } - - int pos = 0; - int pos2 = 0; - ArrayList coords2 = new ArrayList(); - ArrayList coords = new ArrayList(); - /*if(!n.getData().isDummy())*/ { - for (Edge e : n.getOutEdges()) { - - //System.out.println("reversed: " + e.getData().isReversed()); - if (e.getDest() == succ) { - - if (e.getData().isReversed()) { - if (!n.getData().isDummy()) { - coords.add(e.getData().getRelativeEnd().x); - } - - if (!succ.getData().isDummy()) { - coords2.add(e.getData().getRelativeStart().x); - } - } else { - if (!n.getData().isDummy()) { - coords.add(e.getData().getRelativeStart().x); - } - - if (!succ.getData().isDummy()) { - coords2.add(e.getData().getRelativeEnd().x); - } - } - } - } - - // assert coords.size() > 0; - if (!n.getData().isDummy()) { - pos = median(coords); - } - - if (!succ.getData().isDummy()) { - pos2 = median(coords2); - } - } - //System.out.println("coords=" + coords); - //System.out.println("coords2=" + coords2); - - return pos - pos2; - } - - private boolean intersect(int v1, int w1, int v2, int w2) { - if (v1 >= v2 && v1 < v2 + w2) { - return true; - } - if (v1 + w1 > v2 && v1 + w1 < v2 + w2) { - return true; - } - if (v1 < v2 && v1 + w1 > v2) { - return true; - } - return false; - } - - private boolean intersect(Node n1, Node n2) { - return intersect(n1.getData().getCoordinate(), n1.getData().getWidth() + OFFSET, n2.getData().getCoordinate(), n2.getData().getWidth() + OFFSET); - } - - private void tryAdding(List> alreadyAssigned, Node node, int pos) { - - boolean doesIntersect = false; - node.getData().setCoordinate(pos); - for (Node n : alreadyAssigned) { - if (n.getData().getCoordinate() + n.getData().getWidth() < pos) { - break; - } else if (intersect(node, n)) { - doesIntersect = true; - break; - } - - } - - if (!doesIntersect) { - - // Everything fine, just place the node - int z = 0; - for (Node n : alreadyAssigned) { - if (pos > n.getData().getCoordinate()) { - break; - } - z++; - } - - if (z == -1) { - z = alreadyAssigned.size(); - } - - - if (ASSERT) { - assert !findOverlap(alreadyAssigned, node); - } - alreadyAssigned.add(z, node); - - } else { - - assert alreadyAssigned.size() > 0; - - // Search for alternative location - int minOffset = Integer.MAX_VALUE; - int minIndex = -1; - int minPos = 0; - int w = node.getData().getWidth() + OFFSET; - - // Try top-most - minIndex = 0; - minPos = alreadyAssigned.get(0).getData().getCoordinate() + alreadyAssigned.get(0).getData().getWidth() + OFFSET; - minOffset = Math.abs(minPos - pos); - - // Try bottom-most - Node lastNode = alreadyAssigned.get(alreadyAssigned.size() - 1); - int lastPos = lastNode.getData().getCoordinate() - w; - int lastOffset = Math.abs(lastPos - pos); - if (lastOffset < minOffset) { - minPos = lastPos; - minOffset = lastOffset; - minIndex = alreadyAssigned.size(); - } - - // Try between - for (int i = 0; i < alreadyAssigned.size() - 1; i++) { - Node curNode = alreadyAssigned.get(i); - Node nextNode = alreadyAssigned.get(i + 1); - - int start = nextNode.getData().getCoordinate() + nextNode.getData().getWidth() + OFFSET; - int end = curNode.getData().getCoordinate() - OFFSET; - - int bestPoss = end - node.getData().getWidth(); - if (bestPoss < pos && pos - bestPoss > minOffset) { - // No better solution possible => break - break; - } - - if (end - start >= node.getData().getWidth()) { - // Node could fit here - int cand1 = start; - int cand2 = end - node.getData().getWidth(); - int off1 = Math.abs(cand1 - pos); - int off2 = Math.abs(cand2 - pos); - if (off1 < minOffset) { - minPos = cand1; - minOffset = off1; - minIndex = i + 1; - } - - if (off2 < minOffset) { - minPos = cand2; - minOffset = off2; - minIndex = i + 1; - } - } - } - - assert minIndex != -1; - node.getData().setCoordinate(minPos); - if (ASSERT) { - assert !findOverlap(alreadyAssigned, node); - } - alreadyAssigned.add(minIndex, node); - } - - } - - private boolean findOverlap(List> nodes, Node node) { - - for (Node n1 : nodes) { - if (intersect(n1, node)) { - return true; - } - } - - return false; - } - - private int evaluateSolution() { - - int sum = 0; - for (Edge e : graph.getEdges()) { - Node source = e.getSource(); - Node dest = e.getDest(); - int offset = 0; - offset = Math.abs(source.getData().getCoordinate() - dest.getData().getCoordinate()); - sum += offset; - } - - return sum; - } - - private void crossingReduction(ArrayList> layers[]) { - - for (int i = 0; i < layers.length - 1; i++) { - - ArrayList> curNodes = layers[i]; - ArrayList> nextNodes = layers[i + 1]; - for (Node n : curNodes) { - for (Node succ : n.getSuccessors()) { - if (ASSERT) { - assert nextNodes.contains(succ); - } - nextNodes.remove(succ); - nextNodes.add(succ); - } - } - - } - - } - - private void removeCycles(Set> rootNodes) { - final List> reversedEdges = new ArrayList>(); - - - int removedCount = 0; - int reversedCount = 0; - - Graph.DFSTraversalVisitor visitor = graph.new DFSTraversalVisitor() { - - @Override - public boolean visitEdge(Edge e, boolean backEdge) { - if (backEdge) { - if (ASSERT) { - assert !reversedEdges.contains(e); - } - reversedEdges.add(e); - e.getData().setReversed(!e.getData().isReversed()); - } - - return e.getData().isImportant(); - } - }; - Set> nodes = new HashSet>(); - nodes.addAll(rootNodes); - - assert nodes.size() > 0; - - this.graph.traverseDFS(nodes, visitor); - - for (Edge e : reversedEdges) { - if (e.isSelfLoop()) { - e.remove(); - removedCount++; - } else { - e.reverse(); - reversedCount++; - } - } - } - - private boolean checkRemoveCycles() { - return !graph.hasCycles(); - } - // Only used by assignLayers - private int maxLayerTemp; - - private int assignLayers(Set> rootNodes, Set firstLayerHints, - Set lastLayerHints) { - this.maxLayerTemp = -1; - for (Node n : graph.getNodes()) { - n.getData().setLayer(-1); - } - - Graph.BFSTraversalVisitor traverser = graph.new BFSTraversalVisitor() { - - @Override - public void visitNode(Node n, int depth) { - if (depth > n.getData().getLayer()) { - n.getData().setLayer(depth); - maxLayerTemp = Math.max(maxLayerTemp, depth); - } - } - }; - - for (Node n : rootNodes) { - if (n.getData().getLayer() == -1) { - this.graph.traverseBFS(n, traverser, true); - } - } - - for (Vertex v : firstLayerHints) { - assert nodeMap.containsKey(v); - nodeMap.get(v).getData().setLayer(0); - } - - for (Vertex v : lastLayerHints) { - assert nodeMap.containsKey(v); - nodeMap.get(v).getData().setLayer(maxLayerTemp); - } - - return maxLayerTemp; - } - - private boolean checkAssignLayers() { - - for (Edge e : graph.getEdges()) { - Node source = e.getSource(); - Node dest = e.getDest(); - - - if (source.getData().getLayer() >= dest.getData().getLayer()) { - return false; - } - } - int maxLayer = 0; - for (Node n : graph.getNodes()) { - assert n.getData().getLayer() >= 0; - if (n.getData().getLayer() > maxLayer) { - maxLayer = n.getData().getLayer(); - } - } - - int countPerLayer[] = new int[maxLayer + 1]; - for (Node n : graph.getNodes()) { - countPerLayer[n.getData().getLayer()]++; - } - - if (TRACE) { - System.out.println("Number of layers: " + maxLayer); - } - return true; - } -} diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Layout/src/com/sun/hotspot/igv/layout/Cluster.java --- a/src/share/tools/IdealGraphVisualizer/Layout/src/com/sun/hotspot/igv/layout/Cluster.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Layout/src/com/sun/hotspot/igv/layout/Cluster.java Sat Jan 28 00:16:17 2012 +0100 @@ -33,6 +33,8 @@ public interface Cluster extends Comparable { public Cluster getOuter(); + + public Rectangle getBounds(); public void setBounds(Rectangle r); diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Layout/src/com/sun/hotspot/igv/layout/LayoutGraph.java --- a/src/share/tools/IdealGraphVisualizer/Layout/src/com/sun/hotspot/igv/layout/LayoutGraph.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Layout/src/com/sun/hotspot/igv/layout/LayoutGraph.java Sat Jan 28 00:16:17 2012 +0100 @@ -49,10 +49,10 @@ this.links = links; assert verify(); - vertices = new TreeSet(); - portLinks = new HashMap>(links.size()); - inputPorts = new HashMap>(links.size()); - outputPorts = new HashMap>(links.size()); + vertices = new TreeSet<>(); + portLinks = new HashMap<>(links.size()); + inputPorts = new HashMap<>(links.size()); + outputPorts = new HashMap<>(links.size()); for (Link l : links) { Port p = l.getFrom(); @@ -76,7 +76,7 @@ } if (!portLinks.containsKey(p)) { - HashSet hashSet = new HashSet(3); + HashSet hashSet = new HashSet<>(3); portLinks.put(p, hashSet); } @@ -152,7 +152,7 @@ // whole graph is visited. public Set findRootVertices(Set startingRoots) { - Set notRootSet = new HashSet(); + Set notRootSet = new HashSet<>(); for (Vertex v : startingRoots) { if (!notRootSet.contains(v)) { markNotRoot(notRootSet, v, v); @@ -174,7 +174,7 @@ } } - Set result = new HashSet(); + Set result = new HashSet<>(); for (Vertex v : tmpVertices) { if (!notRootSet.contains(v)) { result.add(v); @@ -190,7 +190,7 @@ public SortedSet getClusters() { - SortedSet clusters = new TreeSet(); + SortedSet clusters = new TreeSet<>(); for (Vertex v : getVertices()) { if (v.getCluster() != null) { clusters.add(v.getCluster()); diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/SelectionCoordinator/src/com/sun/hotspot/igv/selectioncoordinator/SelectionCoordinator.java --- a/src/share/tools/IdealGraphVisualizer/SelectionCoordinator/src/com/sun/hotspot/igv/selectioncoordinator/SelectionCoordinator.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/SelectionCoordinator/src/com/sun/hotspot/igv/selectioncoordinator/SelectionCoordinator.java Sat Jan 28 00:16:17 2012 +0100 @@ -46,10 +46,10 @@ } private SelectionCoordinator() { - selectedChangedEvent = new ChangedEvent(this); - highlightedChangedEvent = new ChangedEvent(this); - selectedObjects = new HashSet(); - highlightedObjects = new HashSet(); + selectedChangedEvent = new ChangedEvent<>(this); + highlightedChangedEvent = new ChangedEvent<>(this); + selectedObjects = new HashSet<>(); + highlightedObjects = new HashSet<>(); } public Set getSelectedObjects() { diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java --- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java Sat Jan 28 00:16:17 2012 +0100 @@ -50,8 +50,8 @@ private static class Node { public InputNode inputNode; - public Set succs = new HashSet(); - public List preds = new ArrayList(); + public Set succs = new HashSet<>(); + public List preds = new ArrayList<>(); public InputBlock block; public boolean isBlockProjection; public boolean isBlockStart; @@ -72,13 +72,13 @@ public void buildBlocks() { - blocks = new Vector(); + blocks = new Vector<>(); Node root = findRoot(); if (root == null) { return; } - Stack stack = new Stack(); - Set visited = new HashSet(); + Stack stack = new Stack<>(); + Set visited = new HashSet<>(); stack.add(root); int blockCount = 0; InputBlock rootBlock = null; @@ -179,7 +179,7 @@ } int z = 0; - blockIndex = new HashMap(blocks.size()); + blockIndex = new HashMap<>(blocks.size()); for (InputBlock b : blocks) { blockIndex.put(b, z); z++; @@ -196,7 +196,7 @@ } if (graph.getBlocks().size() > 0) { - Collection tmpNodes = new ArrayList(graph.getNodes()); + Collection tmpNodes = new ArrayList<>(graph.getNodes()); for (InputNode n : tmpNodes) { String block = getBlockName(n); if (graph.getBlock(n) == null) { @@ -206,8 +206,8 @@ } return graph.getBlocks(); } else { - nodes = new ArrayList(); - inputNodeToNode = new HashMap(graph.getNodes().size()); + nodes = new ArrayList<>(); + inputNodeToNode = new HashMap<>(graph.getNodes().size()); this.graph = graph; buildUpGraph(); @@ -241,9 +241,9 @@ } // Mark all nodes reachable in backward traversal from root - Set reachable = new HashSet(); + Set reachable = new HashSet<>(); reachable.add(root); - Stack stack = new Stack(); + Stack stack = new Stack<>(); stack.push(root); while (!stack.isEmpty()) { Node cur = stack.pop(); @@ -255,7 +255,7 @@ } } - Set unscheduled = new HashSet(); + Set unscheduled = new HashSet<>(); for (Node n : this.nodes) { if (n.block == null && reachable.contains(n)) { unscheduled.add(n); @@ -265,7 +265,7 @@ while (unscheduled.size() > 0) { boolean progress = false; - Set newUnscheduled = new HashSet(); + Set newUnscheduled = new HashSet<>(); for (Node n : unscheduled) { InputBlock block = null; @@ -305,7 +305,7 @@ } } - Set curReachable = new HashSet(reachable); + Set curReachable = new HashSet<>(reachable); for (Node n : curReachable) { if (n.block != null) { for (Node s : n.succs) { @@ -320,7 +320,7 @@ private void markWithBlock(Node n, InputBlock b, Set reachable) { assert !reachable.contains(n); - Stack stack = new Stack(); + Stack stack = new Stack<>(); stack.push(n); n.block = b; b.addNode(n.inputNode.getId()); @@ -376,7 +376,7 @@ if (ba == bb) { return ba; } - Set visited = new HashSet(); + Set visited = new HashSet<>(); while (ba != null) { visited.add(ba); ba = dominatorMap.get(ba); @@ -394,12 +394,12 @@ } public void buildDominators() { - dominatorMap = new HashMap(graph.getBlocks().size()); + dominatorMap = new HashMap<>(graph.getBlocks().size()); if (blocks.size() == 0) { return; } - Vector intermediate = new Vector(graph.getBlocks().size()); - Map map = new HashMap(graph.getBlocks().size()); + Vector intermediate = new Vector<>(graph.getBlocks().size()); + Map map = new HashMap<>(graph.getBlocks().size()); int z = 0; for (InputBlock b : blocks) { BlockIntermediate bi = new BlockIntermediate(); @@ -410,16 +410,16 @@ bi.parent = -1; bi.label = z; bi.ancestor = -1; - bi.pred = new ArrayList(); - bi.bucket = new ArrayList(); + bi.pred = new ArrayList<>(); + bi.bucket = new ArrayList<>(); intermediate.add(bi); map.put(b, bi); z++; } - Stack stack = new Stack(); + Stack stack = new Stack<>(); stack.add(0); - Vector array = new Vector(); + Vector array = new Vector<>(); intermediate.get(0).dominator = 0; int n = 0; @@ -597,7 +597,7 @@ inputNodeToNode.put(n, node); } - Map> edgeMap = new HashMap>(graph.getEdges().size()); + Map> edgeMap = new HashMap<>(graph.getEdges().size()); for (InputEdge e : graph.getEdges()) { int to = e.getTo(); diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/LookupHistory.java --- a/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/LookupHistory.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/LookupHistory.java Sat Jan 28 00:16:17 2012 +0100 @@ -36,7 +36,7 @@ */ public class LookupHistory { - private static Map cache = new HashMap(); + private static Map cache = new HashMap<>(); private static class LookupHistoryImpl implements LookupListener { @@ -65,7 +65,7 @@ public static void init(Class klass) { if (!cache.containsKey(klass)) { - cache.put(klass, new LookupHistoryImpl(klass)); + cache.put(klass, new LookupHistoryImpl<>(klass)); } } diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSliderModel.java --- a/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSliderModel.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSliderModel.java Sat Jan 28 00:16:17 2012 +0100 @@ -65,14 +65,14 @@ public RangeSliderModel(List positions) { assert positions.size() > 0; - this.changedEvent = new ChangedEvent(this); - this.colorChangedEvent = new ChangedEvent(this); + this.changedEvent = new ChangedEvent<>(this); + this.colorChangedEvent = new ChangedEvent<>(this); setPositions(positions); } protected void setPositions(List positions) { this.positions = positions; - colors = new ArrayList(); + colors = new ArrayList<>(); for (int i = 0; i < positions.size(); i++) { colors.add(Color.black); } diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramScene.java --- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramScene.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramScene.java Sat Jan 28 00:16:17 2012 +0100 @@ -27,9 +27,8 @@ import com.sun.hotspot.igv.data.Properties; import com.sun.hotspot.igv.data.services.Scheduler; import com.sun.hotspot.igv.graph.*; -import com.sun.hotspot.igv.hierarchicallayout.HierarchicalClusterLayoutManager; import com.sun.hotspot.igv.hierarchicallayout.HierarchicalLayoutManager; -import com.sun.hotspot.igv.hierarchicallayout.OldHierarchicalLayoutManager; +import com.sun.hotspot.igv.layout.Cluster; import com.sun.hotspot.igv.layout.LayoutGraph; import com.sun.hotspot.igv.selectioncoordinator.SelectionCoordinator; import com.sun.hotspot.igv.util.ColorIcon; @@ -165,6 +164,7 @@ } + @Override public void centerFigures(List
list) { boolean b = getUndoRedoEnabled(); @@ -174,7 +174,7 @@ } private Set getObjectsFromIdSet(Set set) { - Set selectedObjects = new HashSet(); + Set selectedObjects = new HashSet<>(); for (Figure f : getModel().getDiagramToView().getFigures()) { if (intersects(f.getSource().getSourceNodesAsSet(), set)) { selectedObjects.add(f); @@ -197,6 +197,7 @@ }; private ControllableChangedListener selectedCoordinatorListener = new ControllableChangedListener() { + @Override public void filteredChanged(SelectionCoordinator source) { DiagramScene.this.gotoSelection(source.getSelectedObjects()); DiagramScene.this.validate(); @@ -205,6 +206,7 @@ private RectangularSelectProvider rectangularSelectProvider = new RectangularSelectProvider() { + @Override public void performSelection(Rectangle rectangle) { if (rectangle.width < 0) { rectangle.x += rectangle.width; @@ -216,7 +218,7 @@ rectangle.height *= -1; } - Set selectedObjects = new HashSet(); + Set selectedObjects = new HashSet<>(); for (Figure f : getModel().getDiagramToView().getFigures()) { FigureWidget w = getWidget(f); if (w != null) { @@ -247,6 +249,7 @@ private MouseWheelListener mouseWheelListener = new MouseWheelListener() { + @Override public void mouseWheelMoved(MouseWheelEvent e) { if (e.isControlDown()) { DiagramScene.this.relayoutWithoutLayout(null); @@ -296,7 +299,7 @@ content.set(newSet, null); - Set nodeSelection = new HashSet(); + Set nodeSelection = new HashSet<>(); for (Object o : newSet) { if (o instanceof Properties.Provider) { final Properties.Provider provider = (Properties.Provider) o; @@ -330,7 +333,7 @@ } public void highlightingChanged(ObjectSceneEvent e, Set oldSet, Set newSet) { - Set nodeHighlighting = new HashSet(); + Set nodeHighlighting = new HashSet<>(); for (Object o : newSet) { if (o instanceof Figure) { nodeHighlighting.addAll(((Figure) o).getSource().getSourceNodesAsSet()); @@ -345,7 +348,7 @@ } public void hoverChanged(ObjectSceneEvent e, Object oldObject, Object newObject) { - Set newHighlightedObjects = new HashSet(DiagramScene.this.getHighlightedObjects()); + Set newHighlightedObjects = new HashSet<>(DiagramScene.this.getHighlightedObjects()); if (oldObject != null) { newHighlightedObjects.remove(oldObject); } @@ -485,7 +488,7 @@ rebuilding = true; - Collection objects = new ArrayList(this.getObjects()); + Collection objects = new ArrayList<>(this.getObjects()); for (Object o : objects) { this.removeObject(o); } @@ -569,7 +572,7 @@ Diagram diagram = getModel().getDiagramToView(); - HashSet
figures = new HashSet
(); + HashSet
figures = new HashSet<>(); for (Figure f : diagram.getFigures()) { FigureWidget w = getWidget(f); @@ -578,7 +581,7 @@ } } - HashSet edges = new HashSet(); + HashSet edges = new HashSet<>(); for (Connection c : diagram.getConnections()) { if (isVisible(c)) { @@ -586,24 +589,28 @@ } } + HierarchicalLayoutManager manager = new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.SAME_OUTPUTS); + manager.setMaxLayerLength(10); + manager.doLayout(new LayoutGraph(edges, figures)); + + if (getModel().getShowBlocks()) { - HierarchicalClusterLayoutManager m = new HierarchicalClusterLayoutManager(OldHierarchicalLayoutManager.Combine.SAME_OUTPUTS); - HierarchicalLayoutManager manager = new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.SAME_OUTPUTS); - manager.setMaxLayerLength(9); - manager.setMinLayerDifference(3); - m.setManager(manager); - m.setSubManager(new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.SAME_OUTPUTS)); - m.doLayout(new LayoutGraph(edges, figures)); - - } else { - HierarchicalLayoutManager manager = new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.SAME_OUTPUTS); - manager.setMaxLayerLength(10); - manager.doLayout(new LayoutGraph(edges, figures)); + for (Figure f : diagram.getFigures()) { + Cluster c = f.getCluster(); + Rectangle r = c.getBounds(); + Rectangle figureBounds = f.getBounds(); + figureBounds.grow(BORDER_SIZE, BORDER_SIZE); + if (r != null) { + figureBounds.add(r); + } + c.setBounds(figureBounds); + } } + relayoutWithoutLayout(oldVisibleWidgets); } - private Set> lineCache = new HashSet>(); + private Set> lineCache = new HashSet<>(); private void relayoutWithoutLayout(Set oldVisibleWidgets) { @@ -642,8 +649,12 @@ BlockWidget w = getWidget(b.getInputBlock()); if (w != null && w.isVisible()) { Rectangle r = b.getBounds(); - maxX = Math.max(maxX, r.x + r.width); - maxY = Math.max(maxY, r.y + r.height); + if (r == null) { + w.setVisible(false); + } else { + maxX = Math.max(maxX, r.x + r.width); + maxY = Math.max(maxY, r.y + r.height); + } } } } @@ -679,7 +690,7 @@ Set> lastLineCache = lineCache; - lineCache = new HashSet>(); + lineCache = new HashSet<>(); for (Figure f : diagram.getFigures()) { for (OutputSlot s : f.getOutputSlots()) { SceneAnimator anim = animator; @@ -726,7 +737,7 @@ private final Point specialNullPoint = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE); private void processOutputSlot(Set> lastLineCache, OutputSlot s, List connections, int controlPointIndex, Point lastPoint, LineWidget predecessor, int offx, int offy, SceneAnimator animator) { - Map> pointMap = new HashMap>(connections.size()); + Map> pointMap = new HashMap<>(connections.size()); for (Connection c : connections) { @@ -751,7 +762,7 @@ if (pointMap.containsKey(cur)) { pointMap.get(cur).add(c); } else { - List newList = new ArrayList(2); + List newList = new ArrayList<>(2); newList.add(c); pointMap.put(cur, newList); } @@ -782,7 +793,7 @@ Point p1 = new Point(lastPoint.x + offx, lastPoint.y + offy); Point p2 = new Point(p.x + offx, p.y + offy); - Pair curPair = new Pair(p1, p2); + Pair curPair = new Pair<>(p1, p2); SceneAnimator curAnimator = animator; if (lastLineCache.contains(curPair)) { curAnimator = null; @@ -811,7 +822,7 @@ private Set connections; public ConnectionSet(Collection connections) { - connections = new HashSet(connections); + connections = new HashSet<>(connections); } public Set getConnectionSet() { @@ -858,7 +869,7 @@ private Set idSetToObjectSet(Set ids) { - Set result = new HashSet(); + Set result = new HashSet<>(); for (Figure f : getModel().getDiagramToView().getFigures()) { if (DiagramScene.doesIntersect(f.getSource().getSourceNodesAsSet(), ids)) { result.add(f); @@ -876,7 +887,7 @@ public void gotoSelection(Set ids) { Rectangle overall = null; - Set hiddenNodes = new HashSet(this.getModel().getHiddenNodes()); + Set hiddenNodes = new HashSet<>(this.getModel().getHiddenNodes()); hiddenNodes.removeAll(ids); this.getModel().showNot(hiddenNodes); @@ -945,7 +956,7 @@ } public void setSelection(Collection
list) { - super.setSelectedObjects(new HashSet
(list)); + super.setSelectedObjects(new HashSet<>(list)); } private UndoRedo.Manager getUndoRedoManager() { @@ -999,12 +1010,12 @@ private void updateHiddenNodes(Set newHiddenNodes, boolean doRelayout) { System.out.println("newHiddenNodes: " + newHiddenNodes); - Set visibleBlocks = new HashSet(); + Set visibleBlocks = new HashSet<>(); Diagram diagram = getModel().getDiagramToView(); assert diagram != null; - Set oldVisibleWidgets = new HashSet(); + Set oldVisibleWidgets = new HashSet<>(); for (Figure f : diagram.getFigures()) { FigureWidget w = getWidget(f); @@ -1040,11 +1051,11 @@ } if (getModel().getShowNodeHull()) { - List boundaries = new ArrayList(); + List boundaries = new ArrayList<>(); for (Figure f : diagram.getFigures()) { FigureWidget w = getWidget(f); if (!w.isVisible()) { - Set
set = new HashSet
(f.getPredecessorSet()); + Set
set = new HashSet<>(f.getPredecessorSet()); set.addAll(f.getSuccessorSet()); boolean b = false; @@ -1097,7 +1108,7 @@ } private void showFigure(Figure f) { - HashSet newHiddenNodes = new HashSet(getModel().getHiddenNodes()); + HashSet newHiddenNodes = new HashSet<>(getModel().getHiddenNodes()); newHiddenNodes.removeAll(f.getSource().getSourceNodesAsSet()); updateHiddenNodes(newHiddenNodes, true); } @@ -1107,7 +1118,7 @@ } public void setSelectedObjects(Object... args) { - Set set = new HashSet(); + Set set = new HashSet<>(); for (Object o : args) { set.add(o); } diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramViewModel.java --- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramViewModel.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramViewModel.java Sat Jan 28 00:16:17 2012 +0100 @@ -147,16 +147,16 @@ this.filterChain = filterChain; assert sequenceFilterChain != null; this.sequenceFilterChain = sequenceFilterChain; - hiddenNodes = new HashSet(); - onScreenNodes = new HashSet(); - selectedNodes = new HashSet(); + hiddenNodes = new HashSet<>(); + onScreenNodes = new HashSet<>(); + selectedNodes = new HashSet<>(); super.getChangedEvent().addListener(this); - diagramChangedEvent = new ChangedEvent(this); - viewChangedEvent = new ChangedEvent(this); - hiddenNodesChangedEvent = new ChangedEvent(this); - viewPropertiesChangedEvent = new ChangedEvent(this); + diagramChangedEvent = new ChangedEvent<>(this); + viewChangedEvent = new ChangedEvent<>(this); + hiddenNodesChangedEvent = new ChangedEvent<>(this); + viewPropertiesChangedEvent = new ChangedEvent<>(this); - groupChangedEvent = new ChangedEvent(this); + groupChangedEvent = new ChangedEvent<>(this); groupChangedEvent.addListener(groupChangedListener); groupChangedEvent.fire(); @@ -214,7 +214,7 @@ public void setSelectedNodes(Set nodes) { this.selectedNodes = nodes; - List colors = new ArrayList(); + List colors = new ArrayList<>(); for (String s : getPositions()) { colors.add(Color.black); } @@ -259,7 +259,7 @@ } public void showFigures(Collection
f) { - HashSet newHiddenNodes = new HashSet(getHiddenNodes()); + HashSet newHiddenNodes = new HashSet<>(getHiddenNodes()); for (Figure fig : f) { newHiddenNodes.removeAll(fig.getSource().getSourceNodesAsSet()); } @@ -268,7 +268,7 @@ public Set
getSelectedFigures() { - Set
result = new HashSet
(); + Set
result = new HashSet<>(); for (Figure f : diagram.getFigures()) { for (InputNode node : f.getSource().getSourceNodes()) { if (getSelectedNodes().contains(node.getId())) { @@ -284,7 +284,7 @@ } public void showOnly(final Set nodes) { - final HashSet allNodes = new HashSet(getGraphToView().getGroup().getAllNodes()); + final HashSet allNodes = new HashSet<>(getGraphToView().getGroup().getAllNodes()); allNodes.removeAll(nodes); setHiddenNodes(allNodes); } @@ -331,7 +331,7 @@ } private static List calculateStringList(Group g) { - List result = new ArrayList(); + List result = new ArrayList<>(); for (InputGraph graph : g.getGraphs()) { result.add(graph.getName()); } @@ -396,7 +396,7 @@ } void setSelectedFigures(List
list) { - Set newSelectedNodes = new HashSet(); + Set newSelectedNodes = new HashSet<>(); for (Figure f : list) { newSelectedNodes.addAll(f.getSource().getSourceNodesAsSet()); } diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/EditorTopComponent.java --- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/EditorTopComponent.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/EditorTopComponent.java Sat Jan 28 00:16:17 2012 +0100 @@ -170,7 +170,7 @@ } }; - private ChangedEvent diagramChangedEvent = new ChangedEvent(diagramProvider); + private ChangedEvent diagramChangedEvent = new ChangedEvent<>(diagramProvider); private void updateDisplayName() { @@ -445,7 +445,7 @@ public void changed(DiagramViewModel source) { updateDisplayName(); - Collection list = new ArrayList(); + Collection list = new ArrayList<>(); list.add(new EditorInputGraphProvider(EditorTopComponent.this)); graphContent.set(list, null); diagramProvider.getChangedEvent().fire(); @@ -459,7 +459,7 @@ public void setSelection(PropertyMatcher matcher) { - Properties.PropertySelector
selector = new Properties.PropertySelector
(getModel().getDiagramToView().getFigures()); + Properties.PropertySelector
selector = new Properties.PropertySelector<>(getModel().getDiagramToView().getFigures()); List
list = selector.selectMultiple(matcher); setSelectedFigures(list); } @@ -471,8 +471,8 @@ public void setSelectedNodes(Set nodes) { - List
list = new ArrayList
(); - Set ids = new HashSet(); + List
list = new ArrayList<>(); + Set ids = new HashSet<>(); for (InputNode n : nodes) { ids.add(n.getId()); } @@ -520,14 +520,14 @@ public void hideNodes() { Set selectedNodes = this.getModel().getSelectedNodes(); - HashSet nodes = new HashSet(getModel().getHiddenNodes()); + HashSet nodes = new HashSet<>(getModel().getHiddenNodes()); nodes.addAll(selectedNodes); this.getModel().showNot(nodes); } public void expandPredecessors() { Set
oldSelection = getModel().getSelectedFigures(); - Set
figures = new HashSet
(); + Set
figures = new HashSet<>(); for (Figure f : this.getDiagramModel().getDiagramToView().getFigures()) { boolean ok = false; @@ -552,7 +552,7 @@ public void expandSuccessors() { Set
oldSelection = getModel().getSelectedFigures(); - Set
figures = new HashSet
(); + Set
figures = new HashSet<>(); for (Figure f : this.getDiagramModel().getDiagramToView().getFigures()) { boolean ok = false; diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/NodeQuickSearch.java --- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/NodeQuickSearch.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/NodeQuickSearch.java Sat Jan 28 00:16:17 2012 +0100 @@ -83,7 +83,7 @@ List matches = null; try { RegexpPropertyMatcher matcher = new RegexpPropertyMatcher(name, value, Pattern.CASE_INSENSITIVE); - Properties.PropertySelector selector = new Properties.PropertySelector(p.getGraph().getNodes()); + Properties.PropertySelector selector = new Properties.PropertySelector<>(p.getGraph().getNodes()); matches = selector.selectMultiple(matcher); } catch (Exception e) { @@ -101,7 +101,7 @@ } if (matches != null) { - final Set set = new HashSet(matches); + final Set set = new HashSet<>(matches); response.addResult(new Runnable() { public void run() { final EditorTopComponent comp = EditorTopComponent.getActive(); @@ -120,7 +120,7 @@ public void run() { final EditorTopComponent comp = EditorTopComponent.getActive(); if (comp != null) { - final Set tmpSet = new HashSet(); + final Set tmpSet = new HashSet<>(); tmpSet.add(n); comp.setSelectedNodes(tmpSet); comp.requestActive(); diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ExportAction.java --- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ExportAction.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/actions/ExportAction.java Sat Jan 28 00:16:17 2012 +0100 @@ -53,7 +53,7 @@ putValue(Action.SHORT_DESCRIPTION, "Export current graph as SVG file"); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_MASK)); lookup = Utilities.actionsGlobalContext(); - result = lookup.lookup(new Lookup.Template(ExportCookie.class)); + result = lookup.lookup(new Lookup.Template<>(ExportCookie.class)); result.addLookupListener(this); resultChanged(null); } diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/FigureWidget.java --- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/FigureWidget.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/FigureWidget.java Sat Jan 28 00:16:17 2012 +0100 @@ -122,7 +122,7 @@ middleWidget.getActions().addAction(new DoubleClickAction(this)); middleWidget.setCheckClipping(true); - labelWidgets = new ArrayList(); + labelWidgets = new ArrayList<>(); String[] strings = figure.getLines(); @@ -351,16 +351,16 @@ public void handleDoubleClick(Widget w, WidgetAction.WidgetMouseEvent e) { if (diagramScene.isAllVisible()) { - final Set hiddenNodes = new HashSet(diagramScene.getModel().getGraphToView().getGroup().getAllNodes()); + final Set hiddenNodes = new HashSet<>(diagramScene.getModel().getGraphToView().getGroup().getAllNodes()); hiddenNodes.removeAll(this.getFigure().getSource().getSourceNodesAsSet()); this.diagramScene.getModel().showNot(hiddenNodes); } else if (isBoundary()) { - final Set hiddenNodes = new HashSet(diagramScene.getModel().getHiddenNodes()); + final Set hiddenNodes = new HashSet<>(diagramScene.getModel().getHiddenNodes()); hiddenNodes.removeAll(this.getFigure().getSource().getSourceNodesAsSet()); this.diagramScene.getModel().showNot(hiddenNodes); } else { - final Set hiddenNodes = new HashSet(diagramScene.getModel().getHiddenNodes()); + final Set hiddenNodes = new HashSet<>(diagramScene.getModel().getHiddenNodes()); hiddenNodes.addAll(this.getFigure().getSource().getSourceNodesAsSet()); this.diagramScene.getModel().showNot(hiddenNodes); } diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/LineWidget.java --- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/LineWidget.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/LineWidget.java Sat Jan 28 00:16:17 2012 +0100 @@ -84,7 +84,7 @@ this.from = from; this.to = to; this.predecessor = predecessor; - this.successors = new ArrayList(); + this.successors = new ArrayList<>(); if (predecessor != null) { predecessor.addSuccessor(this); } @@ -138,7 +138,7 @@ } public void select(Widget arg0, Point arg1, boolean arg2) { - Set
set = new HashSet
(); + Set
set = new HashSet<>(); for (Connection c : LineWidget.this.connections) { set.add(c.getInputSlot().getFigure()); set.add(c.getOutputSlot().getFigure()); @@ -241,8 +241,8 @@ private void setHighlighted(boolean b) { this.highlighted = b; - Set highlightedObjects = new HashSet(scene.getHighlightedObjects()); - Set highlightedObjectsChange = new HashSet(); + Set highlightedObjects = new HashSet<>(scene.getHighlightedObjects()); + Set highlightedObjectsChange = new HashSet<>(); for (Connection c : connections) { highlightedObjectsChange.add(c.getInputSlot().getFigure()); highlightedObjectsChange.add(c.getInputSlot()); diff -r 1b95885bc1e4 -r f22dc0a63f03 src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/SlotWidget.java --- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/SlotWidget.java Fri Jan 27 23:57:47 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/SlotWidget.java Sat Jan 28 00:16:17 2012 +0100 @@ -156,9 +156,9 @@ } public void handleDoubleClick(Widget w, WidgetAction.WidgetMouseEvent e) { - Set hiddenNodes = new HashSet(diagramScene.getModel().getHiddenNodes()); + Set hiddenNodes = new HashSet<>(diagramScene.getModel().getHiddenNodes()); if (diagramScene.isAllVisible()) { - hiddenNodes = new HashSet(diagramScene.getModel().getGraphToView().getGroup().getAllNodes()); + hiddenNodes = new HashSet<>(diagramScene.getModel().getGraphToView().getGroup().getAllNodes()); } boolean progress = false;