System.Xml.Schema.SequenceNode.ConstructPos C# (CSharp) Method

ConstructPos() public method

public ConstructPos ( BitSet firstpos, BitSet lastpos, BitSet followpos ) : void
firstpos BitSet
lastpos BitSet
followpos BitSet
return void
        public override void ConstructPos(BitSet firstpos, BitSet lastpos, BitSet[] followpos) {
            BitSet lastposLeft = new BitSet(lastpos.Count);
            LeftChild.ConstructPos(firstpos, lastposLeft, followpos);

            BitSet firstposRight = new BitSet(firstpos.Count);
            RightChild.ConstructPos(firstposRight, lastpos, followpos);

            if (LeftChild.IsNullable && !RightChild.IsRangeNode) {
                firstpos.Or(firstposRight);
            }
            if (RightChild.IsNullable) {
                lastpos.Or(lastposLeft);
            }
            for (int pos = lastposLeft.NextSet(-1); pos != -1; pos = lastposLeft.NextSet(pos)) {
                followpos[pos].Or(firstposRight);
            }
            if (RightChild.IsRangeNode) { //firstpos is leftchild.firstpos as the or with firstposRight has not been done as it is a rangenode
                ((LeafRangeNode)RightChild).NextIteration = firstpos.Clone();
            }
        }

Usage Example

 public ContentValidator Finish(bool useDFA)
 {
     if (this.contentNode == null)
     {
         if (base.ContentType != XmlSchemaContentType.Mixed)
         {
             return ContentValidator.Empty;
         }
         bool isOpen = base.IsOpen;
         if (!base.IsOpen)
         {
             return ContentValidator.TextOnly;
         }
         return ContentValidator.Any;
     }
     InteriorNode parent = new SequenceNode {
         LeftChild = this.contentNode
     };
     LeafNode node2 = new LeafNode(this.positions.Add(this.symbols.AddName(XmlQualifiedName.Empty, null), null));
     parent.RightChild = node2;
     this.contentNode.ExpandTree(parent, this.symbols, this.positions);
     int count = this.symbols.Count;
     int num = this.positions.Count;
     BitSet firstpos = new BitSet(num);
     BitSet lastpos = new BitSet(num);
     BitSet[] followpos = new BitSet[num];
     for (int i = 0; i < num; i++)
     {
         followpos[i] = new BitSet(num);
     }
     parent.ConstructPos(firstpos, lastpos, followpos);
     if (this.minMaxNodesCount > 0)
     {
         BitSet set3;
         BitSet[] minmaxFollowPos = this.CalculateTotalFollowposForRangeNodes(firstpos, followpos, out set3);
         if (this.enableUpaCheck)
         {
             this.CheckCMUPAWithLeafRangeNodes(this.GetApplicableMinMaxFollowPos(firstpos, set3, minmaxFollowPos));
             for (int j = 0; j < num; j++)
             {
                 this.CheckCMUPAWithLeafRangeNodes(this.GetApplicableMinMaxFollowPos(followpos[j], set3, minmaxFollowPos));
             }
         }
         return new RangeContentValidator(firstpos, followpos, this.symbols, this.positions, node2.Pos, base.ContentType, parent.LeftChild.IsNullable, set3, this.minMaxNodesCount);
     }
     int[][] transitionTable = null;
     if (!this.symbols.IsUpaEnforced)
     {
         if (this.enableUpaCheck)
         {
             this.CheckUniqueParticleAttribution(firstpos, followpos);
         }
     }
     else if (useDFA)
     {
         transitionTable = this.BuildTransitionTable(firstpos, followpos, node2.Pos);
     }
     if (transitionTable != null)
     {
         return new DfaContentValidator(transitionTable, this.symbols, base.ContentType, base.IsOpen, parent.LeftChild.IsNullable);
     }
     return new NfaContentValidator(firstpos, followpos, this.symbols, this.positions, node2.Pos, base.ContentType, base.IsOpen, parent.LeftChild.IsNullable);
 }
All Usage Examples Of System.Xml.Schema.SequenceNode::ConstructPos