Sage Modeling and Simulation Library

EvaluatorFactory Class

The Evaluator Factory creates objects that can evaluate expressions provided by the caller. First an expression is provided and compiled into an object that can evaluate it - that object is passed back as an Evaluator delegate. Then later the Evaluator delegate is called with the values appropriate to the variables that are a part of the pre-provided expression. The result of this evaluation is the (double) value that is computed.
The body of the evaluator can be any compilable statement. If the evaluator is to return a value, the body must assign that value to the (predefined) variable "Result".
The ArgNames array is an array of strings that contain the names of the arguments to the evaluation of the expression. The defaults of those argNames is:


An example of using this class might be as follows:

Evaluator eval = EvaluatorFactory.CreateEvaluator("Result = RA+(RB/RC);",new string[]{"RA","RB","RC"});
...and this eval could later be called with:
which would result in 3.8 being written to the Trace.

Namespace:  Highpoint.Sage.SimCore
Assembly:  Sage4 (in Sage4.dll)


public static class EvaluatorFactory

Inheritance Hierarchy