Node class
Node in a trigger tree.
Constructors
| Node(Clause, Trigger |
Intializes a new instance of the |
Properties
| all |
Gets all triggers that contain the |
| clause | Gets the logical conjunction this node represents. |
| specializations | Gets specialized children of this node. |
| tree | Gets the tree this node is found in. |
| triggers | Gets all of the most specific triggers that contains the |
Methods
| add |
Adds a child node. |
| matches(Memory |
Gets the most specific matches below this node. |
| relationship(Node) | Identify the relationship between two nodes. |
| remove |
Removes a trigger from node. |
| to |
Gets a string that represents the current node. |
Constructor Details
Node(Clause, TriggerTree, Trigger)
Intializes a new instance of the Node class.
new Node(clause: Clause, tree: TriggerTree, trigger?: Trigger)
Parameters
- clause
- Clause
The logical conjunction this node represents.
- tree
- TriggerTree
The trigger tree this node is found in.
- trigger
- Trigger
The trigger to initialize this node.
Property Details
allTriggers
Gets all triggers that contain the Clause in this node.
Trigger[] allTriggers
Property Value
Trigger[]
All triggers that contain the Clause in this node.
clause
specializations
Gets specialized children of this node.
Node[] specializations
Property Value
Node[]
Specialized children of this node.
tree
triggers
Gets all of the most specific triggers that contains the Clause in this node.
Trigger[] triggers
Property Value
Trigger[]
All of the most specific triggers that contains the Clause in this node.
Method Details
addNode(Node)
Adds a child node.
function addNode(triggerNode: Node): boolean
Parameters
- triggerNode
- Node
The node to be added.
Returns
boolean
Whether adding node operation is successful.
matches(MemoryInterface | any)
Gets the most specific matches below this node.
function matches(state: MemoryInterface | any): Trigger[]
Parameters
- state
-
MemoryInterface | any
Frame to evaluate against.
Returns
Trigger[]
List of the most specific matches found.
relationship(Node)
Identify the relationship between two nodes.
function relationship(other: Node): RelationshipType
Parameters
- other
- Node
Node to compare against.
Returns
Relationship between this node an the other.
removeTrigger(Trigger)
Removes a trigger from node.
function removeTrigger(trigger: Trigger): boolean
Parameters
- trigger
- Trigger
The trigger to be removed.
Returns
boolean
Whether removing trigger operation is successful.
toString(string[], number)
Gets a string that represents the current node.
function toString(builder: string[], indent: number): string
Parameters
- builder
-
string[]
An array of string to build the string of node.
- indent
-
number
An integer representing the number of spaces at the start of a line.
Returns
string
A string that represents the current node.