Package megamek.common.pathfinder
Class MovePathFinder<C>
java.lang.Object
megamek.common.pathfinder.AbstractPathFinder<CoordsWithFacing,C,MovePath>
megamek.common.pathfinder.MovePathFinder<C>
- Direct Known Subclasses:
LongestPathFinder,ShortestPathFinder
Generic implementation of AbstractPathFinder when we restrict graph nodes to (coordinates x facing) and edges to
MovePaths. Provides useful implementations of functional interfaces defined in AbstractPathFinder.
-
Constructor Summary
ConstructorsConstructorDescriptionMovePathFinder(EdgeRelaxer<C, MovePath> edgeRelaxer, AdjacencyMap<MovePath> edgeAdjacencyMap, Comparator<MovePath> comparator, Game game) Creates a new instance of MovePathFinder. -
Method Summary
Modifier and TypeMethodDescriptiongetAllComputedCosts(Comparator<C> comp) Returns a map of all computed shortest pathsprotected CgetCost(Coords coords, Comparator<C> comp) Returns computed cost to reach the hex at c coordinates.Methods inherited from class megamek.common.pathfinder.AbstractPathFinder
addFilter, addStopCondition, getAdjacencyMap, getComparator, getCostOf, getDestinationMap, getPathCostMap, removeAllFilters, run, run, setAdjacencyMap, setComparator, setDestinationMap, setEdgeRelaxer
-
Constructor Details
-
MovePathFinder
public MovePathFinder(EdgeRelaxer<C, MovePath> edgeRelaxer, AdjacencyMap<MovePath> edgeAdjacencyMap, Comparator<MovePath> comparator, Game game) Creates a new instance of MovePathFinder. Sets DestinationMap toMovePathDestinationMapand addsMovePathLegalityFilter. Rest of the methods needed by AbstractPathFinder have to be passed as a parameter.
-
-
Method Details
-
getAllComputedCosts
Returns a map of all computed shortest paths -
getCost
Returns computed cost to reach the hex at c coordinates. If multiple path are present with different final facings, the one minimal one is chosen. If none paths are present thennullis returned.- Parameters:
comp- comparator used if multiple paths are present- Returns:
- shortest path to the hex at c coordinates or
null
-