当前位置: 首页>>代码示例>>C#>>正文


C# Schema.BitSet类代码示例

本文整理汇总了C#中System.Xml.Schema.BitSet的典型用法代码示例。如果您正苦于以下问题:C# BitSet类的具体用法?C# BitSet怎么用?C# BitSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BitSet类属于System.Xml.Schema命名空间,在下文中一共展示了BitSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NfaContentValidator

 internal NfaContentValidator(BitSet firstpos, BitSet[] followpos, SymbolsDictionary symbols, Positions positions, int endMarkerPos, XmlSchemaContentType contentType, bool isOpen, bool isEmptiable) : base(contentType, isOpen, isEmptiable)
 {
     this.firstpos = firstpos;
     this.followpos = followpos;
     this.symbols = symbols;
     this.positions = positions;
     this.endMarkerPos = endMarkerPos;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:NfaContentValidator.cs

示例2: ConstructPos

 public override void ConstructPos(BitSet firstpos, BitSet lastpos, BitSet[] followpos)
 {
     base.LeftChild.ConstructPos(firstpos, lastpos, followpos);
     for (int i = lastpos.NextSet(-1); i != -1; i = lastpos.NextSet(i))
     {
         followpos[i].Or(firstpos);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:StarNode.cs

示例3: ConstructPos

 public override void ConstructPos(BitSet firstpos, BitSet lastpos, BitSet[] followpos)
 {
     base.LeftChild.ConstructPos(firstpos, lastpos, followpos);
     BitSet set = new BitSet(firstpos.Count);
     BitSet set2 = new BitSet(lastpos.Count);
     base.RightChild.ConstructPos(set, set2, followpos);
     firstpos.Or(set);
     lastpos.Or(set2);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:ChoiceNode.cs

示例4: Or

        internal void Or(BitSet set) {
            if (this == set) {
                return;
            }

            int setLength = set._length;
            EnsureLength(setLength);
            for (int i = setLength; i-- > 0 ;) {
                _bits[i] |= set._bits[i];
            }
        }
开发者ID:ArildF,项目名称:masters,代码行数:11,代码来源:bitset.cs

示例5: And

 public void And(BitSet other)
 {
     if (this != other)
     {
         int length = this.bits.Length;
         int num2 = other.bits.Length;
         int index = (length > num2) ? num2 : length;
         int num4 = index;
         while (num4-- > 0)
         {
             this.bits[num4] &= other.bits[num4];
         }
         while (index < length)
         {
             this.bits[index] = 0;
             index++;
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:19,代码来源:BitSet.cs

示例6: And

        internal void And(BitSet set) {
            /*
             * Need to synchronize  both this and set->
             * This might lead to deadlock if one thread grabs them in one order
             * while another thread grabs them the other order.
             * Use a trick from Doug Lea's book on concurrency,
             * somewhat complicated because BitSet overrides hashCode().
             */
            if (this == set) {
                return;
            }

            int bitsLength = _length;
            int setLength = set._length;
            int n = (bitsLength > setLength) ? setLength : bitsLength;
            for (int i = n ; i-- > 0 ;) {
                _bits[i] &= set._bits[i];
            }
            for (; n < bitsLength ; n++) {
                _bits[n] = 0;
            }
        }
开发者ID:ArildF,项目名称:masters,代码行数:22,代码来源:bitset.cs

示例7: ConstructPos

 public override void ConstructPos(BitSet firstpos, BitSet lastpos, BitSet[] followpos) {
     throw new InvalidOperationException();
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:3,代码来源:ContentValidator.cs

示例8: ConstructChildPos

 private static void ConstructChildPos(SyntaxTreeNode child, BitSet firstpos, BitSet lastpos, BitSet[] followpos) {
     BitSet firstPosTemp = new BitSet(firstpos.Count);
     BitSet lastPosTemp = new BitSet(lastpos.Count);
     child.ConstructPos(firstPosTemp, lastPosTemp, followpos);
     firstpos.Or(firstPosTemp);
     lastpos.Or(lastPosTemp);
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:ContentValidator.cs

示例9: WritePos

        internal static void WritePos(BitSet firstpos, BitSet lastpos, BitSet[] followpos) {
            Debug.WriteLineIf(DiagnosticsSwitches.XmlSchemaContentModel.Enabled, "FirstPos:  ");
            WriteBitSet(firstpos);

            Debug.WriteLineIf(DiagnosticsSwitches.XmlSchemaContentModel.Enabled, "LastPos:  ");
            WriteBitSet(lastpos);

            Debug.WriteLineIf(DiagnosticsSwitches.XmlSchemaContentModel.Enabled, "Followpos:  ");
            for(int i =0; i < followpos.Length; i++) {
                WriteBitSet(followpos[i]);
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:12,代码来源:ContentValidator.cs

示例10: SequenceConstructPosContext

            public SequenceConstructPosContext(SequenceNode node, BitSet firstpos, BitSet lastpos) {
                this_ = node;
                this.firstpos = firstpos;
                this.lastpos = lastpos;

                lastposLeft = null;
                firstposRight = null;
            }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:8,代码来源:ContentValidator.cs

示例11: CheckUniqueParticleAttribution

 private void CheckUniqueParticleAttribution(BitSet curpos) {
     // particles will be attributed uniquely if the same symbol never poins to two different ones
     object[] particles = new object[symbols.Count]; 
     for (int pos = curpos.NextSet(-1); pos != -1; pos = curpos.NextSet(pos)) {
         // if position can follow
         int symbol = positions[pos].symbol;
         if (particles[symbol] == null) {
             // set particle for the symbol
             particles[symbol] = positions[pos].particle;
         }
         else if (particles[symbol] != positions[pos].particle) {
             throw new UpaException(particles[symbol], positions[pos].particle);
         }
         // two different position point to the same symbol and particle - that's OK
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:16,代码来源:ContentValidator.cs

示例12: GetApplicableMinMaxFollowPos

 //For each position, this method calculates the additional follows of any range nodes that need to be added to its followpos
 //((ab?)2-4)c, Followpos of a is b as well as that of node R(2-4) = c
 private BitSet GetApplicableMinMaxFollowPos(BitSet curpos, BitSet posWithRangeTerminals, BitSet[] minmaxFollowPos) {
     if (curpos.Intersects(posWithRangeTerminals)) {
         BitSet newSet = new BitSet(positions.Count); //Doing work again 
         newSet.Or(curpos);
         newSet.And(posWithRangeTerminals);
         curpos = curpos.Clone();
         for (int pos = newSet.NextSet(-1); pos != -1; pos = newSet.NextSet(pos)) {
             LeafRangeNode lrNode = positions[pos].particle as LeafRangeNode;
             curpos.Or(minmaxFollowPos[lrNode.Pos]);
         }
     }
     return curpos;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:15,代码来源:ContentValidator.cs

示例13: CheckCMUPAWithLeafRangeNodes

 private void CheckCMUPAWithLeafRangeNodes(BitSet curpos) {
     object[] symbolMatches = new object[symbols.Count];
     for (int pos = curpos.NextSet(-1); pos != -1; pos = curpos.NextSet(pos)) {
         Position currentPosition = positions[pos];
         int symbol = currentPosition.symbol;
         if (symbol >= 0) { //its not a range position
             if (symbolMatches[symbol] != null) {
                 throw new UpaException(symbolMatches[symbol], currentPosition.particle);
             }
             else {
                 symbolMatches[symbol] = currentPosition.particle;
             }
         }
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:15,代码来源:ContentValidator.cs

示例14: BuildTransitionTable

        /// <summary>
        /// Algorithm 3.5 Construction of a DFA from a regular expression
        /// </summary>
        private int[][] BuildTransitionTable(BitSet firstpos, BitSet[] followpos, int endMarkerPos) {
            const int TimeConstant = 8192; //(MaxStates * MaxPositions should be a constant) 
            int positionsCount = positions.Count;
            int MaxStatesCount = TimeConstant / positionsCount;
            int symbolsCount = symbols.Count;
            
            // transition table (Dtran in the book)
            ArrayList transitionTable = new ArrayList();
            
            // state lookup table (Dstate in the book)
            Hashtable stateTable = new Hashtable();
            
            // Add empty set that would signal an error
            stateTable.Add(new BitSet(positionsCount), -1);

            // lists unmarked states
            Queue unmarked = new Queue();

            // initially, the only unmarked state in Dstates is firstpo(root) 
            int state = 0;
            unmarked.Enqueue(firstpos);
            stateTable.Add(firstpos, 0);
            transitionTable.Add(new int[symbolsCount + 1]);

            // while there is an umnarked state T in Dstates do begin
            while (unmarked.Count > 0) {
                BitSet statePosSet = (BitSet)unmarked.Dequeue(); // all positions that constitute DFA state 
                Debug.Assert(state == (int)stateTable[statePosSet]); // just make sure that statePosSet is for correct state
                int[] transition = (int[])transitionTable[state];
                if (statePosSet[endMarkerPos]) {
                    transition[symbolsCount] = 1;   // accepting
                }

                // for each input symbol a do begin
                for (int symbol = 0; symbol < symbolsCount; symbol ++) {
                    // let U be the set of positions that are in followpos(p)
                    //       for some position p in T
                    //       such that the symbol at position p is a
                    BitSet newset = new BitSet(positionsCount);
                    for (int pos = statePosSet.NextSet(-1); pos != -1; pos = statePosSet.NextSet(pos)) {
                        if (symbol == positions[pos].symbol) {
                            newset.Or(followpos[pos]);
                        }
                    }

                    // if U is not empty and is not in Dstates then
                    //      add U as an unmarked state to Dstates
                    object lookup = stateTable[newset];
                    if (lookup != null) {
                        transition[symbol] = (int)lookup;
                    }
                    else {
                        // construct new state
                        int newState = stateTable.Count - 1;
                        if (newState >= MaxStatesCount) {
                            return null;
                        }
                        unmarked.Enqueue(newset);
                        stateTable.Add(newset, newState);
                        transitionTable.Add(new int[symbolsCount + 1]);
                        transition[symbol] = newState;
                    }
                }
                state++;
            }
            // now convert transition table to array
            return (int[][])transitionTable.ToArray(typeof(int[]));
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:71,代码来源:ContentValidator.cs

示例15: Dump

 private void Dump(StringBuilder bb, BitSet[] followpos, int[][] transitionTable) {
     // Temporary printout
     bb.AppendLine("Positions");
     for (int i = 0; i < positions.Count; i ++) {
         bb.AppendLine(i + " " + positions[i].symbol.ToString(NumberFormatInfo.InvariantInfo) + " " + symbols.NameOf(positions[i].symbol));
     }
     bb.AppendLine("Followpos");
     for (int i = 0; i < positions.Count; i++) {
         for (int j = 0; j < positions.Count; j++) {
             bb.Append(followpos[i][j] ? "X" : "O");
         }
        bb.AppendLine();
     }
     if (transitionTable != null) {
         // Temporary printout
         bb.AppendLine("Transitions");
         for (int i = 0; i < transitionTable.Length; i++) {
             for (int j = 0; j < symbols.Count; j++) {
                 if (transitionTable[i][j] == -1) {
                     bb.Append("  x  ");
                 }
                 else {
                     bb.AppendFormat(" {0:000} ", transitionTable[i][j]);
                 }
             }
             bb.AppendLine(transitionTable[i][symbols.Count] == 1 ? "+" : "");
         }
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:29,代码来源:ContentValidator.cs


注:本文中的System.Xml.Schema.BitSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。