2025-12-18 12:34:39 +01:00
|
|
|
package fr.iutfbleau.sae.mhuffman;
|
|
|
|
|
|
2025-12-15 20:14:12 +01:00
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
public class CanonicalCode{
|
2025-12-18 13:34:57 +01:00
|
|
|
private Map<Integer,Integer> codeLenghts = HuffmanNode.getDictionnary();
|
2025-12-18 12:56:55 +01:00
|
|
|
private Map<Integer,Integer> canonicalCodes = new HashMap<>();
|
2025-12-15 20:14:12 +01:00
|
|
|
|
|
|
|
|
|
2025-12-18 13:34:57 +01:00
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-15 20:14:12 +01:00
|
|
|
|
|
|
|
|
public int getCode(){
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getLength(){
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2025-12-18 13:34:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
public Map<Integer,Integer> getCanonicalCodes(){
|
|
|
|
|
return this.canonicalCodes;
|
|
|
|
|
}
|
2025-12-18 12:34:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|