Revision 35157 trunk/extensions/extGraph/src/org/gvsig/graph/solvers/ShortestPathSolverAStar.java

View differences:

ShortestPathSolverAStar.java
41 41
package org.gvsig.graph.solvers;
42 42

  
43 43
import java.util.ArrayList;
44
import java.util.PriorityQueue;
44 45

  
45 46
import org.gvsig.exceptions.BaseException;
46 47
import org.gvsig.graph.core.GlobalCounter;
......
163 164
		node.calculateStimation(finalNode, 0);
164 165
		
165 166
        // Priority Queue
166
        FibHeap pq = new FibHeap(graph.numVertices());
167
        pq.insert(node, node.getStimation());
167
        PriorityQueue<GvNode> pq = new PriorityQueue<GvNode>();
168
        pq.add(node);
168 169

  
169 170

  
170 171
		// Mientras que la lista de candidatosSTL no est? vac?a, procesamos
171 172
		// Nodos
172 173
		double bestStimation;
173 174

  
174
		while ((!bExit) && (!pq.empty())) {
175
		while ((!bExit) && (!pq.isEmpty())) {
175 176
			// Buscamos el nodo con m?nimo coste
176 177
//			node = (GvNode) candidatos.get(0);
177 178
//			bestNode = node;
......
186 187
//				}
187 188
//			} // for nodeNum candidatosSTL
188 189

  
189
            node = (GvNode) pq.extract_min(); // get the lowest-weightSum Vertex 'u',
190
            node = pq.poll(); // get the lowest-weightSum Vertex 'u',
190 191
//			node = bestNode;
191 192
			// Borramos el mejor nodo de la lista de candidatosSTL
192 193
			node.setStatus(GvNode.statWasInList);
......
295 296

  
296 297
					if (toNode.getStatus() != GvNode.statNowInList) {
297 298
						toNode.setStatus(GvNode.statNowInList);
298
						pq.insert_or_dec_key(toNode, toNode.getStimation());
299
						pq.add(toNode);
299 300
//						candidatos.add(toNode);
300 301
					}
301 302
				} // Si hay mejora

Also available in: Unified diff