Package org.eclipse.steady
Class DirAnalyzer
- java.lang.Object
-
- org.eclipse.steady.DirAnalyzer
-
- All Implemented Interfaces:
FileAnalyzer
public class DirAnalyzer extends Object implements FileAnalyzer
Analyzes all files below a given directory, thereby using other implementations ofFileAnalyzer.
-
-
Constructor Summary
Constructors Constructor Description DirAnalyzer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete 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.static FileAnalyzercreateAnalyzerForArchiveEntry(InputStream _is, String _entry)The givenInputStreamhas been created from an archive entry with the given name.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.voidsetExtensionFilter(String[] _exts)Setter for the fieldextensionFilter.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.steady.FileAnalyzer
equals, hashCode
-
-
-
-
Method Detail
-
setExtensionFilter
public void setExtensionFilter(String[] _exts)
Setter for the field
extensionFilter.- Parameters:
_exts- an array ofStringobjects.
-
getSupportedFileExtensions
public String[] getSupportedFileExtensions()
Returns all supported file extensions.- Specified by:
getSupportedFileExtensionsin interfaceFileAnalyzer- Returns:
- an array of
Stringobjects.
-
canAnalyze
public boolean canAnalyze(File _file)
Returns true if the givenFilecan be analyzed, false otherwise.- Specified by:
canAnalyzein interfaceFileAnalyzer- Parameters:
_file- aFileobject.- Returns:
- a boolean.
-
analyze
public void analyze(File _file) throws FileAnalysisException
Sets theFileto be analyzed. Note that this does not necessarily trigger the analysis.- Specified by:
analyzein interfaceFileAnalyzer- Parameters:
_file- aFileobject.- Throws:
FileAnalysisException- if any.
-
getConstructs
public 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 the union of constructs of allFileAnalyzers created when searching recursivly in the directory.- Specified by:
getConstructsin interfaceFileAnalyzer- Returns:
- a
Mapobject. - Throws:
FileAnalysisException- if any.
-
containsConstruct
public boolean containsConstruct(ConstructId _id) throws FileAnalysisException
Returns true if the givenConstructIdis part of the analyzed file, false otherwise.- Specified by:
containsConstructin interfaceFileAnalyzer- Parameters:
_id- aConstructIdobject.- Returns:
- a boolean.
- Throws:
FileAnalysisException- if any.
-
getConstruct
public Construct getConstruct(ConstructId _id) throws FileAnalysisException
Returns theConstructwith the givenConstructIdor null if no such construct is present in the analyzed file.- Specified by:
getConstructin interfaceFileAnalyzer- Parameters:
_id- aConstructIdobject.- Returns:
- a
Constructobject. - Throws:
FileAnalysisException- if any.
-
hasChilds
public 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.- Specified by:
hasChildsin interfaceFileAnalyzer- Returns:
- a boolean.
-
getChilds
public 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.- Specified by:
getChildsin interfaceFileAnalyzer- Parameters:
_recursive- a boolean.- Returns:
- a
Setobject.
-
createAnalyzerForArchiveEntry
public static FileAnalyzer createAnalyzerForArchiveEntry(InputStream _is, String _entry)
The givenInputStreamhas been created from an archive entry with the given name. The entry is extracted below the temporary directory, and aFileAnalyzeris created for it.- Parameters:
_is- aInputStreamobject._entry- aStringobject.- Returns:
- a
FileAnalyzerobject.
-
-