Function: @author crossoverJie Date: 04/01/2018 18:26 @since JDK 1.8
| 10 | * @since JDK 1.8 |
| 11 | */ |
| 12 | public class BinaryNode { |
| 13 | private Object data ; |
| 14 | private BinaryNode left ; |
| 15 | private BinaryNode right ; |
| 16 | |
| 17 | public BinaryNode() { |
| 18 | } |
| 19 | |
| 20 | public BinaryNode(Object data, BinaryNode left, BinaryNode right) { |
| 21 | this.data = data; |
| 22 | this.left = left; |
| 23 | this.right = right; |
| 24 | } |
| 25 | |
| 26 | public Object getData() { |
| 27 | return data; |
| 28 | } |
| 29 | |
| 30 | public void setData(Object data) { |
| 31 | this.data = data; |
| 32 | } |
| 33 | |
| 34 | public BinaryNode getLeft() { |
| 35 | return left; |
| 36 | } |
| 37 | |
| 38 | public void setLeft(BinaryNode left) { |
| 39 | this.left = left; |
| 40 | } |
| 41 | |
| 42 | public BinaryNode getRight() { |
| 43 | return right; |
| 44 | } |
| 45 | |
| 46 | public void setRight(BinaryNode right) { |
| 47 | this.right = right; |
| 48 | } |
| 49 | |
| 50 | |
| 51 | public BinaryNode createNode(){ |
| 52 | BinaryNode node = new BinaryNode("1",null,null) ; |
| 53 | BinaryNode left2 = new BinaryNode("2",null,null) ; |
| 54 | BinaryNode left3 = new BinaryNode("3",null,null) ; |
| 55 | BinaryNode left4 = new BinaryNode("4",null,null) ; |
| 56 | BinaryNode left5 = new BinaryNode("5",null,null) ; |
| 57 | BinaryNode left6 = new BinaryNode("6",null,null) ; |
| 58 | node.setLeft(left2) ; |
| 59 | left2.setLeft(left4); |
| 60 | left2.setRight(left6); |
| 61 | node.setRight(left3); |
| 62 | left3.setRight(left5) ; |
| 63 | return node ; |
| 64 | } |
| 65 | |
| 66 | @Override |
| 67 | public String toString() { |
| 68 | return "BinaryNode{" + |
| 69 | "data=" + data + |
nothing calls this directly
no outgoing calls
no test coverage detected