Class TreeNode<T>

  • Type Parameters:
    T - the type of the payload
    All Implemented Interfaces:
    ITreeNode<T>

    public class TreeNode<T>
    extends Object
    implements ITreeNode<T>
    A simple mutable tree node implementation, with a typed payload.
    • Constructor Detail

      • TreeNode

        public TreeNode​(T item)
        Create a new node.
        Parameters:
        item - node payload
    • Method Detail

      • getParent

        public ITreeNode<T> getParent()
        Specified by:
        getParent in interface ITreeNode<T>
        Returns:
        the parent of the tree, or null if it is the root node
      • getChildren

        public List<ITreeNode<T>> getChildren()
        Specified by:
        getChildren in interface ITreeNode<T>
        Returns:
        the children of the the node, or the empty list if there are no children
      • getValue

        public T getValue()
        Specified by:
        getValue in interface ITreeNode<T>
        Returns:
        the payload of the tree node
      • hasDuration

        public boolean hasDuration()
      • getStartTime

        public IQuantity getStartTime()
      • accept

        public void accept​(ITreeVisitor<T> visitor)
        Specified by:
        accept in interface ITreeNode<T>
        Parameters:
        visitor - a tree node visitor
      • addChild

        public void addChild​(TreeNode<T> node)
        Add a child node.
        Parameters:
        node - child node to add
      • detach

        public void detach()
        Detach this node from its parent.