System.Xml.Schema.BitSet.NextSet C# (CSharp) Method

NextSet() public method

public NextSet ( int startFrom ) : int
startFrom int
return int
        public int NextSet(int startFrom) {
            Debug.Assert(startFrom >= -1 && startFrom <= count);
            int offset = startFrom + 1;
            if (offset == count) {
                return -1;
            }
            int nBitSlot = Subscript(offset);
            offset &= bitSlotMask;
            uint word = bits[nBitSlot] >> offset;
            // locate non-empty slot
            while (word == 0) {
                if ((++ nBitSlot) == bits.Length ) {
                    return -1;
                }
                offset = 0;
                word = bits[nBitSlot];
            }
            while ((word & (uint)1) == 0) {
                word >>= 1;
                offset ++;
            }
            return (nBitSlot << bitSlotShift) + offset;
        }

Usage Example

        public override void ConstructPos(BitSet firstpos, BitSet lastpos, BitSet[] followpos)
        {
            BitSet set = new BitSet(lastpos.Count);

            base.LeftChild.ConstructPos(firstpos, set, followpos);
            BitSet set2 = new BitSet(firstpos.Count);

            base.RightChild.ConstructPos(set2, lastpos, followpos);
            if (base.LeftChild.IsNullable && !base.RightChild.IsRangeNode)
            {
                firstpos.Or(set2);
            }
            if (base.RightChild.IsNullable)
            {
                lastpos.Or(set);
            }
            for (int i = set.NextSet(-1); i != -1; i = set.NextSet(i))
            {
                followpos[i].Or(set2);
            }
            if (base.RightChild.IsRangeNode)
            {
                ((LeafRangeNode)base.RightChild).NextIteration = firstpos.Clone();
            }
        }
All Usage Examples Of System.Xml.Schema.BitSet::NextSet