|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.collections4.sequence.ReplacementsFinder<T>
public class ReplacementsFinder<T>
This class handles sequences of replacements resulting from a comparison.
The comparison of two objects sequences leads to the identification of common
parts and parts which only belong to the first or to the second sequence. The
common parts appear in the edit script in the form of keep commands,
they can be considered as synchronization objects between the two sequences.
These synchronization objects split the two sequences in synchronized
sub-sequences. The first sequence can be transformed into the second one by
replacing each synchronized sub-sequence of the first sequence by the
corresponding sub-sequence of the second sequence. This is a synthetic way to
see an edit script
, replacing individual
delete
, keep
and
insert
commands by fewer replacements acting on
complete sub-sequences.
This class is devoted to perform this interpretation. It visits an
edit script
(because it implements the
CommandVisitor
interface) and calls a user-supplied
handler implementing the ReplacementsHandler
interface to process the sub-sequences.
ReplacementsHandler
,
EditScript
,
SequencesComparator
Constructor Summary | |
---|---|
ReplacementsFinder(ReplacementsHandler<T> handler)
Simple constructor. |
Method Summary | |
---|---|
void |
visitDeleteCommand(T object)
Add an object to the pending deletions set. |
void |
visitInsertCommand(T object)
Add an object to the pending insertions set. |
void |
visitKeepCommand(T object)
Handle a synchronization object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ReplacementsFinder(ReplacementsHandler<T> handler)
ReplacementsFinder
.
handler
- handler to call when synchronized sequences are foundMethod Detail |
---|
public void visitInsertCommand(T object)
visitInsertCommand
in interface CommandVisitor<T>
object
- object to insertpublic void visitKeepCommand(T object)
When a synchronization object is identified, the pending insertions and pending deletions sets are provided to the user handler as subsequences.
visitKeepCommand
in interface CommandVisitor<T>
object
- synchronization object detectedpublic void visitDeleteCommand(T object)
visitDeleteCommand
in interface CommandVisitor<T>
object
- object to delete
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |