private void analyzeEdge(int row, int jump, Edge edge) { Node minNode = edge.min(); Node maxNode = edge.max(); if (jump == 0 && !minNode.conRight && !maxNode.conLeft) { edge.con = 0; minNode.conRight = maxNode.conLeft = true; } else { boolean topPossible = !minNode.conTop && !maxNode.conTop; if (topPossible) { int topHeight = Math.max(minNode.conRightTop, maxNode.conLeftTop); List<Node> nodes = coordinates.get(row); for (int i = minNode.col + 1; i < maxNode.col; i++) { Node node = nodes.get(i); if (node != null) { topHeight = Math.max(topHeight, node.conRightTop); topHeight = Math.max(topHeight, node.conLeftTop); } } topHeight++; edge.con = -topHeight; minNode.conRightTop = maxNode.conLeftTop = topHeight; for (int i = minNode.col + 1; i < maxNode.col; i++) { Node node = nodes.get(i); if (node != null) node.conTop = true; } } else { // boolean bottomPossible = minNode.conBottom==0 && maxNode.conBottom==0; int bottomHeight = Math.max(minNode.conRightBottom, maxNode.conLeftBottom); List<Node> nodes = coordinates.get(row); for (int i = minNode.col + 1; i < maxNode.col; i++) { Node node = nodes.get(i); if (node != null) { bottomHeight = Math.max(bottomHeight, node.conRightBottom); bottomHeight = Math.max(bottomHeight, node.conLeftBottom); } } bottomHeight++; edge.con = +bottomHeight; minNode.conRightBottom = maxNode.conLeftBottom = bottomHeight; for (int i = minNode.col + 1; i < maxNode.col; i++) { Node node = nodes.get(i); if (node != null) node.conBottom = true; } } } }