public void contributeNodesToGraph(DirectedGraph graph, HashMap map){ Node node = new Node(this); node.width = getFigure().getBounds().width;//getNode().getWidth(); int height = 22; if (((CFGNode)getModel()).getBefore() != null){ height += ((CFGNode)getModel()).getBefore().getChildren().size() * 22; } if (((CFGNode)getModel()).getAfter() != null){ height += ((CFGNode)getModel()).getAfter().getChildren().size() * 22; } node.height = height;//getFigure().getBounds().height; graph.nodes.add(node); map.put(this, node); }
public void contributeEdgesToGraph(DirectedGraph graph, HashMap map) { List outgoing = getSourceConnections(); for (int i = 0; i < outgoing.size(); i++){ CFGEdgeEditPart edge = (CFGEdgeEditPart)outgoing.get(i); edge.contributeToGraph(graph, map); } }
public void applyGraphResults(DirectedGraph graph, HashMap map){ Node node = (Node)map.get(this); ((CFGNodeFigure)getFigure()).setBounds(new Rectangle(node.x, node.y, node.width, node.height));//getFigure().getBounds().height));//getFigure().getBounds().height)); List outgoing = getSourceConnections(); for (int i = 0; i < outgoing.size(); i++){ CFGEdgeEditPart edge = (CFGEdgeEditPart)outgoing.get(i); edge.applyGraphResults(graph, map); } }
public void visit(DirectedGraph graph) { try { this.graph = graph; this.nodeList = graph.nodes; this.edgeList = graph.edges; // iterate through all of the nodes in the node list for (Iterator iter = nodeList.iterator(); iter.hasNext();) { Node node = (Node) iter.next(); // check whether we have already come across this node if (!encountered.contains(node)) { // create a new cluster for this node currentCluster = new Cluster(); clusters.add(currentCluster); encountered.add(node); currentCluster.set.add(node); // System.out.println("Adding to NEW cluster: " + node + ", cluster: " // + currentCluster); // recursively add any other nodes reachable from it int depth = INITIAL_RECURSION_DEPTH; recursivelyAddToCluster(node, depth); } else { // System.out.println("Already encountered: " + node); } } coalesceRemainingClusters(); // System.out.println(""); joinClusters(); } catch (RuntimeException e) { e.printStackTrace(); throw e; } }
/** * @param graph */ private void init(DirectedGraph graph) { this.graph = graph; this.nodeList = graph.nodes; this.edgeList = graph.edges; edgesAdded = new ArrayList<Edge>(); }
public void layoutDiagram(AbstractGraphicalEditPart diagram) { partToNodesMap = new HashMap<AbstractGraphicalEditPart, Object>(); graph = new DirectedGraph(); graph.setDirection(PositionConstants.EAST); addNodes(diagram); Rectangle r = diagram.getFigure().getBounds(); if (r.x < -1000 || r.y < -1000) return; if (graph.nodes.size() > 0) { addEdges(diagram); new NodeJoiningDirectedGraphLayout().visit(graph); applyChildrenResults(diagram); } }
public HierarchicalLayout() { this.contourToNode = TypeTools.newHashMap(); this.graph = new DirectedGraph(); this.nodeColors = TypeTools.newHashMap(); this.nodeToPosition = TypeTools.newHashMap(); this.staticNodes = TypeTools.newHashMap(); }
public TabularLayout() { this.contourToNode = TypeTools.newHashMap(); this.graph = new DirectedGraph(); this.nodeCells = TypeTools.newHashMap(); this.nodeColors = TypeTools.newHashMap(); this.nodeColumns = TypeTools.newHashMap(); this.nodeLayers = TypeTools.newHashMap(); this.nodeSections = TypeTools.newHashMap(); }
/** * Lays out the given graph. * * @param graph the graph to layout. * @see org.eclipse.draw2d.graph#visit(DirectedGraph) */ @Override public void visit(DirectedGraph graph) { super.visit(graph); DcaseDirectedGraph ddg = new DcaseDirectedGraph(graph); for (int i = 0; i < steps.size(); i++) { DcaseGraphVisitor visitor = (DcaseGraphVisitor) steps.get(i); visitor.visit(ddg); } }
/** * @param clean * next time */ public void visit(DirectedGraph g) { cleanNextTime = true; init(g); setDummyEdges(); }
/** * Creates the DcaseDirectGraph and initializes it. * * @param graph the direct graph. */ public DcaseDirectedGraph(DirectedGraph graph) { this.graph = graph; map.clear(); baseNodeList.clear(); }
public void visit(DirectedGraph graph) { new DummyEdgeCreator().visit(graph); new ClusterEdgeCreator().visit(graph); super.visit(graph); }