net.sf.statcvs.renderer
Class FileCollectionFormatter
public class FileCollectionFormatter
Groups a set of file names by directory. Provides a list
of directories in the file set, and lumps directories
with only one file together with its parent directory.
$Id: FileCollectionFormatter.java,v 1.9 2008/04/02 11:22:15 benoitx Exp $
protected static int | getDepth(String directory) - Returns the depth of the directory
|
List | getDirectories() - Gets a list of
String s containing the
directories in the file set, ordered by name.
|
protected static String | getDirectory(String filename) - Returns directory name of specified file
|
List | getFiles(String directory) - Gets the names of all files which reside in a given directory.
|
protected static String | getParent(String directory) - Returns name of parent directory to specified directory
|
protected static String | getRelativeFilename(String filename, String dir) - Returns relative filename for specified file and directory
|
protected static boolean | isInDirectory(String filename, String directory) - Returns TRUE if file is in specified directroy, FALSE otherwise
|
FileCollectionFormatter
public FileCollectionFormatter(Collection files)
Creates a new instance from a Collection
of
file names.
files
- Collection containing the String representations of files
getDepth
protected static int getDepth(String directory)
Returns the depth of the directory
directory
- to be analysed
- int the depth of the directory
getDirectories
public List getDirectories()
Gets a list of String
s containing the
directories in the file set, ordered by name.
- a list of
String
s containing the
directories in the file set, ordered by name.
getDirectory
protected static String getDirectory(String filename)
Returns directory name of specified file
filename
- file to compute
- String directory name of specified file
getFiles
public List getFiles(String directory)
Gets the names of all files which reside in a given directory.
The directory must be one from the
getDirectories()
list. Files will be relative to the directory. They will be
ordered by name.
- the names of all files which reside in a given directory.
The directory must be one from the
getDirectories()
list. Files will be relative to the directory. They will be
ordered by name.
getParent
protected static String getParent(String directory)
Returns name of parent directory to specified directory
- String name of parent directory to specified directory
getRelativeFilename
protected static String getRelativeFilename(String filename,
String dir)
Returns relative filename for specified file and directory
filename
- filedir
- directory
- String relative filename for specified file and directory
isInDirectory
protected static boolean isInDirectory(String filename,
String directory)
Returns TRUE if file is in specified directroy, FALSE otherwise
filename
- File to testdirectory
- Directory to test
- boolean TRUE if file is in specified directroy, FALSE otherwise