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/06/28 14:15:07 UTC

svn commit: r1140552 - /commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseMutableGraph.java

Author: simonetripodi
Date: Tue Jun 28 12:15:06 2011
New Revision: 1140552

URL: http://svn.apache.org/viewvc?rev=1140552&view=rev
Log:
no needs to throw an exception for already present edges, automatically discarded

Modified:
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseMutableGraph.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=1140552&r1=1140551&r2=1140552&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 Jun 28 12:15:06 2011
@@ -112,10 +112,6 @@ public abstract class BaseMutableGraph<V
             throw new GraphException( "Null tail Vertex not admitted" );
         }
 
-        if ( !getAllEdges().add( e ) )
-        {
-            throw new GraphException( "Edge '%s' already present in the Graph", e );
-        }
         if ( !getAdjacencyList().containsKey( head ) )
         {
             throw new GraphException( "Head Vertex '%s' not present in the Graph", head );
@@ -125,6 +121,8 @@ public abstract class BaseMutableGraph<V
             throw new GraphException( "Tail Vertex '%s' not present in the Graph", tail );
         }
 
+        getAllEdges().add( e );
+
         internalAddEdge( head, e, tail );
 
         decorateAddEdge( head, e, tail );