Documentation / Phase, Localization

Phase

(com.betterdiff.api.Phase)

A phase is homogeneous, separable, and programmatically distinct part of a BetterDiff process. General BetterDiff process consists of unlimited number of phases in unrestricted order. However, the API also defines a Core BetterDiff process.

Core BetterDiff process is a cycle of specific phases in specific order. These phases are called core phases and the cycle is called core algorithm.

The core algorithm defines following core phases in following order:

  • Collecting Evidence
  • Preparation (of Evidence)
  • (Chunk) Pairing
  • (Chunk) Alignment
  • (Mutation) Identification

Each of the core phase has its own API defined, as well as a PhaseProcessor.

Localization

Each phase (including non-core phases) must define whether it supports localization.

Localization is a special part that takes place after a BetterDiff process, in case the client wants to repeat the whole process again on a detail of the processed result.

For example, a BetterDiff process is used to compare 2 files with 10 lines each. All phases are executed and processed and a result is provided. However, the client wants to run the BetterDiff process on lines 2-5 again, but not on the original files, but on the result from the first iteration. In such a case, localization takes place before the second iteration is processed.

During the localization, the detail is specified and provided in a Protocol via Local and Row instructions, and the phases themselves may also provide different Protocol, when they are processed after the localization.

The localization itself, including Protocol changes, however, is not part of the phase and the behavior of the phase must not be dependent on such knowledge or settings.