commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Tripodi <simonetrip...@apache.org>
Subject Re: svn commit: r1290996 - /commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/DefaultSpanningTreeAlgorithmSelector.java
Date Sun, 19 Feb 2012 13:41:09 GMT
Hi again,
sorry, I raw the check on the graph, totally misunderstood.

Apologize!
-Simo

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/



On Sun, Feb 19, 2012 at 2:40 PM, Simone Tripodi
<simonetripodi@apache.org> wrote:
> Hi Marco,
>
>> @@ -77,7 +79,7 @@ final class DefaultSpanningTreeAlgorithm
>>          *     end while
>>          * <pre>
>>          */
>> -
>> +        checkNotNull( orderedMonoid, "The Boruvka algorithm can't be calulated
with a null
>
> these checks are useless. The check has already been performed at
> CommonsGraph#minimumSpanningTree()
>
> Checks have to be performed as soon as inputs are passed, not when the
> algorithms are performed.
>
> Please rollback it, TIA!
> -Simo
>
> http://people.apache.org/~simonetripodi/
> http://simonetripodi.livejournal.com/
> http://twitter.com/simonetripodi
> http://www.99soft.org/
>
>
>
> On Sun, Feb 19, 2012 at 2:21 PM,  <marcosperanza@apache.org> wrote:
>> Author: marcosperanza
>> Date: Sun Feb 19 13:21:23 2012
>> New Revision: 1290996
>>
>> URL: http://svn.apache.org/viewvc?rev=1290996&view=rev
>> Log:
>> Added check for monoid input argument
>>
>> 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=1290996&r1=1290995&r2=1290996&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
Sun Feb 19 13:21:23 2012
>> @@ -20,6 +20,8 @@ package org.apache.commons.graph.spannin
>>  */
>>
>>  import static org.apache.commons.graph.utils.Assertions.checkState;
>> +import static org.apache.commons.graph.utils.Assertions.checkNotNull;
>> +
>>
>>  import java.util.HashMap;
>>  import java.util.HashSet;
> monoid" );
>>         final MutableSpanningTree<V, WE, W> spanningTree =
>>             new MutableSpanningTree<V, WE, W>( orderedMonoid );
>>
>> @@ -157,6 +159,8 @@ final class DefaultSpanningTreeAlgorithm
>>      */
>>     public <OM extends OrderedMonoid<W>> SpanningTree<V, WE, W>
applyingKruskalAlgorithm( OM orderedMonoid )
>>     {
>> +
>> +        checkNotNull( orderedMonoid, "The Kruskal algorithm can't be calulated
with a null monoid" );
>>         final Set<V> settledNodes = new HashSet<V>();
>>
>>         final PriorityQueue<WE> orderedEdges =
>> @@ -202,6 +206,8 @@ final class DefaultSpanningTreeAlgorithm
>>      */
>>     public <OM extends OrderedMonoid<W>> SpanningTree<V, WE, W>
applyingPrimAlgorithm( OM orderedMonoid )
>>     {
>> +        checkNotNull( orderedMonoid, "The Prim algorithm can't be calulated
with a null monoid" );
>> +
>>         final ShortestEdges<V, WE, W> shortestEdges = new ShortestEdges<V,
WE, W>( graph, source, orderedMonoid );
>>
>>         final PriorityQueue<V> unsettledNodes = new PriorityQueue<V>(
graph.getOrder(), shortestEdges );
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message