obs.write(decoderInputs.getShortestCodeWord().iterator()); + decoderInputs.getShortestCodeWord()+"\n");
obs.write(decoderInputs.getShortestCodeWord().iterator()); + decoderInputs.getShortestCodeWord()+"\n");
.getShortestCodeWord(), actualInputs.getShortestCodeWord());
.getShortestCodeWord(), actualInputs.getShortestCodeWord());
/** * Unit test for processing an {@link IRaba} representing B+Tree keys * suitable to setup the data for compression. * * @throws IOException */ public void test_keyRabaSetup() throws IOException { final int n = 8; final byte[][] a = new byte[n][]; a[0] = new byte[]{1,2}; a[1] = new byte[]{1,2,3}; a[2] = new byte[]{1,3}; a[3] = new byte[]{1,3,1}; a[4] = new byte[]{1,3,3}; a[5] = new byte[]{1,3,7}; a[6] = new byte[]{1,5}; a[7] = new byte[]{1,6,0}; final IRaba raba = new ReadOnlyKeysRaba(a); final AbstractCodingSetup setup = new RabaCodingSetup(raba); doDecoderInputRoundTripTest(setup.getSymbolCount(), setup .decoderInputs()); // verify that we can re-create the coder. doCoderRoundTripTest(setup.codec().codeWords(), setup.decoderInputs() .getShortestCodeWord(), setup.decoderInputs().getLengths(), setup.decoderInputs().getSymbols()); }
/** * Unit test for processing an {@link IRaba} representing B+Tree keys * suitable to setup the data for compression. * * @throws IOException */ public void test_keyRabaSetup() throws IOException { final int n = 8; final byte[][] a = new byte[n][]; a[0] = new byte[]{1,2}; a[1] = new byte[]{1,2,3}; a[2] = new byte[]{1,3}; a[3] = new byte[]{1,3,1}; a[4] = new byte[]{1,3,3}; a[5] = new byte[]{1,3,7}; a[6] = new byte[]{1,5}; a[7] = new byte[]{1,6,0}; final IRaba raba = new ReadOnlyKeysRaba(a); final AbstractCodingSetup setup = new RabaCodingSetup(raba); doDecoderInputRoundTripTest(setup.getSymbolCount(), setup .decoderInputs()); // verify that we can re-create the coder. doCoderRoundTripTest(setup.codec().codeWords(), setup.decoderInputs() .getShortestCodeWord(), setup.decoderInputs().getLengths(), setup.decoderInputs().getSymbols()); }
/** * Unit test for processing an {@link IRaba} representing B+Tree values * suitable to setup the data for compression. * * @throws IOException * * @todo test w/ nulls. */ public void test_valueRabaSetup() throws IOException { final int n = 3; final byte[][] a = new byte[n][]; a[0] = new byte[]{2,3}; a[1] = new byte[]{3,5}; a[2] = new byte[]{'m','i','k','e'}; final IRaba raba = new ReadOnlyValuesRaba(a); final RabaCodingSetup setup = new RabaCodingSetup(raba); // verify that we can re-create the decoder. doDecoderInputRoundTripTest(setup.getSymbolCount(), setup .decoderInputs()); // verify that we can re-create the coder. doCoderRoundTripTest(setup.codec().codeWords(), setup.decoderInputs() .getShortestCodeWord(), setup.decoderInputs().getLengths(), setup.decoderInputs().getSymbols()); }
/** * Unit test for processing an {@link IRaba} representing B+Tree values * suitable to setup the data for compression. * * @throws IOException * * @todo test w/ nulls. */ public void test_valueRabaSetup() throws IOException { final int n = 3; final byte[][] a = new byte[n][]; a[0] = new byte[]{2,3}; a[1] = new byte[]{3,5}; a[2] = new byte[]{'m','i','k','e'}; final IRaba raba = new ReadOnlyValuesRaba(a); final RabaCodingSetup setup = new RabaCodingSetup(raba); // verify that we can re-create the decoder. doDecoderInputRoundTripTest(setup.getSymbolCount(), setup .decoderInputs()); // verify that we can re-create the coder. doCoderRoundTripTest(setup.codec().codeWords(), setup.decoderInputs() .getShortestCodeWord(), setup.decoderInputs().getLengths(), setup.decoderInputs().getSymbols()); }
/** * (Re-)constructs the canonical huffman code from the shortest code word, * the non-decreasing bit lengths of each code word, and the permutation of * the symbols corresponding to those bit lengths. This information is * necessary and sufficient to reconstruct a canonical huffman code. * * @param decoderInputs * This contains the necessary and sufficient information to * recreate the {@link PrefixCoder}. * * @return A new {@link PrefixCoder} instance for the corresponding * canonical huffman code. */ static public PrefixCoder newCoder(final DecoderInputs decoderInputs) { return newCoder(decoderInputs.getShortestCodeWord(), decoderInputs .getLengths(), decoderInputs.getSymbols()); }
/** * (Re-)constructs the canonical huffman code from the shortest code word, * the non-decreasing bit lengths of each code word, and the permutation of * the symbols corresponding to those bit lengths. This information is * necessary and sufficient to reconstruct a canonical huffman code. * * @param decoderInputs * This contains the necessary and sufficient information to * recreate the {@link PrefixCoder}. * * @return A new {@link PrefixCoder} instance for the corresponding * canonical huffman code. */ static public PrefixCoder newCoder(final DecoderInputs decoderInputs) { return newCoder(decoderInputs.getShortestCodeWord(), decoderInputs .getLengths(), decoderInputs.getSymbols()); }