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

OrNodeChecker

Extends:

VisitorEmptyVisitor → OrNodeChecker

OrNodeChecker checks if there exist path from root node to the nearest Or node (see FincOrNode), while only passing through FincTimeboundNode and FincScaleNode. It's neccessary to check this before choosing a sub-fincontract (see Executor#choose), since the description tree on the blockchain does not have these explicit node types and rather they are embedded in every node. However, when pulling the contract down (see Fetcher#pullFincontract) we infer and construct these nodes. If we didn't check this ourselves and the top-level nodes is not an OR node, then the transaction would fail and the gas would not be refunded.

Method Summary

Public Methods
public

processOrNode(): true

Called when processing FincOrNode.

public

Called when processing FincScaleNode.

public

Called when processing FincTimeboundNode.

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.

From class EmptyVisitor
public

Called during preorder traversal when processing FincAndNode.

public

Called during preorder traversal when processing FincGiveNode.

public

Called during preorder traversal when processing FincIfNode.

public

Called during preorder traversal when processing FincOneNode.

public

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.

Public Methods

public processOrNode(): true source

Called when processing FincOrNode. Returns true, because we have reached an OR node.

Override:

EmptyVisitor#processOrNode

Return:

true

public processScaleNode(node: FincNode, child: Boolean | null): Boolean | null source

Called when processing FincScaleNode. Passes the child's result to the parent.

Override:

EmptyVisitor#processScaleNode

Params:

NameTypeAttributeDescription
node FincNode

currently being processed node

child Boolean | null

result from processing its child

Return:

Boolean | null

result from processing its child

public processTimeboundNode(node: FincNode, child: Boolean | null): Boolean | null source

Called when processing FincTimeboundNode. Passes the child's result to the parent.

Override:

EmptyVisitor#processTimeboundNode

Params:

NameTypeAttributeDescription
node FincNode

currently being processed node

child Boolean | null

result from processing its child

Return:

Boolean | null

result from processing its child