net.sf.statcvs.model
Class Commit

java.lang.Object
  extended bynet.sf.statcvs.model.Commit

public class Commit
extends java.lang.Object

Encapsulates a CVS commit, which may consist of several CvsRevision objects (several files committed at once by the same author with the same message). The implementation allows for a tolerance of several minutes between individual file commits, but author and message must be identical.

Version:
$Id: Commit.java,v 1.11 2003/05/02 20:29:26 cyganiak Exp $
Author:
Richard Cyganiak

Constructor Summary
Commit(CvsRevision revision)
          Creates a new instance which consists of the given revision.
 
Method Summary
 void addRevision(CvsRevision change)
          Adds a revision to the commit.
 java.util.Set getAffectedFiles()
          Returns a String Set containing all filenames which were affected by this Commit.
 Author getAuthor()
          Returns the author of the commit
 int getChangeCount()
          Returns the number of individual changes which make up this commit.
 java.lang.String getComment()
          Returns the comment of the commit
 java.util.Date getDate()
          Returns the date when the commit took place.
 java.util.List getRevisions()
          Returns a list of CvsRevision objects, which make up this commit.
 boolean isInTimeFrame(java.util.Date date)
          Returns true if the date lies within the timespan of the commit, plus/minus a tolerance.
 boolean isSameCommit(CvsRevision change)
          Returns true if change is part of this commit, that is if they have the same author, the same message, and are within the same timeframe.
 boolean overlaps(Commit commit)
          Returns true if two commits overlap and should be merged.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Commit

public Commit(CvsRevision revision)
Creates a new instance which consists of the given revision.

Parameters:
revision - the single revision out of which the commit will be created
Method Detail

getAuthor

public Author getAuthor()
Returns the author of the commit

Returns:
the author

getComment

public java.lang.String getComment()
Returns the comment of the commit

Returns:
the comment

isSameCommit

public boolean isSameCommit(CvsRevision change)
Returns true if change is part of this commit, that is if they have the same author, the same message, and are within the same timeframe.

Parameters:
change - the revision to check against this commit
Returns:
true if change is part of this commit

isInTimeFrame

public boolean isInTimeFrame(java.util.Date date)
Returns true if the date lies within the timespan of the commit, plus/minus a tolerance.

Parameters:
date - the date to check against this commit
Returns:
true if the date lies within the timespan of the commit

overlaps

public boolean overlaps(Commit commit)
Returns true if two commits overlap and should be merged.

Parameters:
commit - the commit to check
Returns:
true if two commits overlap

addRevision

public void addRevision(CvsRevision change)
Adds a revision to the commit. The revision must be part of the commit.

Parameters:
change - the CvsRevision to add.

getRevisions

public java.util.List getRevisions()
Returns a list of CvsRevision objects, which make up this commit. May be used to access the individual files which were changed by the commit.

Returns:
a list of changes

getAffectedFiles

public java.util.Set getAffectedFiles()
Returns a String Set containing all filenames which were affected by this Commit.

Returns:
a Set of Strings

getChangeCount

public int getChangeCount()
Returns the number of individual changes which make up this commit.

Returns:
the number of changes

getDate

public java.util.Date getDate()
Returns the date when the commit took place. The implementation simply returns the timestamp of the first change of the commit.

Returns:
a date within the timeframe of the commit