Record Class ElevationOption

java.lang.Object
java.lang.Record
megamek.common.board.ElevationOption
Record Components:
elevation - The elevation or altitude in the hex
type - the DeploymentElevationType (on the ground, on a bridge, ...)
All Implemented Interfaces:
Comparable<ElevationOption>

public record ElevationOption(int elevation, DeploymentElevationType type) extends Record implements Comparable<ElevationOption>
This is a data record for a possible deployment elevation together with a DeploymentElevationType that signals if the elevation is, e.g., on the ground, on a bridge or submerged. Note that two such records are equal when their elevation and type are equal. ElevationOptions are comparable, with the natural ordering being by their elevation only.
  • Constructor Details

    • ElevationOption

      public ElevationOption(int elevation, DeploymentElevationType type)
      Creates an instance of a ElevationOption record class.
      Parameters:
      elevation - the value for the elevation record component
      type - the value for the type record component
  • Method Details

    • equals

      public 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 '=='.
      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.
    • hashCode

      public 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
    • compareTo

      public int compareTo(ElevationOption other)
      Specified by:
      compareTo in interface Comparable<ElevationOption>
    • toString

      @Nonnull public 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
    • elevation

      public int elevation()
      Returns the value of the elevation record component.
      Returns:
      the value of the elevation record component
    • type

      public DeploymentElevationType type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component