Record Class MetricLimit.CompoundLimit
java.lang.Object
java.lang.Record
org.ek9lang.compiler.support.MetricLimit.CompoundLimit
- All Implemented Interfaces:
MetricLimit
- Enclosing interface:
MetricLimit
public static record MetricLimit.CompoundLimit(String metricKey, String ruleCode, int maxGroups, double maxRatio, int minConstructs)
extends Record
implements MetricLimit
A compound limit that fires only when an absolute cap AND a relative ratio are BOTH exceeded, and
only once the module is at least
minConstructs in size (small modules are naturally
disconnected and are exempt).-
Nested Class Summary
Nested classes/interfaces inherited from interface MetricLimit
MetricLimit.Comparison, MetricLimit.CompoundLimit, MetricLimit.GenusLimit, MetricLimit.RatioLimit, MetricLimit.ScalarLimit -
Constructor Summary
ConstructorsConstructorDescriptionCompoundLimit(String metricKey, String ruleCode, int maxGroups, double maxRatio, int minConstructs) Creates an instance of aCompoundLimitrecord 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.booleanisOver(int groups, double ratio, int constructs) The exact predicate the checker uses to fire.intReturns the value of themaxGroupsrecord component.doublemaxRatio()Returns the value of themaxRatiorecord component.Returns the value of themetricKeyrecord component.intReturns the value of theminConstructsrecord component.ruleCode()Returns the value of theruleCoderecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
CompoundLimit
public CompoundLimit(String metricKey, String ruleCode, int maxGroups, double maxRatio, int minConstructs) Creates an instance of aCompoundLimitrecord class.- Parameters:
metricKey- the value for themetricKeyrecord componentruleCode- the value for theruleCoderecord componentmaxGroups- the value for themaxGroupsrecord componentmaxRatio- the value for themaxRatiorecord componentminConstructs- the value for theminConstructsrecord component
-
-
Method Details
-
isOver
public boolean isOver(int groups, double ratio, int constructs) The exact predicate the checker uses to fire. -
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
-
maxGroups
public int maxGroups()Returns the value of themaxGroupsrecord component.- Returns:
- the value of the
maxGroupsrecord component
-
maxRatio
public double maxRatio()Returns the value of themaxRatiorecord component.- Returns:
- the value of the
maxRatiorecord component
-
minConstructs
public int minConstructs()Returns the value of theminConstructsrecord component.- Returns:
- the value of the
minConstructsrecord component
-