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.7 2003/03/18 10:33:55 lukasz Exp $
Author:
Richard Cyganiak

Constructor Summary
Commit(CvsRevision change)
          Creates a new instance which consists of the given change.
 
Method Summary
 void addChange(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.
 java.lang.String getAuthor()
          Returns the author of the commit
 int getChangeCount()
          Returns the number of individual changes which make up this commit.
 java.util.List getChanges()
          Returns a list of CvsRevision objects, 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.
 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 change)
Creates a new instance which consists of the given change.

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

getAuthor

public java.lang.String 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

addChange

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

Parameters:
change - the CvsRevision to add.

getChanges

public java.util.List getChanges()
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