Package megamek.common.units
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
ConstructorsConstructorDescriptionUnitLocation(int entityId, Coords coords, int facing, int elevation, int boardId) Creates an instance of aUnitLocationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintboardId()Returns the value of theboardIdrecord component.coords()Returns the value of thecoordsrecord component.intReturns the value of theelevationrecord component.intentityId()Returns the value of theentityIdrecord component.final booleanIndicates whether some other object is "equal to" this one.intfacing()Returns the value of thefacingrecord component.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
UnitLocation
Creates an instance of aUnitLocationrecord class.- Parameters:
entityId- the value for theentityIdrecord componentcoords- the value for thecoordsrecord componentfacing- the value for thefacingrecord componentelevation- the value for theelevationrecord componentboardId- the value for theboardIdrecord component
-
-
Method Details
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
entityId
public int entityId()Returns the value of theentityIdrecord component.- Returns:
- the value of the
entityIdrecord component
-
coords
Returns the value of thecoordsrecord component.- Returns:
- the value of the
coordsrecord component
-
facing
public int facing()Returns the value of thefacingrecord component.- Returns:
- the value of the
facingrecord component
-
elevation
public int elevation()Returns the value of theelevationrecord component.- Returns:
- the value of the
elevationrecord component
-
boardId
public int boardId()Returns the value of theboardIdrecord component.- Returns:
- the value of the
boardIdrecord component
-