commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1142965 - in /commons/sandbox/graph/trunk/src: main/java/org/apache/commons/graph/model/BaseMutableGraph.java test/java/org/apache/commons/graph/visit/VisitTestCase.java
Date Tue, 05 Jul 2011 10:17:51 GMT
Author: simonetripodi
Date: Tue Jul  5 10:17:51 2011
New Revision: 1142965

URL: http://svn.apache.org/viewvc?rev=1142965&view=rev
Log:
[SANDBOX-336] Duplicate Edge - TestCase submitted by Marco Speranza

Modified:
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseMutableGraph.java
    commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/visit/VisitTestCase.java

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseMutableGraph.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseMutableGraph.java?rev=1142965&r1=1142964&r2=1142965&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseMutableGraph.java
(original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseMutableGraph.java
Tue Jul  5 10:17:51 2011
@@ -120,6 +120,11 @@ public abstract class BaseMutableGraph<V
         {
             throw new GraphException( "Tail Vertex '%s' not present in the Graph", tail );
         }
+        
+        if ( getEdge( head, tail ) != null )
+        {
+            throw new GraphException( "Edge %s is already present in the Graph", e );
+        }
 
         getAllEdges().add( e );
 

Modified: commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/visit/VisitTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/visit/VisitTestCase.java?rev=1142965&r1=1142964&r2=1142965&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/visit/VisitTestCase.java
(original)
+++ commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/visit/VisitTestCase.java
Tue Jul  5 10:17:51 2011
@@ -143,24 +143,16 @@ public final class VisitTestCase
         input.addVertex( s );
 
         input.addEdge( s, new BaseLabeledEdge( "S <-> A" ), a );
-        input.addEdge( a, new BaseLabeledEdge( "A <-> S" ), s );
         input.addEdge( s, new BaseLabeledEdge( "S <-> B" ), b );
-        input.addEdge( b, new BaseLabeledEdge( "B <-> S" ), s );
 
         input.addEdge( a, new BaseLabeledEdge( "A <-> C" ), c );
-        input.addEdge( c, new BaseLabeledEdge( "C <-> A" ), a );
         input.addEdge( a, new BaseLabeledEdge( "A <-> D" ), d );
-        input.addEdge( d, new BaseLabeledEdge( "D <-> A" ), a );
 
         input.addEdge( b, new BaseLabeledEdge( "B <-> E" ), e );
-        input.addEdge( e, new BaseLabeledEdge( "E <-> B" ), b );
         input.addEdge( b, new BaseLabeledEdge( "B <-> F" ), f );
-        input.addEdge( f, new BaseLabeledEdge( "F <-> B" ), b );
 
         input.addEdge( e, new BaseLabeledEdge( "E <-> H" ), h );
-        input.addEdge( h, new BaseLabeledEdge( "H <-> E" ), e );
         input.addEdge( e, new BaseLabeledEdge( "E <-> G" ), g );
-        input.addEdge( g, new BaseLabeledEdge( "G <-> E" ), e );
 
         // expected node set
 



Mime
View raw message