/** * @param startNode * @return the finish node corresponding to the start node */ private TableNodeItem finishNode(TableNodeItem startNode) { TableNodeItem nodeFinish = null; String startNodeName = startNode.getString(NAME); String finishNodeName = startNodeName.substring(0, startNodeName.lastIndexOf(START)) + "Finish"; int startNodes = 1; int finishNodes = 0; Iterator nodes = (startNode.getGraph()).nodes(); while (nodes.hasNext()) { TableNodeItem node = (TableNodeItem) nodes.next(); if (node.getInt(ID) > startNode.getInt(ID) && (node.getString(NAME)).equals(startNodeName)) { startNodes++; } if (node.getInt(ID) > startNode.getInt(ID) && (node.getString(NAME)).equals(finishNodeName)) { finishNodes++; } if (startNodes == finishNodes) { nodeFinish = node; break; } } return nodeFinish; }
/** * sets all "Step" type nodes (and their incident edges) connected to the startNode passed as * parameter visible * * @param startNode */ private void setStepVisible(TableNodeItem startNode) { TableNodeItem startNodeParent = getParent(startNode); Iterator<TableNodeItem> children = children(startNodeParent); TableNodeItem child = null; Iterator stepEdges = null; TableEdgeItem stepEdge; assert children.hasNext(); while (children.hasNext()) { child = children.next(); if (child.getString(TYPE).equals(STEP)) { child.setVisible(true); stepEdges = child.edges(); break; } } while (stepEdges.hasNext()) { stepEdge = (TableEdgeItem) stepEdges.next(); stepEdge.setVisible(true); } stepId = child.getInt(ID); }