Debut Generation Code Canonique
This commit is contained in:
@@ -3,20 +3,35 @@ package fr.iutfbleau.sae.mhuffman;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class CanonicalCode{
|
public class CanonicalCode{
|
||||||
private Map<Integer,Integer> codeLenghts;
|
private Map<Integer,Integer> codeLenghts = HuffmanNode.getDictionnary();
|
||||||
private Map<Integer,Integer> canonicalCodes = new HashMap<>();
|
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(){
|
public int getCode(){
|
||||||
// à changer selon le contexte !
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLength(){
|
public int getLength(){
|
||||||
// à changer selon le contexte ! encore une fois !!
|
|
||||||
return 0;
|
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;
|
return this.codes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user