java.lang.Object
java.lang.Record
org.variantsync.studies.evolution.simulation.diff.components.FileDiff
Record Components:
header - The header of UNIX diff's output
hunks - The hunks (i.e., change groups) of the file's difference
oldFile - The path to the old version of the file
newFile - The path to the new version of the file
All Implemented Interfaces:
IDiffComponent

public record FileDiff(List<String> header, List<Hunk> hunks, Path oldFile, Path newFile) extends Record implements IDiffComponent
A FileDiff holds the difference between two versions of a specific file.
  • Constructor Summary

    Constructors
    Constructor
    Description
    FileDiff(List<String> header, List<Hunk> hunks, Path oldFile, Path newFile)
    Creates an instance of a FileDiff record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the header record component.
    Returns the value of the hunks record component.
    Returns the value of the newFile record component.
    Returns the value of the oldFile record component.
    Parse this component back into a list of lines that can be added to a diff file meant as input for unix patch
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • FileDiff

      public FileDiff(List<String> header, List<Hunk> hunks, Path oldFile, Path newFile)
      Creates an instance of a FileDiff record class.
      Parameters:
      header - the value for the header record component
      hunks - the value for the hunks record component
      oldFile - the value for the oldFile record component
      newFile - the value for the newFile record component
  • Method Details

    • toLines

      public List<String> toLines()
      Description copied from interface: IDiffComponent
      Parse this component back into a list of lines that can be added to a diff file meant as input for unix patch
      Specified by:
      toLines in interface IDiffComponent
      Returns:
      the lines of the part of the diff that this component represents
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • header

      public List<String> header()
      Returns the value of the header record component.
      Returns:
      the value of the header record component
    • hunks

      public List<Hunk> hunks()
      Returns the value of the hunks record component.
      Returns:
      the value of the hunks record component
    • oldFile

      public Path oldFile()
      Returns the value of the oldFile record component.
      Returns:
      the value of the oldFile record component
    • newFile

      public Path newFile()
      Returns the value of the newFile record component.
      Returns:
      the value of the newFile record component