Beispiel #1
0
        protected override Expression VisitUnknown(Expression E)
        {
            Expression LE = Call.L(E, t, s);

            // Try applying a rule to E.
            Expression TLE = rules.Transform(LE);

            if (!ReferenceEquals(TLE, LE))
            {
                return(TLE);
            }

            // Try expanding E.
            Expression Ex = E.Expand(s);

            if (!Equals(E, Ex))
            {
                return(Visit(Ex));
            }

            // Try -L(-E, s, t)
            // TODO: It would be nice to handle this case in LinearTransform somehow.
            Expression NE  = Unary.Negate(E);
            Expression NEx = NE.Evaluate();

            if (!Equals(NE, NEx))
            {
                return(Unary.Negate(Visit(NEx)));
            }

            // Give up.
            return(LE);
        }
 protected override Expression VisitUnknown(Expression E)
 {
     if (E.Equals(x))
     {
         return(1);
     }
     else if (E.DependsOn(x))
     {
         return(rules.Transform(Call.D(E, x)));
     }
     else
     {
         return(0);
     }
 }
 protected override Expression VisitUnknown(Expression E)
 {
     return(rules.Transform(Call.D(E, x)));
 }