Пример #1
0
        Calculate()
        {
            Semantics semantics = new Semantics(this);

            FormulaParser.Parser fp = new FP.Parser(Formula, semantics);
            fp.Parse();
            _value = fp.Result;
            Dirty  = false;
        }
Пример #2
0
        public Expression BuildExpression(string input, Expression baseExpression)
        {
            var scanner = new Scanner(new MemoryStream(Encoding.UTF8.GetBytes(input)));
            var parser = new Parser(scanner);

            parser.BaseExpression = baseExpression;
            parser.Parse();
            return parser.Output;
        }
Пример #3
0
        FindParents()
        {
            HashSet <FP.RangeToken> dependencies = new HashSet <FP.RangeToken>();
            Semantics semantics = new Semantics(this, dependencies);

            FP.Parser fp = new FormulaParser.Parser(Formula, semantics);
            fp.Parse();
            foreach (FP.RangeToken r in dependencies)
            {
                _parents.Add(r.Value);
            }
        }
Пример #4
0
 CalculateValues()
 {
     Cream.Network network = new Cream.Network();
     foreach (KeyValuePair <string, Cell> kvp in _cells)
     {
         kvp.Value.Variable = new Cream.IntVariable(network, kvp.Key);
     }
     foreach (KeyValuePair <string, Cell> kvp in _cells)
     {
         CP.Semantics semantics =
             new CP.Semantics(kvp.Value, _cells, network, _spreadSheet);
         FP.Parser fp = new FP.Parser(kvp.Value.Formula, semantics);
         fp.Parse();
     }
     Cream.Solver solver = new Cream.DefaultSolver(network);
     _lastSolution = solver.FindFirst();
 }
Пример #5
0
 private void FindParents()
 {
     HashSet<FP.RangeToken> dependencies = new HashSet<FP.RangeToken>();
       Semantics semantics = new Semantics(this, dependencies);
       FP.Parser fp = new FormulaParser.Parser(Formula, semantics);
       fp.Parse();
       foreach(FP.RangeToken r in dependencies) {
     _parents.Add(r.Value);
       }
 }
Пример #6
0
 public void Calculate()
 {
     Semantics semantics = new Semantics(this);
       FormulaParser.Parser fp = new FP.Parser(Formula, semantics);
       fp.Parse();
       _value = fp.Result;
       Dirty = false;
 }
Пример #7
0
 /// <summary>
 ///   Converts the constrained cells to a CSP, and gets the solution
 ///   from the solver.
 /// </summary>
 private void CalculateValues()
 {
     Cream.Network network = new Cream.Network();
       foreach(KeyValuePair<string, Cell> kvp in _cells) {
     kvp.Value.Variable = new Cream.IntVariable(network, kvp.Key);
       }
       foreach(KeyValuePair<string, Cell> kvp in _cells) {
     CP.Semantics semantics =
       new CP.Semantics(kvp.Value, _cells, network, _spreadSheet);
     FP.Parser fp = new FP.Parser(kvp.Value.Formula, semantics);
     fp.Parse();
       }
       Cream.Solver solver = new Cream.DefaultSolver(network);
       _lastSolution = solver.FindFirst();
 }