xjavadoc.filesystem
Class FileSourceSet
java.lang.Object
xjavadoc.filesystem.FileSourceSet
- Serializable, SourceSet
public final class FileSourceSet
extends java.lang.Object
This class represents a set of Java source files. It designs a directory and
an optional array of files. The size() and getQualifiedName( int ) methods
depend on what files were passed in the constructor. The getSourceFile(
String ) will work regardless of wether the class was instantiated with files
or not (provided the file exists).
- Aslak Helles?y
private File | _dir - root directory
|
private ArrayList | _files - source files
|
private int | hash - overridden hash code
|
FileSourceSet(File fileOrDir) - Creates a SoureSet from a directory or a file.
|
FileSourceSet(File dir, String[] files) - Constructs a new FileSourceSet.
|
boolean | containsAbsolute(String filename) - whether source set contains given absolute file name
|
boolean | containsRelative(String filename) - whether source set contains relative file name
|
boolean | equals(Object o) - Compares with another object.
|
private File | getDir() - Gets the root directory of the source files.
|
AbstractFile[] | getFiles() - Gets the files contained in the source set.
|
private String | getQualifiedName(String relativeFileName) - Gets the fully qualified class name for a relative file
|
String | getQualifiedName(int i) - Gets the fully qualified class name of the i'th file in the instance.
|
private String | getRelativeFileName(String qualifiedName) - Gets the relative file name (relative to dir) for a fully qualified class
name
|
int | getSize() - Returns the number of files in the instance
|
AbstractFile | getSourceFile(String qualifiedName) - Gets the File containing the source of the class.
|
int | hashCode()
|
_dir
private File _dir
root directory
_files
private ArrayList _files
source files
hash
private int hash
overridden hash code
FileSourceSet
public FileSourceSet(File fileOrDir)
Creates a SoureSet from a directory or a file. If fileOrDir is a directory,
all java files under that directory (and all subdirectories) will be added
to this FileSourceSet.
fileOrDir
-
FileSourceSet
public FileSourceSet(File dir,
String[] files)
Constructs a new FileSourceSet. If the files parameter is null, the
FileSourceSet will report that it does not know about any java source files,
even if they exist. See the general class comment.
dir
- The root directory of the java sourcesfiles
- The desired files under the root directory
containsAbsolute
public boolean containsAbsolute(String filename)
whether source set contains given absolute file name
filename
- absolute filename to check
containsRelative
public boolean containsRelative(String filename)
whether source set contains relative file name
filename
- relative filename to check
equals
public boolean equals(Object o)
Compares with another object. They are equal if o is a FileSourceSet and
have the same dir and the same files.
o
- object to compare
- true if they are equal
getDir
private File getDir()
Gets the root directory of the source files.
- the root directory of the source files.
getQualifiedName
private String getQualifiedName(String relativeFileName)
Gets the fully qualified class name for a relative file
relativeFileName
- filename relative to the dir
- fully qualified class name
getQualifiedName
public String getQualifiedName(int i)
Gets the fully qualified class name of the i'th file in the instance.
- getQualifiedName in interface SourceSet
i
- the index of the class
- fully qualified class name
getRelativeFileName
private String getRelativeFileName(String qualifiedName)
Gets the relative file name (relative to dir) for a fully qualified class
name
qualifiedName
- fully qualified class name
- the relative file name
getSize
public int getSize()
Returns the number of files in the instance
- getSize in interface SourceSet
- the number of files in the instance
getSourceFile
public AbstractFile getSourceFile(String qualifiedName)
Gets the File containing the source of the class.
IMPORTANT: This method will find a file regardless of whether it was
part of the files passed in the constructor.
- getSourceFile in interface SourceSet
qualifiedName
- fully qualified class name of the source file to find.
- the File containing the source of the class
hashCode
public int hashCode()