commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1141839 - in /commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph: Path.java model/InMemoryPath.java shortestpath/FloydWarshall.java
Date Fri, 01 Jul 2011 06:55:11 GMT
Author: simonetripodi
Date: Fri Jul  1 06:55:11 2011
New Revision: 1141839

URL: http://svn.apache.org/viewvc?rev=1141839&view=rev
Log:
Path size() method replaced by getOrder()/getSize()

Modified:
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/Path.java
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/InMemoryPath.java
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/FloydWarshall.java

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/Path.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/Path.java?rev=1141839&r1=1141838&r2=1141839&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/Path.java (original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/Path.java Fri Jul 
1 06:55:11 2011
@@ -56,6 +56,13 @@ public interface Path<V extends Vertex, 
     List<V> getVertices();
 
     /**
+     * Returns the <i>order</i> of a Graph (the number of Vertices);
+     *
+     * @return the <i>order</i> of a Graph (the number of Vertices);
+     */
+    int getOrder();
+
+    /**
      * Returns a list of Edges which comprise the path.
      *
      * It will have one less than the list of Vertices.
@@ -65,10 +72,10 @@ public interface Path<V extends Vertex, 
     List<E> getEdges();
 
     /**
-     * Returns the size of the path in terms of number of vertices it visits.
+     * Returns the <i>size</i> of a Graph (the number of Edges)
      *
-     * @return the size of the path in terms of number of vertices it visits.
+     * @return the <i>size</i> of a Graph (the number of Edges)
      */
-    int size();
+    int getSize();
 
 }

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/InMemoryPath.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/InMemoryPath.java?rev=1141839&r1=1141838&r2=1141839&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/InMemoryPath.java
(original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/InMemoryPath.java
Fri Jul  1 06:55:11 2011
@@ -97,6 +97,14 @@ public class InMemoryPath<V extends Vert
         return unmodifiableList( vertices );
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public int getOrder()
+    {
+        return vertices.size();
+    }
+
     public void addEdgeInHead( E edge )
     {
         edges.addFirst( edge );
@@ -118,9 +126,9 @@ public class InMemoryPath<V extends Vert
     /**
      * {@inheritDoc}
      */
-    public int size()
+    public int getSize()
     {
-        return vertices.size();
+        return edges.size();
     }
 
     /**

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=1141839&r1=1141838&r2=1141839&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
Fri Jul  1 06:55:11 2011
@@ -100,7 +100,7 @@ public final class FloydWarshall
                     if ( !predecessorsList.isEmpty() )
                     {
                         WeightedPath<V, WE> weightedPath = predecessorsList.buildPath(
source, target );
-                        if ( weightedPath.size() > 0 )
+                        if ( weightedPath.getOrder() > 0 )
                         {
                             shortesPaths.addShortestPath( source, target, weightedPath );
                         }



Mime
View raw message