C# Class GSF.Parsing.BooleanExpression

Represents a boolean expression that can be parsed and executed at runtime.
Binary operators have the same level of precedence and are evaluated from right to left.
Mostrar archivo Open project: GridProtectionAlliance/gsf

Public Methods

Method Description
BooleanExpression ( string expressionText ) : System

Creates a new instance of the BooleanExpression class.

The default comparer for identifiers is StringComparer.OrdinalIgnoreCase.

BooleanExpression ( string expressionText, IEqualityComparer identifierComparer ) : System

Creates a new instance of the BooleanExpression class.

Evaluate ( ) : bool

Evaluates the expression using the current values of the variables.

TryGetVariable ( string identifier, Variable &variable ) : bool

Attempts to get the variable identified by the given identifier.

this ( string identifier ) : Variable

Gets the variable identified by the given identifier.

Private Methods

Method Description
ParseExpression ( StringBuilder builder ) : Expression
ParseIdentifier ( StringBuilder builder ) : Expression
ParseSubexpression ( StringBuilder builder ) : Expression
ShedWhitespace ( StringBuilder builder ) : void

Method Details

BooleanExpression() public method

Creates a new instance of the BooleanExpression class.
The default comparer for identifiers is StringComparer.OrdinalIgnoreCase.
public BooleanExpression ( string expressionText ) : System
expressionText string The expression text to be parsed as a boolean expression.
return System

BooleanExpression() public method

Creates a new instance of the BooleanExpression class.
public BooleanExpression ( string expressionText, IEqualityComparer identifierComparer ) : System
expressionText string The expression text to be parsed as a boolean expression.
identifierComparer IEqualityComparer Comparer used to compare identifiers.
return System

Evaluate() public method

Evaluates the expression using the current values of the variables.
public Evaluate ( ) : bool
return bool

TryGetVariable() public method

Attempts to get the variable identified by the given identifier.
public TryGetVariable ( string identifier, Variable &variable ) : bool
identifier string The identifier used to refer to the variable.
variable Variable The variable identified by the given identifier.
return bool

this() public method

Gets the variable identified by the given identifier.
public this ( string identifier ) : Variable
identifier string The identifier used to refer to the variable.
return Variable