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


C# CharSetSolver.ReadFromRanges方法代码示例

本文整理汇总了C#中CharSetSolver.ReadFromRanges方法的典型用法代码示例。如果您正苦于以下问题:C# CharSetSolver.ReadFromRanges方法的具体用法?C# CharSetSolver.ReadFromRanges怎么用?C# CharSetSolver.ReadFromRanges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CharSetSolver的用法示例。


在下文中一共展示了CharSetSolver.ReadFromRanges方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BuildAutomaton


//.........这里部分代码省略.........
                    transitions.Add(transition);
                }
                else if (edgeLabels[e] == "C")
                {
                    int[] transition = new int[4];
                    transition[0] = e.Item1;
                    transition[1] = 67; // ASCII C
                    transition[2] = 67;
                    transition[3] = e.Item2;
                    transitions.Add(transition);
                }
                else if (edgeLabels[e] == "B")
                {
                    int[] transition = new int[4];
                    transition[0] = e.Item1;
                    transition[1] = 66; // ASCII B
                    transition[2] = 66;
                    transition[3] = e.Item2;
                    transitions.Add(transition);
                }
                else if (edgeLabels[e] == "E")
                {
                    int[] transition = new int[4];
                    transition[0] = e.Item1;
                    transition[1] = -1;
                    transition[2] = -1;
                    transition[3] = e.Item2;
                    transitions.Add(transition);
                }

            }

#if (DEBUG && !DEBUG_DETAIL)
            Console.Write(" \n Transitions before EPSILONS are added\n ");
            for (int i = 0; i < transitions.Count; i++)
            {
                int[] trans = transitions[i];
                Console.Write("\n From : " + trans[0].ToString() + "--- " + trans[1] + " --- " + " to : " + trans[3].ToString());
            }
#endif


#if DEBUG && !DEBUG_DETAIL
            Console.WriteLine(" ******* Printing initial states\n");
            foreach (int inits in initialStates) {

                Console.WriteLine("initial state is " + inits.ToString());
            }
#endif
            // get final states
            int[] finalSts = ComputeFinalStates(finalStates);
#if DEBUG && !DEBUG_DETAIL
            Console.WriteLine("\n*****Printing Finals states\n");
            foreach (int finals in finalSts)
            {
                Console.WriteLine(" final state " + finals.ToString());
            }
#endif
            int dummyInitial = Math.Abs(Guid.NewGuid().GetHashCode());
            foreach (int s in initialStates)
            {
                int[] transition = new int[4];
                transition[0] = dummyInitial;
                transition[1] = -1;
                transition[2] = -1;
                transition[3] = s;
                transitions.Add(transition);
            }

#if (DEBUG && !DEBUG_DETAIL)
            Console.Write(" \n Transitions are\n ");
            for (int i = 0; i < transitions.Count; i++)
            {
                int[] trans = transitions[i];
                Console.Write("\n From : " + trans[0].ToString() + "--- " + trans[1] + " --- " + " to : " + trans[3].ToString());
            }
#endif

            var solver = new CharSetSolver(BitWidth.BV7);
            // create Automaton
            Automaton<BvSet> yieldTypeCheckAutomaton = solver.ReadFromRanges(dummyInitial, finalSts, transitions);
#if DEBUG && !DEBUG_DETAIL
           Console.WriteLine("\n--Implementation Automaton--");
           foreach (var move in yieldTypeCheckAutomaton.GetMoves()) {
                 Console.WriteLine("\n "+ move.SourceState.ToString() + " -- " +  this.PrintEpsilon(move.Condition,solver)+ " --> " + move.TargetState.ToString() +" \n");
           }
           string implAutomatonGraphName = ytypeChecked.Proc.Name + "phaseNum__" + yTypeCheckCurrentPhaseNum.ToString();
           solver.ShowGraph(yieldTypeCheckAutomaton, implAutomatonGraphName+".dmgl");
#endif


#if DEBUG && !DEBUG_DETAIL
           Console.WriteLine("\n--Epsilons Reduced Automaton--");
           foreach (var move in epsilonReducedAtutomaton.GetMoves()) {
                 Console.WriteLine("\n "+ move.SourceState.ToString() + " -- " +  solver.PrettyPrint(move.Condition)+ " --> " + move.TargetState.ToString() +" \n");
           }
#endif
            return yieldTypeCheckAutomaton;

        }
开发者ID:Chenguang-Zhu,项目名称:ICE-C5,代码行数:101,代码来源:YieldTypeChecker.cs


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