public class AstNode extends Object
Modifier | Constructor and Description |
---|---|
protected |
AstNode(Ast tree,
AstNode nod)
deep copy constructor
|
protected |
AstNode(Ast tree,
AstNode parent,
String nt,
String label)
constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(AstNode n)
append child node
|
void |
delChild(AstNode n)
delete child node
|
boolean |
equals(Object o) |
AstNode |
getChild(int i)
get child with index i
|
List<AstNode> |
getChildren()
get List of children
|
String |
getEscapedLabel()
get label where special chars are escaped
|
AstNode |
getFirstChild()
get first child (note that nodes are ordered in their appearance)
|
int |
getId()
gt identifier
|
String |
getLabel()
get label
|
AstNode |
getLastChild()
get last child (note that nodes are ordered in their appearance)
|
AstNode |
getParent()
get parent node
|
String |
getRule()
get non-terminal rule of that node
|
boolean |
hasChildren()
check if node has children
|
int |
hashCode() |
boolean |
hasParent()
check if node has parent
|
boolean |
isLeaf()
check whether this node is a leaf node
|
void |
replaceChild(AstNode oldNode,
AstNode newNode)
replace child
|
void |
setParent(AstNode par)
set parent node
|
String |
toString() |
protected AstNode(Ast tree, AstNode parent, String nt, String label)
tree
- tree to whom the node belongs toparent
- parent nodent
- non terminal idlabel
- labelpublic AstNode getChild(int i)
i
- the index of the childpublic AstNode getLastChild()
public AstNode getFirstChild()
public void setParent(AstNode par)
par
- parent nodepublic boolean hasParent()
public AstNode getParent()
public boolean hasChildren()
public void addChild(AstNode n)
n
- child node to be addedpublic void delChild(AstNode n)
n
- child node to be deletedpublic void replaceChild(AstNode oldNode, AstNode newNode)
oldNode
- child to be replacednewNode
- replacementpublic int getId()
public String getRule()
public String getEscapedLabel()
public String getLabel()
public boolean isLeaf()
Copyright © 2017. All rights reserved.