comparison src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/ClusterOutputSlotNode.java @ 21146:33ff6b03fad1

add support for control flow window and basic block view on graphs Contributed-by: Michael Haupt <michael.haupt@oracle.com> Contributed-by: Peter Hofer <peter.hofer@jku.at> Contributed-by: Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
author Michael Haupt <michael.haupt@oracle.com>
date Wed, 29 Apr 2015 08:31:28 +0200
parents
children
comparison
equal deleted inserted replaced
21142:0b221b4ad707 21146:33ff6b03fad1
1 /*
2 * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24 package com.sun.hotspot.igv.hierarchicallayout;
25
26 import com.sun.hotspot.igv.layout.Cluster;
27 import com.sun.hotspot.igv.layout.Port;
28 import com.sun.hotspot.igv.layout.Vertex;
29 import java.awt.Dimension;
30 import java.awt.Point;
31
32 /**
33 *
34 * @author Thomas Wuerthinger
35 */
36 public class ClusterOutputSlotNode implements Vertex {
37
38 private final int SIZE = 0;
39 private Point position;
40 private Port inputSlot;
41 private Port outputSlot;
42 private ClusterNode blockNode;
43 private boolean root;
44 private Cluster cluster;
45 private ClusterOutgoingConnection conn;
46 private String id;
47
48 public void setOutgoingConnection(ClusterOutgoingConnection c) {
49 this.conn = c;
50 }
51
52 public ClusterOutgoingConnection getOutgoingConnection() {
53 return conn;
54 }
55
56 @Override
57 public String toString() {
58 return id;
59 }
60
61 public ClusterOutputSlotNode(ClusterNode n, String id) {
62 this.blockNode = n;
63 this.id = id;
64
65 n.addSubNode(this);
66
67 final Vertex thisNode = this;
68 final ClusterNode thisBlockNode = blockNode;
69
70 inputSlot = new Port() {
71
72 public Point getRelativePosition() {
73 return new Point(0, 0);
74 }
75
76 public Vertex getVertex() {
77 return thisNode;
78 }
79
80 @Override
81 public String toString() {
82 return "InPort of " + thisNode.toString();
83 }
84 };
85
86 outputSlot = new Port() {
87
88 public Point getRelativePosition() {
89 Point p = new Point(thisNode.getPosition());
90 p.x += ClusterNode.BORDER;
91 p.y = 0;//thisBlockNode.getSize().height;
92 return p;
93 }
94
95 public Vertex getVertex() {
96 return thisBlockNode;
97 }
98
99 @Override
100 public String toString() {
101 return "OutPort of " + thisNode.toString();
102 }
103 };
104 }
105
106 public Dimension getSize() {
107 return new Dimension(SIZE, SIZE);
108 }
109
110 public void setPosition(Point p) {
111 this.position = p;
112 }
113
114 public Point getPosition() {
115 return position;
116 }
117
118 public Port getInputSlot() {
119 return inputSlot;
120 }
121
122 public Port getOutputSlot() {
123 return outputSlot;
124 }
125
126 public void setCluster(Cluster c) {
127 cluster = c;
128 }
129
130 public void setRoot(boolean b) {
131 root = b;
132 }
133
134 public Cluster getCluster() {
135 return cluster;
136 }
137
138 public boolean isRoot() {
139 return root;
140 }
141
142 public int compareTo(Vertex o) {
143 return toString().compareTo(o.toString());
144 }
145 }