示例#1
0
        /// <summary>
        /// Create a new <seealso cref="ForUtil"/> instance and save state into <code>out</code>.
        /// </summary>
        public ForUtil(float acceptableOverheadRatio, DataOutput @out)
        {
            @out.WriteVInt(PackedInts.VERSION_CURRENT);
            EncodedSizes = new int[33];
            Encoders     = new PackedInts.Encoder[33];
            Decoders     = new PackedInts.Decoder[33];
            Iterations   = new int[33];

            for (int bpv = 1; bpv <= 32; ++bpv)
            {
                PackedInts.FormatAndBits formatAndBits = PackedInts.FastestFormatAndBits(Lucene41PostingsFormat.BLOCK_SIZE, bpv, acceptableOverheadRatio);
                Debug.Assert(formatAndBits.format.IsSupported(formatAndBits.bitsPerValue));
                Debug.Assert(formatAndBits.bitsPerValue <= 32);
                EncodedSizes[bpv] = EncodedSize(formatAndBits.format, PackedInts.VERSION_CURRENT, formatAndBits.bitsPerValue);
                Encoders[bpv]     = PackedInts.GetEncoder(formatAndBits.format, PackedInts.VERSION_CURRENT, formatAndBits.bitsPerValue);
                Decoders[bpv]     = PackedInts.GetDecoder(formatAndBits.format, PackedInts.VERSION_CURRENT, formatAndBits.bitsPerValue);
                Iterations[bpv]   = ComputeIterations(Decoders[bpv]);

                @out.WriteVInt(formatAndBits.format.id << 5 | (formatAndBits.bitsPerValue - 1));
            }
        }
示例#2
0
 internal PagedMutable(long size, int pageSize, PackedInts.FormatAndBits formatAndBits)
     : this(size, pageSize, formatAndBits.bitsPerValue, formatAndBits.format)
 {
 }