public class SimpleNode extends Object implements Node
Modifier and Type | Field and Description |
---|---|
protected List<Node> |
children |
protected int |
id |
protected Node |
parent |
protected SyntaxTreeBuilder |
parser |
Constructor and Description |
---|
SimpleNode(int id) |
SimpleNode(SyntaxTreeBuilder parser,
int id) |
Modifier and Type | Method and Description |
---|---|
Object |
childrenAccept(SyntaxTreeBuilderVisitor visitor,
Object data)
Accept the visitor.
|
String |
dump(String prefix)
Writes a tree-like representation of this node and all of its subnodes
(recursively) and returns it as a string.
|
void |
dump(String prefix,
Appendable out)
Writes a tree-like representation of this node and all of its subnodes
(recursively) to the supplied Appendable.
|
Object |
jjtAccept(SyntaxTreeBuilderVisitor visitor,
Object data)
Accept the visitor.
|
void |
jjtAddChild(Node n,
int i)
This method tells the node to add its argument to the node's list of
children.
|
void |
jjtAppendChild(Node n)
Adds the supplied node as the last child node to this node.
|
void |
jjtClose()
This method is called after all the child nodes have been added.
|
<T extends Node> |
jjtGetChild(Class<T> type)
Gets the (first) child of this node that is of the specific type.
|
Node |
jjtGetChild(int i)
This method returns a child node.
|
List<Node> |
jjtGetChildren() |
<T extends Node> |
jjtGetChildren(Class<T> type) |
int |
jjtGetNumChildren()
Return the number of children the node has.
|
Node |
jjtGetParent() |
void |
jjtInsertChild(Node n,
int i)
Adds the supplied node as the i'th child node to this node.
|
void |
jjtOpen()
This method is called after the node has been made the current node.
|
void |
jjtReplaceChild(Node oldNode,
Node newNode)
Replaces a child node with a new node.
|
void |
jjtReplaceWith(Node newNode)
Replaces this node with the supplied one in the AST.
|
void |
jjtSetParent(Node n)
This pair of methods are used to inform the node of its parent.
|
String |
toString() |
String |
toString(String prefix) |
protected Node parent
protected int id
protected SyntaxTreeBuilder parser
public SimpleNode(int id)
public SimpleNode(SyntaxTreeBuilder parser, int id)
public void jjtOpen()
Node
public void jjtClose()
Node
public void jjtSetParent(Node n)
Node
jjtSetParent
in interface Node
public Node jjtGetParent()
jjtGetParent
in interface Node
public void jjtAddChild(Node n, int i)
Node
jjtAddChild
in interface Node
public void jjtAppendChild(Node n)
Node
jjtAppendChild
in interface Node
public void jjtInsertChild(Node n, int i)
Node
jjtInsertChild
in interface Node
public void jjtReplaceChild(Node oldNode, Node newNode)
Node
jjtReplaceChild
in interface Node
public void jjtReplaceWith(Node newNode)
newNode
- The replacement node.public Node jjtGetChild(int i)
Node
jjtGetChild
in interface Node
public <T extends Node> T jjtGetChild(Class<T> type)
type
- The type of the child node that should be returned.public int jjtGetNumChildren()
Node
jjtGetNumChildren
in interface Node
public Object jjtAccept(SyntaxTreeBuilderVisitor visitor, Object data) throws VisitorException
Node
jjtAccept
in interface Node
VisitorException
public Object childrenAccept(SyntaxTreeBuilderVisitor visitor, Object data) throws VisitorException
VisitorException
public void dump(String prefix, Appendable out) throws IOException
IOException
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.