Class PathfinderUtil.PathNode

java.lang.Object
de.tomatengames.util.PathfinderUtil.PathNode
Enclosing class:
PathfinderUtil

public abstract static class PathfinderUtil.PathNode extends Object
A PathNode should represent a position (node in a graph) combined with the way to get there (edges) from the startpoint. Specifically, PathfinderUtil.World.positionEqual(PathNode, PathNode) needs implementation and typically the taken path is kept to retrieve the resulting path rather than solely the goal position from the find methods. This class contains some private attributes used in the find methods, so its instances should be single-use. To find a path on a 2D grid, you would add attributes like int x, y; and PathNode previous;.
Since:
1.5
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected double
    Initially the cost of the single step that separates this PathNode from its original PathNode.
    protected double
    Is set to the estimated total cost from the startpoint to the goal going over this PathNode.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    PathNode(double cost)
    Creates a new PathNode with the provided step cost.
  • Method Summary

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • cost

      protected double cost
      Initially the cost of the single step that separates this PathNode from its original PathNode. If this PathNode is not immediately discarded, the cost is updated to the total cost from the startpoint to this PathNode.
    • estimateFullCost

      protected double estimateFullCost
      Is set to the estimated total cost from the startpoint to the goal going over this PathNode. That is the cost from the startpoint to this PathNode + PathfinderUtil.World.estimateRemainingCost(PathNode).
  • Constructor Details

    • PathNode

      protected PathNode(double cost)
      Creates a new PathNode with the provided step cost.
      Parameters:
      cost - the cost of reaching this PathNode from its original PathNode