laser.dotgraph
Class AbstractDotGraphWriter

java.lang.Object
  extended by laser.dotgraph.AbstractDotGraphWriter
All Implemented Interfaces:
DotConstants
Direct Known Subclasses:
FSADotWriter

public abstract class AbstractDotGraphWriter
extends java.lang.Object
implements DotConstants

The AbstractDotGraphWriter class writes out the given graph in dot format.

REFERENCE: The URL is "http://www.graphviz.org".

Author:
Heather M. Conboy (laser-software@cs.umass.edu)

Field Summary
 
Fields inherited from interface laser.dotgraph.DotConstants
DOT_ATTRIBUTE_LIST_FOOTER, DOT_ATTRIBUTE_LIST_HEADER, DOT_ATTRIBUTE_LIST_SEPARATOR, DOT_ATTRIBUTE_SEPARATOR, DOT_COLOR_ATTRIBUTE_NAME, DOT_EDGE_SEPARATOR, DOT_GRAPH_EXTENSION, DOT_GRAPH_FOOTER, DOT_GRAPH_HEADER_PREFIX, DOT_GRAPH_HEADER_SUFFIX, DOT_LABEL_ATTRIBUTE_NAME, DOT_LINE_SEPARATOR, DOT_SHAPE_ATTRIBUTE_NAME, DOT_STATEMENT_SUFFIX, DOT_STYLE_ATTRIBUTE_NAME, DOT_SUBGRAPH_FOOTER, DOT_SUBGRAPH_HEADER_PREFIX, DOT_SUBGRAPH_HEADER_SUFFIX, DOT_WORD_SEPARATOR
 
Constructor Summary
protected AbstractDotGraphWriter()
          Creates a new AbstractDotWriter.
 
Method Summary
abstract  java.util.List<DotAttribute> getDotEdgeAttributes(java.lang.Object edge)
          Gets the attributes of the given edge.
abstract  java.lang.String getDotEdgeName(java.lang.Object edge)
          Gets the name of the given edge.
abstract  int getDotEdgeSourceID(java.lang.Object edge)
          Gets the ID of the source node of the given edge.
abstract  int getDotEdgeTargetID(java.lang.Object edge)
          Gets the ID of the target node of the given edge.
abstract  java.util.List<DotAttribute> getDotGraphAttributes(java.lang.Object graph)
          Gets the attributes of the given graph.
abstract  java.util.Set<java.lang.Object> getDotGraphEdges(java.lang.Object graph)
          Gets the Set of edges contained within the given graph that are not contained within any subgraph.
abstract  java.lang.String getDotGraphName(java.lang.Object graph)
          Gets the name of the given graph.
abstract  java.util.Set<java.lang.Object> getDotGraphNodes(java.lang.Object graph)
          Gets the Set of nodes contained within the given graph that are not contained within any subgraph.
abstract  java.util.Set<java.lang.Object> getDotGraphSubgraphs(java.lang.Object graph)
          Gets the Set of subgraphs contained within the given graph.
abstract  java.util.List<DotAttribute> getDotNodeAttributes(java.lang.Object node)
          Gets the attributes of the given node.
abstract  int getDotNodeID(java.lang.Object node)
          Gets the ID of the given node.
abstract  java.lang.String getDotNodeName(java.lang.Object node)
          Gets the name of the given node.
abstract  java.util.List<DotAttribute> getDotSubgraphAttributes(java.lang.Object subgraph)
          Gets the attributes of the given subgraph.
abstract  java.util.Set<java.lang.Object> getDotSubgraphEdges(java.lang.Object subgraph)
          Gets the Set of edges contained within the given subgraph.
abstract  int getDotSubgraphID(java.lang.Object subgraph)
          Gets the ID of the given subgraph.
abstract  java.lang.String getDotSubgraphName(java.lang.Object subgraph)
          Gets the name of the given subgraph.
abstract  java.util.Set<java.lang.Object> getDotSubgraphNodes(java.lang.Object subgraph)
          Gets the Set of nodes contained within the given subgraph.
 java.lang.String toDoubleQuotedString(java.lang.String unquotedString)
          Creates a double quoted String from the given unquoted String.
 void writeDotAttribute(DotAttribute dotAttribute, java.io.Writer out)
          Writes out the given attribute to the specified output Writer.
 void writeDotAttributeList(java.util.List<DotAttribute> dotAttributes, java.io.Writer out)
          Writes out the given attributes as a list to the specified output Writer.
 void writeDotAttributeStatements(java.util.List<DotAttribute> dotAttributes, java.io.Writer out)
          Writes out the given attributes as statements to the specified output Writer.
 void writeDotEdge(java.lang.Object edge, java.io.Writer out)
          Writes out the given edge in dot format to the specified output Writer.
 void writeDotGraph(java.lang.Object graph, java.io.File outFile)
          Writes out the given graph in dot format to the specified output File.
 void writeDotGraph(java.lang.Object graph, java.io.Writer out)
          Writes out the given graph in dot format to the specified output Writer.
 void writeDotNode(java.lang.Object node, java.io.Writer out)
          Writes out the given node in dot format to the specified output Writer.
 void writeDotSubgraph(java.lang.Object subgraph, java.io.Writer out)
          Writes out the given subgraph in dot format to the specified output Writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDotGraphWriter

protected AbstractDotGraphWriter()
Creates a new AbstractDotWriter.

Method Detail

getDotGraphName

public abstract java.lang.String getDotGraphName(java.lang.Object graph)
Gets the name of the given graph.

Parameters:
graph - The graph of interest
Returns:
The name for the given graph

getDotGraphAttributes

public abstract java.util.List<DotAttribute> getDotGraphAttributes(java.lang.Object graph)
Gets the attributes of the given graph.

Parameters:
graph - The graph of interest
Returns:
The List of DotAttributes for the given graph

getDotGraphSubgraphs

public abstract java.util.Set<java.lang.Object> getDotGraphSubgraphs(java.lang.Object graph)
Gets the Set of subgraphs contained within the given graph.

Parameters:
graph - The graph of interest
Returns:
The Set of subgraphs contained within the given graph

getDotGraphNodes

public abstract java.util.Set<java.lang.Object> getDotGraphNodes(java.lang.Object graph)
Gets the Set of nodes contained within the given graph that are not contained within any subgraph.

Parameters:
graph - The graph of interest
Returns:
The Set of nodes contained within the given graph

getDotGraphEdges

public abstract java.util.Set<java.lang.Object> getDotGraphEdges(java.lang.Object graph)
Gets the Set of edges contained within the given graph that are not contained within any subgraph.

Parameters:
graph - The graph of interest
Returns:
The Set of edges contained within the given graph

writeDotGraph

public void writeDotGraph(java.lang.Object graph,
                          java.io.File outFile)
                   throws java.io.IOException
Writes out the given graph in dot format to the specified output File.

PRECONDITIONS:

Parameters:
graph - The graph to be written
outFile - The File to use as output
Throws:
java.io.IOException - if an I/O error occurs
java.lang.IllegalArgumentException - if any precondition is not met

writeDotGraph

public void writeDotGraph(java.lang.Object graph,
                          java.io.Writer out)
                   throws java.io.IOException
Writes out the given graph in dot format to the specified output Writer.

PRECONDITIONS:

Parameters:
graph - The graph to be written
out - The Writer to use as output
Throws:
java.io.IOException - if an I/O error occurs
java.lang.IllegalArgumentException - if any precondition is not met

getDotSubgraphName

public abstract java.lang.String getDotSubgraphName(java.lang.Object subgraph)
Gets the name of the given subgraph.

Parameters:
subgraph - The subgraph of interest
Returns:
The name for the given subgraph

getDotSubgraphID

public abstract int getDotSubgraphID(java.lang.Object subgraph)
Gets the ID of the given subgraph.

Parameters:
subgraph - The subgraph of interest
Returns:
The ID of the given subgraph

getDotSubgraphAttributes

public abstract java.util.List<DotAttribute> getDotSubgraphAttributes(java.lang.Object subgraph)
Gets the attributes of the given subgraph.

Parameters:
subgraph - The subgraph of interest
Returns:
The List of DotAttributes for the given subgraph

getDotSubgraphNodes

public abstract java.util.Set<java.lang.Object> getDotSubgraphNodes(java.lang.Object subgraph)
Gets the Set of nodes contained within the given subgraph.

Parameters:
subgraph - The graph of interest
Returns:
The Set of nodes contained within the given subgraph
See Also:
getDotGraphNodes(java.lang.Object)

getDotSubgraphEdges

public abstract java.util.Set<java.lang.Object> getDotSubgraphEdges(java.lang.Object subgraph)
Gets the Set of edges contained within the given subgraph.

Parameters:
subgraph - The subgraph of interest
Returns:
The Set of edges contained within the given subgraph
See Also:
getDotGraphEdges(java.lang.Object)

writeDotSubgraph

public void writeDotSubgraph(java.lang.Object subgraph,
                             java.io.Writer out)
                      throws java.io.IOException
Writes out the given subgraph in dot format to the specified output Writer.

PRECONDITIONS:

Parameters:
subgraph - The subgraph to be written
out - The Writer to use as output
Throws:
java.io.IOException - if an I/O error occurs
java.lang.IllegalArgumentException - if any precondition is not met

getDotNodeName

public abstract java.lang.String getDotNodeName(java.lang.Object node)
Gets the name of the given node.

Parameters:
node - The node of interest
Returns:
The name for the given node

getDotNodeID

public abstract int getDotNodeID(java.lang.Object node)
Gets the ID of the given node.

Parameters:
node - The node of interest
Returns:
The ID of the given node

getDotNodeAttributes

public abstract java.util.List<DotAttribute> getDotNodeAttributes(java.lang.Object node)
Gets the attributes of the given node.

Parameters:
node - The node of interest
Returns:
The List of DotAttributes for the given node

writeDotNode

public void writeDotNode(java.lang.Object node,
                         java.io.Writer out)
                  throws java.io.IOException
Writes out the given node in dot format to the specified output Writer.

PRECONDITIONS:

Parameters:
node - The node to be written
out - The Writer to use as output
Throws:
java.io.IOException - if an I/O error occurs
java.lang.IllegalArgumentException - if any precondition is not met

getDotEdgeName

public abstract java.lang.String getDotEdgeName(java.lang.Object edge)
Gets the name of the given edge.

Parameters:
edge - The edge of interest
Returns:
The name

getDotEdgeSourceID

public abstract int getDotEdgeSourceID(java.lang.Object edge)
Gets the ID of the source node of the given edge.

Parameters:
edge - The edge of interest
Returns:
The ID of the source node

getDotEdgeTargetID

public abstract int getDotEdgeTargetID(java.lang.Object edge)
Gets the ID of the target node of the given edge.

Parameters:
edge - The edge of interest
Returns:
The ID of the target node

getDotEdgeAttributes

public abstract java.util.List<DotAttribute> getDotEdgeAttributes(java.lang.Object edge)
Gets the attributes of the given edge.

Parameters:
edge - The edge of interest
Returns:
The List of DotAttributes for the given edge

writeDotEdge

public void writeDotEdge(java.lang.Object edge,
                         java.io.Writer out)
                  throws java.io.IOException
Writes out the given edge in dot format to the specified output Writer.

PRECONDITIONS:

Parameters:
edge - The edge to be written
out - The Writer to use as output
Throws:
java.io.IOException - if an I/O error occurs
java.lang.IllegalArgumentException - if any precondition is not met

writeDotAttributeList

public void writeDotAttributeList(java.util.List<DotAttribute> dotAttributes,
                                  java.io.Writer out)
                           throws java.io.IOException
Writes out the given attributes as a list to the specified output Writer.

PRECONDITIONS:

Parameters:
dotAttributes - The attributes to be written
out - The Writer to use as output
Throws:
java.io.IOException - if an I/O error occurs
java.lang.IllegalArgumentException - if any precondition is not met

writeDotAttributeStatements

public void writeDotAttributeStatements(java.util.List<DotAttribute> dotAttributes,
                                        java.io.Writer out)
                                 throws java.io.IOException
Writes out the given attributes as statements to the specified output Writer.

PRECONDITIONS:

Parameters:
dotAttributes - The attributes to be written
out - The Writer to use as output
Throws:
java.io.IOException - if an I/O error occurs
java.lang.IllegalArgumentException - if any precondition is not met

writeDotAttribute

public void writeDotAttribute(DotAttribute dotAttribute,
                              java.io.Writer out)
                       throws java.io.IOException
Writes out the given attribute to the specified output Writer.

PRECONDITIONS:

Parameters:
dotAttribute - The attribute to be written
out - The Writer to use as output
Throws:
java.io.IOException - if an I/O error occurs
java.lang.IllegalArgumentException - if any precondition is not met

toDoubleQuotedString

public java.lang.String toDoubleQuotedString(java.lang.String unquotedString)
Creates a double quoted String from the given unquoted String.

Parameters:
unquotedString - The unquoted String
Returns:
The corresponding double quoted String