Class Node

All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
AbstractLocation, AbstractTemplate, Document, Edge, LscElement, Nail, Query, QueryList

public class Node
extends Element
Nodes are elements that can be placed in a tree structure represented by references to the parent, the first child and left and right siblings.
See Also:
Serialized Form
  • Field Details

    • public Node previous
      The left sibling of this element.
    • public Node next
      The right sibling of this element.
    • first

      public Node first
      First child of this element.
  • Constructor Details

    • Node

      public Node​(Element prototype)
      prototype - - The prototype of the node
  • Method Details

    • getPrevious

      public Node getPrevious()
      Returns the left sibling.
      The previous node
    • getNext

      public Node getNext()
      Returns the right sibling.
      the next node
    • getFirst

      public Node getFirst()
      Returns the first child.
      The first node
    • getLast

      public Node getLast()
      Returns the last child.
      The last node
    • accept

      public void accept​(Visitor visitor) throws Exception
      Description copied from class: Element
      Accept a visitor. This method is specialized in every subclass. Part of the visitor pattern.
      accept in class Element
      visitor - - The visitor
      Exception - the visitor threw an exception.
    • insert

      public Node insert​(Node node, Node position)
      Insert a child node. The node is inserted after the given position, or as the first child if the position is null. Fires an insertion event on the child. Returns the node argument.
      node - - The new node
      position - - The insert position
      The insert node
    • move

      public Node move​(Node child, Node position)
      Move a child node among siblings. The node is moved after the given position, or as the first child if the position is null. Fires a move event on the child node. Returns this node.
      child - - The child node
      position - - The position
      The moved node
    • remove

      public void remove()
      Remove the node from the tree structure. Removal events are fired after the actual removal. The node does not retain its parent reference, but the sibling references are preserved (thus making it possible to remove elements from within a visitor).
    • clone

      public Object clone() throws CloneNotSupportedException
      Returns a deep clone of the node. The sibling references of the clone are set to null.
      clone in class Element
      The cloned object
      CloneNotSupportedException - an object cannot be cloned.
    • setPrototype

      public void setPrototype​(Element prototype)
      Sets the prototype of this element to the given argument. It also recursively reimports all properties and children by calling importInto(this) (thus resetting the prototype structure throughout the tree).
      setPrototype in class Element
      prototype - - The property element
    • getXPathTag

      public String getXPathTag()
      Description copied from class: Element
      Computes the local tag of the XPath address. Needs to be overwritten by concrete instances
      getXPathTag in class Element
      local address of this element