Class Cost
java.lang.Object
de.bsommerfeld.pathetic.api.pathing.processing.Cost
Represents a cost value used in pathfinding. This class ensures that cost values can be handled
consistently.
-
Field Summary
Fields -
Method Summary
-
Field Details
-
ZERO
A shared instance for zero cost.
-
-
Method Details
-
of
Factory method to create aCostinstance.The value must be a finite non-negative number.
NaN,+Infinity,-Infinity, and negative values are rejected at the boundary so that downstream pathfinding arithmetic (G-cost accumulation, F-cost, heap keys, tie-breakers) cannot inherit non-finite operands.- Parameters:
value- The numerical cost.- Returns:
- A new
Costinstance. - Throws:
IllegalArgumentException- ifvalueis NaN, infinite, or negative.
-
getValue
Deprecated.Usevalue()instead.Returns the numerical cost value.- Returns:
- The cost value.
-
value
public double value()Returns the numerical cost value.- Returns:
- The cost value.
-
equals
-
hashCode
public int hashCode() -
toString
-
value()instead.