Class FileLocations

java.lang.Object
io.jenkins.plugins.forensics.blame.FileLocations
All Implemented Interfaces:
Serializable

public class FileLocations extends Object implements Serializable
Defines a set of file locations. A file location is identified by an absolute file name and line number. File locations are grouped by file name, i.e. you can obtain a mapping of a file to all affected lines in that file.
Author:
Ullrich Hafner
See Also:
  • Constructor Details

    • FileLocations

      public FileLocations()
  • Method Details

    • addLine

      public void addLine(String fileName, int lineStart)
      Adds the specified affected file and line number.
      Parameters:
      fileName - the absolute file name that will be used as a key
      lineStart - the line number to find the blame for
    • isEmpty

      public boolean isEmpty()
      Returns whether some files have been added.
      Returns:
      true if there a no blames available, false otherwise
    • size

      public int size()
      Returns the number of files that have been added.
      Returns:
      number of affected files with blames
    • contains

      public boolean contains(String fileName)
      Returns whether the specified file has been added.
      Parameters:
      fileName - the relative or absolute path of the file
      Returns:
      true if the file already has been added, false otherwise
    • getFiles

      public Set<String> getFiles()
      Returns the absolute file names of all files.
      Returns:
      the absolute file names
    • getLines

      public Set<Integer> getLines(String fileName)
      Returns the added lines for the specified file.
      Parameters:
      fileName - the relative or absolute path of the file
      Returns:
      the lines for that file
      Throws:
      NoSuchElementException - if the file name is not registered
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object