📄 binary.java
字号:
package hfmCompress;
public class Binary {
protected Binary left=null;
protected Binary right=null;
private int numberFound=0;//出现的频率
private byte byteToCoded=0;//代表的字节
private int nowCode=0;//本节点保存的编码
private int nowLength=0;//本节点保存编码的长度
public Binary(){
left=null;
right=null;
numberFound=0;
byteToCoded=0;
nowCode=0;
nowLength=0;
}
public Binary(Binary leftArg,Binary rightArg){
left=leftArg;
right=rightArg;
numberFound=0;
byteToCoded=0;
nowCode=0;
nowLength=0;
}
public void addOneBitInLeft(boolean isLeftArg){
if(isLeftArg){
left.nowCode=(nowCode << 1) | 1;
left.nowLength=nowLength+1;
}else{
right.nowCode=(nowCode << 1) | 0;
right.nowLength=nowLength+1;
}
}
public boolean isLeaf(){
return (this.left==null)&&(this.right==null);
}
public static Binary explainCode(long nowReadingLongArg,int nowMoveBits,Binary nowBinaryArg){
if((nowReadingLongArg&(1<<nowMoveBits))!=0){
return nowBinaryArg.left;
}else{
return nowBinaryArg.right;
}
}
public byte getByteToCoded() {
return byteToCoded;
}
public void setByteToCoded(byte byteToCoded) {
this.byteToCoded = byteToCoded;
}
public int getNowCode() {
return nowCode;
}
public void setNowCode(int nowCodeArg) {
this.nowCode = nowCodeArg;
}
public int getNowLength() {
return nowLength;
}
public void setNowLength(int nowLengthArg) {
this.nowLength = nowLengthArg;
}
public int getNumberFound() {
return numberFound;
}
public void setNumberFound(int numberFoundArg) {
this.numberFound = numberFoundArg;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -