Interface DistanceCalculator<M>
- Type Parameters:
M- the type of the distance metric returned by this calculator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Computes a distance metric for the current state of a pathfinding operation.
This functional interface is used by heuristic strategies to obtain a measurable value (the
metric) from the three positions encapsulated in a PathfindingProgress instance. The
generic type <M> represents the concrete metric type – typically double for
numeric distances, but it may be any type that suits the heuristic (e.g. Double,
Vector, or a custom metric object).
Implementations are expected to be stateless and side-effect-free, making them suitable for reuse across multiple heuristic evaluations.
- Since:
- 5.3.3
-
Method Summary
Modifier and TypeMethodDescriptioncalculate(PathfindingProgress progress) Calculates and returns the distance metric for the given pathfinding progress.
-
Method Details
-
calculate
Calculates and returns the distance metric for the given pathfinding progress.- Parameters:
progress- the current pathfinding state containing start, current, and target positions; must not benull- Returns:
- the computed metric value; may be
nullonly if explicitly documented by the implementation
-