コード例 #1
0
        public override void Solve()
        {
            base.Solve();

            var expressionGrammar = new LabGrammar();
            var language          = new LanguageData(expressionGrammar);
            var parser            = new Parser(language);
            var runtime           = new LabRuntime(language);

            ParseTree tree = parser.Parse(Function);

            if (tree.HasErrors())
            {
                Results.Add(new BoxModel("Error at parsing", "Syntax errors found. Abrting."));
                return;
            }

            if (Precision * Math.Abs(A - B) > 0.3 && Method != "simpson")
            {
                Results.Add(new BoxModel("Precision too small", "Use Simpson's method or make precisionne bigger"));
                return;
            }


            Results.AddRange(IntegralCalculator.Calculate(
                                 tree,
                                 runtime,
                                 A,
                                 B,
                                 Precision,
                                 Method,
                                 Subtype
                                 ));
        }
コード例 #2
0
        public FourthLab()
        {
            var expressionGrammar = new LabGrammar();

            _languageData = new LanguageData(expressionGrammar);
            var labRuntime = new LabRuntime(_languageData);

            _scriptApp = new ScriptApp(labRuntime);
        }
コード例 #3
0
        public ThirdLabModel()
        {
            _random = new Random(Seed);

            var expressionGrammar = new LabGrammar();

            _languageData = new LanguageData(expressionGrammar);
            var labRuntime = new LabRuntime(_languageData);

            _scriptApp = new ScriptApp(labRuntime);
        }