Operations¶
The delta between sequences of tokens is represented by a sequence of
Operation. The goal of difference algorithms is to
detect a sequence of Operation that has desirable
properties. apply() can be used with a sequence of
Operation to convert an initial sequence of tokens
into a changed sequence of tokens.
Specifically, this library understands and produces three types of operations:
Delete– some tokens were deletedInsert– some tokens were insertedEqual– some tokens were copied
-
class
deltas.Delete¶ Represents the deletion of tokens.
Parameters: - a1 : int
Start position in first sequence.
- a2 : int
End position in first sequence.
- b1 : int
Start position in second sequence.
- b2 : int
End position in second sequence.
-
class
deltas.Insert¶ Represents the insertions of tokens.
Parameters: - a1 : int
Start position in first sequence.
- a2 : int
End position in first sequence.
- b1 : int
Start position in second sequence.
- b2 : int
End position in second sequence.
-
class
deltas.Equal¶ Represents the equality of tokens between sequences.
Parameters: - a1 : int
Start position in first sequence.
- a2 : int
End position in first sequence.
- b1 : int
Start position in second sequence.
- b2 : int
End position in second sequence.
-
class
deltas.Operation(name, a1, a2, b1, b2)¶