Trigger class

A trigger is a combination of a trigger expression and the corresponding action.

Constructors

Trigger(TriggerTree, Expression, any, Quantifier[])

Intializes a new instance of the Trigger class.

Properties

action

Action to take when trigger is true.

clauses

Gets list of expressions converted into Disjunctive Normal Form where ! is pushed to the leaves and there is an implicit || between clauses and && within a clause.

originalExpression

Original trigger expression.

Methods

matches(Clause, MemoryInterface | any)

Determines whether there is a member in the current Clause that matches the nodeClause parameter.

relationship(Trigger, PredicateComparers)

Determines the relationship between current instance and another Trigger instance.

toString(string[], number)

Gets a string that represents the current trigger.

Constructor Details

Trigger(TriggerTree, Expression, any, Quantifier[])

Intializes a new instance of the Trigger class.

new Trigger(tree: TriggerTree, expression?: Expression, action?: any, quantifiers: Quantifier[])

Parameters

tree
TriggerTree

Trigger tree that contains this trigger.

expression
Expression

Expression for when the trigger action is possible.

action

any

Action to take when a trigger matches.

quantifiers

Quantifier[]

Quantifiers to dynamically expand the expression.

Property Details

action

Action to take when trigger is true.

action: any

Property Value

any

clauses

Gets list of expressions converted into Disjunctive Normal Form where ! is pushed to the leaves and there is an implicit || between clauses and && within a clause.

Clause[] clauses

Property Value

Clause[]

The list of clauses.

originalExpression

Original trigger expression.

originalExpression: Expression

Property Value

Method Details

matches(Clause, MemoryInterface | any)

Determines whether there is a member in the current Clause that matches the nodeClause parameter.

function matches(nodeClause: Clause, state: MemoryInterface | any): boolean

Parameters

nodeClause
Clause

The other Clause instance to match.

state

MemoryInterface | any

The scope for looking up variables.

Returns

boolean

A boolean value inidicating whether there is a member matches.

relationship(Trigger, PredicateComparers)

Determines the relationship between current instance and another Trigger instance.

function relationship(other: Trigger, comparers: PredicateComparers): RelationshipType

Parameters

other
Trigger

The other Trigger instance.

comparers
PredicateComparers

The comparer dictionary.

Returns

A RelationshipType value.

toString(string[], number)

Gets a string that represents the current trigger.

function toString(builder: string[], indent: number): string

Parameters

builder

string[]

An array of string to build the string of trigger.

indent

number

An integer represents the number of spaces at the start of a line.

Returns

string

A string that represents the current trigger.