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).
  • Constructor Details

    • CompoundLimit

      public CompoundLimit(String metricKey, String ruleCode, int maxGroups, double maxRatio, int minConstructs)
      Creates an instance of a CompoundLimit record class.
      Parameters:
      metricKey - the value for the metricKey record component
      ruleCode - the value for the ruleCode record component
      maxGroups - the value for the maxGroups record component
      maxRatio - the value for the maxRatio record component
      minConstructs - the value for the minConstructs record component
  • Method Details

    • isOver

      public boolean isOver(int groups, double ratio, int constructs)
      The exact predicate the checker uses to fire.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • metricKey

      public String metricKey()
      Returns the value of the metricKey record component.
      Specified by:
      metricKey in interface MetricLimit
      Returns:
      the value of the metricKey record component
    • ruleCode

      public String ruleCode()
      Returns the value of the ruleCode record component.
      Specified by:
      ruleCode in interface MetricLimit
      Returns:
      the value of the ruleCode record component
    • maxGroups

      public int maxGroups()
      Returns the value of the maxGroups record component.
      Returns:
      the value of the maxGroups record component
    • maxRatio

      public double maxRatio()
      Returns the value of the maxRatio record component.
      Returns:
      the value of the maxRatio record component
    • minConstructs

      public int minConstructs()
      Returns the value of the minConstructs record component.
      Returns:
      the value of the minConstructs record component