1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.diff.display; |
21 |
|
|
22 |
|
import java.util.List; |
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
@param |
28 |
|
@version |
29 |
|
@since |
30 |
|
|
|
|
| 77.8% |
Uncovered Elements: 4 (18) |
Complexity: 7 |
Complexity Density: 0.64 |
|
31 |
|
public class InlineDiffChunk<E> |
32 |
|
{ |
33 |
|
|
34 |
|
|
35 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 0 |
Complexity Density: - |
|
36 |
|
public enum Type |
37 |
|
{ |
38 |
|
|
39 |
|
ADDED, |
40 |
|
|
41 |
|
|
42 |
|
DELETED, |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
UNMODIFIED; |
49 |
|
} |
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
private final Type type; |
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
private final List<E> elements; |
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
@param |
65 |
|
@param |
66 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
67 |
85 |
public InlineDiffChunk(Type type, List<E> elements)... |
68 |
|
{ |
69 |
85 |
this.type = type; |
70 |
85 |
this.elements = elements; |
71 |
|
} |
72 |
|
|
73 |
|
|
74 |
|
@return |
75 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
76 |
53 |
public Type getType()... |
77 |
|
{ |
78 |
53 |
return this.type; |
79 |
|
} |
80 |
|
|
81 |
|
|
82 |
|
@return |
83 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
84 |
0 |
public List<E> getElements()... |
85 |
|
{ |
86 |
0 |
return this.elements; |
87 |
|
} |
88 |
|
|
89 |
|
|
90 |
|
@return |
91 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
92 |
111 |
public boolean isAdded()... |
93 |
|
{ |
94 |
111 |
return this.type == Type.ADDED; |
95 |
|
} |
96 |
|
|
97 |
|
|
98 |
|
@return |
99 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
100 |
96 |
public boolean isDeleted()... |
101 |
|
{ |
102 |
96 |
return this.type == Type.DELETED; |
103 |
|
} |
104 |
|
|
105 |
|
|
106 |
|
@return |
107 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
108 |
0 |
public boolean isUnmodified()... |
109 |
|
{ |
110 |
0 |
return this.type == Type.UNMODIFIED; |
111 |
|
} |
112 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
113 |
167 |
@Override... |
114 |
|
public String toString() |
115 |
|
{ |
116 |
167 |
StringBuilder stringBuilder = new StringBuilder(this.elements.size()); |
117 |
167 |
for (E element : this.elements) { |
118 |
579 |
stringBuilder.append(element); |
119 |
|
} |
120 |
167 |
return stringBuilder.toString(); |
121 |
|
} |
122 |
|
} |