private void upWalk() { for (int currentNodeIndex = myDownIndex; currentNodeIndex >= myUpIndex; currentNodeIndex--) { if (nodeIsVisible(currentNodeIndex)) { int nearlyDown = Integer.MAX_VALUE; int minAdjNumber = Integer.MAX_VALUE; for (int downNode : myLiteDelegateGraph.getNodes(currentNodeIndex, NodeFilter.DOWN)) { if (downNode > myDownIndex) { addEdgeOrArrow(currentNodeIndex, downNode, false); continue; } if (nodeIsVisible(downNode)) { minAdjNumber = Math.min(minAdjNumber, myNumbers.getNumber(downNode)); } else { nearlyDown = Math.min(nearlyDown, myNumbers.getNumber(downNode)); } } if (nearlyDown == minAdjNumber || nearlyDown == Integer.MAX_VALUE) { myNumbers.setNumber(currentNodeIndex, minAdjNumber); } else { addDottedEdge(currentNodeIndex, nearlyDown); myNumbers.setNumber(currentNodeIndex, nearlyDown); } } else { // node currentNodeIndex invisible int nearlyDown = Integer.MAX_VALUE; for (int downNode : myLiteDelegateGraph.getNodes(currentNodeIndex, NodeFilter.DOWN)) { if (nodeIsVisible(downNode)) { nearlyDown = Math.min(nearlyDown, downNode); } else { if (downNode <= myDownIndex) nearlyDown = Math.min(nearlyDown, myNumbers.getNumber(downNode)); } } myNumbers.setNumber(currentNodeIndex, nearlyDown); } } }
private void downWalk() { for (int currentNodeIndex = myUpIndex; currentNodeIndex <= myDownIndex; currentNodeIndex++) { if (nodeIsVisible(currentNodeIndex)) { int nearlyUp = Integer.MIN_VALUE; int maxAdjNumber = Integer.MIN_VALUE; for (int upNode : myLiteDelegateGraph.getNodes(currentNodeIndex, NodeFilter.UP)) { if (upNode < myUpIndex) { addEdgeOrArrow(currentNodeIndex, upNode, true); continue; } if (nodeIsVisible(upNode)) { maxAdjNumber = Math.max(maxAdjNumber, myNumbers.getNumber(upNode)); } else { nearlyUp = Math.max(nearlyUp, myNumbers.getNumber(upNode)); } } if (nearlyUp == maxAdjNumber || nearlyUp == Integer.MIN_VALUE) { myNumbers.setNumber(currentNodeIndex, maxAdjNumber); } else { addDottedEdge(currentNodeIndex, nearlyUp); myNumbers.setNumber(currentNodeIndex, nearlyUp); } } else { // node currentNodeIndex invisible int nearlyUp = Integer.MIN_VALUE; for (int upNode : myLiteDelegateGraph.getNodes(currentNodeIndex, NodeFilter.UP)) { if (nodeIsVisible(upNode)) { nearlyUp = Math.max(nearlyUp, upNode); } else { if (upNode >= myUpIndex) nearlyUp = Math.max(nearlyUp, myNumbers.getNumber(upNode)); } } myNumbers.setNumber(currentNodeIndex, nearlyUp); } } }