boolean isClosed = (closedPathExplorer != null); if (isClosed && neighbourCumCost < (int)
boolean isClosed = (closedPathExplorer != null); if (isClosed) { if (neighbour.getCumulativeCost() < (int)
    public LinkedList explore() {	int iterations = 0;	logger.log(Level.FINE, "exploring from " + start + " to " + target);	logger.log(Level.FINE, "best minCost=" + minCost + ", maxCost=" +	       maxCost);		PathExplorer pe = startExplorer;		open.add(pe);	int cost = 0;	while (! open.isEmpty()) {	    pe = (PathExplorer) open.removeFirst();	    logger.log(Level.FINEST, "fetched tile " +		    pe.getLocation());	    if (iterations % 2000 == 0) {		logger.log(Level.INFO, "current path cost: " +			(pe.getEstimatedCost(target) + pe.getCumulativeCost())			+ " iterations: " + iterations);		logger.log(Level.INFO, "open size=" + open.size() +		       	", closed size=" + closed.size() + " efficiency: " +			((closed.size() * 100) / 			 (iterations == 0 ? 1 : iterations)) );	    }	    if (pe.getLocation().equals(target)) {		logger.log(Level.INFO, "found target " + target + 			" after " + iterations + " iterations");		return getBestPath(pe);	    }	    while (pe.hasNextDirection()) {		PathExplorer neighbour = (PathExplorer) pe.exploreNewTile();	//	logger.log(Level.FINEST, "testing neighbour " +	//		neighbour.getLocation());		int neighbourCumCost = neighbour.getCumulativeCost();		int neighbourCost = neighbourCumCost +		    neighbour.getEstimatedCost(target);		boolean isOpen = open.contains(neighbour);		PathExplorer closedPathExplorer = (PathExplorer)		    closed.get(neighbour);		boolean isClosed = (closedPathExplorer != null);		if (isClosed && neighbourCumCost < 			 (int) 			 (closedPathExplorer.getCumulativeCost() * TOLERANCE)) {		    // we found a better path to this tile		    closed.remove(neighbour);		    isClosed = false;		}		if (!isClosed && !isOpen) {		    if (neighbourCost <= maxCost)			open.add(neighbour);		}	    }	    closed.put(pe, pe);	    iterations++;	}	// no path was found	return null;    }