コード例 #1
0
 /// <summary>
 /// Construct a decoder for a given <see cref="Packed.EliasFanoEncoder"/>.
 /// The decoding index is set to just before the first encoded value.
 /// </summary>
 public EliasFanoDecoder(EliasFanoEncoder efEncoder)
 {
     this.efEncoder       = efEncoder;
     this.numEncoded      = efEncoder.numEncoded;        // not final in EliasFanoEncoder
     this.numIndexEntries = efEncoder.currentEntryIndex; // not final in EliasFanoEncoder
     this.indexMask       = (1L << efEncoder.nIndexEntryBits) - 1;
 }
コード例 #2
0
        public override bool Equals(object other)
        {
            if (!(other is EliasFanoEncoder))
            {
                return(false);
            }
            EliasFanoEncoder oefs = (EliasFanoEncoder)other;

            // no equality needed for upperBound
            return((this.numValues == oefs.numValues) &&
                   (this.numEncoded == oefs.numEncoded) &&
                   (this.numLowBits == oefs.numLowBits) &&
                   (this.numIndexEntries == oefs.numIndexEntries) &&
                   (this.indexInterval == oefs.indexInterval) &&
                   Arrays.Equals(this.upperLongs, oefs.upperLongs) &&
                   Arrays.Equals(this.lowerLongs, oefs.lowerLongs)); // no need to check index content
        }
コード例 #3
0
 /// <summary>
 /// Provide an indication that is better to use an <see cref="EliasFanoDocIdSet"/> than a <see cref="FixedBitSet"/>
 /// to encode document identifiers. </summary>
 /// <param name="numValues"> The number of document identifiers that is to be encoded. Should be non negative. </param>
 /// <param name="upperBound"> The maximum possible value for a document identifier. Should be at least <paramref name="numValues"/>. </param>
 /// <returns> See <see cref="EliasFanoEncoder.SufficientlySmallerThanBitSet(long, long)"/> </returns>
 public static bool SufficientlySmallerThanBitSet(long numValues, long upperBound)
 {
     return(EliasFanoEncoder.SufficientlySmallerThanBitSet(numValues, upperBound));
 }
コード例 #4
0
 /// <summary>
 /// Construct an EliasFanoDocIdSet. For efficient encoding, the parameters should be chosen as low as possible. </summary>
 /// <param name="numValues"> At least the number of document ids that will be encoded. </param>
 /// <param name="upperBound">  At least the highest document id that will be encoded. </param>
 public EliasFanoDocIdSet(int numValues, int upperBound)
 {
     efEncoder = new EliasFanoEncoder(numValues, upperBound);
 }