Class Node<T extends Node<T>>
java.lang.Object
org.elasticsearch.xpack.esql.core.tree.Node<T>
- Type Parameters:
T- node type
- All Implemented Interfaces:
NamedWriteable,Writeable
- Direct Known Subclasses:
Expression
Immutable tree structure.
The traversal is done depth-first, pre-order (first the node then its children), that is seeks up and then goes down.
Alternative method for post-order (children first, then node) is also offered, that is seeks down and then goes up.
Allows transformation which returns the same tree (if no change has been performed) or a new tree otherwise.
While it tries as much as possible to use functional Java, due to lack of parallelism,
the use of streams and iterators is not really useful and brings too much baggage which
might be used incorrectly.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanchildren()collectFirstChildren(Predicate<? super T> predicate) protected voiddoCollectFirst(Predicate<? super T> predicate, List<T> matches) boolean<E extends T>
voidforEachDown(Class<E> typeToken, Consumer<? super E> action) voidforEachDown(Consumer<? super T> action) booleanforEachDownMayReturnEarly(BiConsumer<? super T, Holder<Boolean>> action) Same as forEachDown, but can end the traverse early, by setting the boolean argument in the action.protected <E> voidforEachProperty(Class<E> typeToken, Consumer<? super E> rule) <E> voidforEachPropertyDown(Class<E> typeToken, Consumer<? super E> rule) <E> voidforEachPropertyOnly(Class<E> typeToken, Consumer<? super E> rule) <E> voidforEachPropertyUp(Class<E> typeToken, Consumer<? super E> rule) <E extends T>
voidvoidinthashCode()info()Normally, you want to use one of the staticcreatemethods to implement this.nodeName()The values of all the properties that are important to thisNode.propertiesToString(boolean skipIfChild) Render the properties of thisNodeone by one likefoo bar baz.abstract TreplaceChildren(List<T> newChildren) final TreplaceChildrenSameSize(List<T> newChildren) source()toString()transformChildren(Function<T, ? extends T> traversalOperation) transformDown(Class<E> typeToken, Function<E, ? extends T> rule) transformDown(Function<? super T, ? extends T> rule) transformDown(Predicate<Node<?>> nodePredicate, Function<E, ? extends T> rule) protected final <E> TtransformNodeProps(Class<E> typeToken, Function<? super E, ? extends E> rule) Transform this node's properties.<E> TtransformPropertiesDown(Class<E> typeToken, Function<? super E, ? extends E> rule) <E> TtransformPropertiesOnly(Class<E> typeToken, Function<? super E, ? extends E> rule) <E> TtransformPropertiesUp(Class<E> typeToken, Function<? super E, ? extends E> rule) transformUp(Class<E> typeToken, Function<E, ? extends T> rule) transformUp(Function<? super T, ? extends T> rule) transformUp(Predicate<Node<?>> nodePredicate, Function<E, ? extends T> rule) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.common.io.stream.NamedWriteable
getWriteableName
-
Constructor Details
-
Node
-
-
Method Details
-
source
-
sourceLocation
-
sourceText
-
children
-
forEachDown
-
forEachDownMayReturnEarly
Same as forEachDown, but can end the traverse early, by setting the boolean argument in the action. -
forEachDown
-
forEachUp
-
forEachUp
-
forEachPropertyOnly
-
forEachPropertyDown
-
forEachPropertyUp
-
forEachProperty
-
anyMatch
-
collect
-
collectLeaves
-
collectFirstChildren
-
doCollectFirst
-
transformDown
-
transformDown
-
transformDown
-
transformUp
-
transformUp
-
transformUp
-
transformChildren
-
replaceChildrenSameSize
-
replaceChildren
-
transformPropertiesOnly
-
transformPropertiesDown
-
transformPropertiesUp
-
transformNodeProps
Transform this node's properties.This always returns something of the same type as the current node but since
Nodedoesn't have aSelfTparameter we return the closest thing we do have:T, which is the root of the hierarchy for this node. -
info
Normally, you want to use one of the staticcreatemethods to implement this.For
QueryPlans, it is very important that the properties contain all of the expressions and references relevant to this node, and that all the properties are used in the provided constructor; otherwise query plan transformations likeQueryPlan#transformExpressionsOnly(Function)will not have an effect. -
hashCode
public int hashCode() -
equals
-
nodeName
-
nodeProperties
The values of all the properties that are important to thisNode. -
nodeString
-
toString
-
propertiesToString
Render the properties of thisNodeone by one likefoo bar baz. These go inside the[and]of the output oftreeString(java.lang.StringBuilder, int, java.util.BitSet).
-