Class SBFMovePathFinder
java.lang.Object
megamek.common.pathfinder.AbstractPathFinder<BoardLocation,SBFMovePath,SBFMovePath>
megamek.common.strategicBattleSystems.SBFMovePathFinder
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA MovePath comparator that compares movement points spent and distance to destination. -
Constructor Summary
ConstructorsConstructorDescriptionSBFMovePathFinder(SBFGame game, DestinationMap<BoardLocation, SBFMovePath> edgeDestinationMap, EdgeRelaxer<SBFMovePath, SBFMovePath> edgeRelaxer, AdjacencyMap<SBFMovePath> edgeAdjacencyMap, Comparator<SBFMovePath> edgeComparator) -
Method Summary
Modifier and TypeMethodDescriptionstatic SBFMovePathFinderaStarFinder(BoardLocation destination, SBFGame game) Produces a new instance of shortest path between starting points and a destination finder.protected Map<BoardLocation, SBFMovePath> Returns a map of all computed shortest pathsReturns a map of all computed shortest paths.getComputedPath(BoardLocation coordinates) Returns the shortest move path to a hex at given coordinates ornullif none is present.protected SBFMovePathgetCost(BoardLocation coords, Comparator<SBFMovePath> comp) Returns computed cost to reach the hex at c coordinates.static SBFMovePathFindermoveEnvelopeFinder(int maxMP, SBFGame game) Produces new instance of shortest path searcher.Methods inherited from class megamek.common.pathfinder.AbstractPathFinder
addFilter, addStopCondition, getAdjacencyMap, getComparator, getCostOf, getDestinationMap, getPathCostMap, removeAllFilters, run, run, setAdjacencyMap, setComparator, setDestinationMap, setEdgeRelaxer
-
Constructor Details
-
SBFMovePathFinder
public SBFMovePathFinder(SBFGame game, DestinationMap<BoardLocation, SBFMovePath> edgeDestinationMap, EdgeRelaxer<SBFMovePath, SBFMovePath> edgeRelaxer, AdjacencyMap<SBFMovePath> edgeAdjacencyMap, Comparator<SBFMovePath> edgeComparator) - Parameters:
edgeDestinationMap- functional interface for retrieving destination node of an edge.edgeRelaxer- functional interface for calculating relaxed cost.edgeAdjacencyMap- functional interface for retrieving neighbouring edges.edgeComparator- implementation of path comparator. Each path is defined by its last edge. (path:= edge concatenated with the best path to the source of the edge)
-
-
Method Details
-
moveEnvelopeFinder
Produces new instance of shortest path searcher. It will find all the shortest paths between starting points that are reachable with at most maxMp move points.- Parameters:
maxMP- maximum MP that entity can usegame- TheSBFGame
-
aStarFinder
Produces a new instance of shortest path between starting points and a destination finder. Algorithm will halt after reaching destination.Current implementation uses AStar algorithm.
- Parameters:
game- The currentGame
-
getAllComputedPaths
Returns a map of all computed shortest paths. If multiple paths to a single hex, each with different final facing, are present, then the minimal one is chosen for each hex.- Returns:
- a map of all computed shortest paths.
-
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
-
getComputedPath
Returns the shortest move path to a hex at given coordinates ornullif none is present. If multiple path are present with different final facings, the minimal one is chosen.- Parameters:
coordinates- - the coordinates of the hex- Returns:
- the shortest move path to hex at given coordinates or
null
-