Skip to content

BH.oM.Verification.Conditions.Formula

Formula in a form of a string in a specific convention, used to calculate values in verification workflows.

Class structure

Implemented interfaces and base types

The Formula is inheriting from the following base type(s) and implements the following interfaces:

Properties

Defining properties

The following properties are defined on the class

Name Type Description Quantity
Equation string Equation in a form of a string, resulting in either numerical, string or Boolean values.
Only basic mathematical operators are currently supported.
Strings need to be wrapped in single quotation marks (').
Enum values need to stay unwrapped and expressed only with the value itself (e.g. MyValue instead of MyEnum.MyValue).
Examples of valid formule:
(a + b) * 2
a == b * 2
a == 'StringValue'
a == EnumValue
a == 'StringValueA' or (a == 'StringValueB' and b == 'StringValueC')
if a == 0: 'zero', else if a == 1: 'one', else if a == 2: 'two', else: 'not supported'
if a == b and a == c: 'all values equal', else: 'values not equal'
-
Tolerance object Tolerance to be applied when evaluating the formula. -

Code and Schema

C# implementation

C#
public class Formula : BH.oM.Base.IObject

Assembly: Verification_oM.dll

The C# class definition is available on github:

All history and changes of the class can be found by inspection the history.

JSON Schema implementation

The object is defined as a JSON schema. You can validate a JSON instance against this schema by reference. To do this, use the schema reference below in a validator like this one.

JSON Schema
{
 "$ref" : "https://raw.githubusercontent.com/BHoM/BHoM_JSONSchema/develop/Verification_oM/Conditions/Formula.json"
}

The JSON Schema is available on github here: