Record Class UnloadAmmoTypeAction

java.lang.Object
java.lang.Record
mekhq.campaign.unit.actions.UnloadAmmoTypeAction
All Implemented Interfaces:
IUnitAction

public record UnloadAmmoTypeAction(AmmoBin ammoBin) extends Record implements IUnitAction
Unloads the AmmoType for an AmmoBin on a Unit, it will not change the AmmoType.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Initializes a new instance of the UnloadAmmoTypeAction class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the ammoBin record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    void
    execute(Campaign campaign, Unit unit)
    Executes an action against a unit in a campaign.
    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

    • UnloadAmmoTypeAction

      public UnloadAmmoTypeAction(AmmoBin ammoBin)
      Initializes a new instance of the UnloadAmmoTypeAction class.
      Parameters:
      ammoBin - The AmmoBin to unload.
  • Method Details

    • execute

      public void execute(Campaign campaign, Unit unit)
      Description copied from interface: IUnitAction
      Executes an action against a unit in a campaign. The action may have side effects.
      Specified by:
      execute in interface IUnitAction
      Parameters:
      campaign - The campaign object this action is executed against.
      unit - The unit object this action is executed against.
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • ammoBin

      public AmmoBin ammoBin()
      Returns the value of the ammoBin record component.
      Returns:
      the value of the ammoBin record component