Package org.rumbledb.expressions
Class Node
java.lang.Object
org.rumbledb.expressions.Node
- Direct Known Subclasses:
Clause
,Expression
,FunctionDeclaration
,Module
,Program
,Prolog
,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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract <T> T
accept
(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.Gets the highest execution mode of this node, which determines whether evaluation will be done locally, with RDDs or with DataFrames.getHighestExecutionMode
(VisitorConfig visitorConfig) Gets the highest execution mode of this node, which determines whether evaluation will be done locally, with RDDs or with DataFrames.Access the metadata of the node, i.e., the line and column number.protected void
indentIt
(StringBuffer buffer, int indent) boolean
Tells whether the expression is context dependent.int
void
print
(StringBuffer buffer, int indent) Prints the node tree to a string buffer.abstract void
serializeToJSONiq
(StringBuffer sb, int indent) void
setHighestExecutionMode
(ExecutionMode newMode) Initializes the highest execution mode of this node, which determines whether evaluation will be done locally, with RDDs or with DataFrames.final String
toString()
-
Field Details
-
highestExecutionMode
-
-
Constructor Details
-
Node
protected Node() -
Node
-
-
Method Details
-
setHighestExecutionMode
Initializes 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. -
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.
-
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.- 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.
-
getMetadata
Access the metadata of the node, i.e., the line and column number. This is used for displaying informative error messages.- Returns:
- the metadata.
-
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.
-