Class Node
java.lang.Object
org.datanucleus.store.query.compiler.Node
- Direct Known Subclasses:
ParameterNode
Representation of a node in a tree of nodes.
Has a parent, and a list of children. Each node has a type and a value.
Optionally has a set of properties; these represent arguments when part of a method call.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addProperty
(Node node) appendChildNode
(Node node) getChildNode
(int index) Access the first child node.Access the next node.boolean
Return whether there is a "next" child node.boolean
private String
indent
(int indentation) Utility to add on indenting when printing out the node tree.insertChildNode
(Node node) insertChildNode
(Node node, int position) private String
printTree
(int indentation) Utility method to print out the node tree.void
removeChildNode
(Node node) void
setNodeValue
(Object val) void
void
setPropertyAtPosition
(int position, Node node) toString()
Method to print out the Node as a tree.
-
Field Details
-
nodeType
Type of node. -
nodeValue
Value of the node. -
cursorPos
private int cursorPosWorking variable used for iterating between child nodes. -
parent
Parent of this node. -
childNodes
List of child nodes in the tree below here. -
properties
List of properties for the node. Used for invocation of methods, representing the arguments.
-
-
Constructor Details
-
Node
-
Node
-
-
Method Details
-
getNodeType
-
setNodeValue
-
getNodeValue
-
getNodeValueAsString
-
hasProperties
public boolean hasProperties() -
getProperties
-
addProperty
-
setPropertyAtPosition
-
getChildNodes
-
removeChildNode
-
insertChildNode
-
insertChildNode
-
appendChildNode
-
getChildNode
-
getFirstChild
Access the first child node.- Returns:
- The first node, or null if no children present
-
getNextChild
Access the next node. This asssumes that the methodgetFirstChild
has been called before.- Returns:
- The next child
-
hasNextChild
public boolean hasNextChild()Return whether there is a "next" child node. Assumes that the methodgetFirstChild
has been called before.- Returns:
- Whether there is a next child node.
-
setParent
-
getParent
-
getNodeId
-
getNodeChildId
-
toString
Method to print out the Node as a tree. -
clone
-
printTree
Utility method to print out the node tree.- Parameters:
indentation
- What indent to use- Returns:
- The tree string
-
indent
Utility to add on indenting when printing out the node tree.- Parameters:
indentation
- The indent size (number of spaces)- Returns:
- value indented
-