|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.brics.grammar.ast.Node dk.brics.grammar.ast.BranchNode
public class BranchNode
AST branch node.
Constructor Summary | |
---|---|
BranchNode(BranchNode n,
int to)
Constructs a new AST node from an existing one by updating 'to'. |
|
BranchNode(BranchNode n,
String edge,
Node m)
Constructs a new AST node from an existing one by adding an edge. |
|
BranchNode(ProductionID id,
String name,
int i,
int j)
Constructs a new AST node with no edges (yet). |
Method Summary | |
---|---|
BranchNode |
getBranchChild(String name)
Returns a branch child node. |
Node |
getChild(String name)
Returns a child node. |
Set<String> |
getChildNames()
Returns the set of child names in this node. |
String |
getLabel()
Returns the production label of this node. |
String |
getLeafString(String name,
AST t)
Returns the substring of the leaf child of the given name. |
String |
getName()
Returns the node name. |
ProductionID |
getProductionID()
Returns the production ID. |
void |
print(String x,
StringBuilder b)
Prints this node. |
void |
replaceChild(String name,
BranchNode n)
Replaces an child with the children of another node. |
void |
visitBy(NodeVisitor v)
Visits this node. |
Methods inherited from class dk.brics.grammar.ast.Node |
---|
getFromIndex, getString, getToIndex |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BranchNode(BranchNode n, int to)
n
- existing nodeto
- to indexpublic BranchNode(BranchNode n, String edge, Node m)
n
- existing nodeedge
- edge namem
- child nodepublic BranchNode(ProductionID id, String name, int i, int j)
id
- production IDname
- node namei
- from indexj
- to index (not included)Method Detail |
---|
public BranchNode getBranchChild(String name) throws ClassCastException
name
- name of branch child node
ClassCastException
- if the child is not a branch nodepublic Node getChild(String name)
name
- name of child node
public Set<String> getChildNames()
public String getLabel()
public String getLeafString(String name, AST t) throws ClassCastException
ClassCastException
- if the child is not a leaf nodepublic String getName()
public ProductionID getProductionID()
public void print(String x, StringBuilder b)
Node
print
in class Node
x
- original stringb
- string buffer for outputpublic void replaceChild(String name, BranchNode n)
name
- child to replacen
- node containing children to copypublic void visitBy(NodeVisitor v)
Node
visitBy
in class Node
v
- visitor
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |