2025-12-15 20:27:25 +01:00
|
|
|
public class HuffmanNode{
|
2025-12-15 20:55:24 +01:00
|
|
|
private char value;
|
2025-12-15 20:27:25 +01:00
|
|
|
private int frequence;
|
|
|
|
|
|
|
|
|
|
private HuffmanNode left;
|
|
|
|
|
private HuffmanNode right;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-12-15 20:55:24 +01:00
|
|
|
public HuffmanNode(char v,int f){
|
2025-12-15 20:27:25 +01:00
|
|
|
this.value = v;
|
|
|
|
|
this.frequence = f;
|
|
|
|
|
this.right = null;
|
|
|
|
|
this.left = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setSonLeft(HuffmanNode lef){
|
|
|
|
|
this.left = lef;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setSonRight(HuffmanNode rig){
|
|
|
|
|
this.right = rig;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isLead(HuffmanNode f){
|
2025-12-15 20:32:35 +01:00
|
|
|
// on est une feuille si on a pas de fils gauche et ni de fils droit !
|
|
|
|
|
boolean b = true;
|
|
|
|
|
|
|
|
|
|
if(this.left == null && this.right == null){
|
|
|
|
|
b = true;
|
|
|
|
|
}else{
|
|
|
|
|
b = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return b;
|
2025-12-15 20:27:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ajouter d'autres méthode tel que les getters par exemple !!!
|
|
|
|
|
}
|