Skip to content
Miroiu Emanuel edited this page Oct 12, 2022 · 1 revision

MathContext Class

Namespace: StringMath

Assembly: StringMath

Inheritance: ObjectMathContext

Implements: IMathContext

References: IMathContext, Precedence

public sealed class MathContext : IMathContext

Constructors

MathContext(IMathContext)

Creates a new instance of a MathContext.

public MathContext(IMathContext parent);

Parameters

parent IMathContext: The parent context to inherit operators from.

MathContext()

Creates a new instance of a MathContext.

public MathContext();

Fields

Default

The global instance used by StringMath.MathExpr.AddOperator(System.String,System.Func{System.Double,System.Double}) methods.

public static IMathContext Default;

Field Value

IMathContext

Properties

Parent

The parent context to inherit from.

public virtual IMathContext Parent { get; set; }

Property Value

IMathContext

Methods

EvaluateBinary(String, Double, Double)

public virtual double EvaluateBinary(string op, double a, double b);

Parameters

op String

a Double

b Double

Returns

Double

EvaluateUnary(String, Double)

public virtual double EvaluateUnary(string op, double a);

Parameters

op String

a Double

Returns

Double

GetBinaryPrecedence(String)

public virtual Precedence GetBinaryPrecedence(string operatorName);

Parameters

operatorName String

Returns

Precedence

IsBinary(String)

public virtual bool IsBinary(string operatorName);

Parameters

operatorName String

Returns

Boolean

IsUnary(String)

public virtual bool IsUnary(string operatorName);

Parameters

operatorName String

Returns

Boolean

RegisterBinary(String, Func<Double, Double, Double>, Precedence?)

public virtual void RegisterBinary(string operatorName, Func<Double, Double, Double> operation, Precedence? precedence = null);

Parameters

operatorName String

operation Func<Double, Double, Double>

precedence Precedence?

RegisterUnary(String, Func<Double, Double>)

public virtual void RegisterUnary(string operatorName, Func<Double, Double> operation);

Parameters

operatorName String

operation Func<Double, Double>