Lucene.Net.Util.OpenBitSet.Flip C# (CSharp) Method

Flip() public method

flips a bit, expanding the set size if necessary
public Flip ( long index ) : void
index long
return void
		public virtual void  Flip(long index)
		{
			int wordNum = ExpandingWordNum(index);
			int bit = (int) index & 0x3f; // mod 64
			long bitmask = 1L << bit;
			internalbits[wordNum] ^= bitmask;
		}
		

Same methods

OpenBitSet::Flip ( long startIndex, long endIndex ) : void

Usage Example

Example #1
0
        /// <summary>Note: The neededBounds iterator must be unsigned (easier understanding what's happening) </summary>
        protected internal virtual void  AssertIntRangeSplit(int lower, int upper, int precisionStep, bool useBitSet, System.Collections.IEnumerator neededBounds)
        {
            OpenBitSet bits = useBitSet?new OpenBitSet(upper - lower + 1):null;

            NumericUtils.SplitIntRange(new AnonymousClassIntRangeBuilder(lower, upper, useBitSet, bits, neededBounds, this), precisionStep, lower, upper);

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