Package megamek.common.board
Record Class ElevationOption
java.lang.Object
java.lang.Record
megamek.common.board.ElevationOption
- Record Components:
elevation- The elevation or altitude in the hextype- 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 Summary
ConstructorsConstructorDescriptionElevationOption(int elevation, DeploymentElevationType type) Creates an instance of aElevationOptionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(ElevationOption other) intReturns the value of theelevationrecord component.booleanIndicates whether some other object is "equal to" this one.inthashCode()Returns a hash code value for this object.toString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Constructor Details
-
Method Details
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
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. -
compareTo
- Specified by:
compareToin interfaceComparable<ElevationOption>
-
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. -
elevation
public int elevation()Returns the value of theelevationrecord component.- Returns:
- the value of the
elevationrecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-