mapss.dif.graph
Class DIFdoc

java.lang.Object
  extended by mapss.dif.graph.DIFdoc

public class DIFdoc
extends java.lang.Object

Generates hierarchical HTML of DIF graphs

Version:
0.1
Author:
Ivan Corretjer

Field Summary
protected  java.util.HashMap _elementAttributes
          HashMap to store graph element attributes (such as node labels).
protected  DIFGraph _graph
          Clone of the original graph given in the constructor.
protected  Hierarchy _topHier
          Clone of the original hierarchy given in the constructor.
protected  java.lang.String topLevelGraphName
           
 
Constructor Summary
protected DIFdoc()
          
  DIFdoc(mocgraph.Graph graph)
          Constructor for generating an DIFdoc object for just this graph.
  DIFdoc(Hierarchy hier)
          Constructor for generating a hierarchical DIFdoc object.
 
Method Summary
 void generateNodePNG(DIFGraph nodeGraph)
          Takes in a DIFGraph and produces a PNG file in the current working directory with name DIFGraph.getName().png
protected  java.lang.String insertIndent(int indentLevel)
          Returns a string containing indentLevel many indents.
protected  void printHierGraph(Hierarchy curHier, int indentLevel, java.lang.StringBuffer curString)
           
 java.lang.String setAttribute(mocgraph.Element graphElement, java.lang.String attribute, java.lang.String value)
          Sets the attribute for an element (node or edge) in the graph.
 void setIndentAmount(java.lang.String indentString)
          Sets the amount of indent per level of the hierarchy.
 void toFile(java.lang.String fileName)
          Creates "HTML" file fileName.html from HTMLGenerator object.
 java.lang.String toString()
          Creates "HTML" code string of the DIFdoc object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

topLevelGraphName

protected java.lang.String topLevelGraphName

_topHier

protected Hierarchy _topHier
Clone of the original hierarchy given in the constructor.


_graph

protected DIFGraph _graph
Clone of the original graph given in the constructor.

See Also:
Graph.clone()

_elementAttributes

protected java.util.HashMap _elementAttributes
HashMap to store graph element attributes (such as node labels).

Constructor Detail

DIFdoc

protected DIFdoc()


DIFdoc

public DIFdoc(mocgraph.Graph graph)
Constructor for generating an DIFdoc object for just this graph.

Parameters:
graph - Graph to use as basis for HTML generation.

DIFdoc

public DIFdoc(Hierarchy hier)
Constructor for generating a hierarchical DIFdoc object.

Parameters:
hier - Hierarchy to use as the top-level hierarchy for HTML generation.
Method Detail

setAttribute

public java.lang.String setAttribute(mocgraph.Element graphElement,
                                     java.lang.String attribute,
                                     java.lang.String value)
Sets the attribute for an element (node or edge) in the graph.

Parameters:
graphElement - The element whose attribute we are setting
attribute - Attribute that is going to be set
value - The value of the attribute
Returns:
The previous value of the attribute if it exists, else null.

toString

public java.lang.String toString()
Creates "HTML" code string of the DIFdoc object.

Overrides:
toString in class java.lang.Object
Returns:
The "HTML" code.

toFile

public void toFile(java.lang.String fileName)
            throws java.io.IOException
Creates "HTML" file fileName.html from HTMLGenerator object.

Parameters:
fileName - Name of the HTML file to be written.
Throws:
java.io.IOException

printHierGraph

protected void printHierGraph(Hierarchy curHier,
                              int indentLevel,
                              java.lang.StringBuffer curString)

generateNodePNG

public void generateNodePNG(DIFGraph nodeGraph)
Takes in a DIFGraph and produces a PNG file in the current working directory with name DIFGraph.getName().png


setIndentAmount

public void setIndentAmount(java.lang.String indentString)
Sets the amount of indent per level of the hierarchy.

Parameters:
indentAmount - The "String" used to indent each level of the hierarchy.

insertIndent

protected java.lang.String insertIndent(int indentLevel)
Returns a string containing indentLevel many indents. The amount of indention is set by setIndentAmount.

Parameters:
indentLevel - The amount of indents
Returns:
A string containing the appropiate number of indents