uk.ac.bbk.dcs.automed.xml.xmldssGraph
Class XMLDSSGraph

java.lang.Object
  extended by uk.ac.bbk.dcs.automed.xml.xmldssGraph.XMLDSSGraph

public class XMLDSSGraph
extends java.lang.Object

Class Task Description

Author:
Lucas Zamboulis

Constructor Summary
XMLDSSGraph(org.w3c.dom.Document domDoc)
           
 
Method Summary
 void addElement(XMLDSSGraphElement xge, XMLDSSGraphElement parent)
           
 void drawTree()
           
 int findPath(XMLDSSGraphElement supposedChild, XMLDSSGraphElement supposedParent, java.util.LinkedList goingUpPath, java.util.LinkedList goingDownPath)
          IMPORTANT: Both goingUpPath and goingDownPath lists contain the common ancestor.
 XMLDSSGraphElement getElement(java.lang.String name)
           
 java.util.LinkedList getElements()
           
 XMLDSSGraphElement getEntryPoint()
           
 boolean isTree()
           
 void printGraphNodes(java.io.PrintStream ps)
           
 void printTree(java.io.PrintStream ps)
           
 void setEntryPoint(XMLDSSGraphElement entryPoint)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLDSSGraph

public XMLDSSGraph(org.w3c.dom.Document domDoc)
            throws XMLDSSGraphException
Throws:
XMLDSSGraphException
Method Detail

addElement

public void addElement(XMLDSSGraphElement xge,
                       XMLDSSGraphElement parent)
                throws XMLDSSGraphException
Throws:
XMLDSSGraphException

getElements

public java.util.LinkedList getElements()

getElement

public XMLDSSGraphElement getElement(java.lang.String name)
                              throws XMLDSSGraphException
Throws:
XMLDSSGraphException

getEntryPoint

public XMLDSSGraphElement getEntryPoint()

setEntryPoint

public void setEntryPoint(XMLDSSGraphElement entryPoint)
                   throws XMLDSSGraphException
Throws:
XMLDSSGraphException

isTree

public boolean isTree()

printTree

public void printTree(java.io.PrintStream ps)
               throws XMLDSSGraphException
Throws:
XMLDSSGraphException

drawTree

public void drawTree()

printGraphNodes

public void printGraphNodes(java.io.PrintStream ps)
                     throws XMLDSSGraphException
Throws:
XMLDSSGraphException

findPath

public int findPath(XMLDSSGraphElement supposedChild,
                    XMLDSSGraphElement supposedParent,
                    java.util.LinkedList goingUpPath,
                    java.util.LinkedList goingDownPath)
IMPORTANT: Both goingUpPath and goingDownPath lists contain the common ancestor. It is up to the function using the result of this method to remove the duplicate common ancestor coming from one of these two lists.

Parameters:
supposedChild - the node from where the path begins
supposedParent - the node the path ends at
goingUpPath - a LinkedList object containing the nodes from supposedChild to supposedParent, if indeed supposedChild is in the same branch with supposed parent and is deeper than supposedParent. In this case, it is returned full. As the name suggests, this list represents going up the schema.
goingDownPath - a LinkedList object containing the nodes from common ancestor to supposedParent or from supposedChild to supposedParent, if they are in the same branch and supposedParent is deeper than supposedChild. supposedParent is always the last node in the list. As the name suggests, this list represents going up the schema.
Returns:
an integer in [1,5]:
- 1 means the two nodes are in the same branch and toNode is higher than fromNode
- 2 means the two nodes are in the same branch and toNode is lower than fromNode
- 3 means the two nodes are in different branches and toNode is higher than fromNode
- 4 means the two nodes are in different branches and toNode is lower than fromNode
- 5 means the two nodes are in different branches and toNode is in the same height as fromNode