Class Node<T>

java.lang.Object
org.docx4j.model.styles.Node<T>

public class Node<T>
extends java.lang.Object
Represents a node of the Tree class. The Node is also a container, and can be thought of as instrumentation to determine the location of the type T in the Tree.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    java.util.List<Node<T>> children  
    T data  
    protected java.lang.String name
    Nodes have names
    protected Tree<T> tree  
  • Constructor Summary

    Constructors 
    Constructor Description
    Node​(Tree<T> tree, java.lang.String name, T data)
    Convenience ctor to create a Node with an instance of T.
  • Method Summary

    Modifier and Type Method Description
    void addChild​(Node<T> child)
    Adds a child to the list of children for this Node.
    java.util.List<Node<T>> getChildren()
    Return the children of Node.
    T getData()  
    Node<T> getParent()  
    void setData​(T data)  
    void setParent​(Node<T> parent)  
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • name

      protected java.lang.String name
      Nodes have names
    • tree

      protected Tree<T> tree
    • data

      public T data
    • children

      public java.util.List<Node<T>> children
  • Constructor Details

    • Node

      public Node​(Tree<T> tree, java.lang.String name, T data)
      Convenience ctor to create a Node with an instance of T.
      Parameters:
      data - an instance of T.
  • Method Details

    • getParent

      public Node<T> getParent()
    • setParent

      public void setParent​(Node<T> parent)
    • getChildren

      public java.util.List<Node<T>> getChildren()
      Return the children of Node. The Tree is represented by a single root Node whose children are represented by a List>. Each of these Node elements in the List can have children. The getChildren() method will return the children of a Node.
      Returns:
      the children of Node
    • addChild

      public void addChild​(Node<T> child)
      Adds a child to the list of children for this Node. The addition of the first child will create a new List>.
      Parameters:
      child - a Node object to set.
    • getData

      public T getData()
    • setData

      public void setData​(T data)
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object