1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.diff.internal; |
21 |
|
|
22 |
|
import java.util.List; |
23 |
|
|
24 |
|
import org.xwiki.diff.Chunk; |
25 |
|
import org.xwiki.diff.PatchException; |
26 |
|
|
27 |
|
|
28 |
|
@link |
29 |
|
|
30 |
|
@param |
31 |
|
@version |
32 |
|
|
|
|
| 19% |
Uncovered Elements: 17 (21) |
Complexity: 7 |
Complexity Density: 0.58 |
|
33 |
|
public class DeleteDelta<E> extends AbstractDelta<E> |
34 |
|
{ |
35 |
|
|
36 |
|
@param |
37 |
|
@param |
38 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
39 |
7 |
public DeleteDelta(Chunk<E> previous, Chunk<E> next)... |
40 |
|
{ |
41 |
7 |
super(previous, next, Type.DELETE); |
42 |
|
} |
43 |
|
|
44 |
|
|
45 |
|
@param |
46 |
|
@param |
47 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
48 |
13 |
public DeleteDelta(difflib.Chunk<E> original, difflib.Chunk<E> revised)... |
49 |
|
{ |
50 |
13 |
super(original, revised, Type.DELETE); |
51 |
|
} |
52 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
53 |
0 |
@Override... |
54 |
|
public void apply(List<E> target) throws PatchException |
55 |
|
{ |
56 |
0 |
verify(target); |
57 |
|
|
58 |
0 |
int index = getPrevious().getIndex(); |
59 |
0 |
int size = getPrevious().size(); |
60 |
0 |
for (int i = 0; i < size; i++) { |
61 |
0 |
target.remove(index); |
62 |
|
} |
63 |
|
} |
64 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
65 |
0 |
@Override... |
66 |
|
public void restore(List<E> target) |
67 |
|
{ |
68 |
0 |
int index = getNext().getIndex(); |
69 |
0 |
List<E> elements = getPrevious().getElements(); |
70 |
0 |
for (int i = 0; i < elements.size(); i++) { |
71 |
0 |
target.add(index + i, elements.get(i)); |
72 |
|
} |
73 |
|
} |
74 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
75 |
0 |
@Override... |
76 |
|
public void verify(List<E> target) throws PatchException |
77 |
|
{ |
78 |
0 |
getPrevious().verify(target); |
79 |
|
} |
80 |
|
} |