Package com.mckoi.database

## Interface QueryPlanNode

All Superinterfaces:
  `java.lang.Cloneable`, `java.io.Serializable`

All Known Implementing Classes:
  `QueryPlan.BranchQueryPlanNode`, `QueryPlan.CachePointNode`, `QueryPlan.CompositeNode`, `QueryPlan.ConstantSelectNode`, `QueryPlan.CreateFunctionsNode`, `QueryPlan.DistinctNode`, `QueryPlan.EquiJoinNode`, `QueryPlan.ExhaustiveSelectNode`, `QueryPlan.FetchTableNode`, `QueryPlan.FetchViewNode`, `QueryPlan.FunctionalSelectNode`, `QueryPlan.GroupNode`, `QueryPlan.JoinNode`, `QueryPlan.LeftOuterJoinNode`, `QueryPlan.LogicalUnionNode`, `QueryPlan.MarkerNode`, `QueryPlan.MultiColumnEquiSelectNode`, `QueryPlan.NaturalJoinNode`, `QueryPlan.NonCorrelatedAnyAllNode`, `QueryPlan.RangeSelectNode`, `QueryPlan.SimplePatternSelectNode`, `QueryPlan.SimpleSelectNode`, `QueryPlan.SingleQueryPlanNode`, `QueryPlan.SingleRowTableNode`, `QueryPlan.SortNode`, `QueryPlan.SubsetNode`

    public interface QueryPlanNode
    extends java.io.Serializable, java.lang.Cloneable

A node element of a query plan tree. A plan of a query is represented as a tree structure of such nodes. The design allows for plan nodes to be easily reorganised for the construction of better plans.

Author:
  Tobias Downer

### Method Summary

All Methods Instance Methods Abstract Methods
`java.lang.Object` `clone()` Deep clones this query plan.
`void` `debugString​(int indent, java.lang.StringBuffer buf)` Writes a textural representation of the node to the StringBuffer at the given indent level.
`java.util.ArrayList` `discoverCorrelatedVariables​(int level, java.util.ArrayList list)` Discovers all the correlated variables in the plan (and plan children) that reference a particular layer.
`java.util.ArrayList` `discoverTableNames​(java.util.ArrayList list)` Discovers a list of TableName that represent the sources that this query requires to complete itself.
`Table` `evaluate​(QueryContext context)` Evaluates the node and returns the result as a Table.

### Method Detail

#### evaluate

    Table evaluate​(QueryContext context)

Evaluates the node and returns the result as a Table. The VariableResolver resolves any outer variables

#### discoverTableNames

    java.util.ArrayList discoverTableNames​(java.util.ArrayList list)

Discovers a list of TableName that represent the sources that this query requires to complete itself. For example, if this is a query plan of two joined table, the fully resolved names of both tables are returned.

The resultant list will not contain the same table name more than once. The resultant list contains TableName objects.

NOTE, if a table is aliased, the unaliased name is returned.

#### discoverCorrelatedVariables

    java.util.ArrayList discoverCorrelatedVariables​(int level,
                                                    java.util.ArrayList list)

Discovers all the correlated variables in the plan (and plan children) that reference a particular layer. For example, if we wanted to find all the CorrelatedVariable objects that reference the current layer, we would typically call 'discoverCorrelatedVariables(0, new ArrayList())'

#### clone

    java.lang.Object clone()
                    throws java.lang.CloneNotSupportedException

Deep clones this query plan.

Throws:
  `java.lang.CloneNotSupportedException`

#### debugString

    void debugString​(int indent,
                     java.lang.StringBuffer buf)

Writes a textural representation of the node to the StringBuffer at the given indent level.