Class TBrookMathExpression

Unit

Declaration

type TBrookMathExpression = class(TBrookHandledComponent)

Description

Mathematical expression evaluator.

Hierarchy

Overview

Methods

Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public procedure Open;
Public procedure Close;
Public function Compile(const AExpression: string; out AError: TBrookMathExpressionError): Boolean; overload; virtual;
Public function Compile(const AExpression: string): Boolean; overload; virtual;
Public procedure Clear; virtual;
Public function Evaluate: Double; virtual;
Public function GetVariable(const AName: string): Double; virtual;
Public procedure SetVariable(const AName: string; const AValue: Double); virtual;

Properties

Public property Compiled: Boolean read FCompiled;
Public property Variables[constAName:string]: Double read GetVariable write SetVariable;
Published property Active: Boolean read FActive write SetActive stored IsActiveStored;
Published property Expression: string read FExpression write SetExpression;
Published property Extensions: TStringList read FExtensions write SetExtensions;
Published property OnExtension: TBrookMathExpressionExtensionEvent read FOnExtension write FOnExtension;
Published property OnError: TBrookMathExpressionErrorEvent read FOnError write FOnError;
Published property OnActivate: TNotifyEvent read FOnActivate write FOnActivate;
Published property OnDeactivate: TNotifyEvent read FOnDeactivate write FOnDeactivate;

Description

Methods

Public constructor Create(AOwner: TComponent); override;

Creates an instance of TBrookMathExpression.

Parameters
AOwner[in]
Owner component.
Public destructor Destroy; override;

Destroys an instance of TBrookMathExpression.

Public procedure Open;

Opens the math expression.

Public procedure Close;

Closes the math expression.

Public function Compile(const AExpression: string; out AError: TBrookMathExpressionError): Boolean; overload; virtual;

Compiles a mathematical expression returning the errors if it does not succeed.

Parameters
AExpression[in]
Mathematical expression.
AError[out]
Mathematical expression error.
Returns

True if compilation succeeds.

Public function Compile(const AExpression: string): Boolean; overload; virtual;

Compiles a mathematical expression indicating if it succeeds.

Parameters
AExpression[in]
Mathematical expression.
Returns

True if compilation succeeds.

Public procedure Clear; virtual;

Clears a mathematical expression instance.

Public function Evaluate: Double; virtual;

Evaluates a compiled mathematical expression.

Returns

Evaluated mathematical expression

Public function GetVariable(const AName: string): Double; virtual;

Gets the value of a declared variable.

Parameters
AName[in]
Name of the declared variable.
Returns

Value of a declared variable.

Public procedure SetVariable(const AName: string; const AValue: Double); virtual;

Sets a variable to the mathematical expression.

Parameters
AName[in]
Name for the variable.
AValue[in]
Value for the variable.

Properties

Public property Compiled: Boolean read FCompiled;

Indicates if a mathematical expression has been successfully compiled.

Public property Variables[constAName:string]: Double read GetVariable write SetVariable;

Gets or sets a mathematical expression variable.

Published property Active: Boolean read FActive write SetActive stored IsActiveStored;

Activates the mathematical expression evaluator.

Published property Expression: string read FExpression write SetExpression;

Declares the mathematical expression.

Published property Extensions: TStringList read FExtensions write SetExtensions;

Declares the list of mathematical expression extensions.

Published property OnExtension: TBrookMathExpressionExtensionEvent read FOnExtension write FOnExtension;

Event triggered when an extensions is called in the mathematical expression.

Published property OnError: TBrookMathExpressionErrorEvent read FOnError write FOnError;

Event triggered when a mathematical expression compilation fails.

Published property OnActivate: TNotifyEvent read FOnActivate write FOnActivate;

Event triggered when the math expression component is enabled.

Published property OnDeactivate: TNotifyEvent read FOnDeactivate write FOnDeactivate;

Event triggered when the math expression component is disabled.


Generated by PasDoc 0.16.0.