Class EditScript<T>
- java.lang.Object
 - 
- org.apache.commons.collections4.sequence.EditScript<T>
 
 
- 
public class EditScript<T> extends java.lang.ObjectThis class gathers all thecommandsneeded to transform one objects sequence into another objects sequence.An edit script is the most general view of the differences between two sequences. It is built as the result of the comparison between two sequences by the
SequencesComparatorclass. The user can walk through it using the visitor design pattern.It is guaranteed that the objects embedded in the
insert commandscome from the second sequence and that the objects embedded in either thedelete commandsorkeep commandscome from the first sequence. This can be important if subclassing is used for some elements in the first sequence and theequalsmethod is specialized.- Since:
 - 4.0
 - See Also:
 SequencesComparator,EditCommand,CommandVisitor,ReplacementsHandler
 
- 
- 
Constructor Summary
Constructors Constructor Description EditScript()Simple constructor. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappend(DeleteCommand<T> command)Add a delete command to the script.voidappend(InsertCommand<T> command)Add an insert command to the script.voidappend(KeepCommand<T> command)Add a keep command to the script.intgetLCSLength()Get the length of the Longest Common Subsequence (LCS).intgetModifications()Get the number of effective modifications.voidvisit(CommandVisitor<T> visitor)Visit the script. 
 - 
 
- 
- 
Method Detail
- 
append
public void append(KeepCommand<T> command)
Add a keep command to the script.- Parameters:
 command- command to add
 
- 
append
public void append(InsertCommand<T> command)
Add an insert command to the script.- Parameters:
 command- command to add
 
- 
append
public void append(DeleteCommand<T> command)
Add a delete command to the script.- Parameters:
 command- command to add
 
- 
visit
public void visit(CommandVisitor<T> visitor)
Visit the script. The script implements the visitor design pattern, this method is the entry point to which the user supplies its own visitor, the script will be responsible to drive it through the commands in order and call the appropriate method as each command is encountered.- Parameters:
 visitor- the visitor that will visit all commands in turn
 
- 
getLCSLength
public int getLCSLength()
Get the length of the Longest Common Subsequence (LCS). The length of the longest common subsequence is the number ofkeep commandsin the script.- Returns:
 - length of the Longest Common Subsequence
 
 
 - 
 
 -