Record Class MetricLimit.RatioLimit
java.lang.Object
java.lang.Record
org.ek9lang.compiler.support.MetricLimit.RatioLimit
- Record Components:
metricKey- stable machine keyruleCode- the EK9 error code this enforcesthreshold- the fractional score above which it fires
- All Implemented Interfaces:
MetricLimit
- Enclosing interface:
MetricLimit
public static record MetricLimit.RatioLimit(String metricKey, String ruleCode, double threshold)
extends Record
implements MetricLimit
A gate on a fractional score rather than a count — E11020 multiplies a construct's complexity
ratio by its statement ratio and fires above 0.50, so neither operand is a limit in its own right
and the threshold cannot be an int.
-
Nested Class Summary
Nested classes/interfaces inherited from interface MetricLimit
MetricLimit.Comparison, MetricLimit.CompoundLimit, MetricLimit.GenusLimit, MetricLimit.RatioLimit, MetricLimit.ScalarLimit -
Constructor Summary
ConstructorsConstructorDescriptionRatioLimit(String metricKey, String ruleCode, double threshold) Creates an instance of aRatioLimitrecord class. -
Method Summary
Modifier and TypeMethodDescriptionAlways>— exposed as a method rather than a record component because, unlike the counted gates, a ratio has no reason to ever be inclusive.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisOver(double value) The exact predicate the checker uses to fire.Returns the value of themetricKeyrecord component.ruleCode()Returns the value of theruleCoderecord component.doubleReturns the value of thethresholdrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
comparison
Always>— exposed as a method rather than a record component because, unlike the counted gates, a ratio has no reason to ever be inclusive. -
isOver
public boolean isOver(double value) 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
-
threshold
-