public class Node
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
java.util.ArrayList<Node> |
children
Children of this node.
|
Content |
content
Contents of this node.
|
int |
indent
Indent of the node in the tree.
|
int |
lineNumber
The line number of the node's contents
|
Node |
parent
Parent of this node.
|
Constructor and Description |
---|
Node(java.lang.String contentLine,
int indent,
Node parent,
int set)
Constructor of the node.
|
Node(java.lang.String contentLine,
int indent,
Node parent,
int set,
int lineNumber) |
Modifier and Type | Method and Description |
---|---|
Node |
getRoot()
Returns the root of the tree structure
|
void |
insert(Node node)
Inserts a new node in the tree structure.
|
java.lang.String |
toString()
Parses the node and children to a String for debug and printing.
|
public Node parent
public Content content
public int indent
public java.util.ArrayList<Node> children
public int lineNumber
public Node(java.lang.String contentLine, int indent, Node parent, int set) throws java.lang.Exception
contentLine
- string with the node informationindent
- indent level of this node, to determine its place on the tree.parent
- indicates the parent of the new node, if any.java.lang.Exception
public Node(java.lang.String contentLine, int indent, Node parent, int set, int lineNumber) throws java.lang.Exception
java.lang.Exception
public void insert(Node node)
node
- new node to add.public java.lang.String toString()
toString
in class java.lang.Object
public Node getRoot()