Package megamek.common.units
Record Class UnitPosition
java.lang.Object
java.lang.Record
megamek.common.units.UnitPosition
-
Constructor Summary
ConstructorsConstructorDescriptionUnitPosition(Coords position, Set<Coords> secondaryPositions, Facing facing, int elevation, int altitude, int height) Unit Position Data Object -
Method Summary
Modifier and TypeMethodDescriptionintaltitude()Returns the value of thealtituderecord component.intReturns the value of theelevationrecord component.final booleanIndicates whether some other object is "equal to" this one.facing()Returns the value of thefacingrecord component.intfinal inthashCode()Returns a hash code value for this object.intheight()Returns the value of theheightrecord component.static UnitPositionstatic UnitPositionstatic UnitPositionstatic UnitPositionstatic UnitPositionof(Targetable targetable) position()Returns the value of thepositionrecord component.intrelativeDotProduct(Coords target) Deprecated, for removal: This API element is subject to removal in a future version.intrelativeDotProduct(Coords origin, Coords target) Returns the value of thesecondaryPositionsrecord component.final StringtoString()Returns a string representation of this record class.static UnitPositionwithFacingOf(Targetable targetable, int facing)
-
Constructor Details
-
UnitPosition
public UnitPosition(Coords position, Set<Coords> secondaryPositions, Facing facing, int elevation, int altitude, int height) Unit Position Data Object- Parameters:
position- unit position using offset coordinatessecondaryPositions- Set of secondary positions of the unitfacing- Facing of the unit, units with no facing are treated as if they were facing northelevation- current topographical elevationaltitude- current altitude if airborneheight- height of the unit, 0 indexed.
-
-
Method Details
-
of
-
of
-
of
-
of
-
of
-
withFacingOf
-
facingAngle
public int facingAngle() -
relativeDotProduct
Deprecated, for removal: This API element is subject to removal in a future version. -
relativeDotProduct
-
getCoords
-
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 '=='. -
position
Returns the value of thepositionrecord component.- Returns:
- the value of the
positionrecord component
-
secondaryPositions
Returns the value of thesecondaryPositionsrecord component.- Returns:
- the value of the
secondaryPositionsrecord component
-
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
-
altitude
public int altitude()Returns the value of thealtituderecord component.- Returns:
- the value of the
altituderecord component
-
height
public int height()Returns the value of theheightrecord component.- Returns:
- the value of the
heightrecord component
-