Package org.rumbledb.expressions
Class Node
java.lang.Object
org.rumbledb.expressions.Node
- Direct Known Subclasses:
Clause,Expression,FunctionDeclaration,Module,OptionDeclaration,Program,Prolog,SchemaImport,Statement,TypeDeclaration,VariableDeclaration
This is the top-level class for nodes in the intermediate representation of a
JSONiq query. Nodes include expressions, clauses, function declarations, etc.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ExecutionModeGets the highest execution mode of this node, which determines whether evaluation will be done locally, with RDDs or with DataFrames.protected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract <T> Taccept(AbstractNodeVisitor<T> visitor, T argument) Accept method for the visitor pattern.Returns all children nodes as a list.For gathering descendant nodes, as a depth-first search.getDescendantsMatching(Predicate<Node> predicate) For gathering descendant nodes that match a predicate.getHighestExecutionMode(VisitorConfig visitorConfig) Gets the highest execution mode of this node, which determines whether evaluation will be done locally, with RDDs or with DataFrames.protected voidindentIt(StringBuilder buffer, int indent) booleanTells whether the expression is context dependent.intvoidprint(StringBuilder buffer, int indent) Prints the node tree to a string buffer.abstract voidserializeToJSONiq(StringBuilder sb, int indent) voidsetIsInSequentialBlock(boolean isInSequentialBlock) final StringtoString()
-
Field Details
-
highestExecutionMode
Gets the highest execution mode of this node, which determines whether evaluation will be done locally, with RDDs or with DataFrames. This method is used during the static analysis. It is meant to be overridden by subclasses that support higher execution modes. By default, the highest execution mode is assumed to be local. -
isInSequentialBlock
protected boolean isInSequentialBlock
-
-
Constructor Details
-
Node
-
-
Method Details
-
getHighestExecutionMode
Gets the highest execution mode of this node, which determines whether evaluation will be done locally, with RDDs or with DataFrames. This method is used during the static analysis. It is meant to be overridden by subclasses that support higher execution modes. By default, the highest execution mode is assumed to be local. When extending this method, make sure to perform a super() call to prevent UNSET accesses. if Node.suppressUnsetExecutionModeAccessedErrors is false, then an error is thrown if an UNSET mode is found. if Node.suppressUnsetExecutionModeAccessedErrors is true, it might silently return UNSET.- Parameters:
visitorConfig- the configuration of the visitor.- Returns:
- the highest execution mode.
-
numberOfUnsetExecutionModes
public int numberOfUnsetExecutionModes() -
accept
Accept method for the visitor pattern.- Type Parameters:
T- the type of the objects returned by the visitor.- Parameters:
visitor- the visitor.argument- the input from the visitor.- Returns:
- the object returned by this visitor
-
getChildren
Returns all children nodes as a list. The list is new and can be modified at will by the caller.- Returns:
- the children nodes as a list.
-
getDescendants
For gathering descendant nodes, as a depth-first search. The list is new and can be modified at will by the caller.- Returns:
- the descendant nodes as a list.
-
getDescendantsMatching
For gathering descendant nodes that match a predicate. The list is new and can be modified at will by the caller.- Parameters:
predicate- a predicate to filter with.- Returns:
- the descendant nodes as a list.
-
print
Prints the node tree to a string buffer.- Parameters:
buffer- a string buffer to write toindent- the current level of indentation
-
toString
-
serializeToJSONiq
-
indentIt
-
isContextDependent
public boolean isContextDependent()Tells whether the expression is context dependent.- Returns:
- true if it is context dependent, false otherwise.
-
setIsInSequentialBlock
public void setIsInSequentialBlock(boolean isInSequentialBlock)
-