commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1298216 - in /commons/sandbox/graph/branches/drop-marker-interfaces-feature/src/main/java/org/apache/commons/graph: CommonsGraph.java flow/DefaultFlowWeightedEdgesBuilder.java flow/DefaultFromHeadBuilder.java
Date Wed, 07 Mar 2012 23:34:57 GMT
Author: simonetripodi
Date: Wed Mar  7 23:34:56 2012
New Revision: 1298216

URL: http://svn.apache.org/viewvc?rev=1298216&view=rev
Log:
plugged builder to plug the mapper that gives weights for edges

Modified:
    commons/sandbox/graph/branches/drop-marker-interfaces-feature/src/main/java/org/apache/commons/graph/CommonsGraph.java
    commons/sandbox/graph/branches/drop-marker-interfaces-feature/src/main/java/org/apache/commons/graph/flow/DefaultFlowWeightedEdgesBuilder.java
    commons/sandbox/graph/branches/drop-marker-interfaces-feature/src/main/java/org/apache/commons/graph/flow/DefaultFromHeadBuilder.java

Modified: commons/sandbox/graph/branches/drop-marker-interfaces-feature/src/main/java/org/apache/commons/graph/CommonsGraph.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/drop-marker-interfaces-feature/src/main/java/org/apache/commons/graph/CommonsGraph.java?rev=1298216&r1=1298215&r2=1298216&view=diff
==============================================================================
--- commons/sandbox/graph/branches/drop-marker-interfaces-feature/src/main/java/org/apache/commons/graph/CommonsGraph.java
(original)
+++ commons/sandbox/graph/branches/drop-marker-interfaces-feature/src/main/java/org/apache/commons/graph/CommonsGraph.java
Wed Mar  7 23:34:56 2012
@@ -37,8 +37,8 @@ import org.apache.commons.graph.connecti
 import org.apache.commons.graph.connectivity.DefaultConnectivityBuilder;
 import org.apache.commons.graph.export.DefaultToStreamBuilder;
 import org.apache.commons.graph.export.ToStreamBuilder;
-import org.apache.commons.graph.flow.DefaultFromHeadBuilder;
-import org.apache.commons.graph.flow.FromHeadBuilder;
+import org.apache.commons.graph.flow.DefaultFlowWeightedEdgesBuilder;
+import org.apache.commons.graph.flow.FlowWeightedEdgesBuilder;
 import org.apache.commons.graph.model.DirectedMutableGraph;
 import org.apache.commons.graph.model.UndirectedMutableGraph;
 import org.apache.commons.graph.scc.DefaultSccAlgorithmSelector;
@@ -78,10 +78,10 @@ public final class CommonsGraph<V, E, G 
      * @param graph the input edge-weighted graph
      * @return
      */
-    public static <V, WE, W, G extends DirectedGraph<V, WE>> FromHeadBuilder<V,
WE, W, G> findMaxFlow( G graph )
+    public static <V, WE, G extends DirectedGraph<V, WE>> FlowWeightedEdgesBuilder<V,
WE, G> findMaxFlow( G graph )
     {
         graph = checkNotNull( graph, "Max flow can not be calculated on null graph" );
-        return new DefaultFromHeadBuilder<V, WE, W, G>( graph );
+        return new DefaultFlowWeightedEdgesBuilder<V, WE, G>( graph );
     }
 
     /**

Modified: commons/sandbox/graph/branches/drop-marker-interfaces-feature/src/main/java/org/apache/commons/graph/flow/DefaultFlowWeightedEdgesBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/drop-marker-interfaces-feature/src/main/java/org/apache/commons/graph/flow/DefaultFlowWeightedEdgesBuilder.java?rev=1298216&r1=1298215&r2=1298216&view=diff
==============================================================================
--- commons/sandbox/graph/branches/drop-marker-interfaces-feature/src/main/java/org/apache/commons/graph/flow/DefaultFlowWeightedEdgesBuilder.java
(original)
+++ commons/sandbox/graph/branches/drop-marker-interfaces-feature/src/main/java/org/apache/commons/graph/flow/DefaultFlowWeightedEdgesBuilder.java
Wed Mar  7 23:34:56 2012
@@ -38,7 +38,7 @@ public final class DefaultFlowWeightedEd
     public <W> FromHeadBuilder<V, WE, W, G> whereEdgesHaveWeights( Mapper<WE,
W> weightedEdges )
     {
         weightedEdges = checkNotNull( weightedEdges, "Function to calculate edges weight
can not be null." );
-        return null;
+        return new DefaultFromHeadBuilder<V, WE, W, G>( graph, weightedEdges );
     }
 
 }

Modified: commons/sandbox/graph/branches/drop-marker-interfaces-feature/src/main/java/org/apache/commons/graph/flow/DefaultFromHeadBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/drop-marker-interfaces-feature/src/main/java/org/apache/commons/graph/flow/DefaultFromHeadBuilder.java?rev=1298216&r1=1298215&r2=1298216&view=diff
==============================================================================
--- commons/sandbox/graph/branches/drop-marker-interfaces-feature/src/main/java/org/apache/commons/graph/flow/DefaultFromHeadBuilder.java
(original)
+++ commons/sandbox/graph/branches/drop-marker-interfaces-feature/src/main/java/org/apache/commons/graph/flow/DefaultFromHeadBuilder.java
Wed Mar  7 23:34:56 2012
@@ -22,6 +22,7 @@ package org.apache.commons.graph.flow;
 import static org.apache.commons.graph.utils.Assertions.checkNotNull;
 
 import org.apache.commons.graph.DirectedGraph;
+import org.apache.commons.graph.Mapper;
 
 /**
  * {@link FromHeadBuilder} implementation.
@@ -31,15 +32,18 @@ import org.apache.commons.graph.Directed
  * @param <WE>
  * @param <G>
  */
-public final class DefaultFromHeadBuilder<V, WE, W, G extends DirectedGraph<V, WE>>
+final class DefaultFromHeadBuilder<V, WE, W, G extends DirectedGraph<V, WE>>
     implements FromHeadBuilder<V, WE, W, G>
 {
 
     private final G graph;
 
-    public DefaultFromHeadBuilder( G graph )
+    private final Mapper<WE, W> weightedEdges;
+
+    public DefaultFromHeadBuilder( G graph, Mapper<WE, W> weightedEdges )
     {
         this.graph = graph;
+        this.weightedEdges = weightedEdges;
     }
 
     public ToTailBuilder<V, WE, W, G> from( V head )



Mime
View raw message