HUCTLp / com.github.sybila / TreeNode

TreeNode

interface TreeNode<out Tree>

Interface implemented by elements of a tree.

Note that we assume the tree node is immutable!

The type parameter Tree indicates what is the least common supertype of all tree nodes.

Note that if a tree node isn't Unary or Binary, it is assumed to be an atom without children.

Properties

node abstract val node: Tree

The object which holds the actual data in the tree.

Extension Functions

fold fun <Tree : TreeNode<Tree>, R> TreeNode<Tree>.fold(atom: Tree.() -> R, unary: Unary<*, Tree>.(R) -> R, binary: Binary<*, Tree>.(R, R) -> R): R

Standard tree fold. You can provide transformation operations for atoms, unary and binary nodes.

map fun <Tree : TreeNode<Tree>> TreeNode<Tree>.map(atom: Tree.() -> Tree = { this }, unary: Unary<Tree, Tree>.(Tree) -> Tree = { this.copy(inner = it) }, binary: Binary<Tree, Tree>.(Tree, Tree) -> Tree = { left, right -> this.copy(left, right)}): Tree

Change tree structure while preserving tree type. You can provide transformation operations for atoms, unary and binary nodes. The only requirement is that operations don't change the type of the tree.

Inheritors

Binary interface Binary<out This : Tree, Tree : TreeNode<Tree>> : TreeNode<Tree>

Common interface for binary operators.

DirFormula sealed class DirFormula : TreeNode<DirFormula>

Formulas that are used to describe the direction of the temporal path.

Expression sealed class Expression : TreeNode<Expression>

Arithmetic expressions which are used in the Formula.Numeric proposition.

Formula sealed class Formula : TreeNode<Formula>

An HUCTLp Formula that can be used to describe general temporal properties.

Unary interface Unary<out This : Tree, Tree : TreeNode<Tree>> : TreeNode<Tree>

Common interface for unary operators.