telepath / com.github.giedomak.telepath.datamodels.plans / LogicalPlan

LogicalPlan

class LogicalPlan : AbstractMultiTree<LogicalPlan> (source)

Data-structure to represent the given user input, and physical plans.

This data-structure is used for both representing the user input, and for physical plans. It basically is a binary-tree. Meaning its children are in turn also ParseTrees.

User input will get parsed through ANTLR into a parseTree by the StaticParserRPQ.

The DynamicProgrammingPlanner will parse such a parseTree from user input, into a physical plan. These physical plans can have slightly different operators and payloads in regard to a parseTree generated from user input.

Constructors

<init>

LogicalPlan(query: Query, operator: Int = 0, leaf: Edge? = null)

Create a non-root empty LogicalPlan.

Properties

operator

var operator: Int

An Int representing the operator. See our Companion for these constants, i.e. CONCATENATION.

operatorName

val operatorName: String?

Inherited Properties

children

var children: MutableList<ImplementingTree>

isLeaf

val isLeaf: Boolean

leaf

var leaf: Edge?

nodeRepresentation

val nodeRepresentation: String

query

val query: Query

Functions

contains

fun contains(operatorId: Int): Boolean

Check if the current tree contains a given operator.

containsSubtreesThroughOperator

fun containsSubtreesThroughOperator(s1: LogicalPlan, s2: LogicalPlan, operatorId: Int): Boolean

Delegate parse-tree-containment to our MultiTreeContainment.

getSize

fun getSize(): Int

mergeAndFlatten

fun mergeAndFlatten(tree: LogicalPlan, operator: Int): LogicalPlan

subtreesOfSize

fun subtreesOfSize(targetSize: Int): List<LogicalPlan>

Delegate parse-tree-sizing to our LogicalPlanSubtree.

Inherited Functions

clone

open fun clone(): ImplementingTree

Deep clone; also clone its children recusively.

equals

open fun equals(other: Any?): Boolean

flatten

fun flatten(): ImplementingTree

Delegate parse-tree-flattening to our MultiTreeFlattener.

getChild

fun getChild(index: Int): ImplementingTree?

Return the child at a given index or null when not existent.

hasChild

fun hasChild(index: Int): Boolean

Check if a child exists with index in our children list.

hashCode

open fun hashCode(): Int

height

fun height(): Int

Recursive function calculating the height of this tree.

postOrderTraversal

fun postOrderTraversal(): Sequence<ImplementingTree>

Post-order traversal.

print

fun print(): Unit

Delegate parse-tree-printing to our MultiTreePrinter.

setLeaf

fun setLeaf(label: String): Unit

Set the leaf by giving in a String which we'll convert to an Edge.

toString

open fun toString(): String

Companion Object Properties

CONCATENATION

const val CONCATENATION: Int

KLEENE_STAR

const val KLEENE_STAR: Int

LEAF

const val LEAF: Int

OPERATORS

val OPERATORS: List<Int>

PLUS

const val PLUS: Int

UNION

const val UNION: Int