Esempio n. 1
0
 void PrintExpressionListDebug()
 {
     foreach (Expression x in theExpressionList)
     {
         ExpressionPrinter x1 = new ExpressionPrinter(x);
         x1.Print();
     }
 }
Esempio n. 2
0
 public void PrintEntireExpressionList()
 {
     foreach (Expression x in theExpressionList)
     {
         ExpressionPrinter c = new ExpressionPrinter(x);
         c.Print();
     }
 }
        private ITableAxis <TStorage> CreateExplicitAxis(string title, Expression <Func <TItem, bool> >[] selectors)
        {
            var items = selectors.Select(i => (Name: ExpressionPrinter.Print(i), Func: i.Compile()));

            return(new TableAxis <TStorage>(title,
                                            items.Select(j => new TableRowOrColumn <TStorage>(j.Name,
                                                                                              Items.Where(k => j.Func(FromStorage(k)))))
                                            ));
        }
Esempio n. 4
0
 void Observer()
 {
     if (Checker.isNumberDeclaration(givenExpression) && !Checker.ifContainOperations(givenExpression))
     {
         MakeNumber();
     }
     else if (Checker.isMatrixDeclaration(givenExpression) && !Checker.ifContainMatOperations(givenExpression) && Checker.isMinusIncludedInMatrix(givenExpression))
     {
         MakeMatrix();
     }
     else
     {
         if (Checker.ifContainOperations(givenExpression))                       // if the expression is a mathematical one.
         {
             EquationHead.EquationWatch theEquationSolution = new EquationHead.EquationWatch(theExpressionList, givenExpression);
             if (theEquationSolution.isProcessed())
             {
                 theResult = new Expression(theEquationSolution.getSolution());
                 if (theResult.getExpType() == 1)
                 {
                     theResult.setEntireTag(autoMatrixNamer());
                 }
                 else if (theResult.getExpType() == 2)
                 {
                     theResult.setEntireTag(autoNumberNamer());
                 }
                 Processed = true;
             }
             else
             {
                 Processed = false;
             }
         }
         else if (!Checker.ifPrefixExist(givenExpression) && !Checker.isConstant(givenExpression) && SearchList(givenExpression))                          // for searching a quried variable
         {
             Processed = false;
         }
         else if (!Checker.ifPrefixExist(givenExpression) && Checker.isConstant(givenExpression))
         {
             Processed = false;
             ExpressionPrinter p = new ExpressionPrinter(theConstantList.getConstant(givenExpression));
             p.Print();
         }
         else if (Checker.ifPrefixExist(givenExpression))
         {
             Processed = false;
             ExpressionPrinter p = new ExpressionPrinter(pUnderstander.prefixList(givenExpression));
             p.Print();
         }
         else
         {
             TheMessageHandler.MessagePrinter.Print("Variable does not exist");
             Processed = false;
         }
     }
 }
        public void TestDynamicExpression()
        {
            Expression e = new AdditionExpression(new DoubleExpression(1),
                                                  new AdditionExpression(new DoubleExpression(2), new DoubleExpression(3)));
            var ep = new ExpressionPrinter();
            var sb = new StringBuilder();

            ep.Print((dynamic)e, sb);
            Console.WriteLine(sb);
        }
Esempio n. 6
0
 public void Printer()     // printes the expressions of the Expression List
 {
     if (printExp)
     {
         ExpressionPrinter x = new ExpressionPrinter(theExpressionList [counter]);
         x.Print();
         counter++;
     }
     //autoDestroyer ();
 }
Esempio n. 7
0
        bool SearchList(string exp)           // searches the list for queried variable and returns a bool if found = true and
        {                                     // false if not found
            bool found = false;

            foreach (Expression x in theExpressionList)
            {
                if (x.getTag() == exp)
                {
                    ExpressionPrinter p = new ExpressionPrinter(x);
                    p.Print();
                    found = true;
                    break;
                }
            }
            return(found);
        }
Esempio n. 8
0
        /// ///////////////////////////////////////////////////////////////////////////

        bool DoesNotAlreadyExist(Expression theResult)
        {
            bool notfound = true;

            foreach (Expression x in theExpressionList)
            {
                if (x.getTag() == theResult.getTag())
                {
                    theExpressionList [theExpressionList.IndexOf(x)] = theResult;
                    notfound = false;
                    break;
                }
            }
            if (notfound == false)
            {
                ExpressionPrinter exp = new ExpressionPrinter(theResult);
                exp.Print();
            }
            return(notfound);
        }
Esempio n. 9
0
        /// ///////////////////////////////////////////////////////////////////////////

        bool DoesNotAlreadyExist(Expression theResult)
        {
            bool notfound = true;

            foreach (Expression x in theExpressionList)
            {
                if (x.getTag() == theResult.getTag())
                {
                    theExpressionList [theExpressionList.IndexOf(x)] = theResult;
                    notfound = false;
                    break;
                }
            }
            if (notfound == false)
            {
                TheMessageHandler.MessagePrinter.Print("A variable with the same name existed so I have overriden the data.");
                ExpressionPrinter exp = new ExpressionPrinter(theResult);
                exp.Print();
            }
            return(notfound);
        }
Esempio n. 10
0
 internal override string PrintTree(ExpressionPrinter printer)
 {
     return printer.Print(this); 
 }
 public ITable <TItem> WithColumns <TKey>(Expression <Func <TItem, TKey> > selector) =>
 WithColumns(ExpressionPrinter.Print(selector), selector.Compile());
 internal override string PrintTree(ExpressionPrinter printer)
 {
     return(printer.Print(this));
 }
 public void SimplePropertyaCCESS()
 {
     Assert.Equal("Length", ExpressionPrinter.Print((string s) => s.Length));
 }
 public void NullCoalescing()
 {
     Assert.Equal("Reverse()", ExpressionPrinter.Print((string s) => s.Reverse() ?? ""));
 }
Esempio n. 15
0
 public static UnivariateSummary <T> UnivariateSummary <T>(this IEnumerable <T> data, Expression <Func <T, bool> > outcome) =>
 new UnivariateSummary <T>(data, ExpressionPrinter.Print(outcome), outcome.Compile());
Esempio n. 16
0
 public UnivariateSummary <T> WithVariable(Expression <Func <T, object> > variable) =>
 WithVariable(ExpressionPrinter.Print(variable), variable.Compile());
Esempio n. 17
0
 protected override void Print(ExpressionPrinter expressionPrinter)
 {
     expressionPrinter.Print(Expression);
 }
Esempio n. 18
0
 public override void Print(ExpressionPrinter expressionPrinter)
 {
     expressionPrinter.Print(Expression);
 }
Esempio n. 19
0
 public TFinalType WithVariable(Expression <Func <T, bool?> > selector) =>
 WithVariable(ExpressionPrinter.Print(selector), selector.Compile());
Esempio n. 20
0
 public TFinalType WithDummyVariable <TVariable>(Expression <Func <T, TVariable?> > selector,
                                                 TVariable?referrant = null) where TVariable : struct =>
 WithDummyVariable(ExpressionPrinter.Print(selector), selector.Compile(), referrant);
Esempio n. 21
0
 public TFinalType WithDummyVariable <TVariable>(Expression <Func <T, TVariable> > selector, TVariable referrant = null,
                                                 RequireClass <TVariable> reserved = null) where TVariable : class =>
 WithDummyVariable(ExpressionPrinter.Print(selector), selector.Compile(), referrant, reserved);