Exemplo n.º 1
0
 internal ExpressionEvaluator(string expression, NEVariables variables, int row, string unit)
 {
     this.expression = expression;
     this.variables  = variables;
     this.row        = row;
     this.unit       = unit;
 }
Exemplo n.º 2
0
 public List <T> EvaluateList <T>(NEVariables variables, int?rowCount = null, string unit = null)
 {
     try
     {
         if (rowCount < 0)
         {
             throw new ArgumentException($"{nameof(rowCount)} must be positive");
         }
         var count = rowCount ?? variables.ResultCount(Variables);
         return(Enumerable.Range(0, count).Select(row => ChangeType <T>(InternalEvaluate(variables, row, unit))).ToList());
     }
     catch (AggregateException ex) { throw ex.InnerException ?? ex; }
 }
Exemplo n.º 3
0
 public List <object> EvaluateList(NEVariables variables, int?rowCount = null, string unit = null) => EvaluateList <object>(variables, rowCount, unit);
Exemplo n.º 4
0
 public T Evaluate <T>(NEVariables variables  = null, string unit = null) => EvaluateList <T>(variables, 1, unit)[0];
Exemplo n.º 5
0
 public object Evaluate(NEVariables variables = null, string unit = null) => EvaluateList(variables, 1, unit)[0];
Exemplo n.º 6
0
 internal object InternalEvaluate(NEVariables variables, int row, string unit) => new ExpressionEvaluator(expression, variables, row, unit).Visit(tree);