Record Class MetricLimit.ScalarLimit
java.lang.Object
java.lang.Record
org.ek9lang.compiler.support.MetricLimit.ScalarLimit
- All Implemented Interfaces:
MetricLimit
- Enclosing interface:
MetricLimit
public static record MetricLimit.ScalarLimit(String metricKey, String ruleCode, int limit, MetricLimit.Comparison comparison)
extends Record
implements MetricLimit
A single-threshold limit with a comparator.
-
Nested Class Summary
Nested classes/interfaces inherited from interface MetricLimit
MetricLimit.Comparison, MetricLimit.CompoundLimit, MetricLimit.GenusLimit, MetricLimit.RatioLimit, MetricLimit.ScalarLimit -
Constructor Summary
ConstructorsConstructorDescriptionScalarLimit(String metricKey, String ruleCode, int limit, MetricLimit.Comparison comparison) Creates an instance of aScalarLimitrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecomparisonrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisOver(int value) The exact predicate the checker uses to fire.intlimit()Returns the value of thelimitrecord component.Returns the value of themetricKeyrecord component.ruleCode()Returns the value of theruleCoderecord component.final StringtoString()Returns a string representation of this record class.intThe largest value that does NOT fire —limitforGT,limit - 1forGTE.
-
Constructor Details
-
ScalarLimit
Creates an instance of aScalarLimitrecord class.- Parameters:
metricKey- the value for themetricKeyrecord componentruleCode- the value for theruleCoderecord componentlimit- the value for thelimitrecord componentcomparison- the value for thecomparisonrecord component
-
-
Method Details
-
isOver
public boolean isOver(int value) The exact predicate the checker uses to fire. -
usableMax
public int usableMax()The largest value that does NOT fire —limitforGT,limit - 1forGTE. This is the "one more crosses" boundary the enquiry bands are computed from. -
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
-
limit
public int limit()Returns the value of thelimitrecord component.- Returns:
- the value of the
limitrecord component
-
comparison
Returns the value of thecomparisonrecord component.- Returns:
- the value of the
comparisonrecord component
-