/** Create a new transformation strategy based on a prefix-free coder. * * @param coder a prefix-free coder. * @param char2symbol a map from character to symbols (the default returned value will be used for unknown symbols). * @param prefixFree whether it is required that the resulting bit vectors are prefix-free: in this case, symbol 0 will * be appended to each string, and will not be allowed to appear in any string. */ public PrefixCoderTransformationStrategy( final PrefixCoder coder, final Char2IntOpenHashMap char2symbol, final boolean prefixFree ) { this( coder.codeWords(), char2symbol, prefixFree ); }
"Can not code value: " + b); bitsWritten += coder.encode(symbol, obs);
"Can not code value: " + b); bitsWritten += coder.encode(symbol, obs);
/** Create a new transformation strategy based on a prefix-free coder. * * @param coder a prefix-free coder. * @param char2symbol a map from character to symbols (the default returned value will be used for unknown symbols). * @param prefixFree whether it is required that the resulting bit vectors are prefix-free: in this case, symbol 0 will * be appended to each string, and will not be allowed to appear in any string. */ public PrefixCoderTransformationStrategy( final PrefixCoder coder, final Char2IntOpenHashMap char2symbol, final boolean prefixFree ) { this( coder.codeWords(), char2symbol, prefixFree ); }
/** Create a new transformation strategy based on a prefix-free coder. * * @param coder a prefix-free coder. * @param char2symbol a map from character to symbols (the default returned value will be used for unknown symbols). * @param prefixFree whether it is required that the resulting bit vectors are prefix-free: in this case, symbol 0 will * be appended to each string, and will not be allowed to appear in any string. */ public PrefixCoderTransformationStrategy(final PrefixCoder coder, final Char2IntOpenHashMap char2symbol, final boolean prefixFree) { this(coder.codeWords(), char2symbol, prefixFree); }
/** * @param shortestCodeWord * @param lengths * @param */ private void doCoderRoundTripTest(final BitVector[] expected, final BitVector shortestCodeWord, final int[] length, final int[] symbol) { final PrefixCoder newCoder = HuffmanCodec.newCoder(shortestCodeWord, length, symbol); final BitVector[] actual = newCoder.codeWords(); assertEquals("codeWord[]", expected, actual); if (log.isDebugEnabled()) { log.debug("\nexpected: " + Arrays.toString(expected) + "\nactual : " + Arrays.toString(actual)); } }
/** * @param shortestCodeWord * @param lengths * @param */ private void doCoderRoundTripTest(final BitVector[] expected, final BitVector shortestCodeWord, final int[] length, final int[] symbol) { final PrefixCoder newCoder = HuffmanCodec.newCoder(shortestCodeWord, length, symbol); final BitVector[] actual = newCoder.codeWords(); assertEquals("codeWord[]", expected, actual); if (log.isDebugEnabled()) { log.debug("\nexpected: " + Arrays.toString(expected) + "\nactual : " + Arrays.toString(actual)); } }
prefixCoder = codec.coder(); decoder = codec.decoder(); codeWord = prefixCoder.codeWords();
prefixCoder = codec.coder(); decoder = codec.decoder(); codeWord = prefixCoder.codeWords();
prefixCoder = codec.coder(); decoder = codec.decoder(); codeWord = prefixCoder.codeWords();
prefixCoder = codec.coder(); decoder = codec.decoder(); codeWord = prefixCoder.codeWords();