public class ParseTree
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
java.util.ArrayList<ParseTree> |
children |
Constructor and Description |
---|
ParseTree(NonterminalSymbol symbol,
java.util.Map<java.lang.String,java.lang.String> attrs) |
ParseTree(Token token,
java.util.Map<java.lang.String,java.lang.String> attrs) |
Modifier and Type | Method and Description |
---|---|
ParseTree |
addChild(NonterminalSymbol symbol,
java.util.Map<java.lang.String,java.lang.String> attrs) |
void |
addChild(Token token,
java.util.Map<java.lang.String,java.lang.String> attrs) |
java.lang.String |
getAttribute(java.lang.String name,
java.lang.String defaultValue) |
java.util.Map<java.lang.String,java.lang.String> |
getAttributes() |
java.util.List<ParseTree> |
getChildren()
Get the children
|
ParseTree |
getParent()
Get the parent.
|
Symbol |
getSymbol()
Get the symbol associated with this node in the tree.
|
Token |
getToken()
Get the token associated with this node in the tree.
|
java.lang.String |
serialize()
Serialize the tree as XML.
|
void |
serialize(java.io.PrintStream stream)
Serialize the tree as XML.
|
void |
serialize(java.lang.String filename)
Serialize the tree as XML.
|
java.lang.String |
toString() |
public java.util.ArrayList<ParseTree> children
public ParseTree(NonterminalSymbol symbol, java.util.Map<java.lang.String,java.lang.String> attrs)
public ParseTree(Token token, java.util.Map<java.lang.String,java.lang.String> attrs)
public ParseTree addChild(NonterminalSymbol symbol, java.util.Map<java.lang.String,java.lang.String> attrs)
public void addChild(Token token, java.util.Map<java.lang.String,java.lang.String> attrs)
public Symbol getSymbol()
public Token getToken()
public java.lang.String getAttribute(java.lang.String name, java.lang.String defaultValue)
public java.util.Map<java.lang.String,java.lang.String> getAttributes()
public ParseTree getParent()
public java.util.List<ParseTree> getChildren()
public java.lang.String serialize()
See ParserOptions
for details about options that may be used to influence the
structure of trees.
public void serialize(java.io.PrintStream stream)
See ParserOptions
for details about options that may be used to influence the
structure of trees.
stream
- the stream on which to write the XML serializationpublic void serialize(java.lang.String filename)
This method attempts to write the XML to a file.
See ParserOptions
for details about options that may be used to influence the
structure of trees.
filename
- the name of the fileForestException
- if a error occurs attempt to write to the filepublic java.lang.String toString()
toString
in class java.lang.Object