Class IncrementalModelBuilder

java.lang.Object
org.jtool.jxplatform.builder.ModelBuilder
org.jtool.jxplatform.builder.IncrementalModelBuilder

public class IncrementalModelBuilder extends ModelBuilder
A builder that incrementally builds models from Java source code.
  • Field Details

    • jprojects

      protected List<JavaProject> jprojects
      A project that this builder is applied to.
    • addedFiles

      protected Set<org.jtool.jxplatform.builder.IncrementalModelBuilder.FilePath> addedFiles
      The collection of files that are added.
    • removedFiles

      protected Set<JavaFile> removedFiles
      The collection of files that are removed.
    • updatedFiles

      protected Set<JavaFile> updatedFiles
      The collection of files that are updated.
  • Constructor Details

    • IncrementalModelBuilder

      public IncrementalModelBuilder()
      Creates an incremental-mode model builder.
    • IncrementalModelBuilder

      public IncrementalModelBuilder(org.jtool.jxplatform.project.ModelBuilderImpl builderImpl)
      Creates an incremental-mode model builder.
      Parameters:
      builderImpl - the implementation module of this model builder
    • IncrementalModelBuilder

      public IncrementalModelBuilder(org.jtool.jxplatform.project.ModelBuilderImpl builderImpl, List<JavaProject> jprojects)
      Creates an incremental-mode model builder.
      Parameters:
      builderImpl - the implementation of a model builder
      jprojects - the collection of project data
  • Method Details

    • clearFiles

      public void clearFiles()
      Clear the records of changed files.
    • build

      public List<JavaProject> build(String name, String target)
      Description copied from class: ModelBuilder
      Builds a source code model for target projects.
      Overrides:
      build in class ModelBuilder
      Parameters:
      name - the name of the created model
      target - the directory storing the target projects
      Returns:
      the collection of created project data
    • build

      public JavaProject build(String name, String target, String classpath)
      Builds a source code model for a target project.
      Overrides:
      build in class ModelBuilder
      Parameters:
      name - the name of the created model
      target - the directory storing the target project
      classpath - the path where the needed class (or jar) files are located
      Returns:
      the created project data
    • build

      public JavaProject build(String name, String target, String classpath, String srcpath, String binpath)
      Builds a source code model for a target project.
      Overrides:
      build in class ModelBuilder
      Parameters:
      name - the name of the created model
      target - the directory storing the target project
      classpath - the path where the needed class (or jar) files are located
      srcpath - the path where the source files are located
      binpath - the path where the binary files are located
      Returns:
      the created project data
    • build

      public JavaProject build(String name, String target, String[] classpath, String[] srcpath, String[] binpath)
      Builds a source code model for a target project.
      Overrides:
      build in class ModelBuilder
      Parameters:
      name - the name of the created model
      target - the directory storing the target project
      classpath - the collection of the paths where the needed class (or jar) files are located
      srcpath - the collection of the paths where the source files are located
      binpath - the collection of the paths where the binary files are located
      Returns:
      the created project data
    • getJavaProjects

      public List<JavaProject> getJavaProjects()
      Returns the project that this builder is applied to.
      Returns:
      the collection of projects
    • resetClassPath

      public void resetClassPath(JavaProject jproject, String[] classPath)
      Resets the class paths.
      Parameters:
      jproject - a project whose class paths will be changed
      classPath - the absolute paths that store class files
    • resetSourceBinaryPaths

      public void resetSourceBinaryPaths(JavaProject jproject, String[] sourcePath, String[] binaryPath)
      Resets source paths and binary paths.
      Parameters:
      jproject - a project whose source and binary paths will be changed
      sourcePath - the absolute paths that store source files
      binaryPath - the absolute paths that store binary files
    • getAddedFileNames

      public Set<String> getAddedFileNames()
      Returns the names of files that were added.
      Returns:
      the collection of the names of the added files
    • getRemovedFileNames

      public Set<String> getRemovedFileNames()
      Returns the names of files that were removed.
      Returns:
      the collection of the names of the removed files
    • getUpdatedFileNames

      public Set<String> getUpdatedFileNames()
      Returns the names of files that were updated.
      Returns:
      the collection of the names of the updated files
    • getObsoleteFileNames

      public Set<String> getObsoleteFileNames()
      Returns the names of files whose contents are obsolete.
      Returns:
      the collection of the names of the obsolete files
    • rebuild

      public void rebuild()
      Re-builds a source code model from all files.
    • incrementalBuildByFileTime

      public void incrementalBuildByFileTime()
      Builds a source code model based on added and removed files.
    • incrementalBuild

      public void incrementalBuild()
      Builds a source code model based on added and removed files.
    • unbuild

      public void unbuild()
      Disposes the created models.
      Overrides:
      unbuild in class ModelBuilder
    • addFile

      public void addFile(JavaProject jproject, String pathname)
      Registers a file that was added to the project.
      Parameters:
      jproject - a project that contains the added file
      pathname - the path name of the added file
    • addFiles

      public void addFiles(JavaProject jproject, Set<String> pathnames)
      Registers files that were added to the project.
      Parameters:
      jproject - a project that contains the added files
      pathnames - the collection of path names of the added files
    • removeFile

      public void removeFile(JavaProject jproject, String pathname)
      Registers a file that was removed from the project.
      Parameters:
      jproject - a project that contains the removed file
      pathname - the path name of the removed file
    • removeFiles

      public void removeFiles(JavaProject jproject, Set<String> pathnames)
      Registers files that were removed from the project.
      Parameters:
      jproject - a project that contains the removed files
      pathnames - the collection of path names of the removed files
    • updateFile

      public void updateFile(JavaProject jproject, String pathname)
      Registers a file that was updated in the project.
      Parameters:
      jproject - a project that contains the updated file
      pathname - the path name of the updated file
    • updateFiles

      public void updateFiles(JavaProject jproject, Set<String> pathnames)
      Registers files that were updated in the project.
      Parameters:
      jproject - a project that contains the updated files
      pathnames - the collection of path names of the updated files