Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8CF6E9032 for ; Mon, 6 Feb 2012 12:05:09 +0000 (UTC) Received: (qmail 88733 invoked by uid 500); 6 Feb 2012 12:05:09 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 88611 invoked by uid 500); 6 Feb 2012 12:05:08 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 88604 invoked by uid 99); 6 Feb 2012 12:05:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Feb 2012 12:05:08 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Feb 2012 12:05:07 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 5ACD7238890D for ; Mon, 6 Feb 2012 12:04:47 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1240992 - /commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/DefaultSpanningTreeAlgorithmSelector.java Date: Mon, 06 Feb 2012 12:04:47 -0000 To: commits@commons.apache.org From: simonetripodi@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120206120447.5ACD7238890D@eris.apache.org> Author: simonetripodi Date: Mon Feb 6 12:04:46 2012 New Revision: 1240992 URL: http://svn.apache.org/viewvc?rev=1240992&view=rev Log: trivial format Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/DefaultSpanningTreeAlgorithmSelector.java Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/DefaultSpanningTreeAlgorithmSelector.java URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/DefaultSpanningTreeAlgorithmSelector.java?rev=1240992&r1=1240991&r2=1240992&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/DefaultSpanningTreeAlgorithmSelector.java (original) +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/DefaultSpanningTreeAlgorithmSelector.java Mon Feb 6 12:04:46 2012 @@ -77,13 +77,13 @@ final class DefaultSpanningTreeAlgorithm * end while *
          */
-        
+
         final MutableSpanningTree spanningTree =
             new MutableSpanningTree( orderedMonoid );
-        
+
         final Set> components =
             new HashSet>( graph.getOrder() );
-        
+
         final Map> mapping =
             new HashMap>( graph.getOrder() );
 
@@ -99,52 +99,59 @@ final class DefaultSpanningTreeAlgorithm
             spanningTree.addVertex( v );
         }
 
-        while ( components.size() > 1 ) {
+        while ( components.size() > 1 )
+        {
             List edges = new LinkedList();
-            for ( SuperVertex v : components ) {
+            for ( SuperVertex v : components )
+            {
                 // get the minimum edge for each component to any other component
                 WE edge = v.getMinimumWeightEdge();
-                if (edge != null) {
+                if ( edge != null )
+                {
                     edges.add( edge );
                 }
             }
 
             // if there is no edge anymore for a component, and there is still more than 1 component,
             // the graph is unconnected
-            checkState(!edges.isEmpty() || components.size() == 1, "unconnected graph");
-            
-            for ( WE edge : edges ) {
+            checkState( !edges.isEmpty() || components.size() == 1, "unconnected graph" );
+
+            for ( WE edge : edges )
+            {
                 VertexPair pair = graph.getVertices( edge );
                 V head = pair.getHead();
                 V tail = pair.getTail();
-                
+
                 // find the super vertices corresponding to this edge
                 SuperVertex headSuper = mapping.get( head );
                 SuperVertex tailSuper = mapping.get( tail );
-                
+
                 // merge them, if they are not the same
-                if ( headSuper != tailSuper ) {
+                if ( headSuper != tailSuper )
+                {
                     headSuper.merge( tailSuper );
-                
+
                     // update the mapping for each merged vertex
-                    for ( V v : tailSuper ) {
+                    for ( V v : tailSuper )
+                    {
                         mapping.put( v, headSuper );
                     }
-                
+
                     // remove the merged super vertex from the components set
                     components.remove( tailSuper );
 
                     // add the edge to the spanning tree
-                    if ( spanningTree.getVertices( edge ) == null ) {
+                    if ( spanningTree.getVertices( edge ) == null )
+                    {
                         spanningTree.addEdge( head, edge, tail );
                     }
                 }
-            }            
+            }
         }
-        
+
         return spanningTree;
     }
-    
+
     /**
      * {@inheritDoc}
      */