Class CommitDiffItem
java.lang.Object
io.jenkins.plugins.forensics.miner.CommitDiffItem
- All Implemented Interfaces:
Serializable
Represents all changes related to a specific file in a given SCM commit (diff). For each commit the number of added
and deleted lines will be recorded. Since a commit consists of a list of differences the number of added or deleted
lines can be updated several times until the final size has been reached.
- Author:
- Ullrich Hafner
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCommitDiffItem(CommitDiffItem copy) Creates a new copy of the specifiedCommitDiffItem.CommitDiffItem(String id, String author, int time) Creates a newCommitDiffItem. -
Method Summary
Modifier and TypeMethodDescriptionaddLines(int addedLines) Adds a diff with the specified number of added lines to this commit.deleteLines(int deletedLines) Adds a diff with the specified number of deleted lines to this commit.booleangetId()intgetTime()intintinthashCode()booleanisDelete()booleanisMove()protected ObjectCalled after deserialization to improve the memory usage.setNewPath(edu.hm.hafner.util.TreeString newPath) Sets the path of the modified file.setOldPath(edu.hm.hafner.util.TreeString oldPath) Sets the old path of a moved or deleted file.toString()
-
Constructor Details
-
CommitDiffItem
Creates a newCommitDiffItem.- Parameters:
id- commit IDauthor- author of the committime- the time of the commit (given as number of seconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT)
-
CommitDiffItem
Creates a new copy of the specifiedCommitDiffItem. Note that the number of added and deleted lines will be set to zero, so this constructor is not a copy constructor in the common sense.- Parameters:
copy- the commit to copy the base properties from
-
-
Method Details
-
readResolve
Called after deserialization to improve the memory usage.- Returns:
- this
-
getId
-
getAuthor
-
getTime
public int getTime() -
getTotalAddedLines
public int getTotalAddedLines() -
getTotalDeletedLines
public int getTotalDeletedLines() -
getOldPath
-
isDelete
public boolean isDelete() -
isMove
public boolean isMove() -
getNewPath
-
addLines
Adds a diff with the specified number of added lines to this commit.- Parameters:
addedLines- the additional number of added lines- Returns:
- this
-
deleteLines
Adds a diff with the specified number of deleted lines to this commit.- Parameters:
deletedLines- the additional number of deleted lines- Returns:
- this
-
setOldPath
Sets the old path of a moved or deleted file. If a file has been moved then thenewPathcontains the new file name while theoldPathcontains the old file name. It a file has been deleted, then thenewPathshould be set toNO_FILE_NAMEwhile theoldPathcontains the name of the deleted file.- Parameters:
oldPath- the path of the modified path- Returns:
- this
-
setNewPath
Sets the path of the modified file. If a file has been moved then thenewPathcontains the new file name while theoldPathcontains the old file name. It a file has been deleted, then thenewPathshould be set toNO_FILE_NAMEwhile theoldPathcontains the name of the deleted file.- Parameters:
newPath- the path of the modified path- Returns:
- this
-
equals
-
hashCode
public int hashCode() -
toString
-