java.lang.Object
de.bsommerfeld.pathetic.api.pathing.processing.Cost

public final class Cost extends Object
Represents a cost value used in pathfinding. This class ensures that cost values can be handled consistently.
  • Field Details

    • ZERO

      public static final Cost ZERO
      A shared instance for zero cost.
  • Method Details

    • of

      public static Cost of(double value)
      Factory method to create a Cost instance.

      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 Cost instance.
      Throws:
      IllegalArgumentException - if value is NaN, infinite, or negative.
    • getValue

      @Deprecated public double getValue()
      Deprecated.
      Use value() instead.
      Returns the numerical cost value.
      Returns:
      The cost value.
    • value

      public double value()
      Returns the numerical cost value.
      Returns:
      The cost value.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object