Record Class StratConPathfinder.Pathing
java.lang.Object
java.lang.Record
mekhq.campaign.digitalGM.stratCon.sectorGeneration.StratConPathfinder.Pathing
- Record Components:
distance- the least cost to each hex reached; a source costs nothingprevious- the hex each hex was reached from; a source has none
- Enclosing class:
StratConPathfinder
public static record StratConPathfinder.Pathing(Map<StratConCoords,Integer> distance, Map<StratConCoords,StratConCoords> previous)
extends Record
The result of a sweep: the least cost to each hex reached, and the hex each was reached from.
- Since:
- 0.51.01
-
Constructor Summary
ConstructorsConstructorDescriptionPathing(Map<StratConCoords, Integer> distance, Map<StratConCoords, StratConCoords> previous) Creates an instance of aPathingrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondistance()Returns the value of thedistancerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.nearest(Iterable<StratConCoords> candidates) pathTo(StratConCoords target) Rebuilds the hex path betweentargetand the sweep's source by following the previous-hex links; includes both endpoints.previous()Returns the value of thepreviousrecord component.booleanreaches(StratConCoords target) final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
reaches
- Parameters:
target- a hex- Returns:
trueif the sweep reached the hex
-
nearest
- Parameters:
candidates- the hexes to choose between- Returns:
- the candidate cheapest to reach, the first one met winning a tie;
nullif none was reached
-
pathTo
Rebuilds the hex path betweentargetand the sweep's source by following the previous-hex links; includes both endpoints.The list runs from
targetback to the source, because that is the direction the links point.- Parameters:
target- a hex- Returns:
- the path, or an empty list if the sweep did not reach the hex
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
distance
Returns the value of thedistancerecord component.- Returns:
- the value of the
distancerecord component
-
previous
Returns the value of thepreviousrecord component.- Returns:
- the value of the
previousrecord component
-