📄 node.java
字号:
package logical;
import java.io.Serializable;
public class Node implements Serializable {
private static final long serialVersionUID = 1L;
long weight; // the weight of the Node
int name; // the name of the Node, store the value of the Node
Node lchild, rchild, parent;
Node() {
// Initialization
this.name = -1;
this.weight = 0;
this.lchild = null;
this.rchild = null;
this.parent = null;
}
// get the left child of the Node
public Node getLeftChild() {
return this.lchild;
}
// get the right child with the given Node
public Node getRightChild() {
return this.rchild;
}
// get the parent of the Node
public Node getParent() {
return this.parent;
}
// get the value of the Node
public int getValue() {
return this.name;
}
// Check out if the Node is a leaf
public boolean isLeaf() {
return (this.lchild == null) && (this.rchild == null);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -