Class NodeEvaluationContextImpl

java.lang.Object
de.bsommerfeld.pathetic.engine.pathfinder.processing.NodeEvaluationContextImpl
All Implemented Interfaces:
NodeEvaluationContext

public class NodeEvaluationContextImpl extends Object implements NodeEvaluationContext
  • Constructor Details

    • NodeEvaluationContextImpl

      public NodeEvaluationContextImpl(SearchContext searchContext, Node engineNode, Node parentEngineNode, IHeuristicStrategy heuristicStrategy)
      Creates a new NodeEvaluationContextImpl with the specified parameters.
      Parameters:
      searchContext - The search context
      engineNode - The current node being evaluated
      parentEngineNode - The parent node (can be null for the start node)
  • Method Details

    • getCurrentPathPosition

      public PathPosition getCurrentPathPosition()
      Description copied from interface: NodeEvaluationContext
      Returns the PathPosition currently being evaluated. This is the potential next step in the path.
      Specified by:
      getCurrentPathPosition in interface NodeEvaluationContext
      Returns:
      The current PathPosition.
    • getPreviousPathPosition

      public PathPosition getPreviousPathPosition()
      Description copied from interface: NodeEvaluationContext
      Returns the PathPosition from which the current PathPosition is being reached. This is the position of the parent A* Node. This will be null if the currentPathPosition is the start position being evaluated initially.
      Specified by:
      getPreviousPathPosition in interface NodeEvaluationContext
      Returns:
      The previous PathPosition in the path segment, or null.
    • getCurrentNodeDepth

      public int getCurrentNodeDepth()
      Description copied from interface: NodeEvaluationContext
      Returns the depth of the current PathPosition in the search tree. The start node is typically at depth 0 or 1 depending on convention. This value comes from the engine's internal node representation.
      Specified by:
      getCurrentNodeDepth in interface NodeEvaluationContext
      Returns:
      The depth of the current node.
    • getCurrentNodeHeuristicValue

      public double getCurrentNodeHeuristicValue()
      Description copied from interface: NodeEvaluationContext
      Returns the heuristic value (H-cost) calculated by the pathfinding engine for the current PathPosition towards the target. This is the engine's estimate *before* any processor adjustments might influence path choices.
      Specified by:
      getCurrentNodeHeuristicValue in interface NodeEvaluationContext
      Returns:
      The engine-calculated heuristic value for the current node.
    • getPathCostToPreviousPosition

      public double getPathCostToPreviousPosition()
      Description copied from interface: NodeEvaluationContext
      Returns the accumulated G-cost (actual known cost from start) up to the previous PathPosition. This value is derived from getParentEngineNode().getGCost(). If previousPathPosition is null (i.e., current is start), this returns 0.
      Specified by:
      getPathCostToPreviousPosition in interface NodeEvaluationContext
      Returns:
      The accumulated g-cost to the previous position.
    • getBaseTransitionCost

      public double getBaseTransitionCost()
      Description copied from interface: NodeEvaluationContext
      Returns the base traversal cost for the transition from the previous PathPosition to the current PathPosition. This is typically derived from currentPathPosition.distance(previousPathPosition) and represents the raw geometric/movement cost *before* any NodeCostProcessor processors add their contributions for this specific transition. Returns 0 if previousPathPosition is null.
      Specified by:
      getBaseTransitionCost in interface NodeEvaluationContext
      Returns:
      The base cost of the current transition.
    • getSearchContext

      public SearchContext getSearchContext()
      Description copied from interface: NodeEvaluationContext
      Provides access to the overarching SearchContext for this pathfinding operation.
      Specified by:
      getSearchContext in interface NodeEvaluationContext
      Returns:
      The search context.