Class Preparation

java.lang.Object
com.betterdiff.core.preparation.Preparation
All Implemented Interfaces:
PreparationPhase

public abstract class Preparation
extends java.lang.Object
implements PreparationPhase
Preparation phase is a phase where chunks should be identified. The exact method of identification is not defined and is given to the implementation detail.
Author:
troomar
  • Method Details

    • addText

      public final void addText​(java.lang.String text)
      Adds a new text to the list for comparison. There is no limit of how many texts are allowed, but too many of them can lead to a slow comparison or can be restricted in the implementation.
      Parameters:
      text -
    • getChunks

      public final java.util.List<Chunk> getChunks()
      Return a copy of identified chunks.
      Specified by:
      getChunks in interface PreparationPhase
      Returns:
      Hard copy of identified chunks.
    • getChunkText

      public final java.lang.String getChunkText​(Chunk chunk)
      Return a part of text covered by given chunk. If the chunk indexes are incorrect or ordinal number doesn't match avalable texts, empty string is returned.
      Specified by:
      getChunkText in interface PreparationPhase
      Parameters:
      chunk - Chunk to read the text from
      Returns:
      part of text covered by given chunk
    • getNextChunkId

      public final int getNextChunkId​(int ordinalNumber)
      Returns the next chunk Axis Y for given ordinal Number. It doesn't increase the number internally.
      Parameters:
      ordinalNumber - Ordinal number of text the chunk should belong to.
      Returns:
      next Axis Y number for given ordinal number.
    • process

      public final PartialProtocol process()
      Process all texts.
      Specified by:
      process in interface PreparationPhase
      Returns:
    • processIndependently

      public final PartialProtocol processIndependently()
      Process all texts independently. It means that during the process of identification of chunks the texts shouldn't require a comparison between each other.
      Returns:
    • processSimultaneously

      public final PartialProtocol processSimultaneously()
      Process all texts as a batch. It's up on the implementation how this will be processed further.
      Returns:
    • getProtocol

      public final PartialProtocol getProtocol()
      Returns a sequence of commands for preparation phase.
      Specified by:
      getProtocol in interface PreparationPhase
      Returns: