/** * sets invisible nodes with visible edges connected to them visible these nodes exist because the * setNodesAndEdgesVisible(...) method does not follow data flow ("DF") edges * * @param graph */ private void setIsolatedNodesVisible(Graph graph) { Iterator graphNodes = graph.nodes(); TableNodeItem node; while (graphNodes.hasNext()) { node = (TableNodeItem) graphNodes.next(); if (!node.isVisible()) { Iterator incidentEdges = node.edges(); int visibleEdges = 0; while (incidentEdges.hasNext()) { TableEdgeItem edge = (TableEdgeItem) incidentEdges.next(); if (edge.isVisible()) { visibleEdges++; } } if (visibleEdges != 0) { node.setVisible(true); Iterator edges = node.edges(); while (edges.hasNext()) { TableEdgeItem edgeItem = (TableEdgeItem) (edges.next()); if (!edgeItem.getSourceItem().getString(TYPE).equals(STEP) && !edgeItem.getTargetItem().getString(TYPE).equals(STEP)) { edgeItem.setVisible(true); } } } } } }
/** * sets all nodes and incident edges between startNode and finishNode visible nodes must be * connected through control flow ("CF") edge to their parent to be set visible * * @param startNode * @param finishNode * @param isFirstNode */ private void setNodesAndEdgesVisible( TableNodeItem startNode, TableNodeItem finishNode, boolean isFirstNode) { startNode.setVisible(true); Iterator startNodeEdges; if (isFirstNode) { startNodeEdges = startNode.inEdges(); } else { startNodeEdges = startNode.edges(); } while (startNodeEdges.hasNext()) { TableEdgeItem startNodeEdge = (TableEdgeItem) startNodeEdges.next(); if (!startNodeEdge.getString(TYPE).equals(STEP) && !(startNodeEdge.getTargetItem()).getString(TYPE).equals(STEP) && !(startNodeEdge.getSourceItem()).getString(TYPE).equals(STEP)) { startNodeEdge.setVisible(true); } } Iterator<TableNodeItem> startNodeChildren; TableNodeItem child; if (startNode != finishNode) { startNodeChildren = children(startNode); while (startNodeChildren.hasNext()) { child = startNodeChildren.next(); if (checkInvisibleFlow(child, startNode) && !(child.isVisible())) { setNodesAndEdgesVisible(child, finishNode, false); } } } }
/** * sets nodes with no visible edges connected to them (isolated nodes) invisible these nodes exist * because the setNodesAndEdgesInvisible(...) method does not follow data flow ("DF") edges * * @param graph */ private void setIsolatedNodesInvisible(Graph graph) { Iterator graphNodes = graph.nodes(); TableNodeItem node; boolean rootDrawn = false; while (graphNodes.hasNext()) { node = (TableNodeItem) graphNodes.next(); if (node.isVisible() && getOutVDegree(node) == 0 && rootDrawn) { node.setVisible(false); Iterator incidentEdges = node.edges(); while (incidentEdges.hasNext()) { ((TableEdgeItem) incidentEdges.next()).setVisible(false); } } rootDrawn = true; } }
/** * sets all nodes and incident edges between startNode and finishNode invisible nodes must be * connected through control flow ("CF") edge or "Step" edge to their parent to be set invisible * * @param startNode * @param finishNode */ private void setNodesAndEdgesInvisible(TableNodeItem startNode, TableNodeItem finishNode) { startNode.setVisible(false); Iterator startNodeEdges = startNode.edges(); while (startNodeEdges.hasNext()) { TableEdgeItem startNodeEdge = (TableEdgeItem) startNodeEdges.next(); startNodeEdge.setVisible(false); } Iterator<TableNodeItem> startNodeChildren; TableNodeItem startNodeChild; if (startNode != finishNode) { startNodeChildren = children(startNode); while (startNodeChildren.hasNext()) { startNodeChild = startNodeChildren.next(); if (checkFlow(startNodeChild, startNode) && startNodeChild.isVisible()) { setNodesAndEdgesInvisible(startNodeChild, finishNode); } } } }