You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2011/12/20 09:32:46 UTC
svn commit: r1221138 -
/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/export/DotExporter.java
Author: simonetripodi
Date: Tue Dec 20 08:32:45 2011
New Revision: 1221138
URL: http://svn.apache.org/viewvc?rev=1221138&view=rev
Log:
[SANDBOX-346] DotExporter only exports weights that extend Number - patch provided by Claudio Squarcella
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=1221138&r1=1221137&r2=1221138&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 Tue Dec 20 08:32:45 2011
@@ -204,15 +204,20 @@ public final class DotExporter
}
if ( edge instanceof WeightedEdge )
{
- printWriter.format( " " );
+ Object weight = ( (WeightedEdge<?>) edge ).getWeight();
- if ( !attributesFound )
+ if( weight instanceof Number )
{
- printWriter.format( "[" );
- attributesFound = true;
- }
+ printWriter.format( " " );
+
+ if ( !attributesFound )
+ {
+ printWriter.format( "[" );
+ attributesFound = true;
+ }
- printWriter.format( "weight=%s", ( (WeightedEdge<?>) edge ).getWeight() );
+ printWriter.format( "weight=%f", ( (Number) weight ).doubleValue() );
+ }
}
if ( attributesFound )