T
- object typepublic class EditScript<T> extends Object
commands
needed 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 StringsComparator
class. The user can
walk through it using the visitor design pattern.
It is guaranteed that the objects embedded in the insert
commands
come from the second sequence and that the objects embedded in
either the delete commands
or keep
commands
come from the first sequence. This can be important if subclassing
is used for some elements in the first sequence and the equals
method is specialized.
StringsComparator
,
EditCommand
,
CommandVisitor
,
ReplacementsHandler
Constructor and Description |
---|
EditScript()
Simple constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
append(DeleteCommand<T> command)
Add a delete command to the script.
|
void |
append(InsertCommand<T> command)
Add an insert command to the script.
|
void |
append(KeepCommand<T> command)
Add a keep command to the script.
|
int |
getLCSLength()
Get the length of the Longest Common Subsequence (LCS).
|
int |
getModifications()
Get the number of effective modifications.
|
void |
visit(CommandVisitor<T> visitor)
Visit the script.
|
public EditScript()
public void append(KeepCommand<T> command)
command
- command to addpublic void append(InsertCommand<T> command)
command
- command to addpublic void append(DeleteCommand<T> command)
command
- command to addpublic void visit(CommandVisitor<T> visitor)
visitor
- the visitor that will visit all commands in turnpublic int getLCSLength()
keep
commands
in the script.public int getModifications()
delete
and
insert
commands in the script.Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.