• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Schema.BitSet类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: WriteBitSet

 internal static void WriteBitSet(BitSet curpos) {
     int[] list = new int[curpos.Count];
     for (int pos = curpos.NextSet(-1); pos != -1; pos = curpos.NextSet(pos)) {
         list[pos] = 1;
     }
     for(int i = 0; i < list.Length; i++) {
         Debug.WriteIf(DiagnosticsSwitches.XmlSchemaContentModel.Enabled, list[i] + " ");
     }
     Debug.WriteLineIf(DiagnosticsSwitches.XmlSchemaContentModel.Enabled, "");
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:10,代码来源:ContentValidator.cs


示例17: RangeContentValidator

 internal RangeContentValidator(
     BitSet firstpos, BitSet[] followpos, SymbolsDictionary symbols, Positions positions, int endMarkerPos, XmlSchemaContentType contentType, bool isEmptiable, BitSet positionsWithRangeTerminals, int minmaxNodesCount)  : base(contentType, false, isEmptiable) {
     this.firstpos = firstpos;
     this.followpos = followpos;
     this.symbols = symbols;
     this.positions = positions;
     this.positionsWithRangeTerminals = positionsWithRangeTerminals;
     this.minMaxNodesCount = minmaxNodesCount;
     this.endMarkerPos = endMarkerPos;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:10,代码来源:ContentValidator.cs


示例18: ExpectedElements

 public override ArrayList ExpectedElements(ValidationState context, bool isRequiredOnly) {
     ArrayList names = null;
     BitSet expectedPos;
     if (context.RunningPositions != null) {
         List<RangePositionInfo> runningPositions = context.RunningPositions;
         expectedPos = new BitSet(positions.Count);
         for (int i = context.CurrentState.NumberOfRunningPos - 1; i >=0; i--) {
             Debug.Assert(runningPositions[i].curpos != null);
             expectedPos.Or(runningPositions[i].curpos);
         }
         for (int pos = expectedPos.NextSet(-1); pos != -1; pos = expectedPos.NextSet(pos)) {
             if (names == null) {
                 names = new ArrayList();
             }
             int symbol = positions[pos].symbol;
             if (symbol >= 0) { //non range nodes
                 XmlSchemaParticle p = positions[pos].particle as XmlSchemaParticle;
                 if (p == null) {
                     string s = symbols.NameOf(positions[pos].symbol);
                     if (s.Length != 0) {
                         names.Add(s);
                     }
                 }
                 else {
                     string s = p.NameString;
                     if (!names.Contains(s)) {
                         names.Add(s);
                     }
                 }
             }
         }
     }
     return names;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:34,代码来源:ContentValidator.cs


示例19: ExpectedParticles

 public override ArrayList ExpectedParticles(ValidationState context, bool isRequiredOnly, XmlSchemaSet schemaSet) {
     ArrayList particles = new ArrayList();
     BitSet expectedPos;
     if (context.RunningPositions != null) {
         List<RangePositionInfo> runningPositions = context.RunningPositions;
         expectedPos = new BitSet(positions.Count);
         for (int i = context.CurrentState.NumberOfRunningPos - 1; i >=0; i--) { 
             Debug.Assert(runningPositions[i].curpos != null);
             expectedPos.Or(runningPositions[i].curpos);
         }
         for (int pos = expectedPos.NextSet(-1); pos != -1; pos = expectedPos.NextSet(pos)) {
             int symbol = positions[pos].symbol;
             if (symbol >= 0) { //non range nodes
                 XmlSchemaParticle p = positions[pos].particle as XmlSchemaParticle;
                 if (p == null) {
                    continue;
                 }
                 AddParticleToExpected(p, schemaSet, particles);
             }
         }
     }
     return particles;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:23,代码来源:ContentValidator.cs


示例20: IsSequenceFromAll

 private bool IsSequenceFromAll(XmlSchemaSequence derivedSequence, XmlSchemaAll baseAll) {
     if (!IsValidOccurrenceRangeRestriction(derivedSequence, baseAll) || derivedSequence.Items.Count > baseAll.Items.Count) {
         return false;
     }
     BitSet map = new BitSet(baseAll.Items.Count);
     for (int j = 0; j < derivedSequence.Items.Count; ++j) {
         int i = GetMappingParticle((XmlSchemaParticle)derivedSequence.Items[j], baseAll.Items);
         if (i >= 0) {
             if (map[i]) {
                 return false;
             }
             else {
                 map.Set(i);
             }
         }
         else {
             return false;
         }
     }
     for (int i = 0; i < baseAll.Items.Count; i++) {
         if (!map[i] && !IsParticleEmptiable((XmlSchemaParticle)baseAll.Items[i])) {
             return false;
         }
     }
     return true;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:26,代码来源:SchemaSetCompiler.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Schema.SchemaAttDef类代码示例发布时间:2022-05-26
下一篇:
C# Linq.XText类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap