Concepts of the Equation Solver

Links: External Links:

The Equation Solver is .NET Standard class library that implements a state machine defined as:

"In general, a state machine is any device that stores the status of something at a given time and can operate on input to change the status and/or cause an action or output to take place for any given change." from: Defintion of State Machine

The state of the Equation Solver is maintained as a collection of Variables which always provide the current value as numbers, strings, and booleans.

The variable are modified by the execution of equations whose targets are the those variables.

What is a Variable?

A .NET Standard Class that encapsulates values for a specific, unique key (name). Every Variable must have a name and values. The values of a Variable for short, int, long, decimal, double, boolean and text are always set. You can set the value of a Variable using the constructor or the SetValue method.

What is a Function?

A .NET Standard class encapsulating a unique identifying name, an expression, and a list of arguments for that expresssion. Functions are used to define and reuse formulas (expressions) in equations.

What is an Equation?

A .NET Standard class that encapuslate the data comprising a equation (expressions and targets)

UseExpression - a string expression that must evaluate to a true or false. If this UseExpression evaluates to true then the equation and the inner equations are executed.

Expression - a string that produces a value (number, boolean, or text), the value is then assigned to the Variable named in Target.

Target - the variable name to hold the value calculated from the Expression.

MoreEquations - a collection of Equations that will be executed if this equation executes. (provides a tree of equations)

How Equations are Executed


Calculations may be different equations depending on expressions or varable values. This is the reason for branching, the logical determination of equations following a true/false determination. The branches are defined by adding Equations to the MoreEquations collection.

Use Case 1:

Calculations occur within an application instance

Use Case 2:

Calculations occur within an application which gets the equations from another source