public class Tree
extends java.lang.Object
Constructor and Description |
---|
Tree()
Creates a new and empty instance of a data tree.
|
Tree(Node rootNode)
Creates a new instance of a data tree with a specified root node.
|
Modifier and Type | Method and Description |
---|---|
int |
countTreeNodes()
Recursively counts all nodes in the data tree.
|
static Tree |
createFromXmlFile(java.lang.String fileName)
Creates a new data tree from a given XML document.
|
void |
exportToXmlFile(java.lang.String fileName,
java.lang.String prologueStr)
Exports the given data tree into a new XML file.
|
Node |
getRootNode()
Returns the root node of the data tree.
|
Stats |
getTreeStatistics()
Computes the basic statistics about this data tree.
|
java.lang.String |
serializeDataTree(java.lang.String prologueStr,
boolean useIndentation)
Serializes the data tree into an string.
|
public Tree()
public Tree(Node rootNode)
rootNode
- Reference to a new root node of a tree.public static Tree createFromXmlFile(java.lang.String fileName)
fileName
- Path to the specified XML file.public Node getRootNode()
public int countTreeNodes()
public Stats getTreeStatistics()
public java.lang.String serializeDataTree(java.lang.String prologueStr, boolean useIndentation)
prologueStr
- Optional XML prologue string.useIndentation
- Whether to produce indented document.public void exportToXmlFile(java.lang.String fileName, java.lang.String prologueStr)
fileName
- Complete file name of the output file.prologueStr
- Optional XML prologue string.