xjavadoc.filesystem
Class FileSourceSet

java.lang.Object
  extended byxjavadoc.filesystem.FileSourceSet
All Implemented Interfaces:
java.io.Serializable, SourceSet

public final class FileSourceSet
extends java.lang.Object
implements SourceSet

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).

Author:
Aslak Hellesøy
See Also:
Serialized Form

Constructor Summary
FileSourceSet(java.io.File fileOrDir)
          Creates a SoureSet from a directory or a file.
FileSourceSet(java.io.File dir, java.lang.String[] files)
          Constructs a new FileSourceSet.
 
Method Summary
 boolean containsAbsolute(java.lang.String filename)
          whether source set contains given absolute file name
 boolean containsRelative(java.lang.String filename)
          whether source set contains relative file name
 boolean equals(java.lang.Object o)
          Compares with another object.
 AbstractFile[] getFiles()
          Gets the files contained in the source set.
 java.lang.String getQualifiedName(int i)
          Gets the fully qualified class name of the i'th file in the instance.
 int getSize()
          Returns the number of files in the instance
 AbstractFile getSourceFile(java.lang.String qualifiedName)
          Gets the File containing the source of the class.
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSourceSet

public FileSourceSet(java.io.File dir,
                     java.lang.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.

Parameters:
dir - The root directory of the java sources
files - The desired files under the root directory

FileSourceSet

public FileSourceSet(java.io.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.

Parameters:
fileOrDir -
Method Detail

getFiles

public AbstractFile[] getFiles()
Gets the files contained in the source set.

Specified by:
getFiles in interface SourceSet
Returns:

getSourceFile

public AbstractFile getSourceFile(java.lang.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.

Specified by:
getSourceFile in interface SourceSet
Parameters:
qualifiedName - fully qualified class name of the source file to find.
Returns:
the File containing the source of the class

getQualifiedName

public java.lang.String getQualifiedName(int i)
Gets the fully qualified class name of the i'th file in the instance.

Specified by:
getQualifiedName in interface SourceSet
Parameters:
i - the index of the class
Returns:
fully qualified class name

getSize

public int getSize()
Returns the number of files in the instance

Specified by:
getSize in interface SourceSet
Returns:
the number of files in the instance

containsAbsolute

public boolean containsAbsolute(java.lang.String filename)
whether source set contains given absolute file name

Parameters:
filename - absolute filename to check
Returns:

containsRelative

public boolean containsRelative(java.lang.String filename)
whether source set contains relative file name

Parameters:
filename - relative filename to check
Returns:

equals

public boolean equals(java.lang.Object o)
Compares with another object. They are equal if o is a FileSourceSet and have the same dir and the same files.

Parameters:
o - object to compare
Returns:
true if they are equal

hashCode

public int hashCode()


Copyright © 2002-2004 XDoclet Team. All Rights Reserved.