1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.datamodel; |
22 |
|
|
23 |
|
import java.util.ArrayList; |
24 |
|
import java.util.Arrays; |
25 |
|
import java.util.List; |
26 |
|
|
|
|
| 4.2% |
Uncovered Elements: 91 (95) |
Complexity: 34 |
Complexity Density: 0.68 |
|
27 |
|
public class AlignmentOrder |
28 |
|
{ |
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
public static final int FILE = 0; |
45 |
|
|
46 |
|
|
47 |
|
public static final int MSA = 1; |
48 |
|
|
49 |
|
|
50 |
|
public static final int USER = 2; |
51 |
|
|
52 |
|
private int Type = 0; |
53 |
|
|
54 |
|
private String Name; |
55 |
|
|
56 |
|
private List<SequenceI> Order = null; |
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
61 |
0 |
public AlignmentOrder()... |
62 |
|
{ |
63 |
|
} |
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
@param |
69 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
70 |
0 |
public AlignmentOrder(List<SequenceI> anOrder)... |
71 |
|
{ |
72 |
0 |
Order = anOrder; |
73 |
|
} |
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
@param |
79 |
|
|
80 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
81 |
3 |
public AlignmentOrder(AlignmentI orderFrom)... |
82 |
|
{ |
83 |
3 |
Order = new ArrayList<SequenceI>(); |
84 |
|
|
85 |
3 |
for (SequenceI seq : orderFrom.getSequences()) |
86 |
|
{ |
87 |
99 |
Order.add(seq); |
88 |
|
} |
89 |
|
} |
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
@param |
95 |
|
|
96 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
97 |
0 |
public AlignmentOrder(SequenceI[] orderFrom)... |
98 |
|
{ |
99 |
0 |
Order = new ArrayList<SequenceI>(Arrays.asList(orderFrom)); |
100 |
|
} |
101 |
|
|
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
@param |
106 |
|
|
107 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
108 |
0 |
public void setType(int Type)... |
109 |
|
{ |
110 |
0 |
this.Type = Type; |
111 |
|
} |
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
@return |
117 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
118 |
0 |
public int getType()... |
119 |
|
{ |
120 |
0 |
return Type; |
121 |
|
} |
122 |
|
|
123 |
|
|
124 |
|
|
125 |
|
|
126 |
|
@param |
127 |
|
|
128 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
129 |
0 |
public void setName(String Name)... |
130 |
|
{ |
131 |
0 |
this.Name = Name; |
132 |
|
} |
133 |
|
|
134 |
|
|
135 |
|
|
136 |
|
|
137 |
|
@return |
138 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
139 |
0 |
public String getName()... |
140 |
|
{ |
141 |
0 |
return Name; |
142 |
|
} |
143 |
|
|
144 |
|
|
145 |
|
|
146 |
|
|
147 |
|
@param |
148 |
|
|
149 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
150 |
0 |
public void setOrder(List<SequenceI> Order)... |
151 |
|
{ |
152 |
0 |
this.Order = Order; |
153 |
|
} |
154 |
|
|
155 |
|
|
156 |
|
|
157 |
|
|
158 |
|
@return |
159 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
160 |
0 |
public List<SequenceI> getOrder()... |
161 |
|
{ |
162 |
0 |
return Order; |
163 |
|
} |
164 |
|
|
165 |
|
|
166 |
|
|
167 |
|
|
168 |
|
@param |
169 |
|
@param |
170 |
|
@return |
171 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
172 |
0 |
public boolean updateSequence(SequenceI oldref, SequenceI newref)... |
173 |
|
{ |
174 |
0 |
int found = Order.indexOf(oldref); |
175 |
0 |
if (found > -1) |
176 |
|
{ |
177 |
0 |
Order.set(found, newref); |
178 |
|
} |
179 |
0 |
return found > -1; |
180 |
|
} |
181 |
|
|
182 |
|
|
183 |
|
|
184 |
|
|
185 |
|
@param |
186 |
|
@return |
187 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
188 |
0 |
@Override... |
189 |
|
public boolean equals(Object o) |
190 |
|
{ |
191 |
0 |
if (o == null || !(o instanceof AlignmentOrder)) |
192 |
|
{ |
193 |
0 |
return false; |
194 |
|
} |
195 |
0 |
return equals((AlignmentOrder) o, true); |
196 |
|
} |
197 |
|
|
198 |
|
|
199 |
|
|
200 |
|
|
201 |
|
|
202 |
|
@param |
203 |
|
@param |
204 |
|
|
205 |
|
|
206 |
|
@return |
207 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 9 |
Complexity Density: 0.82 |
|
208 |
0 |
public boolean equals(AlignmentOrder o, boolean identity)... |
209 |
|
{ |
210 |
0 |
if (o != this) |
211 |
|
{ |
212 |
0 |
if (o == null) |
213 |
|
{ |
214 |
0 |
return false; |
215 |
|
} |
216 |
0 |
if (Order != null && o.Order != null |
217 |
|
&& Order.size() == o.Order.size()) |
218 |
|
{ |
219 |
0 |
if (!identity) |
220 |
|
{ |
221 |
0 |
throw new Error( |
222 |
|
"Weak sequenceI equivalence not yet implemented."); |
223 |
|
} |
224 |
|
else |
225 |
|
{ |
226 |
0 |
for (int i = 0, j = o.Order.size(); i < j; i++) |
227 |
|
{ |
228 |
0 |
if (Order.get(i) != o.Order.get(i)) |
229 |
|
{ |
230 |
0 |
return false; |
231 |
|
} |
232 |
|
} |
233 |
|
} |
234 |
|
} |
235 |
|
else |
236 |
|
{ |
237 |
0 |
return false; |
238 |
|
} |
239 |
|
} |
240 |
0 |
return true; |
241 |
|
} |
242 |
|
|
243 |
|
|
244 |
|
|
245 |
|
|
246 |
|
@param |
247 |
|
@return |
248 |
|
|
249 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
250 |
0 |
public boolean isConsistent(AlignmentOrder o)... |
251 |
|
{ |
252 |
0 |
return isConsistent(o, true); |
253 |
|
} |
254 |
|
|
255 |
|
|
256 |
|
|
257 |
|
|
258 |
|
@param |
259 |
|
|
260 |
|
@param |
261 |
|
|
262 |
|
|
263 |
|
@return |
264 |
|
|
265 |
|
|
|
|
| 0% |
Uncovered Elements: 34 (34) |
Complexity: 9 |
Complexity Density: 0.45 |
|
266 |
0 |
public boolean isConsistent(AlignmentOrder o, boolean identity)... |
267 |
|
{ |
268 |
0 |
if (o != this) |
269 |
|
{ |
270 |
0 |
if (o == null) |
271 |
|
{ |
272 |
0 |
return false; |
273 |
|
} |
274 |
0 |
if (Order != null && o.Order != null) |
275 |
|
{ |
276 |
0 |
List<SequenceI> c, s; |
277 |
0 |
if (o.Order.size() > Order.size()) |
278 |
|
{ |
279 |
0 |
c = o.Order; |
280 |
0 |
s = Order; |
281 |
|
} |
282 |
|
else |
283 |
|
{ |
284 |
0 |
c = Order; |
285 |
0 |
s = o.Order; |
286 |
|
} |
287 |
0 |
if (!identity) |
288 |
|
{ |
289 |
0 |
throw new Error( |
290 |
|
"Weak sequenceI equivalence not yet implemented."); |
291 |
|
} |
292 |
|
else |
293 |
|
{ |
294 |
|
|
295 |
0 |
int last = -1; |
296 |
0 |
for (int i = 0, j = s.size(); i < j; i++) |
297 |
|
{ |
298 |
0 |
int pos = c.indexOf(s.get(i)); |
299 |
|
|
300 |
0 |
if (pos > last) |
301 |
|
{ |
302 |
0 |
last = pos; |
303 |
|
} |
304 |
|
else |
305 |
|
{ |
306 |
0 |
return false; |
307 |
|
} |
308 |
|
} |
309 |
|
} |
310 |
|
} |
311 |
|
else |
312 |
|
{ |
313 |
0 |
return false; |
314 |
|
} |
315 |
|
} |
316 |
0 |
return true; |
317 |
|
} |
318 |
|
|
319 |
|
|
320 |
|
|
321 |
|
@param |
322 |
|
|
323 |
|
@param |
324 |
|
|
325 |
|
|
326 |
|
|
327 |
|
|
328 |
|
|
329 |
|
|
330 |
|
|
331 |
|
|
332 |
|
} |