Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
gdggfb committed Mar 27, 2018
1 parent 7e95002 commit 2092ac5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/main/java/cc/xkxk/learn/dataStructure2D/StartFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ public static void main(String[] args) {
EventQueue.invokeLater(() -> new StartFrame().doDraw());
}

public void action(JTextField textField, JPanel board, RedBlackTree tree, int action) {
private void action(JTextField textField, JPanel board, RedBlackTree tree, int action) {
doAction(textField, board, tree, action);
textField.requestFocus();
}

public void doAction(JTextField textField, JPanel board, RedBlackTree tree, int action) {
private void doAction(JTextField textField, JPanel board, RedBlackTree tree, int action) {
String value = textField.getText();
if (value == null || value.isEmpty()) {
return;
Expand All @@ -60,7 +60,7 @@ public void doAction(JTextField textField, JPanel board, RedBlackTree tree, int
board.revalidate();
}

public void doDraw() {
private void doDraw() {
JPanel board = createBoard();
JTextField textField = createTextField();
JPanel buttonPanel = createButtonPanel(board, textField);
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/cc/xkxk/learn/dataStructure2D/TreeJpanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public TreeJpanel(Entry root, List<String> process) {
}

private int countOffset(int depth) {
return (int) (distanceX * (depth + 1));
return (int) (distanceX * (depth));
}

public void depthCount(Entry node, Entry nodeP, boolean isLeft) {
Expand All @@ -51,16 +51,17 @@ public void depthCount(Entry node, Entry nodeP, boolean isLeft) {
if (is != (n == n.parent.left)) {
if (is) {
n.parent.depthR = n.parent.depthR + 1 + same;
System.out.println("key:" + node.key + "now:" + n.key + ",parentR:" + n.parent.depthR);
} else {
n.parent.depthL = n.parent.depthL + 1 + same;
System.out.println("key:" + node.key + "now:" + n.key + ",parentL:" + n.parent.depthR);
}
same = 0;
} else {
same = same + 1;
}
is = n == n.parent.left;
}

depthCount(node.left, node, true);
depthCount(node.right, node, false);
}
Expand Down

0 comments on commit 2092ac5

Please sign in to comment.