commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1220532 - /commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/DotExporter.java
Date Sun, 18 Dec 2011 20:38:07 GMT
Author: simonetripodi
Date: Sun Dec 18 20:38:07 2011
New Revision: 1220532

URL: http://svn.apache.org/viewvc?rev=1220532&view=rev
Log:
no needs to buffer the edge output

Modified:
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/DotExporter.java

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/DotExporter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/DotExporter.java?rev=1220532&r1=1220531&r2=1220532&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/DotExporter.java
(original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/DotExporter.java
Sun Dec 18 20:38:07 2011
@@ -27,7 +27,6 @@ import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.io.Writer;
 import java.util.Date;
-import java.util.Formatter;
 
 import org.apache.commons.graph.DirectedGraph;
 import org.apache.commons.graph.Edge;
@@ -191,39 +190,37 @@ public final class DotExporter
             {
                 VertexPair<V> vertexPair = graph.getVertices( edge );
 
-                Formatter formatter = new Formatter().format( "  %s %s %s",
-                                                              vertexPair.getHead().hashCode(),
-                                                              connector,
-                                                              vertexPair.getTail().hashCode()
);
+                printWriter.format( "  %s %s %s",
+                                    vertexPair.getHead().hashCode(),
+                                    connector,
+                                    vertexPair.getTail().hashCode() );
 
                 boolean attributesFound = false;
 
                 if ( edge instanceof Labeled )
                 {
                     attributesFound = true;
-                    formatter.format( " [label=\"%s\"", ( (Labeled) edge ).getLabel() );
+                    printWriter.format( " [label=\"%s\"", ( (Labeled) edge ).getLabel() );
                 }
                 if ( edge instanceof WeightedEdge )
                 {
-                    formatter.format( " " );
+                    printWriter.format( " " );
 
                     if ( !attributesFound )
                     {
-                        formatter.format( "[" );
+                        printWriter.format( "[" );
                         attributesFound = true;
                     }
 
-                    formatter.format( "weight=%s", ( (WeightedEdge<?>) edge ).getWeight()
);
+                    printWriter.format( "weight=%s", ( (WeightedEdge<?>) edge ).getWeight()
);
                 }
 
                 if ( attributesFound )
                 {
-                    formatter.format( "]" );
+                    printWriter.format( "]" );
                 }
 
-                formatter.format( "%n" );
-
-                printWriter.write( formatter.toString() );
+                printWriter.format( "%n" );
             }
 
             printWriter.write( '}' );



Mime
View raw message