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 AA69097D5 for ; Wed, 22 Feb 2012 13:21:33 +0000 (UTC) Received: (qmail 59355 invoked by uid 500); 22 Feb 2012 13:21:33 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 59290 invoked by uid 500); 22 Feb 2012 13:21:33 -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 59283 invoked by uid 99); 22 Feb 2012 13:21:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Feb 2012 13:21:33 +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; Wed, 22 Feb 2012 13:21:27 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id A1C602388860 for ; Wed, 22 Feb 2012 13:21:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1292272 [1/2] - in /commons/sandbox/graph/trunk/src: changes/ main/java/org/apache/commons/graph/flow/ main/java/org/apache/commons/graph/model/ main/java/org/apache/commons/graph/shortestpath/ main/java/org/apache/commons/graph/spanning/ ... Date: Wed, 22 Feb 2012 13:21:05 -0000 To: commits@commons.apache.org From: cs@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120222132107.A1C602388860@eris.apache.org> Author: cs Date: Wed Feb 22 13:21:03 2012 New Revision: 1292272 URL: http://svn.apache.org/viewvc?rev=1292272&view=rev Log: corrected names for classes and variables related to operations on weights Added: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigDecimalWeightBaseOperations.java - copied, changed from r1290988, commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigDecimalWeight.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigIntegerWeightBaseOperations.java - copied, changed from r1290988, commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigIntegerWeight.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/DoubleWeightBaseOperations.java - copied, changed from r1290988, commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/DoubleWeight.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/FloatWeightBaseOperations.java - copied, changed from r1290988, commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/FloatWeight.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/IntegerWeightBaseOperations.java - copied, changed from r1290988, commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/IntegerWeight.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/LongWeightBaseOperations.java - copied, changed from r1290988, commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/LongWeight.java Removed: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigDecimalWeight.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigIntegerWeight.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/DoubleWeight.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/FloatWeight.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/IntegerWeight.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/LongWeight.java Modified: commons/sandbox/graph/trunk/src/changes/changes.xml commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/DefaultMaxFlowAlgorithmSelector.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/FlowNetworkHandler.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/MaxFlowAlgorithmSelector.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/InMemoryWeightedPath.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/MutableSpanningTree.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/AllVertexPairsShortestPath.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/DefaultHeuristicBuilder.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/DefaultPathSourceSelector.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/DefaultShortestPathAlgorithmSelector.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/DefaultTargetSourceSelector.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/HeuristicBuilder.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/PathSourceSelector.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/PredecessorsList.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/ShortestDistances.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/ShortestPathAlgorithmSelector.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/TargetSourceSelector.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/DefaultSpanningTreeAlgorithmSelector.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/DefaultSpanningTreeSourceSelector.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/ShortestEdges.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/SpanningTreeAlgorithmSelector.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/SpanningTreeSourceSelector.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/SuperVertex.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/WeightedEdgesComparator.java commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/package-info.java commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/flow/EdmondsKarpTestCase.java commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/flow/FordFulkersonTestCase.java commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/shortestpath/AStarTestCase.java commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/shortestpath/BellmannFordTestCase.java commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/shortestpath/DijkstraTestCase.java commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/shortestpath/FloydWarshallTestCase.java commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/BoruvkaTestCase.java commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/KruskalTestCase.java commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/PrimTestCase.java commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/ReverseDeleteTestCase.java Modified: commons/sandbox/graph/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/changes/changes.xml?rev=1292272&r1=1292271&r2=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/changes/changes.xml (original) +++ commons/sandbox/graph/trunk/src/changes/changes.xml Wed Feb 22 13:21:03 2012 @@ -23,6 +23,9 @@ + + Correct names for classes and variables related to operations on weights + Add containsEdge and containsVertex into Graph interface Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/DefaultMaxFlowAlgorithmSelector.java URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/DefaultMaxFlowAlgorithmSelector.java?rev=1292272&r1=1292271&r2=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/DefaultMaxFlowAlgorithmSelector.java (original) +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/DefaultMaxFlowAlgorithmSelector.java Wed Feb 22 13:21:03 2012 @@ -59,15 +59,15 @@ final class DefaultMaxFlowAlgorithmSelec /** * {@inheritDoc} */ - public > W applyingFordFulkerson( OM orderedMonoid ) + public > W applyingFordFulkerson( WO weightOperations ) { - final OM checkedOrderedMonoid = checkNotNull( orderedMonoid, "Weight monoid can not be null to find the max flow in the graph" ); + final WO checkedWeightOperations = checkNotNull( weightOperations, "Weight operations can not be null to find the max flow in the graph" ); // create flow network - final DirectedGraph> flowNetwork = newFlowNetwok( graph, checkedOrderedMonoid ); + final DirectedGraph> flowNetwork = newFlowNetwok( graph, checkedWeightOperations ); // create flow network handler - final FlowNetworkHandler flowNetworkHandler = new FlowNetworkHandler( flowNetwork, source, target, checkedOrderedMonoid ); + final FlowNetworkHandler flowNetworkHandler = new FlowNetworkHandler( flowNetwork, source, target, checkedWeightOperations ); // perform depth first search visit( flowNetwork ).from( source ).applyingDepthFirstSearch( flowNetworkHandler ); @@ -86,15 +86,15 @@ final class DefaultMaxFlowAlgorithmSelec /** * {@inheritDoc} */ - public > W applyingEdmondsKarp( OM orderedMonoid ) + public > W applyingEdmondsKarp( WO weightOperations ) { - final OM checkedOrderedMonoid = checkNotNull( orderedMonoid, "Weight monoid can not be null to find the max flow in the graph" ); + final WO checkedWeightOperations = checkNotNull( weightOperations, "Weight operations can not be null to find the max flow in the graph" ); // create flow network - final DirectedGraph> flowNetwork = newFlowNetwok( graph, checkedOrderedMonoid ); + final DirectedGraph> flowNetwork = newFlowNetwok( graph, checkedWeightOperations ); // create flow network handler - final FlowNetworkHandler flowNetworkHandler = new FlowNetworkHandler( flowNetwork, source, target, checkedOrderedMonoid ); + final FlowNetworkHandler flowNetworkHandler = new FlowNetworkHandler( flowNetwork, source, target, checkedWeightOperations ); // perform breadth first search visit( flowNetwork ).from( source ).applyingBreadthFirstSearch( flowNetworkHandler ); @@ -110,7 +110,7 @@ final class DefaultMaxFlowAlgorithmSelec return flowNetworkHandler.onCompleted(); } - private > DirectedGraph> newFlowNetwok( final G graph, final OM orderedMonoid ) + private > DirectedGraph> newFlowNetwok( final G graph, final WO weightOperations ) { return newDirectedMutableWeightedGraph( new AbstractGraphConnection>() { @@ -134,7 +134,7 @@ final class DefaultMaxFlowAlgorithmSelec if ( graph.getEdge( tail, head ) == null ) { // complete the flow network with a zero-capacity inverse edge - addEdge( new BaseLabeledWeightedEdge( "Inverse edge for " + edge, orderedMonoid.zero() ) ) + addEdge( new BaseLabeledWeightedEdge( "Inverse edge for " + edge, weightOperations.zero() ) ) .from( tail ).to( head ); } } Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/FlowNetworkHandler.java URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/FlowNetworkHandler.java?rev=1292272&r1=1292271&r2=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/FlowNetworkHandler.java (original) +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/FlowNetworkHandler.java Wed Feb 22 13:21:03 2012 @@ -48,7 +48,7 @@ class FlowNetworkHandler orderedMonoid; + private final OrderedMonoid weightOperations; private W maxFlow; @@ -59,14 +59,14 @@ class FlowNetworkHandler> flowNetwork, V source, V target, OrderedMonoid orderedMonoid ) + FlowNetworkHandler( DirectedGraph> flowNetwork, V source, V target, OrderedMonoid weightOperations ) { this.flowNetwork = flowNetwork; this.source = source; this.target = target; - this.orderedMonoid = orderedMonoid; + this.weightOperations = weightOperations; - maxFlow = orderedMonoid.zero(); + maxFlow = weightOperations.zero(); for ( WeightedEdge edge : flowNetwork.getEdges() ) { @@ -101,25 +101,25 @@ class FlowNetworkHandler edge : augmentingPath.getEdges() ) { // decrease capacity for direct edge W directCapacity = residualEdgeCapacities.get( edge ); - residualEdgeCapacities.put( edge, orderedMonoid.append( directCapacity, orderedMonoid.inverse( flowIncrement ) ) ); + residualEdgeCapacities.put( edge, weightOperations.append( directCapacity, weightOperations.inverse( flowIncrement ) ) ); // increase capacity for inverse edge VertexPair vertexPair = flowNetwork.getVertices( edge ); WeightedEdge inverseEdge = flowNetwork.getEdge( vertexPair.getTail(), vertexPair.getHead() ); W inverseCapacity = residualEdgeCapacities.get( inverseEdge ); - residualEdgeCapacities.put( inverseEdge, orderedMonoid.append( inverseCapacity, flowIncrement ) ); + residualEdgeCapacities.put( inverseEdge, weightOperations.append( inverseCapacity, flowIncrement ) ); } } @@ -130,7 +130,7 @@ class FlowNetworkHandler> graph ) { // reset ausiliary structures for a new graph visit - predecessors = new PredecessorsList, W>( graph, orderedMonoid ); + predecessors = new PredecessorsList, W>( graph, weightOperations ); foundAugmentingPath = false; } @@ -142,7 +142,7 @@ class FlowNetworkHandler the type of weight operations + * @param weightOperations the class responsible for operations on weights * @return */ - > W applyingFordFulkerson( OM orderedMonoid ); + > W applyingFordFulkerson( WO weightOperations ); /** + * Calculates the maximum flow using the Edmonds-Karp algorithm. * - * - * @param orderedMonoid + * @param the type of weight operations + * @param weightOperations the class responsible for operations on weights * @return */ - > W applyingEdmondsKarp( OM orderedMonoid ); + > W applyingEdmondsKarp( WO weightOperations ); } Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/InMemoryWeightedPath.java URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/InMemoryWeightedPath.java?rev=1292272&r1=1292271&r2=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/InMemoryWeightedPath.java (original) +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/InMemoryWeightedPath.java Wed Feb 22 13:21:03 2012 @@ -46,13 +46,13 @@ public final class InMemoryWeightedPath< private W weight; - private Monoid monoid; + private Monoid weightOperations; - public InMemoryWeightedPath( V start, V target, Monoid monoid ) + public InMemoryWeightedPath( V start, V target, Monoid weightOperations ) { super( start, target ); - this.monoid = monoid; - this.weight = monoid.zero(); + this.weightOperations = weightOperations; + this.weight = weightOperations.zero(); } /** @@ -82,7 +82,7 @@ public final class InMemoryWeightedPath< */ private void increaseWeight( WE edge ) { - weight = monoid.append( edge.getWeight(), weight ); + weight = weightOperations.append( edge.getWeight(), weight ); } /** Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/MutableSpanningTree.java URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/MutableSpanningTree.java?rev=1292272&r1=1292271&r2=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/MutableSpanningTree.java (original) +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/MutableSpanningTree.java Wed Feb 22 13:21:03 2012 @@ -38,13 +38,13 @@ public final class MutableSpanningTree monoid; + private Monoid weightOperations; private W weight; - public MutableSpanningTree(Monoid monoid) { - this.monoid = monoid; - this.weight = monoid.zero(); + public MutableSpanningTree(Monoid weightOperations) { + this.weightOperations = weightOperations; + this.weight = weightOperations.zero(); } /** @@ -62,7 +62,7 @@ public final class MutableSpanningTree, W> shortestDistances = new HashMap, W>(); - private final OrderedMonoid orderedMonoid; + private final OrderedMonoid weightOperations; /** * Constructor visible only inside the package */ - AllVertexPairsShortestPath( OrderedMonoid orderedMonoid ) + AllVertexPairsShortestPath( OrderedMonoid weightOperations ) { - this.orderedMonoid = orderedMonoid; + this.weightOperations = weightOperations; } /** @@ -118,7 +118,7 @@ public final class AllVertexPairsShortes if ( source.equals( target ) ) { - return orderedMonoid.zero(); + return weightOperations.zero(); } return shortestDistances.get( new VertexPair( source, target ) ); Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/DefaultHeuristicBuilder.java URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/DefaultHeuristicBuilder.java?rev=1292272&r1=1292271&r2=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/DefaultHeuristicBuilder.java (original) +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/DefaultHeuristicBuilder.java Wed Feb 22 13:21:03 2012 @@ -33,8 +33,8 @@ import org.apache.commons.graph.Weighted import org.apache.commons.graph.collections.FibonacciHeap; import org.apache.commons.graph.weight.OrderedMonoid; -final class DefaultHeuristicBuilder, W, G extends WeightedGraph, OM extends OrderedMonoid> - implements HeuristicBuilder +final class DefaultHeuristicBuilder, W, G extends WeightedGraph, WO extends OrderedMonoid> + implements HeuristicBuilder { private final G graph; @@ -43,14 +43,14 @@ final class DefaultHeuristicBuilder gScores = new ShortestDistances( orderedMonoid ); - gScores.setWeight( start, orderedMonoid.zero() ); + final ShortestDistances gScores = new ShortestDistances( weightOperations ); + gScores.setWeight( start, weightOperations.zero() ); // Estimated total cost from start to goal through y. - final ShortestDistances fScores = new ShortestDistances( orderedMonoid ); + final ShortestDistances fScores = new ShortestDistances( weightOperations ); W hScore = heuristic.applyHeuristic( start, goal ); fScores.setWeight( start, hScore ); @@ -77,7 +77,7 @@ final class DefaultHeuristicBuilder predecessors = new PredecessorsList( graph, orderedMonoid ); + final PredecessorsList predecessors = new PredecessorsList( graph, weightOperations ); // extract the node in openset having the lowest f_score[] value while ( !openSet.isEmpty() ) @@ -101,15 +101,15 @@ final class DefaultHeuristicBuilder> AllVertexPairsShortestPath applyingFloydWarshall( OM orderedMonoid ) + public > AllVertexPairsShortestPath applyingFloydWarshall( WO weightOperations ) { - orderedMonoid = checkNotNull( orderedMonoid, "Floyd-Warshall algorithm can not be applied using a null weight monoid" ); + weightOperations = checkNotNull( weightOperations, "Floyd-Warshall algorithm can not be applied using null weight operations" ); - AllVertexPairsShortestPath shortestPaths = new AllVertexPairsShortestPath( orderedMonoid ); + AllVertexPairsShortestPath shortestPaths = new AllVertexPairsShortestPath( weightOperations ); Map, V> next = new HashMap, V>(); // init @@ -74,9 +74,9 @@ public final class DefaultPathSourceSele { if ( shortestPaths.hasShortestDistance( i, k ) && shortestPaths.hasShortestDistance( k, j ) ) { - W newDistance = orderedMonoid.append( shortestPaths.getShortestDistance( i, k ), shortestPaths.getShortestDistance( k, j ) ); + W newDistance = weightOperations.append( shortestPaths.getShortestDistance( i, k ), shortestPaths.getShortestDistance( k, j ) ); if ( !shortestPaths.hasShortestDistance( i, j ) - || orderedMonoid.compare( newDistance, shortestPaths.getShortestDistance( i, j ) ) < 0 ) + || weightOperations.compare( newDistance, shortestPaths.getShortestDistance( i, j ) ) < 0 ) { shortestPaths.addShortestDistance( i, j, newDistance ); @@ -96,7 +96,7 @@ public final class DefaultPathSourceSele { if ( !source.equals( target ) ) { - PredecessorsList predecessorsList = new PredecessorsList( graph, orderedMonoid ); + PredecessorsList predecessorsList = new PredecessorsList( graph, weightOperations ); pathReconstruction( predecessorsList, source, target, next ); if ( !predecessorsList.isEmpty() ) Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/DefaultShortestPathAlgorithmSelector.java URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/DefaultShortestPathAlgorithmSelector.java?rev=1292272&r1=1292271&r2=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/DefaultShortestPathAlgorithmSelector.java (original) +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/DefaultShortestPathAlgorithmSelector.java Wed Feb 22 13:21:03 2012 @@ -52,28 +52,28 @@ final class DefaultShortestPathAlgorithm /** * {@inheritDoc} */ - public > HeuristicBuilder applyingAStar( OM orderedMonoid ) + public > HeuristicBuilder applyingAStar( WO weightOperations ) { - orderedMonoid = checkNotNull( orderedMonoid, "A* algorithm can not be applied using a null weight monoid" ); - return new DefaultHeuristicBuilder( graph, source, target, orderedMonoid ); + weightOperations = checkNotNull( weightOperations, "A* algorithm can not be applied using null weight operations" ); + return new DefaultHeuristicBuilder( graph, source, target, weightOperations ); } /** * {@inheritDoc} */ - public > WeightedPath applyingDijkstra( OM orderedMonoid ) + public > WeightedPath applyingDijkstra( WO weightOperations ) { - orderedMonoid = checkNotNull( orderedMonoid, "Dijkstra algorithm can not be applied using a null weight monoid" ); + weightOperations = checkNotNull( weightOperations, "Dijkstra algorithm can not be applied using null weight operations" ); - final ShortestDistances shortestDistances = new ShortestDistances( orderedMonoid ); - shortestDistances.setWeight( source, orderedMonoid.zero() ); + final ShortestDistances shortestDistances = new ShortestDistances( weightOperations ); + shortestDistances.setWeight( source, weightOperations.zero() ); final Queue unsettledNodes = new FibonacciHeap( shortestDistances ); unsettledNodes.add( source ); final Set settledNodes = new HashSet(); - final PredecessorsList predecessors = new PredecessorsList( graph, orderedMonoid ); + final PredecessorsList predecessors = new PredecessorsList( graph, weightOperations ); // extract the node with the shortest distance while ( !unsettledNodes.isEmpty() ) @@ -96,10 +96,10 @@ final class DefaultShortestPathAlgorithm WE edge = graph.getEdge( vertex, v ); if ( shortestDistances.alreadyVisited( vertex ) ) { - W shortDist = orderedMonoid.append( shortestDistances.getWeight( vertex ), edge.getWeight() ); + W shortDist = weightOperations.append( shortestDistances.getWeight( vertex ), edge.getWeight() ); if ( !shortestDistances.alreadyVisited( v ) - || orderedMonoid.compare( shortDist, shortestDistances.getWeight( v ) ) < 0 ) + || weightOperations.compare( shortDist, shortestDistances.getWeight( v ) ) < 0 ) { // assign new shortest distance and mark unsettled shortestDistances.setWeight( v, shortDist ); Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/DefaultTargetSourceSelector.java URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/DefaultTargetSourceSelector.java?rev=1292272&r1=1292271&r2=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/DefaultTargetSourceSelector.java (original) +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/DefaultTargetSourceSelector.java Wed Feb 22 13:21:03 2012 @@ -45,14 +45,14 @@ final class DefaultTargetSourceSelector< /** * {@inheritDoc} */ - public > AllVertexPairsShortestPath applyingBelmannFord( OM orderedMonoid ) + public > AllVertexPairsShortestPath applyingBelmannFord( WO weightOperations ) { - orderedMonoid = checkNotNull( orderedMonoid, "Belmann-Ford algorithm can not be applied using a null weight monoid" ); + weightOperations = checkNotNull( weightOperations, "Belmann-Ford algorithm can not be applied using null weight operations" ); - final ShortestDistances shortestDistances = new ShortestDistances( orderedMonoid ); - shortestDistances.setWeight( source, orderedMonoid.zero() ); + final ShortestDistances shortestDistances = new ShortestDistances( weightOperations ); + shortestDistances.setWeight( source, weightOperations.zero() ); - final PredecessorsList predecessors = new PredecessorsList( graph, orderedMonoid ); + final PredecessorsList predecessors = new PredecessorsList( graph, weightOperations ); for ( int i = 0; i < graph.getOrder(); i++ ) { @@ -64,10 +64,10 @@ final class DefaultTargetSourceSelector< if ( shortestDistances.alreadyVisited( u ) ) { - W shortDist = orderedMonoid.append( shortestDistances.getWeight( u ), edge.getWeight() ); + W shortDist = weightOperations.append( shortestDistances.getWeight( u ), edge.getWeight() ); if ( !shortestDistances.alreadyVisited( v ) - || orderedMonoid.compare( shortDist, shortestDistances.getWeight( v ) ) < 0 ) + || weightOperations.compare( shortDist, shortestDistances.getWeight( v ) ) < 0 ) { // assign new shortest distance and mark unsettled shortestDistances.setWeight( v, shortDist ); @@ -87,10 +87,10 @@ final class DefaultTargetSourceSelector< if ( shortestDistances.alreadyVisited( u ) ) { - W shortDist = orderedMonoid.append( shortestDistances.getWeight( u ), edge.getWeight() ); + W shortDist = weightOperations.append( shortestDistances.getWeight( u ), edge.getWeight() ); if ( !shortestDistances.alreadyVisited( v ) - || orderedMonoid.compare( shortDist, shortestDistances.getWeight( v ) ) < 0 ) + || weightOperations.compare( shortDist, shortestDistances.getWeight( v ) ) < 0 ) { // TODO it would be nice printing the cycle throw new NegativeWeightedCycleException( "Graph contains a negative-weight cycle in vertex %s", @@ -99,7 +99,7 @@ final class DefaultTargetSourceSelector< } } - AllVertexPairsShortestPath allVertexPairsShortestPath = new AllVertexPairsShortestPath( orderedMonoid ); + AllVertexPairsShortestPath allVertexPairsShortestPath = new AllVertexPairsShortestPath( weightOperations ); for ( V target : graph.getVertices() ) { Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/HeuristicBuilder.java URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/HeuristicBuilder.java?rev=1292272&r1=1292271&r2=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/HeuristicBuilder.java (original) +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/HeuristicBuilder.java Wed Feb 22 13:21:03 2012 @@ -32,7 +32,7 @@ import org.apache.commons.graph.weight.O * @param * @param */ -public interface HeuristicBuilder, W, G extends WeightedGraph, OM extends OrderedMonoid> +public interface HeuristicBuilder, W, G extends WeightedGraph, WO extends OrderedMonoid> { /** Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/PathSourceSelector.java URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/PathSourceSelector.java?rev=1292272&r1=1292271&r2=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/PathSourceSelector.java (original) +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/PathSourceSelector.java Wed Feb 22 13:21:03 2012 @@ -38,11 +38,11 @@ public interface PathSourceSelector - * @param orderedMonoid the ordered monoid needed to handle operations on weights + * @param the type of weight operations + * @param weightOperations the weight operations needed for the algorithm * @return a data structure which contains all vertex pairs shortest path. */ - > AllVertexPairsShortestPath applyingFloydWarshall( OM orderedMonoid ); + > AllVertexPairsShortestPath applyingFloydWarshall( WO weightOperations ); /** * Specifies the shortest path source. 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=1292272&r1=1292271&r2=1292272&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 Wed Feb 22 13:21:03 2012 @@ -43,14 +43,14 @@ public final class PredecessorsList graph; - private final Monoid monoid; + private final Monoid weightOperations; private final Map predecessors = new HashMap(); - public PredecessorsList( Graph graph, Monoid monoid ) + public PredecessorsList( Graph graph, Monoid weightOperations ) { this.graph = graph; - this.monoid = monoid; + this.weightOperations = weightOperations; } /** @@ -74,7 +74,7 @@ public final class PredecessorsList buildPath( V source, V target ) { - InMemoryWeightedPath path = new InMemoryWeightedPath( source, target, monoid ); + InMemoryWeightedPath path = new InMemoryWeightedPath( source, target, weightOperations ); V vertex = target; while ( !source.equals( vertex ) ) Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/ShortestDistances.java URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/ShortestDistances.java?rev=1292272&r1=1292271&r2=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/ShortestDistances.java (original) +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/ShortestDistances.java Wed Feb 22 13:21:03 2012 @@ -38,11 +38,11 @@ final class ShortestDistances distances = new HashMap(); - private final OrderedMonoid orderedMonoid; + private final OrderedMonoid weightOperations; - public ShortestDistances( OrderedMonoid orderedMonoid ) + public ShortestDistances( OrderedMonoid weightOperations ) { - this.orderedMonoid = orderedMonoid; + this.weightOperations = weightOperations; } /** @@ -98,7 +98,7 @@ final class ShortestDistances - * @param orderedMonoid the ordered monoid needed to handle operations on weights + * @param the type of weight operations + * @param weightOperations the class responsible for operations on weights * @return */ - > HeuristicBuilder applyingAStar( OM orderedMonoid ); + > HeuristicBuilder applyingAStar( WO weightOperations ); /** - * Calculates the shortest path using the Dijkstra's algorithm. + * Calculates the shortest path using Dijkstra's algorithm. * - * @param - * @param orderedMonoid the ordered monoid needed to handle operations on weights + * @param the type of weight operations + * @param weightOperations the class responsible for operations on weights * @return a path which describes the shortest path, if any, otherwise a {@link PathNotFoundException} will be thrown */ - > WeightedPath applyingDijkstra( OM orderedMonoid ); + > WeightedPath applyingDijkstra( WO weightOperations ); } Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/TargetSourceSelector.java URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/TargetSourceSelector.java?rev=1292272&r1=1292271&r2=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/TargetSourceSelector.java (original) +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/TargetSourceSelector.java Wed Feb 22 13:21:03 2012 @@ -38,11 +38,11 @@ public interface TargetSourceSelector - * @param orderedMonoid the ordered monoid needed to handle operations on weights + * @param the type of weight operations + * @param weightOperations the weight operations needed for the algorithm * @return a data structure which contains all vertex pairs shortest path. */ - > AllVertexPairsShortestPath applyingBelmannFord( OM orderedMonoid ); + > AllVertexPairsShortestPath applyingBelmannFord( WO weightOperations ); /** * Specifies the shortest path source. 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=1292272&r1=1292271&r2=1292272&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 Wed Feb 22 13:21:03 2012 @@ -63,7 +63,7 @@ final class DefaultSpanningTreeAlgorithm } /** {@inheritDoc} */ - public > SpanningTree applyingBoruvkaAlgorithm( OM orderedMonoid ) + public > SpanningTree applyingBoruvkaAlgorithm( WO weightOperations ) { /* *
@@ -79,21 +79,21 @@ final class DefaultSpanningTreeAlgorithm
          *     end while
          * 
          */
-        checkNotNull( orderedMonoid, "The Boruvka algorithm can't be calulated with a null monoid" );
+        checkNotNull( weightOperations, "The Boruvka algorithm cannot be calculated with null weight operations" );
         final MutableSpanningTree spanningTree =
-            new MutableSpanningTree( orderedMonoid );
+            new MutableSpanningTree( weightOperations );
 
-        final Set> components =
-            new HashSet>( graph.getOrder() );
+        final Set> components =
+            new HashSet>( graph.getOrder() );
 
-        final Map> mapping =
-            new HashMap>( graph.getOrder() );
+        final Map> mapping =
+            new HashMap>( graph.getOrder() );
 
         for ( V v : graph.getVertices() )
         {
             // create a super vertex for each vertex
-            final SuperVertex sv =
-                new SuperVertex( v, graph, orderedMonoid );
+            final SuperVertex sv =
+                new SuperVertex( v, graph, weightOperations );
             components.add( sv );
             // add a mapping for each vertex to its corresponding super vertex
             mapping.put( v, sv );
@@ -104,7 +104,7 @@ final class DefaultSpanningTreeAlgorithm
         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();
@@ -125,8 +125,8 @@ final class DefaultSpanningTreeAlgorithm
                 V tail = pair.getTail();
 
                 // find the super vertices corresponding to this edge
-                SuperVertex headSuper = mapping.get( head );
-                SuperVertex tailSuper = mapping.get( tail );
+                SuperVertex headSuper = mapping.get( head );
+                SuperVertex tailSuper = mapping.get( tail );
 
                 // merge them, if they are not the same
                 if ( headSuper != tailSuper )
@@ -157,14 +157,14 @@ final class DefaultSpanningTreeAlgorithm
     /**
      * {@inheritDoc}
      */
-    public > SpanningTree applyingKruskalAlgorithm( OM orderedMonoid )
+    public > SpanningTree applyingKruskalAlgorithm( WO weightOperations )
     {
         
-        checkNotNull( orderedMonoid, "The Kruskal algorithm can't be calulated with a null monoid" );
+        checkNotNull( weightOperations, "The Kruskal algorithm cannot be calculated with null weight operations" );
         final Set settledNodes = new HashSet();
 
         final PriorityQueue orderedEdges =
-            new PriorityQueue( graph.getSize(), new WeightedEdgesComparator( orderedMonoid ) );
+            new PriorityQueue( graph.getSize(), new WeightedEdgesComparator( weightOperations ) );
 
         for ( WE edge : graph.getEdges() )
         {
@@ -173,7 +173,7 @@ final class DefaultSpanningTreeAlgorithm
 
         final DisjointSet disjointSet = new DisjointSet();
 
-        final MutableSpanningTree spanningTree = new MutableSpanningTree( orderedMonoid );
+        final MutableSpanningTree spanningTree = new MutableSpanningTree( weightOperations );
 
         // fill the spanning tree with vertices.
         for ( V v : graph.getVertices() )
@@ -204,11 +204,11 @@ final class DefaultSpanningTreeAlgorithm
     /**
      * {@inheritDoc}
      */
-    public > SpanningTree applyingPrimAlgorithm( OM orderedMonoid )
+    public > SpanningTree applyingPrimAlgorithm( WO weightOperations )
     {
-        checkNotNull( orderedMonoid, "The Prim algorithm can't be calulated with a null monoid" );
+        checkNotNull( weightOperations, "The Prim algorithm cannot be calculated with null weight operations" );
         
-        final ShortestEdges shortestEdges = new ShortestEdges( graph, source, orderedMonoid );
+        final ShortestEdges shortestEdges = new ShortestEdges( graph, source, weightOperations );
 
         final PriorityQueue unsettledNodes = new PriorityQueue( graph.getOrder(), shortestEdges );
         unsettledNodes.add( source );
@@ -227,7 +227,7 @@ final class DefaultSpanningTreeAlgorithm
                 // if the edge has not been already visited and its weight is
                 // less then the current Vertex weight
                 boolean weightLessThanCurrent = !shortestEdges.hasWeight( v )
-                        || orderedMonoid.compare( edge.getWeight(), shortestEdges.getWeight( v ) ) < 0;
+                        || weightOperations.compare( edge.getWeight(), shortestEdges.getWeight( v ) ) < 0;
                 if ( settledEdges.add( edge ) && weightLessThanCurrent )
                 {
                     if ( !unsettledNodes.contains( v ) )

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/DefaultSpanningTreeSourceSelector.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/DefaultSpanningTreeSourceSelector.java?rev=1292272&r1=1292271&r2=1292272&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/DefaultSpanningTreeSourceSelector.java (original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/DefaultSpanningTreeSourceSelector.java Wed Feb 22 13:21:03 2012
@@ -80,10 +80,10 @@ public final class DefaultSpanningTreeSo
     /**
      * {@inheritDoc}
      */
-    public > SpanningTree applyingReverseDeleteAlgorithm( OM orderedMonoid )
+    public > SpanningTree applyingReverseDeleteAlgorithm( WO weightOperations )
     {
         
-        checkNotNull( orderedMonoid, "The Reverse-Delete algorithm can't be calulated with a null monoid" );
+        checkNotNull( weightOperations, "The Reverse-Delete algorithm cannot be calulated with null weight operations" );
         
         final List sortedEdge = new ArrayList();
         final List visitedEdge = new ArrayList();
@@ -94,7 +94,7 @@ public final class DefaultSpanningTreeSo
             sortedEdge.add( we );
         }
 
-        sort( sortedEdge, reverseOrder( new WeightedEdgesComparator( orderedMonoid ) ) );
+        sort( sortedEdge, reverseOrder( new WeightedEdgesComparator( weightOperations ) ) );
 
         WeightedGraph tmpGraph = new ReverseDeleteGraph( graph, sortedEdge, visitedEdge );
 
@@ -107,7 +107,7 @@ public final class DefaultSpanningTreeSo
 
             try
             {
-                findShortestPath( tmpGraph ).from( vertices.getHead() ).to( vertices.getTail() ).applyingDijkstra( orderedMonoid );
+                findShortestPath( tmpGraph ).from( vertices.getHead() ).to( vertices.getTail() ).applyingDijkstra( weightOperations );
             }
             catch ( PathNotFoundException ex )
             {
@@ -116,7 +116,7 @@ public final class DefaultSpanningTreeSo
             }
         }
 
-        final MutableSpanningTree res = new MutableSpanningTree( orderedMonoid );
+        final MutableSpanningTree res = new MutableSpanningTree( weightOperations );
         for ( V v : graph.getVertices() )
         {
             res.addVertex( v );

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/ShortestEdges.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/ShortestEdges.java?rev=1292272&r1=1292271&r2=1292272&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/ShortestEdges.java (original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/ShortestEdges.java Wed Feb 22 13:21:03 2012
@@ -47,17 +47,17 @@ final class ShortestEdges predecessors = new HashMap();
 
-    private final OrderedMonoid orderedMonoid;
+    private final OrderedMonoid weightOperations;
     
     private final Graph graph;
 
     private final V source;
 
-    public ShortestEdges(Graph graph, V source, OrderedMonoid orderedMonoid )
+    public ShortestEdges(Graph graph, V source, OrderedMonoid weightOperations )
     {
         this.graph = graph;
         this.source = source;
-        this.orderedMonoid = orderedMonoid;
+        this.weightOperations = weightOperations;
     }
 
     /**
@@ -78,7 +78,7 @@ final class ShortestEdges createSpanningTree()
     {
-        MutableSpanningTree spanningTree = new MutableSpanningTree( orderedMonoid );
+        MutableSpanningTree spanningTree = new MutableSpanningTree( weightOperations );
 
         for ( WE edge : this.predecessors.values() )
         {
@@ -132,7 +132,7 @@ final class ShortestEdgesBoruvka's algorithm.
      *
-     * @param orderedMonoid the graph weights monoid
+     * @param  the type of weight operations
+     * @param weightOperations the class responsible for operations on weights
      * @return the calculated spanning tree
      */
-    > SpanningTree applyingBoruvkaAlgorithm( OM orderedMonoid );
+    > SpanningTree applyingBoruvkaAlgorithm( WO weightOperations );
 
     /**
      * Applies the Kruskal's algorithm.
      *
-     * @param orderedMonoid the graph weights monoid
+     * @param  the type of weight operations
+     * @param weightOperations the class responsible for operations on weights
      * @return the calculated spanning tree
      */
-    > SpanningTree applyingKruskalAlgorithm( OM orderedMonoid );
+    > SpanningTree applyingKruskalAlgorithm( WO weightOperations );
 
     /**
      * Applies the Prim's algorithm.
      *
-     * @param orderedMonoid the graph weights monoid
+     * @param  the type of weight operations
+     * @param weightOperations the class responsible for operations on weights
      * @return the calculated spanning tree
      */
-    > SpanningTree applyingPrimAlgorithm( OM orderedMonoid );
+    > SpanningTree applyingPrimAlgorithm( WO weightOperations );
 
 }

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/SpanningTreeSourceSelector.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/SpanningTreeSourceSelector.java?rev=1292272&r1=1292271&r2=1292272&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/SpanningTreeSourceSelector.java (original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/SpanningTreeSourceSelector.java Wed Feb 22 13:21:03 2012
@@ -67,9 +67,9 @@ public interface SpanningTreeSourceSelec
      *   return edges[] E
      * 
* - * @param orderedMonoid the graph weights monoid + * @param weightOperations the weight operations * @return the calculated spanning tree */ - > SpanningTree applyingReverseDeleteAlgorithm( OM orderedMonoid ); + > SpanningTree applyingReverseDeleteAlgorithm( WO weightOperations ); } Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/SuperVertex.java URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/SuperVertex.java?rev=1292272&r1=1292271&r2=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/SuperVertex.java (original) +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/SuperVertex.java Wed Feb 22 13:21:03 2012 @@ -19,6 +19,7 @@ package org.apache.commons.graph.spannin * under the License. */ +import java.util.Comparator; import java.util.HashSet; import java.util.Iterator; import java.util.Set; @@ -28,7 +29,6 @@ import org.apache.commons.graph.Graph; import org.apache.commons.graph.Vertex; import org.apache.commons.graph.VertexPair; import org.apache.commons.graph.WeightedEdge; -import org.apache.commons.graph.weight.OrderedMonoid; /** * A {@link SuperVertex} is a collection of {@link Vertex} objects and is only @@ -38,9 +38,9 @@ import org.apache.commons.graph.weight.O * @param the weight type * @param the Graph weighted edges type * @param the input Graph type - * @param the Comparator for weighted edges + * @param the weight operations */ -class SuperVertex, G extends Graph, OM extends OrderedMonoid> +class SuperVertex, G extends Graph, WC extends Comparator> implements Iterable { /** The reference to the graph. */ @@ -58,15 +58,15 @@ class SuperVertex(); vertices.add( source ); - orderedEdges = new TreeSet( new WeightedEdgesComparator( orderedMonoid ) ); + orderedEdges = new TreeSet( new WeightedEdgesComparator( weightComparator ) ); // add all edges for this vertex to the sorted set for ( V w : graph.getConnectedVertices( source )) { @@ -87,7 +87,7 @@ class SuperVertex other ) { + public void merge( final SuperVertex other ) { for ( V v : other.vertices ) { vertices.add(v); } Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/WeightedEdgesComparator.java URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/WeightedEdgesComparator.java?rev=1292272&r1=1292271&r2=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/WeightedEdgesComparator.java (original) +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/WeightedEdgesComparator.java Wed Feb 22 13:21:03 2012 @@ -20,7 +20,6 @@ package org.apache.commons.graph.spannin */ import org.apache.commons.graph.WeightedEdge; -import org.apache.commons.graph.weight.OrderedMonoid; import java.util.Comparator; @@ -33,16 +32,16 @@ public class WeightedEdgesComparator { - private final OrderedMonoid orderedMonoid; + private final Comparator weightComparator; - public WeightedEdgesComparator( OrderedMonoid orderedMonoid ) + public WeightedEdgesComparator( Comparator weightComparator ) { - this.orderedMonoid = orderedMonoid; + this.weightComparator = weightComparator; } public int compare( WE o1, WE o2 ) { - return orderedMonoid.compare( o1.getWeight(), o2.getWeight() ); + return weightComparator.compare( o1.getWeight(), o2.getWeight() ); } } Copied: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigDecimalWeightBaseOperations.java (from r1290988, commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigDecimalWeight.java) URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigDecimalWeightBaseOperations.java?p2=commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigDecimalWeightBaseOperations.java&p1=commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigDecimalWeight.java&r1=1290988&r2=1292272&rev=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigDecimalWeight.java (original) +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigDecimalWeightBaseOperations.java Wed Feb 22 13:21:03 2012 @@ -26,10 +26,10 @@ import java.math.BigDecimal; import org.apache.commons.graph.weight.OrderedMonoid; /** - * An {@link BigBigDecimalWeight} provides operations and properties + * The class {@link BigDecimalWeightBaseOperations} provides operations and properties * for weights of type {@link BigDecimal}. */ -public class BigDecimalWeight +public class BigDecimalWeightBaseOperations implements OrderedMonoid { Copied: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigIntegerWeightBaseOperations.java (from r1290988, commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigIntegerWeight.java) URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigIntegerWeightBaseOperations.java?p2=commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigIntegerWeightBaseOperations.java&p1=commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigIntegerWeight.java&r1=1290988&r2=1292272&rev=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigIntegerWeight.java (original) +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigIntegerWeightBaseOperations.java Wed Feb 22 13:21:03 2012 @@ -26,10 +26,10 @@ import java.math.BigInteger; import org.apache.commons.graph.weight.OrderedMonoid; /** - * An {@link BigIntegerWeight} provides operations and properties + * The class {@link BigIntegerWeightBaseOperations} provides operations and properties * for weights of type {@link BigInteger}. */ -public class BigIntegerWeight +public class BigIntegerWeightBaseOperations implements OrderedMonoid { Copied: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/DoubleWeightBaseOperations.java (from r1290988, commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/DoubleWeight.java) URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/DoubleWeightBaseOperations.java?p2=commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/DoubleWeightBaseOperations.java&p1=commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/DoubleWeight.java&r1=1290988&r2=1292272&rev=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/DoubleWeight.java (original) +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/DoubleWeightBaseOperations.java Wed Feb 22 13:21:03 2012 @@ -22,10 +22,10 @@ package org.apache.commons.graph.weight. import org.apache.commons.graph.weight.OrderedMonoid; /** - * A {@link DoubleWeight} provides operations and properties + * The class {@link DoubleWeightBaseOperations} provides operations and properties * for weights of type {@link Double}. */ -public class DoubleWeight +public class DoubleWeightBaseOperations implements OrderedMonoid { Copied: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/FloatWeightBaseOperations.java (from r1290988, commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/FloatWeight.java) URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/FloatWeightBaseOperations.java?p2=commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/FloatWeightBaseOperations.java&p1=commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/FloatWeight.java&r1=1290988&r2=1292272&rev=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/FloatWeight.java (original) +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/FloatWeightBaseOperations.java Wed Feb 22 13:21:03 2012 @@ -22,10 +22,10 @@ package org.apache.commons.graph.weight. import org.apache.commons.graph.weight.OrderedMonoid; /** - * A {@link FloatWeight} provides operations and properties + * The class {@link FloatWeightBaseOperations} provides operations and properties * for weights of type {@link Float}. */ -public class FloatWeight +public class FloatWeightBaseOperations implements OrderedMonoid { Copied: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/IntegerWeightBaseOperations.java (from r1290988, commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/IntegerWeight.java) URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/IntegerWeightBaseOperations.java?p2=commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/IntegerWeightBaseOperations.java&p1=commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/IntegerWeight.java&r1=1290988&r2=1292272&rev=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/IntegerWeight.java (original) +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/IntegerWeightBaseOperations.java Wed Feb 22 13:21:03 2012 @@ -22,10 +22,10 @@ package org.apache.commons.graph.weight. import org.apache.commons.graph.weight.OrderedMonoid; /** - * An {@link IntegerWeight} provides operations and properties + * The class {@link IntegerWeightBaseOperations} provides operations and properties * for weights of type {@link Integer}. */ -public class IntegerWeight +public class IntegerWeightBaseOperations implements OrderedMonoid { Copied: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/LongWeightBaseOperations.java (from r1290988, commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/LongWeight.java) URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/LongWeightBaseOperations.java?p2=commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/LongWeightBaseOperations.java&p1=commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/LongWeight.java&r1=1290988&r2=1292272&rev=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/LongWeight.java (original) +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/LongWeightBaseOperations.java Wed Feb 22 13:21:03 2012 @@ -22,10 +22,10 @@ package org.apache.commons.graph.weight. import org.apache.commons.graph.weight.OrderedMonoid; /** - * A {@link LongWeight} provides operations and properties + * The class {@link LongWeightBaseOperations} provides operations and properties * for weights of type {@link Long}. */ -public class LongWeight +public class LongWeightBaseOperations implements OrderedMonoid { Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/package-info.java URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/package-info.java?rev=1292272&r1=1292271&r2=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/package-info.java (original) +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/package-info.java Wed Feb 22 13:21:03 2012 @@ -1,5 +1,5 @@ /** - * Primitive weight implementations. + * Implementations of base operations on primitive types of weights. */ package org.apache.commons.graph.weight.primitive; Modified: commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/flow/EdmondsKarpTestCase.java URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/flow/EdmondsKarpTestCase.java?rev=1292272&r1=1292271&r2=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/flow/EdmondsKarpTestCase.java (original) +++ commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/flow/EdmondsKarpTestCase.java Wed Feb 22 13:21:03 2012 @@ -29,7 +29,7 @@ import org.apache.commons.graph.builder. import org.apache.commons.graph.model.BaseLabeledVertex; import org.apache.commons.graph.model.BaseLabeledWeightedEdge; import org.apache.commons.graph.model.DirectedMutableWeightedGraph; -import org.apache.commons.graph.weight.primitive.IntegerWeight; +import org.apache.commons.graph.weight.primitive.IntegerWeightBaseOperations; import org.junit.Test; /** @@ -47,7 +47,7 @@ public class EdmondsKarpTestCase final BaseLabeledVertex g = new BaseLabeledVertex( "G" ); // actual max flow - findMaxFlow( (DirectedMutableWeightedGraph, Integer>) null ).from( a ).to( g ).applyingEdmondsKarp( new IntegerWeight() ); + findMaxFlow( (DirectedMutableWeightedGraph, Integer>) null ).from( a ).to( g ).applyingEdmondsKarp( new IntegerWeightBaseOperations() ); } @Test( expected = NullPointerException.class ) @@ -68,7 +68,7 @@ public class EdmondsKarpTestCase } ); // actual max flow - findMaxFlow( graph ).from( a ).to( g ).applyingEdmondsKarp( new IntegerWeight() ); + findMaxFlow( graph ).from( a ).to( g ).applyingEdmondsKarp( new IntegerWeightBaseOperations() ); } @Test @@ -101,7 +101,7 @@ public class EdmondsKarpTestCase final Integer expected = 0; // actual max flow - Integer actual = findMaxFlow( graph ).from( a ).to( g ).applyingEdmondsKarp( new IntegerWeight() ); + Integer actual = findMaxFlow( graph ).from( a ).to( g ).applyingEdmondsKarp( new IntegerWeightBaseOperations() ); assertEquals( actual, expected ); } @@ -145,7 +145,7 @@ public class EdmondsKarpTestCase final Integer expected = 5; // actual max flow - Integer actual = findMaxFlow( graph ).from( a ).to( g ).applyingEdmondsKarp( new IntegerWeight() ); + Integer actual = findMaxFlow( graph ).from( a ).to( g ).applyingEdmondsKarp( new IntegerWeightBaseOperations() ); assertEquals( actual, expected ); } Modified: commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/flow/FordFulkersonTestCase.java URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/flow/FordFulkersonTestCase.java?rev=1292272&r1=1292271&r2=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/flow/FordFulkersonTestCase.java (original) +++ commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/flow/FordFulkersonTestCase.java Wed Feb 22 13:21:03 2012 @@ -31,7 +31,7 @@ import org.apache.commons.graph.builder. import org.apache.commons.graph.model.BaseLabeledVertex; import org.apache.commons.graph.model.BaseLabeledWeightedEdge; import org.apache.commons.graph.model.DirectedMutableWeightedGraph; -import org.apache.commons.graph.weight.primitive.IntegerWeight; +import org.apache.commons.graph.weight.primitive.IntegerWeightBaseOperations; import org.junit.Test; /** @@ -48,13 +48,13 @@ public final class FordFulkersonTestCase final BaseLabeledVertex a = new BaseLabeledVertex( "A" ); final BaseLabeledVertex d = new BaseLabeledVertex( "D" ); - findMaxFlow( (DirectedMutableWeightedGraph, Integer>) null ).from( a ).to( d ).applyingFordFulkerson( new IntegerWeight() ); + findMaxFlow( (DirectedMutableWeightedGraph, Integer>) null ).from( a ).to( d ).applyingFordFulkerson( new IntegerWeightBaseOperations() ); } @Test(expected=NullPointerException.class) public void testNullGraphAndVertices() { - findMaxFlow( (DirectedMutableWeightedGraph, Integer>) null ).from( null ).to( null ).applyingFordFulkerson( new IntegerWeight() ); + findMaxFlow( (DirectedMutableWeightedGraph, Integer>) null ).from( null ).to( null ).applyingFordFulkerson( new IntegerWeightBaseOperations() ); } @Test @@ -83,7 +83,7 @@ public final class FordFulkersonTestCase final Integer expected = 0; // actual max flow - Integer actual = findMaxFlow( graph ).from( a ).to( d ).applyingFordFulkerson( new IntegerWeight() ); + Integer actual = findMaxFlow( graph ).from( a ).to( d ).applyingFordFulkerson( new IntegerWeightBaseOperations() ); assertEquals( actual, expected ); } @@ -115,7 +115,7 @@ public final class FordFulkersonTestCase final Integer expected = 0; // actual max flow - Integer actual = findMaxFlow( graph ).from( a ).to( d ).applyingFordFulkerson( new IntegerWeight() ); + Integer actual = findMaxFlow( graph ).from( a ).to( d ).applyingFordFulkerson( new IntegerWeightBaseOperations() ); assertEquals( actual, expected ); } @@ -143,7 +143,7 @@ public final class FordFulkersonTestCase } // actual max flow - findMaxFlow( graph ).from( null ).to( null ).applyingFordFulkerson( new IntegerWeight() ); + findMaxFlow( graph ).from( null ).to( null ).applyingFordFulkerson( new IntegerWeightBaseOperations() ); } @Test @@ -177,7 +177,7 @@ public final class FordFulkersonTestCase final Integer expected = 2000; // actual max flow - Integer actual = findMaxFlow( graph ).from( a ).to( d ).applyingFordFulkerson( new IntegerWeight() ); + Integer actual = findMaxFlow( graph ).from( a ).to( d ).applyingFordFulkerson( new IntegerWeightBaseOperations() ); assertEquals( actual, expected ); } Modified: commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/shortestpath/AStarTestCase.java URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/shortestpath/AStarTestCase.java?rev=1292272&r1=1292271&r2=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/shortestpath/AStarTestCase.java (original) +++ commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/shortestpath/AStarTestCase.java Wed Feb 22 13:21:03 2012 @@ -34,7 +34,7 @@ import org.apache.commons.graph.model.Ba import org.apache.commons.graph.model.BaseLabeledWeightedEdge; import org.apache.commons.graph.model.InMemoryWeightedPath; import org.apache.commons.graph.model.UndirectedMutableWeightedGraph; -import org.apache.commons.graph.weight.primitive.DoubleWeight; +import org.apache.commons.graph.weight.primitive.DoubleWeightBaseOperations; import org.junit.Test; public final class AStarTestCase @@ -43,7 +43,7 @@ public final class AStarTestCase @Test( expected = NullPointerException.class ) public void testNullGraph() { - findShortestPath( (WeightedGraph, Double>) null ).from( null ).to( null ).applyingAStar( new DoubleWeight() ).withHeuristic( null ); + findShortestPath( (WeightedGraph, Double>) null ).from( null ).to( null ).applyingAStar( new DoubleWeightBaseOperations() ).withHeuristic( null ); } @Test( expected = NullPointerException.class ) @@ -52,7 +52,7 @@ public final class AStarTestCase UndirectedMutableWeightedGraph, Double> graph = new UndirectedMutableWeightedGraph, Double>(); - findShortestPath( graph ).from( null ).to( null ).applyingAStar( new DoubleWeight() ).withHeuristic( null ); + findShortestPath( graph ).from( null ).to( null ).applyingAStar( new DoubleWeightBaseOperations() ).withHeuristic( null ); } @Test( expected = NullPointerException.class ) @@ -61,7 +61,7 @@ public final class AStarTestCase UndirectedMutableWeightedGraph, Double> graph = new UndirectedMutableWeightedGraph, Double>(); - findShortestPath( graph ).from( new BaseLabeledVertex( "a" ) ).to( new BaseLabeledVertex( "b" ) ).applyingAStar( new DoubleWeight() ).withHeuristic( null ); + findShortestPath( graph ).from( new BaseLabeledVertex( "a" ) ).to( new BaseLabeledVertex( "b" ) ).applyingAStar( new DoubleWeightBaseOperations() ).withHeuristic( null ); } @Test( expected = NullPointerException.class ) @@ -121,7 +121,7 @@ public final class AStarTestCase }; - findShortestPath( graph ).from( a ).to( b ).applyingAStar( new DoubleWeight() ).withHeuristic( heuristic ); + findShortestPath( graph ).from( a ).to( b ).applyingAStar( new DoubleWeightBaseOperations() ).withHeuristic( heuristic ); } /** @@ -186,7 +186,7 @@ public final class AStarTestCase InMemoryWeightedPath, Double> expected = new InMemoryWeightedPath, Double>( start, goal, - new DoubleWeight() ); + new DoubleWeightBaseOperations() ); expected.addConnectionInTail( start, new BaseLabeledWeightedEdge( "start <-> a", 1.5D ), a ); expected.addConnectionInTail( a, new BaseLabeledWeightedEdge( "a <-> b", 2D ), b ); @@ -196,7 +196,7 @@ public final class AStarTestCase // actual path Path> actual = - findShortestPath( graph ).from( start ).to( goal ).applyingAStar( new DoubleWeight() ).withHeuristic( heuristic ); + findShortestPath( graph ).from( start ).to( goal ).applyingAStar( new DoubleWeightBaseOperations() ).withHeuristic( heuristic ); // assert! Modified: commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/shortestpath/BellmannFordTestCase.java URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/shortestpath/BellmannFordTestCase.java?rev=1292272&r1=1292271&r2=1292272&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/shortestpath/BellmannFordTestCase.java (original) +++ commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/shortestpath/BellmannFordTestCase.java Wed Feb 22 13:21:03 2012 @@ -32,7 +32,7 @@ import org.apache.commons.graph.model.Ba import org.apache.commons.graph.model.DirectedMutableWeightedGraph; import org.apache.commons.graph.model.InMemoryWeightedPath; import org.apache.commons.graph.model.UndirectedMutableWeightedGraph; -import org.apache.commons.graph.weight.primitive.DoubleWeight; +import org.apache.commons.graph.weight.primitive.DoubleWeightBaseOperations; import org.junit.Test; public final class BellmannFordTestCase @@ -42,7 +42,7 @@ public final class BellmannFordTestCase public void testNullGraph() { // the actual weighted path - findShortestPath( (WeightedGraph, Double>) null ).from( null ).applyingBelmannFord( new DoubleWeight() ); + findShortestPath( (WeightedGraph, Double>) null ).from( null ).applyingBelmannFord( new DoubleWeightBaseOperations() ); } @Test( expected = NullPointerException.class ) @@ -51,7 +51,7 @@ public final class BellmannFordTestCase UndirectedMutableWeightedGraph, Double> graph = new UndirectedMutableWeightedGraph, Double>(); - findShortestPath( graph ).from( null ).applyingBelmannFord( new DoubleWeight() ); + findShortestPath( graph ).from( null ).applyingBelmannFord( new DoubleWeightBaseOperations() ); } @Test( expected = NullPointerException.class ) @@ -95,7 +95,7 @@ public final class BellmannFordTestCase graph.addVertex( a ); graph.addVertex( b ); - allVertexPairsShortestPath = findShortestPath( graph ).from( a ).applyingBelmannFord( new DoubleWeight() ); + allVertexPairsShortestPath = findShortestPath( graph ).from( a ).applyingBelmannFord( new DoubleWeightBaseOperations() ); } catch ( PathNotFoundException e ) { @@ -144,13 +144,13 @@ public final class BellmannFordTestCase // the expected weighted path InMemoryWeightedPath, Double> expected = - new InMemoryWeightedPath, Double>( one, three, new DoubleWeight() ); + new InMemoryWeightedPath, Double>( one, three, new DoubleWeightBaseOperations() ); expected.addConnectionInTail( one, new BaseLabeledWeightedEdge( "1 -> 4", 7D ), four ); expected.addConnectionInTail( four, new BaseLabeledWeightedEdge( "4 -> 3", -3D ), three ); // the actual weighted path AllVertexPairsShortestPath, Double> allVertexPairsShortestPath = - findShortestPath( graph ).from( one ).applyingBelmannFord( new DoubleWeight() ); + findShortestPath( graph ).from( one ).applyingBelmannFord( new DoubleWeightBaseOperations() ); WeightedPath, Double> actual = allVertexPairsShortestPath.findShortestPath( one, three );