commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1141657 - in /commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath: FloydWarshall.java PredecessorsList.java
Date Thu, 30 Jun 2011 18:37:13 GMT
Author: simonetripodi
Date: Thu Jun 30 18:37:13 2011
New Revision: 1141657

URL: http://svn.apache.org/viewvc?rev=1141657&view=rev
Log:
PredecessorsList field members made private, added public method to check if PredecessorsList
is empty

Modified:
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/FloydWarshall.java
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/PredecessorsList.java

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/FloydWarshall.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/FloydWarshall.java?rev=1141657&r1=1141656&r2=1141657&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/FloydWarshall.java
(original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/FloydWarshall.java
Thu Jun 30 18:37:13 2011
@@ -97,7 +97,7 @@ public final class FloydWarshall
                     PredecessorsList<V, WE> predecessorsList = new PredecessorsList<V,
WE>( graph );
 
                     pathReconstruction( predecessorsList, source, target, next, graph );
-                    if ( !predecessorsList.predecessors.isEmpty() )
+                    if ( !predecessorsList.isEmpty() )
                     {
                         WeightedPath<V, WE> weightedPath = predecessorsList.buildPath(
source, target );
                         if ( weightedPath.size() > 0 )

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/PredecessorsList.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/PredecessorsList.java?rev=1141657&r1=1141656&r2=1141657&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/PredecessorsList.java
(original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/PredecessorsList.java
Thu Jun 30 18:37:13 2011
@@ -39,9 +39,9 @@ import org.apache.commons.graph.model.In
 final class PredecessorsList<V extends Vertex, WE extends WeightedEdge>
 {
 
-    final Graph<V, WE> graph;
+    private final Graph<V, WE> graph;
 
-    final Map<V, V> predecessors = new HashMap<V, V>();
+    private final Map<V, V> predecessors = new HashMap<V, V>();
 
     public PredecessorsList(Graph<V, WE> graph )
     {
@@ -88,4 +88,14 @@ final class PredecessorsList<V extends V
         return path;
     }
 
+    /**
+     * Checks the predecessor list has no elements.
+     *
+     * @return true, if the predecessor list has no elements, false otherwise.
+     */
+    public boolean isEmpty()
+    {
+        return predecessors.isEmpty();
+    }
+
 }



Mime
View raw message