Commit 24068248 by Hut

Fixed HuffmanCodeBuilder after update.

parent 67d038d8
package markov.huffman;
import com.tomgibara.bits.Bits;
import directory.passive.huffman.ByteHuffmanCodeBuilder;
import directory.passive.huffman.HuffmanCode;
import markov.stuff.SimpleCountMap;
import markov.stuff.Utils;
import org.junit.jupiter.api.Test;
......@@ -20,8 +22,10 @@ class ByteHuffmanCodeBuilderTest {
countMap.count(i);
}
}
ByteHuffmanCodeBuilder<Integer, SimpleCountMap.MutableInt> builder = new ByteHuffmanCodeBuilder<>();
HuffmanCode<Integer, List<Boolean>, Boolean, SimpleCountMap.MutableInt> code = builder.generateCode(countMap);
HuffmanCode<Integer, List<Boolean>> code =
ByteHuffmanCodeBuilder.<Integer, SimpleCountMap.MutableInt>createFactory()
.generateCode(countMap,
new SimpleCountMap.MutableInt.FrequencySupport());
List<Boolean> result = new ArrayList<>();
result.addAll(printVarious(code, 6));
result.addAll(printVarious(code, 2));
......@@ -47,7 +51,8 @@ class ByteHuffmanCodeBuilderTest {
// System.out.println(booleanListAsByteArrayToStirng(result));
}
private List<Boolean> printVarious(HuffmanCode<Integer, List<Boolean>, Boolean, SimpleCountMap.MutableInt> code, int n) {
private List<Boolean> printVarious(
HuffmanCode<Integer, List<Boolean>> code, int n) {
List<Boolean> c = code.encode(n);
System.out.println(c);
System.out.println(booleanListAsByteArrayToStirng(c));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment