Record Class MilitaryCampaignAnalyzer.TerrainSegment

java.lang.Object
java.lang.Record
org.episteme.social.history.MilitaryCampaignAnalyzer.TerrainSegment
Record Components:
name - segment name
distanceKm - length in kilometers
terrainDifficulty - weight (1.0 = road, 2.0 = rough, 3.0 = mountain)
forageAvailability - availability of resources on land (0.0 to 1.0)
hasWaterSource - true if natural water is present along the path
All Implemented Interfaces:
Serializable
Enclosing class:
MilitaryCampaignAnalyzer

public static record MilitaryCampaignAnalyzer.TerrainSegment(String name, double distanceKm, double terrainDifficulty, double forageAvailability, boolean hasWaterSource) extends Record implements Serializable
Physical characteristics of a geographical segment of a campaign route.
See Also:
  • Constructor Details

    • TerrainSegment

      public TerrainSegment(String name, double distanceKm, double terrainDifficulty, double forageAvailability, boolean hasWaterSource)
      Creates an instance of a TerrainSegment record class.
      Parameters:
      name - the value for the name record component
      distanceKm - the value for the distanceKm record component
      terrainDifficulty - the value for the terrainDifficulty record component
      forageAvailability - the value for the forageAvailability record component
      hasWaterSource - the value for the hasWaterSource record component
  • Method Details

    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • distanceKm

      public double distanceKm()
      Returns the value of the distanceKm record component.
      Returns:
      the value of the distanceKm record component
    • terrainDifficulty

      public double terrainDifficulty()
      Returns the value of the terrainDifficulty record component.
      Returns:
      the value of the terrainDifficulty record component
    • forageAvailability

      public double forageAvailability()
      Returns the value of the forageAvailability record component.
      Returns:
      the value of the forageAvailability record component
    • hasWaterSource

      public boolean hasWaterSource()
      Returns the value of the hasWaterSource record component.
      Returns:
      the value of the hasWaterSource record component