binarynode.java
来自「对文本信息进行哈夫曼加密」· Java 代码 · 共 73 行
JAVA
73 行
package wlf;
/**
* 二叉节点类,元素类型未定
*/
import java.io.Serializable;
public class BinaryNode<E> implements Serializable{
/**
*
*/
private static final long serialVersionUID = 3677625897095376784L;
private E item;
private BinaryNode<E> left;
private BinaryNode<E> right;
public BinaryNode(){}
public BinaryNode(E item)
{
this.item=item;
}
public BinaryNode(E item,BinaryNode<E>left,BinaryNode<E>right)
{
this.item=item;
this.left=left;
this.right=right;
}
/**
* @return the item
*/
public E getItem() {
return item;
}
/**
* @param item the item to set
*/
public void setItem(E item) {
this.item = item;
}
/**
* @return the left
*/
public BinaryNode<E> getLeft() {
return left;
}
/**
* @param left the left to set
*/
public void setLeft(BinaryNode<E> left) {
this.left = left;
}
/**
* @return the right
*/
public BinaryNode<E> getRight() {
return right;
}
/**
* @param right the right to set
*/
public void setRight(BinaryNode<E> right) {
this.right = right;
}
/**
*
* @return 判断是否为叶节点
*/
public boolean isLeaf(){
return (left==null && right==null) ;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?