Package net.sf.statcvs.model
Class Revision
- java.lang.Object
-
- net.sf.statcvs.model.Revision
-
- All Implemented Interfaces:
java.lang.Comparable
public class Revision extends java.lang.Object implements java.lang.Comparable
One revision of aVersionedFile
. That can be an initial revision (checkin), a change, a deletion, or a re-add. Revisions are created using the methodsVersionedFile.addInitialRevision(java.lang.String, net.sf.statcvs.model.Author, java.util.Date, java.lang.String, int, java.util.SortedSet)
,VersionedFile.addChangeRevision(java.lang.String, net.sf.statcvs.model.Author, java.util.Date, java.lang.String, int, int, int, java.util.SortedSet)
andVersionedFile.addDeletionRevision(java.lang.String, net.sf.statcvs.model.Author, java.util.Date, java.lang.String, int, java.util.SortedSet)
. TODO: Replace type code with hierarchy TODO: Rename class to Revision, getAuthor() to getLogin(), isDead() to isDeletion()- Version:
- $Id: Revision.java,v 1.3 2009/08/20 17:44:05 benoitx Exp $
- Author:
- Manuel Schulze, Richard Cyganiak
-
-
Field Summary
Fields Modifier and Type Field Description static int
TYPE_BEGIN_OF_LOG
Marks a revision at the very beginning of the log timespan.static int
TYPE_CHANGE
Marks a revision that changes the file.static int
TYPE_CREATION
Marks a revision that creates a new file.static int
TYPE_DELETION
Marks a revision that deletes the file.
-
Constructor Summary
Constructors Constructor Description Revision(VersionedFile file, java.lang.String revisionNumber, int type, Author author, java.util.Date date, java.lang.String comment, int lines, int linesDelta, int linesReplaced, java.util.SortedSet symbolicNames)
Creates a new revision of a file with the specified revision number.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
compareTo(java.lang.Object other)
Compares this revision to another revision.boolean
equals(java.lang.Object rhs)
Author
getAuthor()
Returns the author of this revision.java.lang.String
getComment()
Returns the comment for this revision.java.util.Date
getDate()
Returns the date of this revision.int
getEffectiveLinesOfCode()
Deprecated.UsegetLines()
instead.VersionedFile
getFile()
Returns the file which was changed by this revision.int
getFileCountChange()
Deprecated.UsegetFileCountDelta()
instead.int
getFileCountDelta()
Returns the change of the file count caused by this revision.int
getLines()
Returns the number of lines for this revision.int
getLinesAdded()
Deprecated.UsegetLinesDelta()
andgetReplacedLines()
instead.int
getLinesDelta()
Returns by how many lines the line count changed with this revision.int
getLinesOfCode()
Deprecated.UsegetLines()
instead.int
getLinesOfCodeChange()
Deprecated.UsegetLinesDelta()
instead.int
getLinesRemoved()
Deprecated.UsegetLinesDelta()
andgetReplacedLines()
instead.int
getLineValue()
Deprecated.UsegetNewLines()
instead.int
getNewLines()
Returns the number of "new" lines in this revision.Revision
getPreviousRevision()
Returns the predecessor of this revision or null if it is the first revision for the file.int
getRemovingValue()
Deprecated.UsegetReplacedLines()
andgetLinesDelta()
instead.int
getReplacedLines()
Returns the number of lines that were removed and replaced by other lines in this revision.java.lang.String
getRevision()
Deprecated.UsegetRevisionNumber()
instead.java.lang.String
getRevisionNumber()
Returns the revision number.java.util.SortedSet
getSymbolicNames()
Returns a list ofSymbolicName
s of this revision or null if the revision has no symbolic names.int
hashCode()
boolean
isBeginOfLog()
Returns true if this is a revision at the very beginning of the log timespan which is only a container for the number of code lines at the beginning of the log and not a real revision committed by an author.boolean
isDead()
Returns true if the file is deleted in this revision.boolean
isInitialRevision()
Returnstrue
if the file did not exist before this revision and does exist afterwards.java.lang.String
toString()
-
-
-
Field Detail
-
TYPE_CREATION
public static final int TYPE_CREATION
Marks a revision that creates a new file. The file did not exist in the current branch before this revision, and it does exist afterwards. Possibly the file existed before, that is, it was deleted and restored.- See Also:
- Constant Field Values
-
TYPE_CHANGE
public static final int TYPE_CHANGE
Marks a revision that changes the file. It does neither create nor delete the file.- See Also:
- Constant Field Values
-
TYPE_DELETION
public static final int TYPE_DELETION
Marks a revision that deletes the file. The file existed before, but does not exist afterwards in the current branch.- See Also:
- Constant Field Values
-
TYPE_BEGIN_OF_LOG
public static final int TYPE_BEGIN_OF_LOG
Marks a revision at the very beginning of the log timespan. This is only a container for the number of code lines at the beginning of the log. It is not a real revision committed by an author.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Revision
public Revision(VersionedFile file, java.lang.String revisionNumber, int type, Author author, java.util.Date date, java.lang.String comment, int lines, int linesDelta, int linesReplaced, java.util.SortedSet symbolicNames)
Creates a new revision of a file with the specified revision number. Should not be called directly. Instead,VersionedFile.addInitialRevision(java.lang.String, net.sf.statcvs.model.Author, java.util.Date, java.lang.String, int, java.util.SortedSet)
and its sister methods should be used.- Parameters:
file
- VersionedFile that belongs to this revisionrevisionNumber
- revision number, for example "1.1"type
- a TYPE_XXX constantauthor
- the author of the revisiondate
- the date of the revisioncomment
- the author's commentlines
- number of lines; 0 for deletionslinesDelta
- by how much did the number of lines change, compared to the previous revision?linesReplaced
- How many lines were removed and replaced by other lines, without the delta changing?symbolicNames
- list of symbolic names for this revision or null if this revision has no symbolic names
-
-
Method Detail
-
getRevisionNumber
public java.lang.String getRevisionNumber()
Returns the revision number.- Returns:
- the revision number
-
getAuthor
public Author getAuthor()
Returns the author of this revision.- Returns:
- the author
-
getComment
public java.lang.String getComment()
Returns the comment for this revision.- Returns:
- the comment
-
getDate
public java.util.Date getDate()
Returns the date of this revision.- Returns:
- the date
-
getLines
public int getLines()
Returns the number of lines for this revision. This is 0 for dead revisions.- Returns:
- the number of lines
-
getLinesDelta
public int getLinesDelta()
Returns by how many lines the line count changed with this revision. Deletions return-getLines()
, re-adds and initial revisions returngetLines()
.- Returns:
- the line count change of this revision
-
getReplacedLines
public int getReplacedLines()
Returns the number of lines that were removed and replaced by other lines in this revision. For example, if 5 lines were added and 2 lines removed, this would be 3. If 1 line was added and 1 was removed, it would be 1. If it was an initial revision or a deletion, it would be 0.- Returns:
- the number of lines that were replaced by other lines.
-
getNewLines
public int getNewLines()
Returns the number of "new" lines in this revision. This is the sum of added and changed lines. In other words, all the "original" lines the author of this revision came up with.- Returns:
- lines changed or added
-
getFileCountDelta
public int getFileCountDelta()
Returns the change of the file count caused by this revision. This is 1 for initial revisions and re-adds, -1 for deletions, and 0 for normal revisions.- Returns:
- the file count change of this revision
-
isInitialRevision
public boolean isInitialRevision()
Returnstrue
if the file did not exist before this revision and does exist afterwards. Possibly the file was deleted before, or it never existed before.- Returns:
true
if the file did not exist before
-
isDead
public boolean isDead()
Returns true if the file is deleted in this revision.- Returns:
true
if the file is deleted in this revision
-
isBeginOfLog
public boolean isBeginOfLog()
Returns true if this is a revision at the very beginning of the log timespan which is only a container for the number of code lines at the beginning of the log and not a real revision committed by an author.- Returns:
true
if this revision exists only for StatCvs bookkeeping purposes
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getFile
public VersionedFile getFile()
Returns the file which was changed by this revision.- Returns:
- the file
-
getPreviousRevision
public Revision getPreviousRevision()
Returns the predecessor of this revision or null if it is the first revision for the file.- Returns:
- the predecessor of this revision
-
getSymbolicNames
public java.util.SortedSet getSymbolicNames()
Returns a list ofSymbolicName
s of this revision or null if the revision has no symbolic names. The list is ordered from latest to oldest.- Returns:
- list of symbolic names
-
compareTo
public int compareTo(java.lang.Object other)
Compares this revision to another revision. A revision is considered smaller if its date is smaller. If the dates are identical, the filename, author name, revision number and comment will be used to break the tie.- Specified by:
compareTo
in interfacejava.lang.Comparable
-
equals
public boolean equals(java.lang.Object rhs)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getLinesAdded
public int getLinesAdded()
Deprecated.UsegetLinesDelta()
andgetReplacedLines()
instead.
-
getLinesRemoved
public int getLinesRemoved()
Deprecated.UsegetLinesDelta()
andgetReplacedLines()
instead.
-
getLinesOfCode
public int getLinesOfCode()
Deprecated.UsegetLines()
instead.
-
getEffectiveLinesOfCode
public int getEffectiveLinesOfCode()
Deprecated.UsegetLines()
instead.
-
getLinesOfCodeChange
public int getLinesOfCodeChange()
Deprecated.UsegetLinesDelta()
instead.
-
getLineValue
public int getLineValue()
Deprecated.UsegetNewLines()
instead.
-
getRemovingValue
public int getRemovingValue()
Deprecated.UsegetReplacedLines()
andgetLinesDelta()
instead.
-
getFileCountChange
public int getFileCountChange()
Deprecated.UsegetFileCountDelta()
instead.
-
getRevision
public java.lang.String getRevision()
Deprecated.UsegetRevisionNumber()
instead.
-
-