Esempio n. 1
0
        public StatementViewModel(string statement, SimpleAcyclicDirectedGraph <string> variableGraph, IVariableEvaluator parentEvaluator)
        {
            Statement = statement;

            var graphVariableEvaluator = new GraphBuilderVariableEvaluator(variableGraph, null);

            _engine = new EvaluationEngine(new IVariableEvaluator[] { graphVariableEvaluator, parentEvaluator }, null);

            ParseStatement(statement);
            graphVariableEvaluator.AssociateVariable(_id);
            RefreshResult();
        }
 public CalculatorViewModel()
 {
     _variableGraph = new SimpleAcyclicDirectedGraph <string>();
     _statements    = new List <StatementViewModel <decimal> >();
     Statements     = new ReadOnlyCollection <StatementViewModel <decimal> >(_statements);
 }
 public GraphBuilderVariableEvaluator(SimpleAcyclicDirectedGraph <string> graph, string associatedVariable)
 {
     _graph = graph;
     _associatedVariable = associatedVariable;
 }