Package org.jtool.srcmodel
Class JavaProject
java.lang.Object
org.jtool.srcmodel.JavaProject
An object representing a project that contains source files to be analyzed.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String[]
The collection of class paths that store binary files for this project.protected final org.jtool.cfg.internal.CFGStore
A CFG repository that stores CFGs for source files for this project.protected String[]
The collection of class paths that store class files for this project.The map between the fully-qualified names and their corresponding classes.protected String
The version of the compiler source.protected String
The the version of the compiler target platform.The map between the fully-qualified names and their corresponding classes not having their files.The map paths and source files corresponding to the paths.protected final String
The name of this project.protected Map<String,
JavaPackage> The map between package names and their corresponding packages.protected String
The absolute path string that indicates the root directory of this project in the file system.protected String
The absolute path string that indicates the root directory of this project relative to the workspace.protected final org.jtool.pdg.internal.PDGStore
A PDG repository that stores PDGs for source files for this project.protected String[]
The collection of class paths that store source files for this project.protected String
The absolute path string that indicates the root directory of the top project enclosing this project in the file system. -
Constructor Summary
ConstructorsConstructorDescriptionJavaProject
(String name, String path, String topPath) Creates a project that stores source files and their related information.JavaProject
(String name, String wpath, String path, String topPath) Creates a project that stores source files and their related information.JavaProject
(String name, String wpath, String path, String topPath, org.jtool.cfg.internal.CFGStore cfgStore, org.jtool.pdg.internal.PDGStore pdgStore) Creates a project that stores source files and their related information. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears information on this project.collectClassesDependingOn
(JavaClass jclass) Obtains the classes depending on a given class, which are needed to be re-analyzed when the given class is modifiedvoid
collectInfo
(JavaClass jclass) Collects additional information on a given class.static JavaProject
findProject
(String path) Finds a project of interestObtains all classes related to this project.static List<JavaProject>
Returns the collection of all projects.String[]
Returns the absolute path where binary files are located in the project.org.jtool.cfg.internal.CFGStore
Return the repository that stores CFGs for source files in this project.Obtains a class having a given fully-qualified name from the inside of this project.Obtains classes existing in this project.String[]
Returns the absolute path where class files (jar or zip archives) are located in the project.Returns the version of the compiler source.Returns the version of the compiler target platform.getExternalClass
(String fqn) Obtains a class having a given fully-qualified name from the outside of this project.Obtains classes existing outside this project.Obtains the source file located at a given absolute path.getFiles()
Obtains source files existing in this project.Return the model builder that creates Java models in this project.org.jtool.jxplatform.project.ModelBuilderImpl
Return the model builder implementation that creates Java models in this project.getName()
Returns the name of this project.getPackage
(String name) Obtains a package having a given name.Obtains packages appearing in this project.Obtains packages appearing in this project.getPath()
Returns the path string that indicates the root directory of this project in the file system.Returns the path string that indicates the root directory of this project relative to the workspace.org.jtool.pdg.internal.PDGStore
Return the repository that stores PDGs for source files in this project.Obtains classes existing in this project.Obtains source files existing in this project.Obtains packages appearing in this project.String[]
Returns the absolute path where source files are located in the project.Returns the path string that indicates the root directory of the top project enclosing this project in the file system.void
removeClass
(JavaClass jclass) Removes a class from this project.void
removeFile
(String path) Removes a file from this project.void
removePackage
(JavaPackage jpackage) Removes a package from this project.void
setClassPath
(String[] classPath) Sets the class paths.void
setCompilerVersions
(String compilerSourceVersion, String compilerTargetVersion) Sets the versions for compilation.void
setModelBuilder
(ModelBuilder modelBuilder) Sets a model builder that creates Java models in this project.void
setSourceBinaryPaths
(String[] sourcePath, String[] binaryPath) Sets source paths and binary paths.void
setSourceBinaryPaths
(String sourcePath, String binaryPath) Sets a source path and a binary path.Sorts the list of source files.static List<JavaPackage>
sortPackages
(List<? extends JavaPackage> packages) Sorts the list of packages.toString()
Obtains information on this project.
-
Field Details
-
name
The name of this project. -
pathInWorkspace
The absolute path string that indicates the root directory of this project relative to the workspace. -
path
The absolute path string that indicates the root directory of this project in the file system. -
topPath
The absolute path string that indicates the root directory of the top project enclosing this project in the file system. -
fileStore
The map paths and source files corresponding to the paths. -
packageStore
The map between package names and their corresponding packages. -
classStore
The map between the fully-qualified names and their corresponding classes. -
externalClassStore
The map between the fully-qualified names and their corresponding classes not having their files. -
classPath
The collection of class paths that store class files for this project. -
sourcePath
The collection of class paths that store source files for this project. -
binaryPath
The collection of class paths that store binary files for this project. -
compilerSourceVersion
The version of the compiler source. -
compilerTargetVersion
The the version of the compiler target platform. -
cfgStore
protected final org.jtool.cfg.internal.CFGStore cfgStoreA CFG repository that stores CFGs for source files for this project. -
pdgStore
protected final org.jtool.pdg.internal.PDGStore pdgStoreA PDG repository that stores PDGs for source files for this project.
-
-
Constructor Details
-
JavaProject
Creates a project that stores source files and their related information.- Parameters:
name
- the name of this projectpath
- the absolute path that indicates the root directory of this project in the file systemtopPath
- the absolute path string that indicates the root directory of the top project enclosing this project
-
JavaProject
Creates a project that stores source files and their related information.- Parameters:
name
- the name of this projectwpath
- the absolute path that indicates the root directory of this project relative to the workspacepath
- the absolute path that indicates the root directory of this project in the file systemtopPath
- the absolute path string that indicates the root directory of the top project enclosing this project
-
JavaProject
public JavaProject(String name, String wpath, String path, String topPath, org.jtool.cfg.internal.CFGStore cfgStore, org.jtool.pdg.internal.PDGStore pdgStore) Creates a project that stores source files and their related information.- Parameters:
name
- the name of this projectwpath
- the absolute path that indicates the root directory of this project relative to the workspacepath
- the absolute path that indicates the root directory of this project in the file systemtopPath
- the absolute path string that indicates the root directory of the top project enclosing this projectcfgStore
- a CFG repository that stores CFGs for source files for this projectpdgStore
- a PDG repository that stores PDGs for source files for this project.
-
-
Method Details
-
setModelBuilder
Sets a model builder that creates Java models in this project.- Parameters:
modelBuilder
- the model builder
-
getModelBuilder
Return the model builder that creates Java models in this project.- Returns:
- the model builder
-
getModelBuilderImpl
public org.jtool.jxplatform.project.ModelBuilderImpl getModelBuilderImpl()Return the model builder implementation that creates Java models in this project.- Returns:
- the model builder implementation
-
getAllProjects
Returns the collection of all projects.- Returns:
- the collection of all the projects that were already analyzed
-
findProject
Finds a project of interest- Parameters:
path
- the absolute path of the project to be retrieved- Returns:
- the found project, or
null
if there is no project related to the path
-
clear
public void clear()Clears information on this project. -
getName
Returns the name of this project.- Returns:
- the project name
-
getPathRelativeToWorkspace
Returns the path string that indicates the root directory of this project relative to the workspace.- Returns:
- the relative path of this project, or the absolute path when there is no workspace
-
getPath
Returns the path string that indicates the root directory of this project in the file system.- Returns:
- the absolute path of this project
-
getTopPath
Returns the path string that indicates the root directory of the top project enclosing this project in the file system.- Returns:
- the absolute path of the top project
-
removeFile
Removes a file from this project. This method is not intended to be invoked by clients.- Parameters:
path
- the path of a file to be removed
-
getFile
Obtains the source file located at a given absolute path.- Parameters:
path
- the absolute path of the file in the file system- Returns:
- the found source file,
null
if no file is found
-
getFiles
Obtains source files existing in this project.- Returns:
- the collection of the existing files
-
getSortedFiles
Obtains source files existing in this project.- Returns:
- the sorted collection of the existing files
-
removePackage
Removes a package from this project. This method is not intended to be invoked by clients.- Parameters:
jpackage
- the package to be removed
-
getPackages
Obtains packages appearing in this project.- Returns:
- the collection of the existing packages
-
getPackagesInProject
Obtains packages appearing in this project.- Returns:
- the collection of the existing packages
-
getSortedPackages
Obtains packages appearing in this project.- Returns:
- the sorted collection of the existing packages
-
getPackage
Obtains a package having a given name.- Parameters:
name
- the name of the package to be retrieved- Returns:
- the found package, or
null
if no package is found
-
removeClass
Removes a class from this project. This method is not intended to be invoked by clients.- Parameters:
jclass
- the class to be removed
-
getClasses
Obtains classes existing in this project.- Returns:
- the collection of the classes in this project
-
getSortedClasses
Obtains classes existing in this project.- Returns:
- the sorted collection of the classes in this project
-
getClass
Obtains a class having a given fully-qualified name from the inside of this project.- Parameters:
fqn
- the fully-qualified name of the class- Returns:
- the found class, or
null
if no class is found
-
getExternalClasses
Obtains classes existing outside this project.- Returns:
- the collection of the outside classes
-
getAllClasses
Obtains all classes related to this project.- Returns:
- the collection of all the related classes
-
getExternalClass
Obtains a class having a given fully-qualified name from the outside of this project.- Parameters:
fqn
- the fully-qualified name of the class- Returns:
- the found class, or
null
if no class is found
-
collectClassesDependingOn
Obtains the classes depending on a given class, which are needed to be re-analyzed when the given class is modified- Parameters:
jclass
- the class of interest- Returns:
- the collection of the dependent classes
-
setClassPath
Sets the class paths.- Parameters:
classPath
- the absolute paths that store class files
-
setSourceBinaryPaths
Sets a source path and a binary path.- Parameters:
sourcePath
- the absolute path that stores source filesbinaryPath
- the absolute path that stores binary files
-
setSourceBinaryPaths
Sets source paths and binary paths.- Parameters:
sourcePath
- the absolute paths that store source filesbinaryPath
- the absolute paths that store binary files
-
getClassPath
Returns the absolute path where class files (jar or zip archives) are located in the project. The class path will be searched when finding class files are loaded.- Returns:
- the absolute path of the class files
-
getSourcePath
Returns the absolute path where source files are located in the project.- Returns:
- the collection of the absolute path of the source files
-
getBinaryPath
Returns the absolute path where binary files are located in the project.- Returns:
- the collection of the absolute path of the binary files
-
setCompilerVersions
Sets the versions for compilation.- Parameters:
compilerSourceVersion
- the version of the compiler source.compilerTargetVersion
- the version of the compiler target platform.
-
getCompilerSourceVersion
Returns the version of the compiler source.- Returns:
- the version number
-
getCompilerTargetVersion
Returns the version of the compiler target platform.- Returns:
- the version number
-
collectInfo
Collects additional information on a given class. This method is not intended to be invoked by clients, which will be automatically invoked as needed.- Parameters:
jclass
- the class of interest
-
getCFGStore
public org.jtool.cfg.internal.CFGStore getCFGStore()Return the repository that stores CFGs for source files in this project.- Returns:
- the CFG repository
-
getPDGStore
public org.jtool.pdg.internal.PDGStore getPDGStore()Return the repository that stores PDGs for source files in this project.- Returns:
- the PDG repository
-
toString
Obtains information on this project. -
sortFiles
Sorts the list of source files.- Parameters:
files
- the file list- Returns:
- the sorted file list
-
sortPackages
Sorts the list of packages.- Parameters:
packages
- the package list- Returns:
- the sorted package list
-