Package megamek.client.bot.princess
Record Class CoverageValidator
java.lang.Object
java.lang.Record
megamek.client.bot.princess.CoverageValidator
Validates the coverage of a unit in the battlefield.
-
Constructor Summary
ConstructorsConstructorDescriptionCoverageValidator(Princess owner) Creates an instance of aCoverageValidatorrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisPositionExposed(Entity unit) Indicates if the unit is exposed to enemy fire.owner()Returns the value of theownerrecord component.final StringtoString()Returns a string representation of this record class.booleanvalidateUnitCoverage(Entity unit, Coords newPosition) Validates if the unit has coverage from at least one ally.
-
Constructor Details
-
CoverageValidator
Creates an instance of aCoverageValidatorrecord class.- Parameters:
owner- the value for theownerrecord component
-
-
Method Details
-
validateUnitCoverage
Validates if the unit has coverage from at least one ally.- Parameters:
unit- The unit to be validated.newPosition- The new position to be validated.- Returns:
- TRUE if the unit has coverage from at least one ally.
-
isPositionExposed
Indicates if the unit is exposed to enemy fire.- Parameters:
unit- The unit to be checked.- Returns:
- TRUE if the unit is exposed to enemy fire.
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
owner
Returns the value of theownerrecord component.- Returns:
- the value of the
ownerrecord component
-