Length() public method

public Length ( ) : int
return int
コード例 #1
0
 /// <summary>
 /// If the given <seealso cref="FixedBitSet"/> is large enough to hold {@code numBits},
 /// returns the given bits, otherwise returns a new <seealso cref="FixedBitSet"/> which
 /// can hold the requested number of bits.
 ///
 /// <p>
 /// <b>NOTE:</b> the returned bitset reuses the underlying {@code long[]} of
 /// the given {@code bits} if possible. Also, calling <seealso cref="#length()"/> on the
 /// returned bits may return a value greater than {@code numBits}.
 /// </summary>
 public static FixedBitSet EnsureCapacity(FixedBitSet bits, int numBits)
 {
     if (numBits < bits.Length())
     {
         return(bits);
     }
     else
     {
         int    numWords = Bits2words(numBits);
         long[] arr      = bits.Bits;
         if (numWords >= arr.Length)
         {
             arr = ArrayUtil.Grow(arr, numWords + 1);
         }
         return(new FixedBitSet(arr, arr.Length << 6));
     }
 }
コード例 #2
0
ファイル: FixedBitSet.cs プロジェクト: leotohill/lucene.net
        /// <summary>
        /// returns true if both sets have the same bits set </summary>
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (!(o is FixedBitSet))
            {
                return(false);
            }
            FixedBitSet other = (FixedBitSet)o;

            if (NumBits != other.Length())
            {
                return(false);
            }
            return(Arrays.Equals(bits, other.bits));
        }
コード例 #3
0
ファイル: FixedBitSet.cs プロジェクト: Cefa68000/lucenenet
 /// <summary>
 /// If the given <seealso cref="FixedBitSet"/> is large enough to hold {@code numBits},
 /// returns the given bits, otherwise returns a new <seealso cref="FixedBitSet"/> which
 /// can hold the requested number of bits.
 ///
 /// <p>
 /// <b>NOTE:</b> the returned bitset reuses the underlying {@code long[]} of
 /// the given {@code bits} if possible. Also, calling <seealso cref="#length()"/> on the
 /// returned bits may return a value greater than {@code numBits}.
 /// </summary>
 public static FixedBitSet EnsureCapacity(FixedBitSet bits, int numBits)
 {
     if (numBits < bits.Length())
     {
         return bits;
     }
     else
     {
         int numWords = Bits2words(numBits);
         long[] arr = bits.Bits;
         if (numWords >= arr.Length)
         {
             arr = ArrayUtil.Grow(arr, numWords + 1);
         }
         return new FixedBitSet(arr, arr.Length << 6);
     }
 }