Class NodeBase

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int myId  
      private static int nextId  
      private Node parent  
    • Constructor Summary

      Constructors 
      Constructor Description
      NodeBase​(Node parent)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void accept​(Visitor visitor)
      Accept the visitor and allow it to perform actions on this Node.
      <T extends Node>
      T
      copy​(java.lang.Class<T> cls)
      Make a deep copy of this node.
      <T extends Node>
      T
      copy​(Node newParent, java.lang.Class<T> cls)
      Copy setting a new parent in the result.
      <T extends Node>
      T
      getAncestor​(java.lang.Class<T> type)
      Return the first ancestor of this node of the given type, if any.
      private static int getNewId()  
      int id()
      Return the unique ID of this node.
      Node parent()
      Return the Node that contains (and created) this Node.
      void parent​(Node node)
      Set the parent to a new value.
      void postCopy()  
      void preCopy()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • nextId

        private static int nextId
      • myId

        private int myId
    • Constructor Detail

      • NodeBase

        public NodeBase​(Node parent)
    • Method Detail

      • getNewId

        private static int getNewId()
      • getAncestor

        public final <T extends Node> T getAncestor​(java.lang.Class<T> type)
        Description copied from interface: Node
        Return the first ancestor of this node of the given type, if any. Throws IllegalArgumentException if not found.
        Specified by:
        getAncestor in interface Node
      • id

        public int id()
        Description copied from interface: Node
        Return the unique ID of this node. This starts at 1 and is incremented for each new Node that is created.
        Specified by:
        id in interface Node
      • parent

        public final Node parent()
        Description copied from interface: Node
        Return the Node that contains (and created) this Node.
        Specified by:
        parent in interface Node
      • parent

        public final void parent​(Node node)
        Description copied from interface: Node
        Set the parent to a new value. Should only be called inside NodeBase.
        Specified by:
        parent in interface Node
      • copy

        public <T extends Node> T copy​(java.lang.Class<T> cls)
        Description copied from interface: Node
        Make a deep copy of this node. If nn = n.copy(), then n.parent() == nn.parent(), which also means that the parent is NOT copied.
        Specified by:
        copy in interface Node
      • copy

        public <T extends Node> T copy​(Node newParent,
                                       java.lang.Class<T> cls)
        Description copied from interface: Node
        Copy setting a new parent in the result.
        Specified by:
        copy in interface Node
      • toString

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

        public void accept​(Visitor visitor)
        Description copied from interface: Node
        Accept the visitor and allow it to perform actions on this Node.
        Specified by:
        accept in interface Node