Class TreeNode<ValueType>

  • Type Parameters:
    ValueType - The value to be stored by this node

    public class TreeNode<ValueType>
    extends java.lang.Object
    Simple generic tree node with links to parent and a list of children
    • Constructor Detail

      • TreeNode

        public TreeNode​(ValueType value)
        Create a new TreeNode with a given value
        Parameters:
        value - The value to set
    • Method Detail

      • getChildren

        public java.util.Collection<TreeNode<ValueType>> getChildren()
        Get a list of all the children of this node
        Returns:
        A List of child nodes.
      • addChild

        public void addChild​(TreeNode<ValueType> node)
        Add a child to the children list
        Parameters:
        node - The child to add
      • getValue

        public ValueType getValue()
        Get the value stored by this node
        Returns:
        the value stored by this node
      • setValue

        public void setValue​(ValueType value)
        Set the value for this node
        Parameters:
        value - the value for this node
      • setParent

        public void setParent​(TreeNode<ValueType> parent)
        Set the parent node
        Parameters:
        parent - the parent node
      • getParent

        public TreeNode<ValueType> getParent()
        Get the parent node
        Returns:
        the parent node
      • getProperties

        public java.util.Map<java.lang.String,​java.lang.Object> getProperties()
      • setProperties

        public void setProperties​(java.util.Map<java.lang.String,​java.lang.Object> properties)
      • addProperty

        public void addProperty​(java.lang.String key,
                                java.lang.Object value)
        Add a property to the tree node
        Parameters:
        key - key for the property
        value - value of the property
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

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