Interface Pathfinder
public interface Pathfinder
A Pathfinder is a class that can find a path between two positions while following a given set of
rules.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
abort()
Requests all currently running pathfinding operations of this pathfinder instance to abort.default CompletionStage<PathfinderResult>
findPath
(PathPosition start, PathPosition target) Tries to find a Path between the twoPathPosition
s.findPath
(PathPosition start, PathPosition target, EnvironmentContext context) Tries to find a path between the specified start and target positions within the provided environment context.void
Registers aPathfinderHook
that will be called on every step of the pathfinding process.
-
Method Details
-
findPath
Tries to find a Path between the twoPathPosition
s.- Returns:
- An
CompletionStage
that will contain aPathfinderResult
.
-
findPath
CompletionStage<PathfinderResult> findPath(PathPosition start, PathPosition target, EnvironmentContext context) Tries to find a path between the specified start and target positions within the provided environment context.- Parameters:
start
- The starting position for pathfinding.target
- The target position for pathfinding.context
- The environment context that provides additional information for the pathfinding operation. This parameter can be null if no specific context is required.- Returns:
- A
CompletionStage
containing thePathfinderResult
of the pathfinding operation, indicating the outcome and the resulting path.
-
abort
void abort()Requests all currently running pathfinding operations of this pathfinder instance to abort. The abortion is cooperative and might not be immediate.Scope of Abortion: This method affects all pathfinding operations that are currently being executed by this specific pathfinder instance. If you need to abort individual operations independently, consider using separate pathfinder instances for each operation.
Cooperative Abortion: The actual termination depends on the pathfinding algorithm's main loop checking the abort flag. The operation will complete with
PathState.ABORTED
as soon as possible.- See Also:
-
registerPathfindingHook
Registers aPathfinderHook
that will be called on every step of the pathfinding process. This can be used to modify the pathfinding process or to collect data.- Parameters:
hook
- The hook to register.
-