net.sf.statcvs.model

## Class Commit

- java.lang.Object
- - net.sf.statcvs.model.Commit

- All Implemented Interfaces:
    java.lang.Comparable

      public class Commit
      extends java.lang.Object
      implements java.lang.Comparable

  Represents a commit, which may consist of several `Revision` objects. A commit means that several files were committed at once by the same author with the same message. TODO: Rename getAuthor() to getLogin(), getAffectedFiles() to getAffectedFileNames() (or change to return CvsFiles?)
  Version:
    $Id: Commit.java,v 1.17 2009/08/20 17:44:05 benoitx Exp $
  Author:
    Richard Cyganiak

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Commit(Revision revision)` Creates a new instance which consists of the given revision.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addRevision(Revision revision)` Adds a revision to the commit.
    `int` | `compareTo(java.lang.Object other)` Compares this commit to another revision, based on their date.
    `boolean` | `equals(java.lang.Object rhs)`
    `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.
    `java.lang.String` | `getComment()` Returns the comment of the commit.
    `java.util.Date` | `getDate()` Returns the date when the commit took place.
    `java.util.Set` | `getRevisions()` Returns the `Revision` objects that make up this commit.
    `int` | `hashCode()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Commit

          public Commit(Revision 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

    - #### addRevision

          public void addRevision(Revision revision)

      Adds a revision to the commit. The revision must be part of the commit, that is, it must have the same date, author and message as all other revisions in the commit.
      Parameters:
        `revision` - the `Revision` to add.

    - #### getRevisions

          public java.util.Set getRevisions()

      Returns the `Revision` objects that make up this commit.
      Returns:
        a set of `Revision` instances

    - #### 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

    - #### 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

    - #### getAffectedFiles

          public java.util.Set getAffectedFiles()

      Returns a `String` `Set` containing all filenames which were affected by this `Commit`.
      Returns:
        a `Set` of `String`s

    - #### compareTo

          public int compareTo(java.lang.Object other)

      Compares this commit to another revision, based on their date.
      Specified by:
        `compareTo` in interface `java.lang.Comparable`
      See Also:
        `Comparable.compareTo(java.lang.Object)`

    - #### equals

          public boolean equals(java.lang.Object rhs)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`