Lucene.Net.Util.FixedBitSet.Cardinality C# (CSharp) Метод

Cardinality() публичный Метод

Returns number of set bits. NOTE: this visits every long in the backing bits array, and the result is not internally cached!
public Cardinality ( ) : int
Результат int
        public int Cardinality()
        {
            return (int)BitUtil.Pop_array(bits, 0, bits.Length);
        }

Usage Example

Пример #1
0
        /// <summary>
        /// Note: The neededBounds Iterable must be unsigned (easier understanding what's happening) </summary>
        private void AssertIntRangeSplit(int lower, int upper, int precisionStep, bool useBitSet, IEnumerable <int> expectedBounds, IEnumerable <int> expectedShifts)
        {
            FixedBitSet       bits         = useBitSet ? new FixedBitSet(upper - lower + 1) : null;
            IEnumerator <int> neededBounds = (expectedBounds == null) ? null : expectedBounds.GetEnumerator();
            IEnumerator <int> neededShifts = (expectedShifts == null) ? null : expectedShifts.GetEnumerator();

            NumericUtils.SplitInt32Range(new IntRangeBuilderAnonymousInnerClassHelper(this, lower, upper, useBitSet, bits, neededBounds, neededShifts), precisionStep, lower, upper);

            if (useBitSet)
            {
                // after flipping all bits in the range, the cardinality should be zero
                bits.Flip(0, upper - lower + 1);
                Assert.AreEqual(0, bits.Cardinality(), "The sub-range concenated should match the whole range");
            }
        }
All Usage Examples Of Lucene.Net.Util.FixedBitSet::Cardinality