public abstract class Node
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Node.Type
Enumeration of node types.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
TOKEN_DT_DATA
String token for a label of data nodes.
|
static java.lang.String |
TOKEN_DV_UNDEFINED
Undefined value for data nodes.
|
static java.lang.String |
TOKEN_SE_EOL
End of line char used for serialization.
|
static java.lang.String |
TOKEN_SE_INDENT
String used for elements indentation during serialization.
|
static java.lang.String |
TOKEN_TG_CLOSE
Closing parenthesis for a non-empty element tags.
|
static java.lang.String |
TOKEN_TG_CLOSE_EMPTY
Closing parenthesis for an empty element tag.
|
static java.lang.String |
TOKEN_TG_OPEN_END
Opening parenthesis for an element ending tag.
|
static java.lang.String |
TOKEN_TG_OPEN_START
Opening parenthesis for an element starting tag.
|
Modifier | Constructor and Description |
---|---|
protected |
Node()
Initializes the node structure.
|
Modifier and Type | Method and Description |
---|---|
abstract int |
countTreeNodes()
Recursively counts all nodes in the data tree.
|
static void |
generateIndent(java.lang.StringBuilder builder,
int level)
Generates indentation string used for indented serialization.
|
abstract java.util.List<Node> |
getChildNodes()
Returns the list of all child nodes.
|
int |
getNodeIdentifier()
Returns the node identifier.
|
abstract java.lang.String |
getNodeLabel()
Returns the node label.
|
static java.util.List<java.lang.String> |
getNodesLabels(java.util.List<Node> listNodes)
Translates the given sequence of nodes to their labels.
|
abstract Node.Type |
getNodeType()
Returns the type of a given node.
|
abstract Stats |
getTreeStatistics()
Computes the basic statistics about this subtree.
|
abstract void |
serializeNode(java.lang.StringBuilder builder)
Serializes the node into an XML string.
|
abstract void |
serializeNode(java.lang.StringBuilder builder,
int level)
Serializes the node into an indented XML string.
|
java.lang.String |
toString() |
public static java.lang.String TOKEN_DT_DATA
public static java.lang.String TOKEN_DV_UNDEFINED
public static java.lang.String TOKEN_TG_OPEN_START
public static java.lang.String TOKEN_TG_CLOSE_EMPTY
public static java.lang.String TOKEN_TG_OPEN_END
public static java.lang.String TOKEN_TG_CLOSE
public static java.lang.String TOKEN_SE_EOL
public static java.lang.String TOKEN_SE_INDENT
public static java.util.List<java.lang.String> getNodesLabels(java.util.List<Node> listNodes)
listNodes
- Input sequence of nodes.public abstract Node.Type getNodeType()
public abstract java.lang.String getNodeLabel()
public abstract java.util.List<Node> getChildNodes()
public abstract int countTreeNodes()
public abstract Stats getTreeStatistics()
public abstract void serializeNode(java.lang.StringBuilder builder)
builder
- String builder for serialization output.public abstract void serializeNode(java.lang.StringBuilder builder, int level)
builder
- String builder for serialization output.level
- Level of recursive nesting for indentation.public static void generateIndent(java.lang.StringBuilder builder, int level)
builder
- String builder for serialization output.level
- Level of recursive nesting for indentation.public int getNodeIdentifier()
public java.lang.String toString()
toString
in class java.lang.Object