archimate.util
Class TagNode

java.lang.Object
  extended by archimate.util.TagNode

public class TagNode
extends java.lang.Object

This class implements a node of a TagTree

Author:
Samuel Esposito

Constructor Summary
TagNode(java.lang.String tag)
          Creates a new node with the given tag
 
Method Summary
 void addChild(TagNode node)
          Adds a child to the node
 void addSource(ICodeElement code)
          Adds a ICodeElement to the list of source elements.
 java.util.ArrayList<TagNode> children()
           
 ICodeElement getSource(java.lang.String identifier)
          Returns the source element that matches with the identifier
 boolean hasChild(java.lang.String tag)
          Searches the nodes children for a child with a certain tag
 boolean hasChildren()
           
 boolean hasParent()
          Returns whether the node has a parent or not
 int nrOfChildren()
          Returns the number of children in a node
 TagNode parent()
           
 void resetVisited()
          Sets the visited state to true
 void setParent(TagNode parent)
          Sets the nodes parent
 void setVisited()
          Sets the visited state to true
 void setVisited(ICodeElement element)
          Marks the source element as visited.
 java.util.ArrayList<ICodeElement> source()
          Returns the list of ICodeElements
 java.lang.String tag()
           
 void tickOffSource(java.lang.String name)
          Marks the encountered source as visited
 boolean visited()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TagNode

public TagNode(java.lang.String tag)
Creates a new node with the given tag

Parameters:
tag - Tag for the new node
Method Detail

children

public java.util.ArrayList<TagNode> children()
Returns:
The nodes children

nrOfChildren

public int nrOfChildren()
Returns the number of children in a node

Returns:
The number of children in a node

addChild

public void addChild(TagNode node)
Adds a child to the node

Parameters:
node - The new child

parent

public TagNode parent()
Returns:
The nodes parent

setParent

public void setParent(TagNode parent)
Sets the nodes parent

Parameters:
parent - The nodes parent

tag

public java.lang.String tag()
Returns:
The nodes tag

visited

public boolean visited()
Returns:
Whether the node has been visited or not

resetVisited

public void resetVisited()
Sets the visited state to true


setVisited

public void setVisited()
Sets the visited state to true


hasChildren

public boolean hasChildren()
Returns:
Whether the node has children or not

hasChild

public boolean hasChild(java.lang.String tag)
Searches the nodes children for a child with a certain tag

Parameters:
tag - The tag to match
Returns:
Whether the node has a child with a matching tag

hasParent

public boolean hasParent()
Returns whether the node has a parent or not

Returns:
Whether the node has a parent or not

addSource

public void addSource(ICodeElement code)
Adds a ICodeElement to the list of source elements. If the list contains an element with the same identifier, the element is silently ignored.

Parameters:
code - ICodeElement that will be added to the list of source elements

source

public java.util.ArrayList<ICodeElement> source()
Returns the list of ICodeElements

Returns:
The list of ICodeElements

getSource

public ICodeElement getSource(java.lang.String identifier)
Returns the source element that matches with the identifier

Parameters:
identifier - the identifier to match with
Returns:
The source element that matches with the identifier

tickOffSource

public void tickOffSource(java.lang.String name)
Marks the encountered source as visited

Parameters:
name - The name identifying the encountered source

setVisited

public void setVisited(ICodeElement element)
Marks the source element as visited.

Parameters:
element - the visited element