Debut Generation Code Canonique

This commit is contained in:
2025-12-18 13:34:57 +01:00
parent 396b4bbf57
commit a5c52be6a8
2 changed files with 19 additions and 4 deletions
@@ -3,20 +3,35 @@ package fr.iutfbleau.sae.mhuffman;
import java.util.*;
public class CanonicalCode{
private Map<Integer,Integer> codeLenghts;
private Map<Integer,Integer> codeLenghts = HuffmanNode.getDictionnary();
private Map<Integer,Integer> canonicalCodes = new HashMap<>();
public void generateCodes(){
// 1- Premiere chose à faire : trier les codes initiaux par longueur du code :
List<Integer> codes = new ArrayList<>();
codes = codeLenghts.keySet();
int[] tab = code.toArray(new Integer[0]);
Arrays.sort(tab);
}
public int getCode(){
// à changer selon le contexte !
return 0;
}
public int getLength(){
// à changer selon le contexte ! encore une fois !!
return 0;
}
public Map<Integer,Integer> getCanonicalCodes(){
return this.canonicalCodes;
}
}
@@ -192,7 +192,7 @@ public class HuffmanTree {
}
public Map<Integer,String> getDictionnary(){
public static Map<Integer,String> getDictionnary(){
return this.codes;
}