com.arsdigita.util
Interface GraphFormatter


public interface GraphFormatter

Implementations of this interface can be used for pretty-printing graphs.

Since:
2003-01-23
Version:
$Date: 2004/04/07 $
Author:
Vadim Nasardinov (vadimn@redhat.com)

Method Summary
 String edge(Object edge)
          Returns a short textual label describing the edge.
 String graphAttributes(Graph graph)
          Returns graph attributes.
 String nodeAttributes(Object node)
          Returns [bracketed] node attributes.
 String nodeName(Object node)
          Returns a textual representation of the node, preferably a short one that can be used in the following plain-text representation of the tree.
 

Method Detail

graphAttributes

public String graphAttributes(Graph graph)
Returns graph attributes.

For example, if you choose to pretty-print your graph in the DOT language, then the graph attributes section may look like so:

  digraph mygraph {
     // the following two lines are graph attributes
     node[shape=box,fontsize=8,fontname=verdana,height=0.2,width=0.2,style=filled];
     ranksep=0.05;

     // the following lines are nodes and edges
     A -> B -> C -> D;
     B -> E -> F;
     C -> G;
     D -> I;
     D -> J -> H;
  }


nodeName

public String nodeName(Object node)
Returns a textual representation of the node, preferably a short one that can be used in the following plain-text representation of the tree.
 digraph tree {
     A -> B -> C -> D;
     B -> E -> F;
     C -> G;
     D -> I;
     D -> J -> H;
 }
 

Example implementation:

  public String formatNode(Object node) {
      return node == null ? null : ((ObjectType) node).getName();
  }
 


nodeAttributes

public String nodeAttributes(Object node)
Returns [bracketed] node attributes.
  digraph g {
      C[label="The C Language"];
      J;
      C -> J;
  }
 


edge

public String edge(Object edge)
Returns a short textual label describing the edge.



Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC