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

DotGeneratorVisitor

Extends:

Visitor → DotGeneratorVisitor

DotGeneratorVisitor performs collection of links and labels in order to later generate a DOT description of the Fincontract graph from FincNode description tree by extending Visitor.

Method Summary

Public Methods
public

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

Called during preorder traversal when processing FincAndNode.

public

Called during preorder traversal when processing FincGiveNode.

public

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

Called during preorder traversal when processing FincIfNode.

public

Called during preorder traversal when processing FincOneNode.

public

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

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 an unknown node.

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): Object source

Called during preorder traversal when processing FincAndNode. Adds current links to all the children to the intermediate set of links and labels returned by children.

Override:

Visitor#processAndNode

Params:

NameTypeAttributeDescription
node FincNode

currently processed node

left Object

an Object containing intermediate result of collecting links and labels form left child (first subtree) of the current node

right Object

an Object containing intermediate result of collecting links and labels form right child (second subtree) of the current node

Return:

Object

an Object containing combined results from the children and the current node

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

Called during preorder traversal when processing FincGiveNode. Adds current links to all the children to the intermediate set of links and labels returned by the only child.

Override:

Visitor#processGiveNode

Params:

NameTypeAttributeDescription
node FincNode

currently processed node

child Object

an Object containing intermediate result of collecting links and labels form its only child (subtree)

Return:

Object

an Object containing combined results from the child and the current node

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

Called during preorder traversal when processing FincIfNode. Adds current links to all the children to the intermediate set of links and labels returned by children.

Override:

Visitor#processIfNode

Params:

NameTypeAttributeDescription
node FincNode

currently processed node

left Object

an Object containing intermediate result of collecting links and labels form left child (first subtree) of the current node

right Object

an Object containing intermediate result of collecting links and labels form right child (second subtree) of the current node

Return:

Object

an Object containing combined results from the children and the current node

public processOneNode(node: FincNode): Object source

Called during preorder traversal when processing FincOneNode. As FincOneNode is a leaf node, therefore this functions just returns an empty object with a single label (this node).

Override:

Visitor#processOneNode

Params:

NameTypeAttributeDescription
node FincNode

currently processed node

Return:

Object

an Object containing a single label (this node)

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

Called during preorder traversal when processing FincOrNode. Adds current links to all the children to the intermediate set of links and labels returned by children.

Override:

Visitor#processOrNode

Params:

NameTypeAttributeDescription
node FincNode

currently processed node

left Object

an Object containing intermediate result of collecting links and labels form left child (first subtree) of the current node

right Object

an Object containing intermediate result of collecting links and labels form right child (second subtree) of the current node

Return:

Object

an Object containing combined results from the children and the current node

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

Called during preorder traversal when processing FincScaleNode. Adds current links to all the children to the intermediate set of links and labels returned by the only child.

Override:

Visitor#processScaleNode

Params:

NameTypeAttributeDescription
node FincNode

currently processed node

child Object

an Object containing intermediate result of collecting links and labels form its only child (subtree)

Return:

Object

an Object containing combined results from the child and the current node

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

Called during preorder traversal when processing FincScaleObsNode. Adds current links to all the children to the intermediate set of links and labels returned by the only child.

Override:

Visitor#processScaleObsNode

Params:

NameTypeAttributeDescription
node FincNode

currently processed node

child Object

an Object containing intermediate result of collecting links and labels form its only child (subtree)

Return:

Object

an Object containing combined results from the child and the current node

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

Called during preorder traversal when processing FincTimeboundNode. Adds current links to all the children to the intermediate set of links and labels returned by the only child.

Override:

Visitor#processTimeboundNode

Params:

NameTypeAttributeDescription
node FincNode

currently processed node

child Object

an Object containing intermediate result of collecting links and labels form its only child (subtree)

Return:

Object

an Object containing combined results from the child and the current node

public processUnknownNode() source

Called during preorder traversal when processing an unknown node. Throws an error.

Throw:

Error

always

public processZeroNode(): Object source

Called during preorder traversal when processing FincZeroNode. As FincZeroNode is a leaf node, therefore this functions just returns an empty object with a single label (this node).

Override:

Visitor#processZeroNode

Return:

Object

an Object containing a single label (this node)