Home Reference Source Repository
import {CollectingVisitor} from 'fincontracts-lib/src/fincontract-visitor.js'
public class | source

CollectingVisitor

Extends:

Visitor → CollectingVisitor

Direct Subclass:

GatewayVisitor

CollectingVisitor extends Visitor by providing default functionality of collecting all leaf nodes. By default leaf-nodes return an empty list, so the result is an empty list as well. An example of usage is the GatewayVisitor which collects all Gateways from the tree.

Method Summary

Public Methods
public

processAndNode(node: FincNode, left: Object, right: Object): Array

Called during preorder traversal when processing FincAndNode.

public

Called during preorder traversal when processing FincGiveNode.

public

processIfNode(node: FincNode, left: Object, right: Object): Array

Called during preorder traversal when processing FincIfNode.

public

Called during preorder traversal when processing FincOneNode.

public

processOrNode(node: FincNode, left: Object, right: Object): Array

Called during preorder traversal when processing FincOrNode.

public

Called during preorder traversal when processing FincScaleNode.

public

Called during preorder traversal when processing FincScaleObsNode.

public

Called during preorder traversal when processing FincTimeboundNode.

public

Called during preorder traversal when processing FincZeroNode.

Inherited Summary

From class Visitor
public abstract

Called when processing FincAndNode.

public abstract

Called when processing FincGiveNode.

public abstract

Called when processing FincIfNode.

public abstract

Called when processing FincOneNode.

public abstract

Called when processing FincOrNode.

public abstract

Called when processing FincScaleNode.

public abstract

Called when processing FincScaleObsNode.

public abstract

Called when processing FincTimeboundNode.

public abstract

Called when processing FincZeroNode.

public

Visits current node.

Public Methods

public processAndNode(node: FincNode, left: Object, right: Object): Array source

Called during preorder traversal when processing FincAndNode. Returns a list that concatenates the results from processing both left and right subtrees

Override:

Visitor#processAndNode

Params:

NameTypeAttributeDescription
node FincNode

currently processed node

left Object

an Object containing result of processing left child (first subtree) of the current node

right Object

an Object containing result of processing right child (second subtree) of the current node

Return:

Array

an Array that contains the concatenated results from processing both left and right subtrees

public processGiveNode(node: FincNode, child: Object): Object source

Called during preorder traversal when processing FincGiveNode. Passes the result from child to parent.

Override:

Visitor#processGiveNode

Params:

NameTypeAttributeDescription
node FincNode

currently processed node

child Object

an Object containing result of processing the only child (its subtree) of the current node

Return:

Object

returns the result of processing the only child

public processIfNode(node: FincNode, left: Object, right: Object): Array source

Called during preorder traversal when processing FincIfNode. Returns a list that concatenates the results from processing both left and right subtrees

Override:

Visitor#processIfNode

Params:

NameTypeAttributeDescription
node FincNode

currently processed node

left Object

an Object containing result of processing left child (first subtree) of the current node

right Object

an Object containing result of processing right child (second subtree) of the current node

Return:

Array

an Array that contains the concatenated results from processing both left and right subtrees

public processOneNode(): Array source

Called during preorder traversal when processing FincOneNode. Returns an empty list.

Override:

Visitor#processOneNode

Return:

Array

an empty list

public processOrNode(node: FincNode, left: Object, right: Object): Array source

Called during preorder traversal when processing FincOrNode. Returns a list that concatenates the results from processing both left and right subtrees

Override:

Visitor#processOrNode

Params:

NameTypeAttributeDescription
node FincNode

currently processed node

left Object

an Object containing result of processing left child (first subtree) of the current node

right Object

an Object containing result of processing right child (second subtree) of the current node

Return:

Array

an Array that contains the concatenated results from processing both left and right subtrees

public processScaleNode(node: FincNode, child: Object): Object source

Called during preorder traversal when processing FincScaleNode. Passes the result from child to parent.

Override:

Visitor#processScaleNode

Params:

NameTypeAttributeDescription
node FincNode

currently processed node

child Object

an Object containing result of processing the only child (its subtree) of the current node

Return:

Object

returns the result of processing the only child

public processScaleObsNode(node: FincNode, child: Object): Object source

Called during preorder traversal when processing FincScaleObsNode. Passes the result from child to parent.

Override:

Visitor#processScaleObsNode

Params:

NameTypeAttributeDescription
node FincNode

currently processed node

child Object

an Object containing result of processing the only child (its subtree) of the current node

Return:

Object

returns the result of processing the only child

public processTimeboundNode(node: FincNode, child: Object): Object source

Called during preorder traversal when processing FincTimeboundNode. Passes the result from child to parent.

Override:

Visitor#processTimeboundNode

Params:

NameTypeAttributeDescription
node FincNode

currently processed node

child Object

an Object containing result of processing the only child (its subtree) of the current node

Return:

Object

returns the result of processing the only child

public processZeroNode(): Array source

Called during preorder traversal when processing FincZeroNode. Returns an empty list.

Override:

Visitor#processZeroNode

Return:

Array

an empty list