Package megamek.client.ratgenerator
Class FormationType.CountConstraint
java.lang.Object
megamek.client.ratgenerator.FormationType.Constraint
megamek.client.ratgenerator.FormationType.CountConstraint
- Enclosing class:
FormationType
A
FormationType.Constraint requiring a fixed minimum number of units to satisfy the criterion, regardless of
formation size. Used for rules like "at least 3 units must be Heavy or larger".-
Constructor Summary
ConstructorsConstructorDescriptionCountConstraint(int min, Predicate<MekSummary> criterion, String description) -
Method Summary
Methods inherited from class megamek.client.ratgenerator.FormationType.Constraint
getDescription, isPairedWithNext, isPairedWithPrevious, matches, setPairedWithNext, setPairedWithPrevious
-
Constructor Details
-
CountConstraint
- Parameters:
min- the minimum count of matching unitscriterion- predicate identifying units that satisfy this constraintdescription- human-readable rule description
-
-
Method Details
-
getMinimum
public int getMinimum(int unitSize) - Specified by:
getMinimumin classFormationType.Constraint- Parameters:
unitSize- the total number of units in the formation- Returns:
- the minimum number of units that must satisfy
FormationType.Constraint.matches(MekSummary)for this constraint to be considered met. May depend onunitSize(e.g., percent constraints).
-