Interface LargeSourceSet

All Known Implementing Classes:
InMemoryLargeSourceSet

public interface LargeSourceSet
A source set that may be too large to be materialized in memory. It contains operations for filtering and mapping that are optimized for large repositories, though the same operations work on small repositories.

A large source set must always track of its initial state to be able to produce getChangeset() from that initial state through any number of transformations to some end state.

  • Method Details

    • beforeCycle

      @Deprecated default void beforeCycle()
      Deprecated.
      Override beforeCycle(boolean) instead
      Called by RecipeScheduler at the beginning of a scan/generate/edit cycle.
    • beforeCycle

      default void beforeCycle(boolean definitelyLastCycle)
      Called by RecipeScheduler at the beginning of a scan/generate/edit cycle.
      Parameters:
      definitelyLastCycle - true if this is definitely the last cycle of a recipe; when called with a value of false the next call to afterCycle(boolean) could still be called with true. This depends on whether any of the recipes requested an additional cycle.
    • setRecipe

      void setRecipe(List<Recipe> recipeStack)
      Maintain context about what recipe is performing an edit or generating code.
      Parameters:
      recipeStack - A stack rooted at the currently operating recipe and extending up its containing recipes to top-level recipe that a developer is running directly.
    • edit

      Execute a transformation on all items.
      Parameters:
      map - A transformation on T
      Returns:
      A new source set if the map function results in any changes, otherwise this source set is returned.
    • generate

      LargeSourceSet generate(@Nullable Collection<? extends SourceFile> ls)
      Concatenate new items. Where possible, implementations should not iterate the entire source set in order to accomplish this, since the ordering of SourceFile is not significant.
      Parameters:
      ls - The new item to insert
      Returns:
      A new source set with the new item inserted.
    • afterCycle

      default void afterCycle(boolean lastCycle)
      Called by RecipeScheduler at the conclusion of a scan/generate/edit cycle.
    • getChangeset

      Changeset getChangeset()
      Returns:
      The set of changes (encompassing adds, edits, and deletions) to the initial state.
    • getBefore

      @Nullable SourceFile getBefore(Path sourcePath)
      Get the original source file, before any edits. Returns null if it is not present.
      Parameters:
      sourcePath - The path of the source file to retrieve.
      Returns:
      The original source file. Null if not present.