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 Summary
Modifier and Type Method Description void
addText(java.lang.String text)
Adds a new text to the list for comparison.java.util.List<Chunk>
getChunks()
Return a copy of identified chunks.java.lang.String
getChunkText(Chunk chunk)
Return a part of text covered by given chunk.int
getNextChunkId(int ordinalNumber)
Returns the next chunk Axis Y for given ordinal Number.PartialProtocol
getProtocol()
Returns a sequence of commands for preparation phase.PartialProtocol
process()
Process all texts.PartialProtocol
processIndependently()
Process all texts independently.PartialProtocol
processSimultaneously()
Process all texts as a batch.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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
Return a copy of identified chunks.- Specified by:
getChunks
in interfacePreparationPhase
- Returns:
- Hard copy of identified chunks.
-
getChunkText
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 interfacePreparationPhase
- 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
Process all texts.- Specified by:
process
in interfacePreparationPhase
- Returns:
-
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
Process all texts as a batch. It's up on the implementation how this will be processed further.- Returns:
-
getProtocol
Returns a sequence of commands for preparation phase.- Specified by:
getProtocol
in interfacePreparationPhase
- Returns:
-