com.uppaal.model.core2
Class Node

java.lang.Object
  extended by com.uppaal.model.core2.Element
      extended by com.uppaal.model.core2.Node
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
AbstractLocation, AbstractTemplate, Document, Edge, LscElement, Nail

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 Summary
 Node first
          First child of this element.
 Node next
          The right sibling of this element.
 Node previous
          The left sibling of this element.
 
Fields inherited from class com.uppaal.model.core2.Element
listeners, properties, prototype
 
Constructor Summary
Node(Element prototype)
           
 
Method Summary
 void accept(Visitor visitor)
          Accept a visitor.
 Object clone()
          Returns a deep clone of the node.
 Node getFirst()
          Returns the first child.
 Node getLast()
          Returns the last child.
 Node getNext()
          Returns the right sibling.
 Node getPrevious()
          Returns the left sibling.
 Node insert(Node node, Node position)
          Insert a child node.
 Node move(Node child, Node position)
          Move a child node among siblings.
 void remove()
          Remove the node from the tree structure.
 void setPrototype(Element prototype)
          Sets the prototype of this element to the given argument.
 
Methods inherited from class com.uppaal.model.core2.Element
acceptSafe, addListener, getColor, getDocument, getLocalProperty, getParent, getProperties, getProperty, getPropertyValue, getPrototype, getPrototypeFromParent, getTemplate, getX, getY, hasFlag, importInto, isPropertyLocal, removeListener, setProperties, setProperty, setPropertyFromPath
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

previous

public Node previous
The left sibling of this element.


next

public Node next
The right sibling of this element.


first

public Node first
First child of this element.

Constructor Detail

Node

public Node(Element prototype)
Method Detail

getPrevious

public Node getPrevious()
Returns the left sibling.


getNext

public Node getNext()
Returns the right sibling.


getFirst

public Node getFirst()
Returns the first child.


getLast

public Node getLast()
Returns the last child.


accept

public void accept(Visitor visitor)
            throws Exception
Description copied from class: Element
Accept a visitor. This method is specialised in every subclass. Part of the visitor pattern.

Overrides:
accept in class Element
Throws:
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.


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.


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.

Overrides:
clone in class Element
Throws:
CloneNotSupportedException

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).

Overrides:
setPrototype in class Element


Copyright © 2012 Uppsala University and Aalborg University. All Rights Reserved.