Record Class SourceFileInfo

java.lang.Object
java.lang.Record
org.ek9lang.cli.coverage.model.SourceFileInfo
Record Components:
filePath - The relative path to the source file
moduleName - The EK9 module name this file belongs to
lineCoverage - Map of line numbers to their coverage information
coveredCount - Number of lines that were covered
totalCount - Total number of coverable lines

public record SourceFileInfo(String filePath, String moduleName, Map<Integer, LineCoverage> lineCoverage, int coveredCount, int totalCount) extends Record
Source file with its module and coverage data. Immutable record representing coverage information for a single EK9 source file.
  • Constructor Details

    • SourceFileInfo

      public SourceFileInfo(String filePath, String moduleName, Map<Integer, LineCoverage> lineCoverage, int coveredCount, int totalCount)
      Creates an instance of a SourceFileInfo record class.
      Parameters:
      filePath - the value for the filePath record component
      moduleName - the value for the moduleName record component
      lineCoverage - the value for the lineCoverage record component
      coveredCount - the value for the coveredCount record component
      totalCount - the value for the totalCount record component
  • Method Details

    • coveragePercentage

      public double coveragePercentage()
      Calculate the coverage percentage for this file.
      Returns:
      Coverage percentage (0-100), or 0 if no coverable lines
    • isFullyCovered

      public boolean isFullyCovered()
      Check if this file has full coverage.
      Returns:
      true if all coverable lines were covered
    • uncoveredCount

      public int uncoveredCount()
      Get the number of uncovered lines.
      Returns:
      Number of lines not covered
    • 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.
    • filePath

      public String filePath()
      Returns the value of the filePath record component.
      Returns:
      the value of the filePath record component
    • moduleName

      public String moduleName()
      Returns the value of the moduleName record component.
      Returns:
      the value of the moduleName record component
    • lineCoverage

      public Map<Integer, LineCoverage> lineCoverage()
      Returns the value of the lineCoverage record component.
      Returns:
      the value of the lineCoverage record component
    • coveredCount

      public int coveredCount()
      Returns the value of the coveredCount record component.
      Returns:
      the value of the coveredCount record component
    • totalCount

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