Author: simonetripodi
Date: Wed Jun 29 00:43:34 2011
New Revision: 1140923
URL: http://svn.apache.org/viewvc?rev=1140923&view=rev
Log:
checkstyle violations: avoid inner assignment
Modified:
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/AStar.java
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/Dijkstra.java
Modified:
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/AStar.java
URL:
http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/AStar.java?rev=1140923&r1=1140922&r2=1140923&view=diff
==============================================================================
---
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/AStar.java
(original)
+++
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/AStar.java
Wed Jun 29 00:43:34 2011
@@ -78,12 +78,11 @@ public final class AStar
// The of navigated nodes
final PredecessorsList<V, WE> predecessors = new PredecessorsList<V,
WE>( graph );
- // the current node
- V current;
-
// extract the node in openset having the lowest f_score[] value
- while ( ( current = openSet.poll() ) != null )
+ while ( !openSet.isEmpty() )
{
+ V current = openSet.poll();
+
// destination reached, stop and build the path
if ( goal.equals( current ) )
{
Modified:
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/Dijkstra.java
URL:
http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/Dijkstra.java?rev=1140923&r1=1140922&r2=1140923&view=diff
==============================================================================
---
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/Dijkstra.java
(original)
+++
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/Dijkstra.java
Wed Jun 29 00:43:34 2011
@@ -68,12 +68,11 @@ public final class Dijkstra
final PredecessorsList<V, WE> predecessors = new PredecessorsList<V,
WE>( graph );
- // the current node
- V vertex;
-
// extract the node with the shortest distance
- while ( ( vertex = unsettledNodes.poll() ) != null )
+ while ( !unsettledNodes.isEmpty() )
{
+ V vertex = unsettledNodes.poll();
+
// destination reached, stop and build the path
if ( target.equals( vertex ) )
{