Class Node

  • Direct Known Subclasses:

    public class Node
    extends Object
    Representation of a node in a tree of nodes. Has a parent, and a list of children. Each node has a type and a value. Optionally has a set of properties; these represent arguments when part of a method call.
    • Field Detail

      • nodeType

        protected NodeType nodeType
        Type of node.
      • nodeValue

        protected Object nodeValue
        Value of the node.
      • parent

        protected Node parent
        Parent of this node.
      • childNodes

        protected List<Node> childNodes
        List of child nodes in the tree below here.
      • properties

        protected List<Node> properties
        List of properties for the node. Used for invocation of methods, representing the arguments.
    • Method Detail

      • getNodeType

        public NodeType getNodeType()
      • setNodeValue

        public void setNodeValue​(Object val)
      • getNodeValue

        public Object getNodeValue()
      • hasProperties

        public boolean hasProperties()
      • getProperties

        public List<Node> getProperties()
      • addProperty

        public void addProperty​(Node node)
      • setPropertyAtPosition

        public void setPropertyAtPosition​(int position,
                                          Node node)
      • getChildNodes

        public List<Node> getChildNodes()
      • removeChildNode

        public void removeChildNode​(Node node)
      • insertChildNode

        public Node insertChildNode​(Node node)
      • insertChildNode

        public Node insertChildNode​(Node node,
                                    int position)
      • appendChildNode

        public Node appendChildNode​(Node node)
      • getChildNode

        public Node getChildNode​(int index)
      • getFirstChild

        public Node getFirstChild()
        Access the first child node.
        The first node, or null if no children present
      • getNextChild

        public Node getNextChild()
        Access the next node. This asssumes that the method
        has been called before.
        The next child
      • hasNextChild

        public boolean hasNextChild()
        Return whether there is a "next" child node. Assumes that the method
        has been called before.
        Whether there is a next child node.
      • setParent

        public void setParent​(Node parent)
      • getParent

        public Node getParent()
      • getNodeId

        public String getNodeId()
      • getNodeChildId

        public String getNodeChildId()
      • toString

        public String toString()
        Method to print out the Node as a tree.
        toString in class Object
        the node tree as a string
      • clone

        public Node clone​(Node parent)