Class RepositoryStatistics
java.lang.Object
io.jenkins.plugins.forensics.miner.RepositoryStatistics
- All Implemented Interfaces:
Serializable
Provides access to the SCM commit statistics of all repository files up to a specific commit.
- Author:
- Ullrich Hafner
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty instance ofRepositoryStatisticswith no latest commit ID set.RepositoryStatistics(String latestCommitId) Creates an empty instance ofRepositoryStatistics. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(FileStatistics additionalStatistics) Adds the additional file statistics instance.voidaddAll(RepositoryStatistics additionalStatistics) Adds all additional file statistics.voidaddAll(Collection<FileStatistics> additionalStatistics) Adds all additional file statistics.voidaddAll(List<CommitDiffItem> commits) Adds and inspects the specified commits.booleanReturns whether the specified file is part of the repository.booleanReturns the statistics for the specified file.getFiles()Returns the absolute file names of the files that are part of the repository.Returns the statistics for all repository files.Returns the ID of the latest commit mined.Returns the mapping of file names to statistics.intintinthashCode()booleanReturns whether the latest commit ID has been set.booleanisEmpty()Returns whether the repository is empty.protected ObjectCalled after deserialization to retain backward compatibility.intsize()Returns the number of files in the repository.protected ObjectCalled before serialization to fill the fileStatistics field.
-
Constructor Details
-
RepositoryStatistics
public RepositoryStatistics()Creates an empty instance ofRepositoryStatisticswith no latest commit ID set. -
RepositoryStatistics
Creates an empty instance ofRepositoryStatistics.- Parameters:
latestCommitId- the ID of the latest commit that
-
-
Method Details
-
readResolve
Called after deserialization to retain backward compatibility.- Returns:
- this
-
writeReplace
Called before serialization to fill the fileStatistics field.- Returns:
- this
-
isEmpty
public boolean isEmpty()Returns whether the repository is empty.- Returns:
trueif the repository is empty,falseotherwise
-
getLatestCommitId
Returns the ID of the latest commit mined.- Returns:
- ID of the latest commit.
-
hasLatestCommitId
public boolean hasLatestCommitId()Returns whether the latest commit ID has been set.- Returns:
trueif the latest commit ID has been set,falseotherwise
-
size
public int size()Returns the number of files in the repository.- Returns:
- number of files in the repository
-
contains
Returns whether the specified file is part of the repository.- Parameters:
fileName- the name of the file- Returns:
trueif the file file is part of the repository,falseotherwise
-
getFiles
Returns the absolute file names of the files that are part of the repository.- Returns:
- the file names
-
getFileStatistics
Returns the statistics for all repository files.- Returns:
- the statistics
-
getMapping
Returns the mapping of file names to statistics.- Returns:
- the mapping of file names to statistics
-
get
Returns the statistics for the specified file.- Parameters:
fileName- absolute file name- Returns:
- the statistics for that file
- Throws:
NoSuchElementException- if the file name is not registered
-
addAll
Adds and inspects the specified commits.- Parameters:
commits- the additional commits
-
addAll
Adds all additional file statistics.- Parameters:
additionalStatistics- the additional statistics to add
-
addAll
Adds all additional file statistics.- Parameters:
additionalStatistics- the additional statistics to add
-
add
Adds the additional file statistics instance.- Parameters:
additionalStatistics- the additional statistics to add
-
getTotalChurn
public int getTotalChurn() -
getTotalLinesOfCode
public int getTotalLinesOfCode() -
getLatestStatistics
-
equals
-
hashCode
public int hashCode()
-