soot.util.dot
Class DotGraph

java.lang.Object
  extended bysoot.util.dot.DotGraph
All Implemented Interfaces:
Renderable

public class DotGraph
extends Object
implements Renderable


Field Summary
static String DOT_EXTENSION
          The extension added to output files, exported so that clients can search for the filenames.
 
Constructor Summary
DotGraph(String graphname)
          Creates a new graph for drawing.
 
Method Summary
 DotGraph createSubGraph(String label)
          creates a sub graph.
 DotGraphEdge drawEdge(String from, String to)
          Draws a directed edge (including the source and end nodes, if they have not already been drawn).
 DotGraphNode drawNode(String name)
          Draws a node.
 void drawUndirectedEdge(String label1, String label2)
          draws an undirected edge
 DotGraphNode getNode(String name)
          Gets the graph node by name.
 void plot(String filename)
          Generates the drawing on canvas to the dot file.
 void render(OutputStream out, int indent)
           
 void setGraphAttribute(DotGraphAttribute attr)
          sets any general attributes
 void setGraphAttribute(String id, String value)
          sets any general attributes
 void setGraphLabel(String label)
          sets the graph label
 void setGraphSize(double width, double height)
          sets the size of drawing area, in inches
 void setNodeShape(String shape)
          Sets all node shapes, see the list of node shapes in DotGraphConstants.
 void setNodeStyle(String style)
          Sets all node styles
 void setOrientation(String orientation)
          sets the graph rotation angles
 void setPageSize(double width, double height)
          sets the pages size, once this is set, the generated graph will be broken into several pages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOT_EXTENSION

public static final String DOT_EXTENSION
The extension added to output files, exported so that clients can search for the filenames.

See Also:
Constant Field Values
Constructor Detail

DotGraph

public DotGraph(String graphname)
Creates a new graph for drawing.

Method Detail

plot

public void plot(String filename)
Generates the drawing on canvas to the dot file.

Parameters:
filename - the name for the output file. By convention, it should end with DOT_EXTENSION, but this is not enforced.

drawEdge

public DotGraphEdge drawEdge(String from,
                             String to)
Draws a directed edge (including the source and end nodes, if they have not already been drawn).

Returns:
a graph edge

drawNode

public DotGraphNode drawNode(String name)
Draws a node.

Returns:
the DotGraphNode corresponding to the specified name.

getNode

public DotGraphNode getNode(String name)
Gets the graph node by name.

Returns:
the node with the specified name, or null if there is no such node.

setNodeShape

public void setNodeShape(String shape)
Sets all node shapes, see the list of node shapes in DotGraphConstants.


setNodeStyle

public void setNodeStyle(String style)
Sets all node styles


setGraphSize

public void setGraphSize(double width,
                         double height)
sets the size of drawing area, in inches


setPageSize

public void setPageSize(double width,
                        double height)
sets the pages size, once this is set, the generated graph will be broken into several pages.


setOrientation

public void setOrientation(String orientation)
sets the graph rotation angles


setGraphLabel

public void setGraphLabel(String label)
sets the graph label


setGraphAttribute

public void setGraphAttribute(String id,
                              String value)
sets any general attributes

Parameters:
id - is the attribute name.
value - is the attribute value.

setGraphAttribute

public void setGraphAttribute(DotGraphAttribute attr)
sets any general attributes

Parameters:
attr - a DotGraphAttribute specifying the attribute name and value.

drawUndirectedEdge

public void drawUndirectedEdge(String label1,
                               String label2)
draws an undirected edge


createSubGraph

public DotGraph createSubGraph(String label)
creates a sub graph.

Returns:
the newly created sub graph.

render

public void render(OutputStream out,
                   int indent)
            throws IOException
Specified by:
render in interface Renderable
Throws:
IOException