java.lang.Comparablepublic class VersionedFile
extends java.lang.Object
implements java.lang.Comparable
Repository,
including its name, Directory and Revision list.
Revisions can be created using the addXXXRevision factory
methods. Revisions can be created in any order.
TODO: Rename class to something like VersionedFile, getCurrentLinesOfCode() to getCurrentLines(), maybe getFilenameXXX, isDead() to isDeleted()| Constructor | Description |
|---|---|
VersionedFile(java.lang.String name,
Directory directory) |
Creates a VersionedFile object.
|
| Modifier and Type | Method | Description |
|---|---|---|
Revision |
addBeginOfLogRevision(java.util.Date date,
int lines,
java.util.SortedSet symbolicNames) |
Adds a "begin of log" revision to the file.
|
Revision |
addChangeRevision(java.lang.String revisionNumber,
Author author,
java.util.Date date,
java.lang.String comment,
int lines,
int linesDelta,
int replacedLines,
java.util.SortedSet symbolicNames) |
Adds a change revision to the file.
|
Revision |
addDeletionRevision(java.lang.String revisionNumber,
Author author,
java.util.Date date,
java.lang.String comment,
int lines,
java.util.SortedSet symbolicNames) |
Adds a deletion revision to the file.
|
Revision |
addInitialRevision(java.lang.String revisionNumber,
Author author,
java.util.Date date,
java.lang.String comment,
int lines,
java.util.SortedSet symbolicNames) |
Adds an initial revision to the file.
|
int |
compareTo(java.lang.Object other) |
Compares this file to another one, based on filename.
|
boolean |
equals(java.lang.Object rhs) |
|
java.util.Set |
getAuthors() |
Returns a list of authors that have commited at least one revision of the file.
|
int |
getCurrentLinesOfCode() |
Returns the current number of lines for this file.
|
Directory |
getDirectory() |
Returns the file's Directory.
|
java.lang.String |
getFilename() |
Returns the filename without path.
|
java.lang.String |
getFilenameWithPath() |
Returns the full filename.
|
Revision |
getInitialRevision() |
Gets the earliest revision of this file.
|
Revision |
getLatestRevision() |
Gets the latest revision of this file.
|
Module |
getModule() |
|
Revision |
getPreviousRevision(Revision revision) |
Returns the revision which was replaced by the revision given as
argument.
|
java.util.SortedSet |
getRevisions() |
Returns the list of
Revisions of this file,
sorted from earliest to most recent. |
boolean |
hasAuthor(Author author) |
Returns true, if
author worked on this file. |
int |
hashCode() |
|
boolean |
isDead() |
Returns
true if the latest revision of this file was
a deletion. |
void |
setModule(Module module) |
|
java.lang.String |
toString() |
public VersionedFile(java.lang.String name,
Directory directory)
name - The full name of the filedirectory - the directory where the file residespublic java.util.Set getAuthors()
public java.lang.String getFilenameWithPath()
public java.lang.String getFilename()
public Directory getDirectory()
public Revision getLatestRevision()
public Revision getInitialRevision()
public java.util.SortedSet getRevisions()
Revisions of this file,
sorted from earliest to most recent.Revisionspublic int getCurrentLinesOfCode()
public boolean isDead()
true if the latest revision of this file was
a deletion.true if this file is deletedpublic boolean hasAuthor(Author author)
author worked on this file.author - The Author to search fortrue, if the author is listed in one of
this file's revisionspublic Revision getPreviousRevision(Revision revision)
revision - a revision of this filepublic java.lang.String toString()
toString in class java.lang.Objectpublic int compareTo(java.lang.Object other)
compareTo in interface java.lang.ComparableComparable.compareTo(java.lang.Object)public boolean equals(java.lang.Object rhs)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic Revision addInitialRevision(java.lang.String revisionNumber, Author author, java.util.Date date, java.lang.String comment, int lines, java.util.SortedSet symbolicNames)
revisionNumber - the revision number, for example "1.1"author - the login from which the change was committeddate - the time when the change was committedcomment - the commit messagelines - the number of lines of the new filepublic Revision addChangeRevision(java.lang.String revisionNumber, Author author, java.util.Date date, java.lang.String comment, int lines, int linesDelta, int replacedLines, java.util.SortedSet symbolicNames)
revisionNumber - the revision number, for example "1.1"author - the login from which the change was committeddate - the time when the change was committedcomment - the commit messagelines - the number of lines in the file after the changelinesDelta - the change in the number of linesreplacedLines - number of lines that were removed and replaced by otherspublic Revision addDeletionRevision(java.lang.String revisionNumber, Author author, java.util.Date date, java.lang.String comment, int lines, java.util.SortedSet symbolicNames)
revisionNumber - the revision number, for example "1.1"author - the login from which the change was committeddate - the time when the change was committedcomment - the commit messagelines - the number of lines in the file before it was deletedpublic Revision addBeginOfLogRevision(java.util.Date date, int lines, java.util.SortedSet symbolicNames)
date - the begin of the loglines - the number of lines in the file at that timepublic Module getModule()
public void setModule(Module module)