Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
markov
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Patrick Friedel
markov
Commits
24068248
Commit
24068248
authored
Mar 25, 2018
by
Hut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed HuffmanCodeBuilder after update.
parent
67d038d8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
ByteHuffmanCodeBuilderTest.java
src/test/java/markov/huffman/ByteHuffmanCodeBuilderTest.java
+8
-3
No files found.
src/test/java/markov/huffman/ByteHuffmanCodeBuilderTest.java
View file @
24068248
package
markov
.
huffman
;
package
markov
.
huffman
;
import
com.tomgibara.bits.Bits
;
import
com.tomgibara.bits.Bits
;
import
directory.passive.huffman.ByteHuffmanCodeBuilder
;
import
directory.passive.huffman.HuffmanCode
;
import
markov.stuff.SimpleCountMap
;
import
markov.stuff.SimpleCountMap
;
import
markov.stuff.Utils
;
import
markov.stuff.Utils
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
...
@@ -20,8 +22,10 @@ class ByteHuffmanCodeBuilderTest {
...
@@ -20,8 +22,10 @@ class ByteHuffmanCodeBuilderTest {
countMap
.
count
(
i
);
countMap
.
count
(
i
);
}
}
}
}
ByteHuffmanCodeBuilder
<
Integer
,
SimpleCountMap
.
MutableInt
>
builder
=
new
ByteHuffmanCodeBuilder
<>();
HuffmanCode
<
Integer
,
List
<
Boolean
>>
code
=
HuffmanCode
<
Integer
,
List
<
Boolean
>,
Boolean
,
SimpleCountMap
.
MutableInt
>
code
=
builder
.
generateCode
(
countMap
);
ByteHuffmanCodeBuilder
.<
Integer
,
SimpleCountMap
.
MutableInt
>
createFactory
()
.
generateCode
(
countMap
,
new
SimpleCountMap
.
MutableInt
.
FrequencySupport
());
List
<
Boolean
>
result
=
new
ArrayList
<>();
List
<
Boolean
>
result
=
new
ArrayList
<>();
result
.
addAll
(
printVarious
(
code
,
6
));
result
.
addAll
(
printVarious
(
code
,
6
));
result
.
addAll
(
printVarious
(
code
,
2
));
result
.
addAll
(
printVarious
(
code
,
2
));
...
@@ -47,7 +51,8 @@ class ByteHuffmanCodeBuilderTest {
...
@@ -47,7 +51,8 @@ class ByteHuffmanCodeBuilderTest {
// System.out.println(booleanListAsByteArrayToStirng(result));
// 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
);
List
<
Boolean
>
c
=
code
.
encode
(
n
);
System
.
out
.
println
(
c
);
System
.
out
.
println
(
c
);
System
.
out
.
println
(
booleanListAsByteArrayToStirng
(
c
));
System
.
out
.
println
(
booleanListAsByteArrayToStirng
(
c
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment