Record Class UnitLocation

java.lang.Object
java.lang.Record
megamek.common.units.UnitLocation
All Implemented Interfaces:
Serializable

public record UnitLocation(int entityId, Coords coords, int facing, int elevation, int boardId) extends Record implements Serializable
A simple class to specify a location and facing for a unit.
Since:
July 5, 2005
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    UnitLocation(int entityId, Coords coords, int facing, int elevation, int boardId)
    Creates an instance of a UnitLocation record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the boardId record component.
    Returns the value of the coords record component.
    int
    Returns the value of the elevation record component.
    int
    Returns the value of the entityId record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    int
    Returns the value of the facing record component.
    final int
    Returns a hash code value for this object.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • UnitLocation

      public UnitLocation(int entityId, Coords coords, int facing, int elevation, int boardId)
      Creates an instance of a UnitLocation record class.
      Parameters:
      entityId - the value for the entityId record component
      coords - the value for the coords record component
      facing - the value for the facing record component
      elevation - the value for the elevation record component
      boardId - the value for the boardId 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 '=='.
      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.
    • entityId

      public int entityId()
      Returns the value of the entityId record component.
      Returns:
      the value of the entityId record component
    • coords

      public Coords coords()
      Returns the value of the coords record component.
      Returns:
      the value of the coords record component
    • facing

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

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

      public int boardId()
      Returns the value of the boardId record component.
      Returns:
      the value of the boardId record component