class Condition

This class allows the storage and retrieval of the attributes of a condition

A condition is a part of the set of conditions that makes up a busines rule of a simulator. It is a true/false (Boolean) expression that consists of one predicate that are applied to data.

It may be the only condition of the set of condtions or combined with other conditions using connectors "all", "any" and "none".

A condition has the following syntax :

<operand><operator>[<arithmetic expression>]

Operand, operator and arithmetic expression are stored in instances of this class.

Properties

private Simulator $simulator
private Connector $connector
private string $operand
private string $operator
private string $expression

Methods

void
__construct(Simulator $simulator, Connector $connector, string $operand, string $operator, string $expression)

Constructor of class Condition

getSimulator()

Retrieves the Simulator object that has the business rule that uses this condition.

Connector|null
getConnector()

Retrieves the Connector object that combines this condition with others.

string
getOperand()

Retrieves the operand part (name of a data item) of this condition.

void
setOperand(string $operand)

Sets the operand part (name of a data item) of this condition.

string
getOperator()

Retrieves the operator part of this condition.

void
setOperator(string $operator)

Sets the operator part of this condition.

string|null
getExpression()

Retrieves the arithmetic expression part of this condition.

void
setExpression(string $expression)

Sets the arithmetic expression part of this condition.

Details

at line 102
void __construct(Simulator $simulator, Connector $connector, string $operand, string $operator, string $expression)

Constructor of class Condition

Parameters

Simulator $simulator The Simulator object that has the business rule that uses this condition.
Connector $connector The Connector object that combines this condition with others.
string $operand The operand part (name of a data item) of this condition.
string $operator The operator part of this condition.
string $expression the arithmetic expression part of this condition.

Return Value

void

at line 117
Simulator getSimulator()

Retrieves the Simulator object that has the business rule that uses this condition.

Return Value

Simulator The Simulator object

at line 130
Connector|null getConnector()

Retrieves the Connector object that combines this condition with others.

Returns null if this condition is not combined with others.

Return Value

Connector|null The Connector object

at line 141
string getOperand()

Retrieves the operand part (name of a data item) of this condition.

Return Value

string The operand part of this condition.

at line 153
void setOperand(string $operand)

Sets the operand part (name of a data item) of this condition.

Parameters

string $operand The operand part of this condition.

Return Value

void

at line 168
string getOperator()

Retrieves the operator part of this condition.

The possible values are: present, blank, =, !=, <, <=, >, >=, ~, !~, isTrue or isFalse.

present, blank, isTrue and isFalse are unary operators, the others are binary operators.

Return Value

string The operator part of this condition.

at line 184
void setOperator(string $operator)

Sets the operator part of this condition.

The possible values are: present, blank, =, !=, <, <=, >, >=, ~, !~, isTrue or isFalse.

present, blank, isTrue and isFalse are unary operators, the others are binary operators.

Parameters

string $operator The operator part of this condition.

Return Value

void

at line 197
string|null getExpression()

Retrieves the arithmetic expression part of this condition.

Returns null if the operator is an unary operator.

Return Value

string|null The arithmetic expression part

at line 211
void setExpression(string $expression)

Sets the arithmetic expression part of this condition.

Arithmetic expressions contain data (data id prefixed with #), constants, numeric operators, boolean operators (&& or ||), parenthesis, functions.

Parameters

string $expression The arithmetic expression part

Return Value

void