Record Class MetricLimit.GenusLimit
java.lang.Object
java.lang.Record
org.ek9lang.compiler.support.MetricLimit.GenusLimit
- All Implemented Interfaces:
MetricLimit
- Enclosing interface:
MetricLimit
public static record MetricLimit.GenusLimit(String metricKey, String ruleCode, MetricLimit.Comparison comparison, Map<SymbolGenus, Integer> byGenus, int fallback, Set<SymbolGenus> exempt)
extends Record
implements MetricLimit
A per-genus threshold table:
byGenus holds explicit limits, fallback covers genera
not listed, and exempt genera are not checked at all (so limitFor(SymbolGenus) is empty and
isOver(int, SymbolGenus) is always false for them).-
Nested Class Summary
Nested classes/interfaces inherited from interface MetricLimit
MetricLimit.Comparison, MetricLimit.CompoundLimit, MetricLimit.GenusLimit, MetricLimit.RatioLimit, MetricLimit.ScalarLimit -
Constructor Summary
ConstructorsConstructorDescriptionGenusLimit(String metricKey, String ruleCode, MetricLimit.Comparison comparison, Map<SymbolGenus, Integer> byGenus, int fallback, Set<SymbolGenus> exempt) Creates an instance of aGenusLimitrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbyGenus()Returns the value of thebyGenusrecord component.Returns the value of thecomparisonrecord component.final booleanIndicates whether some other object is "equal to" this one.exempt()Returns the value of theexemptrecord component.intfallback()Returns the value of thefallbackrecord component.final inthashCode()Returns a hash code value for this object.booleanisOver(double value, SymbolGenus genus) Fractional overload — construct coupling (E11015) is a fractional score oncebydelegation is weighted at 0.5, so the fire predicate compares a double against the integer limit.booleanisOver(int value, SymbolGenus genus) The exact predicate the checker uses to fire — false for exempt genera.limitFor(SymbolGenus genus) The effective limit for a genus, or empty when the genus is exempt from this metric entirely.Returns the value of themetricKeyrecord component.ruleCode()Returns the value of theruleCoderecord component.final StringtoString()Returns a string representation of this record class.usableMaxFor(SymbolGenus genus) The "one more crosses" boundary for a genus, or empty when exempt.
-
Constructor Details
-
GenusLimit
public GenusLimit(String metricKey, String ruleCode, MetricLimit.Comparison comparison, Map<SymbolGenus, Integer> byGenus, int fallback, Set<SymbolGenus> exempt) Creates an instance of aGenusLimitrecord class.- Parameters:
metricKey- the value for themetricKeyrecord componentruleCode- the value for theruleCoderecord componentcomparison- the value for thecomparisonrecord componentbyGenus- the value for thebyGenusrecord componentfallback- the value for thefallbackrecord componentexempt- the value for theexemptrecord component
-
-
Method Details
-
limitFor
The effective limit for a genus, or empty when the genus is exempt from this metric entirely. -
isOver
The exact predicate the checker uses to fire — false for exempt genera. -
isOver
Fractional overload — construct coupling (E11015) is a fractional score oncebydelegation is weighted at 0.5, so the fire predicate compares a double against the integer limit. -
usableMaxFor
The "one more crosses" boundary for a genus, or empty when exempt. -
toString
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
metricKey
Returns the value of themetricKeyrecord component.- Specified by:
metricKeyin interfaceMetricLimit- Returns:
- the value of the
metricKeyrecord component
-
ruleCode
Returns the value of theruleCoderecord component.- Specified by:
ruleCodein interfaceMetricLimit- Returns:
- the value of the
ruleCoderecord component
-
comparison
Returns the value of thecomparisonrecord component.- Returns:
- the value of the
comparisonrecord component
-
byGenus
Returns the value of thebyGenusrecord component.- Returns:
- the value of the
byGenusrecord component
-
fallback
public int fallback()Returns the value of thefallbackrecord component.- Returns:
- the value of the
fallbackrecord component
-
exempt
Returns the value of theexemptrecord component.- Returns:
- the value of the
exemptrecord component
-