uk.ac.bbk.dcs.automed.graph
Class DirectedGraphNode

java.lang.Object
  extended by uk.ac.bbk.dcs.automed.graph.DirectedGraphNode

public class DirectedGraphNode
extends java.lang.Object

Class that abstracts a node in a directed unlabelled graph.

Author:
Lucas Zamboulis

Constructor Summary
DirectedGraphNode(java.lang.String name)
           
 
Method Summary
 void addIncomingEdge(DirectedGraphNode n)
          Adds a node in the set of incoming edges of the calling node.
 void addOutgoingEdge(DirectedGraphNode n)
          Adds a node in the set of outgoing edges of the calling node.
protected  java.util.HashSet getIncomingEdges()
           
protected  java.lang.String getName()
           
protected  java.util.HashSet getOutgoingEdges()
           
protected  int getType()
           
protected  void unvisit()
          Marks the calling node as unvisited
protected  void visited()
          Marks the calling node as visited.
protected  boolean wasVisited()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectedGraphNode

public DirectedGraphNode(java.lang.String name)
Parameters:
name - the name of the node
Method Detail

getName

protected java.lang.String getName()
Returns:
the name of the node

addIncomingEdge

public void addIncomingEdge(DirectedGraphNode n)
                     throws XMLException
Adds a node in the set of incoming edges of the calling node.

Parameters:
n -
Throws:
XMLException

addOutgoingEdge

public void addOutgoingEdge(DirectedGraphNode n)
                     throws XMLException
Adds a node in the set of outgoing edges of the calling node.

Parameters:
n - the node to add
Throws:
XMLException

getType

protected int getType()
Returns:
0 if the node has no incoming edges (root), 1 if the node has both incoming and outgoing edges, 2 if the node has incoming but no outgoing edges (leaf) and 3 if the node has no incoming or outgoing edges (dangling)

wasVisited

protected boolean wasVisited()
Returns:
true if the node was marked as visited

visited

protected void visited()
Marks the calling node as visited.


unvisit

protected void unvisit()
Marks the calling node as unvisited


getIncomingEdges

protected java.util.HashSet getIncomingEdges()
Returns:
the set of incoming edges

getOutgoingEdges

protected java.util.HashSet getOutgoingEdges()
Returns:
the set of outgoing edges