Package org.eclipse.steady
Interface FileAnalyzer
-
- All Known Implementing Classes:
DirAnalyzer
public interface FileAnalyzerAnalyzes a given file or directory in order to search for contained programming constructs. Instances ofFileAnalyzerare built byFileAnalyzerFactory.FileAnalyzers can be nested and form a tree structure, which is addressed by methodshasChilds()andgetChilds(boolean).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidanalyze(File _file)Sets theFileto be analyzed.booleancanAnalyze(File _file)Returns true if the givenFilecan be analyzed, false otherwise.booleancontainsConstruct(ConstructId _id)Returns true if the givenConstructIdis part of the analyzed file, false otherwise.booleanequals(Object obj)Set<FileAnalyzer>getChilds(boolean _recursive)Returns nestedFileAnalyzers or null if no child analyzers exist.ConstructgetConstruct(ConstructId _id)Returns theConstructwith the givenConstructIdor null if no such construct is present in the analyzed file.Map<ConstructId,Construct>getConstructs()String[]getSupportedFileExtensions()Returns all supported file extensions.booleanhasChilds()Returns true if there are any childFileAnalyzers, false otherwise.inthashCode()
-
-
-
Method Detail
-
getSupportedFileExtensions
String[] getSupportedFileExtensions()
Returns all supported file extensions.- Returns:
- an array of
Stringobjects.
-
canAnalyze
boolean canAnalyze(File _file)
Returns true if the givenFilecan be analyzed, false otherwise.- Parameters:
_file- aFileobject.- Returns:
- a boolean.
-
analyze
void analyze(File _file) throws FileAnalysisException
Sets theFileto be analyzed. Note that this does not necessarily trigger the analysis.- Parameters:
_file- aFileobject.- Throws:
FileAnalysisException- if any.
-
getConstructs
Map<ConstructId,Construct> getConstructs() throws FileAnalysisException
Searches for programmingConstructs contained in a givenFileand returns them to the caller. TheFileto be analyzed is not specified using the methods of the interface. Typically, it is passed to the constructor of the respective implementation.- Returns:
- a
Mapobject. - Throws:
FileAnalysisException- if any.
-
containsConstruct
boolean containsConstruct(ConstructId _id) throws FileAnalysisException
Returns true if the givenConstructIdis part of the analyzed file, false otherwise.- Parameters:
_id- aConstructIdobject.- Returns:
- a boolean.
- Throws:
FileAnalysisException- if any.
-
getConstruct
Construct getConstruct(ConstructId _id) throws FileAnalysisException
Returns theConstructwith the givenConstructIdor null if no such construct is present in the analyzed file.- Parameters:
_id- aConstructIdobject.- Returns:
- a
Constructobject. - Throws:
FileAnalysisException- if any.
-
hasChilds
boolean hasChilds()
Returns true if there are any childFileAnalyzers, false otherwise. Some analyzers will never have any childs, e.g., those that parse single source code files. In case of other analyzes, e.g., theDirAnalyzer, it depends on whether there are any "analyzable" files.- Returns:
- a boolean.
-
getChilds
Set<FileAnalyzer> getChilds(boolean _recursive)
Returns nestedFileAnalyzers or null if no child analyzers exist. Depending on the argument, only direct childs or also indirect childs will be returned.- Parameters:
_recursive- a boolean.- Returns:
- a
Setobject.
-
-