general cleanup

This commit is contained in:
Leijurv 2018-11-14 14:27:30 -08:00
parent 8385bc35ed
commit f808fc9802
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -35,11 +35,6 @@ import java.util.Optional;
*/
public abstract class AbstractNodeCostSearch implements IPathFinder {
/**
* The currently running search task
*/
private static AbstractNodeCostSearch currentlyRunning = null;
protected final int startX;
protected final int startY;
protected final int startZ;
@ -114,19 +109,10 @@ public abstract class AbstractNodeCostSearch implements IPathFinder {
return new PathCalculationResult(PathCalculationResult.Type.EXCEPTION, Optional.empty());
} finally {
// this is run regardless of what exception may or may not be raised by calculate0
currentlyRunning = null;
isFinished = true;
}
}
/**
* Don't set currentlyRunning to this until everything is all ready to go, and we're about to enter the main loop.
* For example, bestSoFar is null so bestPathSoFar (which gets bestSoFar[0]) could NPE if we set currentlyRunning before calculate0
*/
protected void loopBegin() {
currentlyRunning = this;
}
protected abstract Optional<IPath> calculate0(long timeout);
/**
@ -161,22 +147,6 @@ public abstract class AbstractNodeCostSearch implements IPathFinder {
return node;
}
public static void forceCancel() {
currentlyRunning = null;
}
public PathNode mostRecentNodeConsidered() {
return mostRecentConsidered;
}
public PathNode bestNodeSoFar() {
return bestSoFar[0];
}
public PathNode startNode() {
return startNode;
}
@Override
public Optional<IPath> pathToMostRecentNodeConsidered() {
try {