net.sf.statsvn.input
public class Builder extends Object implements SvnLogBuilder
Helps building the net.sf.statsvn.model.Repository
from a SVN log. The Builder is fed by some SVN history data source, for example a SVN
log parser. The Repository can be retrieved using the createRepository()
method.
The class also takes care of the creation of Author and Directory objects and makes sure that there's only one of these for each author name and path. It also provides LOC count services.
Constructor and Description |
---|
Builder(RepositoryFileManager repositoryFileManager,
net.sf.statcvs.util.FilePatternMatcher includePattern,
net.sf.statcvs.util.FilePatternMatcher excludePattern,
Pattern tagsPattern)
Creates a new Builder
|
Modifier and Type | Method and Description |
---|---|
void |
addToAttic(String filename)
Adds a file to the attic.
|
void |
buildFile(String filename,
boolean isBinary,
boolean isInAttic,
Map revBySymnames,
Map dateBySymnames)
Starts building a new file.
|
void |
buildModule(String moduleName)
Starts building the module.
|
void |
buildRevision(RevisionData data)
Adds a revision to the current file.
|
void |
clean() |
net.sf.statcvs.model.Repository |
createRepository()
Returns a Repository object of all files.
|
Set |
getAtticFileNames()
Returns the Set of filenames that are "in the attic".
|
net.sf.statcvs.model.Author |
getAuthor(String name)
returns the Author of the given name or creates it if it does not yet exist.
|
net.sf.statcvs.model.Directory |
getDirectory(String filename)
Returns the Directory of the given filename or creates it if it does not yet exist.
|
Map |
getFileBuilders()
New in StatSVN: We need to have access to FileBuilders after they have been created to populate them with version numbers later on.
|
int |
getLOC(String filename) |
String |
getProjectName() |
String |
getRevision(String filename) |
net.sf.statcvs.model.SymbolicName |
getSymbolicName(String name,
Date date)
Returns the
SymbolicName with the given name or creates it if it does not yet exist. |
boolean |
matchesPatterns(String filename)
Matches a filename against the include and exclude patterns.
|
boolean |
matchesTagPatterns(String tag)
Matches a tag against the tag patterns.
|
void |
updateRevision(String filename,
String revisionNumber,
int linesAdded,
int linesRemoved)
New in StatSVN: Updates a particular revision for a file with new line count information.
|
public Builder(RepositoryFileManager repositoryFileManager, net.sf.statcvs.util.FilePatternMatcher includePattern, net.sf.statcvs.util.FilePatternMatcher excludePattern, Pattern tagsPattern)
repositoryFileManager
- the RepositoryFileManager
that can be used to retrieve LOC counts for the files that this builder will createincludePattern
- a list of Ant-style wildcard patterns, seperated by : or ;excludePattern
- a list of Ant-style wildcard patterns, seperated by : or ;public void clean()
public void addToAttic(String filename)
addToAttic
in interface SvnLogBuilder
filename
- the filename to add to the attic.public void buildFile(String filename, boolean isBinary, boolean isInAttic, Map revBySymnames, Map dateBySymnames)
Starts building a new file. The files are not expected to be created in any particular order. Subsequent calls to (@link #buildRevision(RevisionData)) will add revisions to this file.
New in StatSVN: If the method has already been invoked with the same filename, the original file will be re-loaded and the other arguments are ignored.
buildFile
in interface SvnLogBuilder
filename
- the file's name with path, for example "path/file.txt"isBinary
- true if it's a binary fileisInAttic
- true if the file is dead on the main branchrevBySymnames
- maps revision (string) by symbolic name (string)dateBySymnames
- maps date (date) by symbolic name (string)public void buildModule(String moduleName)
buildModule
in interface SvnLogBuilder
moduleName
- name of the modulepublic void buildRevision(RevisionData data)
buildRevision
in interface SvnLogBuilder
data
- the revisionpublic net.sf.statcvs.model.Repository createRepository()
public Set getAtticFileNames()
public net.sf.statcvs.model.Author getAuthor(String name)
name
- the author's namepublic net.sf.statcvs.model.Directory getDirectory(String filename)
filename
- the name and path of a file, for example "src/Main.java"public Map getFileBuilders()
getFileBuilders
in interface SvnLogBuilder
public int getLOC(String filename) throws net.sf.statcvs.input.NoLineCountException
net.sf.statcvs.input.NoLineCountException
RepositoryFileManager.getLinesOfCode(String)
public String getProjectName()
public String getRevision(String filename) throws IOException
IOException
RepositoryFileManager.getRevision(String)
public net.sf.statcvs.model.SymbolicName getSymbolicName(String name, Date date)
SymbolicName
with the given name or creates it if it does not yet exist.name
- the symbolic name's namepublic boolean matchesPatterns(String filename)
matchesPatterns
in interface SvnLogBuilder
filename
- a filenamepublic boolean matchesTagPatterns(String tag)
matchesTagPatterns
in interface SvnLogBuilder
tag
- a tagpublic void updateRevision(String filename, String revisionNumber, int linesAdded, int linesRemoved)
updateRevision
in interface SvnLogBuilder
filename
- the file to be updatedrevisionNumber
- the revision number to be updatedlinesAdded
- the lines that were addedlinesRemoved
- the lines that were removed