コード例 #1
0
ファイル: SComb.cs プロジェクト: xach/jrm-code-project
        internal override PartialResult PartialEval(PartialEnvironment environment)
        {
            bool changed = false;

            PartialResult [] ra = new PartialResult [this.components.Length];
            for (int i = 0; i < this.components.Length; i++)
            {
                ra [i] = this.components [i].PartialEval(environment);
                if (ra [i].Residual != this.components [i])
                {
                    changed = true;
                }
            }
            if (changed)
            {
                SCode [] components = new SCode [ra.Length];
                for (int i = 0; i < ra.Length; i++)
                {
                    components [i] = ra [i].Residual;
                }
                return(new PartialResult(new Combination(components)));
            }
            else
            {
                return(new PartialResult(this));
            }
        }
コード例 #2
0
        internal override PartialResult PartialEval(PartialEnvironment environment)
        {
            PartialResult pred = this.predicate.PartialEval(environment);
            PartialResult alt  = this.alternative.PartialEval(environment);

            return(new PartialResult((pred.Residual == this.predicate &&
                                      alt.Residual == this.alternative) ? this : Disjunction.Make(pred.Residual, alt.Residual)));
        }
コード例 #3
0
ファイル: SComb3.cs プロジェクト: xach/jrm-code-project
        internal override PartialResult PartialEval(PartialEnvironment environment)
        {
            PartialResult rator = this.components [0].PartialEval(environment);
            PartialResult rand0 = this.components [1].PartialEval(environment);
            PartialResult rand1 = this.components [2].PartialEval(environment);
            PartialResult rand2 = this.components [3].PartialEval(environment);

            return(new PartialResult(rator.Residual == this.components [0] &&
                                     rand0.Residual == this.components [1] &&
                                     rand1.Residual == this.components [2] &&
                                     rand2.Residual == this.components [3] ? this : Combination3.Make(rator.Residual, rand0.Residual, rand1.Residual, rand2.Residual)));
        }
コード例 #4
0
ファイル: SComb.cs プロジェクト: xach/jrm-code-project
        internal override PartialResult PartialEval(PartialEnvironment environment)
        {
            PartialResult po = this.Operator.PartialEval(environment);

            return(new PartialResult((po.Residual == this.Operator) ? this : Combination0.Make(po.Residual)));
        }