Package com.uppaal.model.core2
Class Node
- java.lang.Object
-
- com.uppaal.model.core2.Element
-
- com.uppaal.model.core2.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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.String
getXPathTag()
Computes the local tag of the XPath address.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, getCommandManager, getDocument, getLocalProperty, getParent, getProperties, getProperty, getPropertyValue, getPrototype, getPrototypeFromParent, getTemplate, getX, getXMLLabelKinds, getXPath, getY, hasFlag, importInto, isPropertyLocal, removeListener, setCommandManager, setProperties, setProperty, setPropertyFromPath
-
-
-
-
Constructor Detail
-
Node
public Node(Element prototype)
constructor- Parameters:
prototype
- - The prototype of the node
-
-
Method Detail
-
getPrevious
public Node getPrevious()
Returns the left sibling.- Returns:
- The previous node
-
getNext
public Node getNext()
Returns the right sibling.- Returns:
- the next node
-
getFirst
public Node getFirst()
Returns the first child.- Returns:
- The first node
-
getLast
public Node getLast()
Returns the last child.- Returns:
- 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.
-
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.- Parameters:
node
- - The new nodeposition
- - The insert position- Returns:
- 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.- Parameters:
child
- - The child nodeposition
- - The position- Returns:
- 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.- Overrides:
clone
in classElement
- Returns:
- The cloned object
- Throws:
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).- Overrides:
setPrototype
in classElement
- Parameters:
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- Overrides:
getXPathTag
in classElement
- Returns:
- local address of this element
-
-