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


C# CharSetSolver.Accepts方法代码示例

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


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

示例1: TestLoopThatStartsWith0

 public void TestLoopThatStartsWith0()
 {
     string regex = @"(w(a|bc){0,2})";
     CharSetSolver css = new CharSetSolver(BitWidth.BV7);
     var aut = css.Convert(regex,RegexOptions.Singleline,true);
     //css.ShowGraph(aut, "CornerCase");
     var str = "w.-J_";
     var actual = css.Accepts(aut, str);
     var expected = Regex.IsMatch(str, regex);
     Assert.AreEqual(expected, actual);
 }
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:11,代码来源:MiscRegexConversionTests.cs

示例2: TestWordBoundaryCase

 public void TestWordBoundaryCase()
 {
     string s = "abc";
     string r = @"\b";
     CharSetSolver css = new CharSetSolver(BitWidth.BV7);
     var aut = css.Convert(r,RegexOptions.Singleline,true);
     //css.ShowGraph(aut, "test1");
     css.RegexConverter.EliminateBoundaryStates(aut);
     //css.ShowGraph(aut,"test2");
     Assert.IsTrue(css.Accepts(aut, s));
     Assert.IsTrue(Regex.IsMatch(s, r, RegexOptions.Singleline));
 }
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:12,代码来源:MiscRegexConversionTests.cs

示例3: TestTrivialWordBoundary4

        public void TestTrivialWordBoundary4()
        {
            Regex r = new Regex(@"^\b[[email protected]]\b$",RegexOptions.None);
            CharSetSolver css = new CharSetSolver(BitWidth.BV16);
            var aut = css.Convert(r.ToString(), RegexOptions.Singleline, true);
            //css.ShowGraph(aut, "TrivialWordBoundary4_with_b");
            css.RegexConverter.EliminateBoundaryStates(aut);
            var aut1 = aut.RemoveEpsilons().Determinize().Minimize();
            //css.ShowGraph(aut, "TrivialWordBoundary4");

            string s = "@";
            bool ismatchExpected = r.IsMatch(s);
            bool ismatchActual = css.Accepts(aut1, s);

            CheckValidity(css, aut, r);
        }
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:16,代码来源:MiscRegexConversionTests.cs

示例4: TestWordBoundary

        public void TestWordBoundary()
        {
            CharSetSolver css = new CharSetSolver(BitWidth.BV7);
            var regex = @"\b(@|A)B\b";

            Assert.IsTrue(Regex.IsMatch("AB", regex));
            Assert.IsTrue(Regex.IsMatch("[email protected]", regex));
            Assert.IsTrue(Regex.IsMatch("[email protected]&", regex));
            Assert.IsTrue(Regex.IsMatch("+AB+", regex));
            Assert.IsFalse(Regex.IsMatch("@B", regex));
            Assert.IsFalse(Regex.IsMatch("[email protected]_", regex));

            var aut = css.Convert(regex);//.RemoveEpsilons(css.MkOr).Determinize(css).Minimize(css);
            //css.ShowGraph(aut, "aut");

            Assert.IsTrue(css.Accepts(aut, "AB"));
            Assert.IsTrue(css.Accepts(aut, "[email protected]"));
            Assert.IsTrue(css.Accepts(aut, "[email protected]&"));
            Assert.IsTrue(css.Accepts(aut, "+AB+"));
            Assert.IsFalse(css.Accepts(aut, "@B"));
            Assert.IsFalse(css.Accepts(aut, "[email protected]_"));

            CheckValidity(css, aut, new Regex(regex, RegexOptions.Singleline));
        }
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:24,代码来源:MiscRegexConversionTests.cs

示例5: Accepts

        //returns true iff dfa accepts str
        private static bool Accepts(Automaton<BDD> dfa1,  string str, HashSet<char> al, CharSetSolver solver)
        {
            return solver.Accepts(dfa1, str);

            //int currState = dfa1.InitialState;
            //for (int i = 0; i < str.Length; i++)
            //{
            //    currState = GetNextState(currState, str[i], dfa1, solver);
            //    if (currState < 0)
            //        return false;
            //}
            //return dfa1.GetFinalStates().ToList().Contains(currState);
        }
开发者ID:AutomataTutor,项目名称:automatatutor-backend,代码行数:14,代码来源:DFAUtilities.cs


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