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.awt.Color; |
24 |
|
|
25 |
|
import jalview.renderer.ContactGeometry.contactInterval; |
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
@author |
31 |
|
|
32 |
|
|
|
|
| 83.1% |
Uncovered Elements: 10 (59) |
Complexity: 17 |
Complexity Density: 0.49 |
|
33 |
|
public class ContactListImpl implements ContactListI |
34 |
|
{ |
35 |
|
ContactListProviderI clist; |
36 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
37 |
0 |
public static ContactListI newContactList(ContactListProviderI list)... |
38 |
|
{ |
39 |
0 |
return new ContactListImpl(list); |
40 |
|
} |
41 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
42 |
7696 |
public ContactListImpl(ContactListProviderI list)... |
43 |
|
{ |
44 |
7696 |
clist = list; |
45 |
|
} |
46 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
47 |
0 |
@Override... |
48 |
|
public int getPosition() |
49 |
|
{ |
50 |
0 |
return clist.getPosition(); |
51 |
|
} |
52 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
53 |
4670565 |
@Override... |
54 |
|
public double getContactAt(int column) |
55 |
|
{ |
56 |
4670565 |
return clist.getContactAt(column); |
57 |
|
} |
58 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
59 |
4294101 |
@Override... |
60 |
|
public int getContactHeight() |
61 |
|
{ |
62 |
4294101 |
return clist.getContactHeight(); |
63 |
|
} |
64 |
|
|
|
|
| 86.4% |
Uncovered Elements: 6 (44) |
Complexity: 10 |
Complexity Density: 0.36 |
|
65 |
146520 |
@Override... |
66 |
|
public ContactRange getRangeFor(int from_column, int to_column) |
67 |
|
{ |
68 |
|
|
69 |
146520 |
if (clist instanceof ContactListI) |
70 |
|
{ |
71 |
|
|
72 |
0 |
return ((ContactListI) clist).getRangeFor(from_column, to_column); |
73 |
|
} |
74 |
146520 |
if (from_column < 0) |
75 |
|
{ |
76 |
0 |
from_column = 0; |
77 |
|
} |
78 |
146520 |
if (to_column >= getContactHeight()) |
79 |
|
{ |
80 |
0 |
to_column = getContactHeight() - 1; |
81 |
|
} |
82 |
146520 |
ContactRange cr = new ContactRange(); |
83 |
146520 |
cr.setFrom_column(from_column); |
84 |
146520 |
cr.setTo_column(to_column); |
85 |
146520 |
double tot = 0; |
86 |
606257 |
for (int i = from_column; i <= to_column; i++) |
87 |
|
{ |
88 |
459740 |
double contact = getContactAt(i); |
89 |
459741 |
tot += contact; |
90 |
459746 |
if (i == from_column) |
91 |
|
{ |
92 |
146520 |
cr.setMin(contact); |
93 |
146520 |
cr.setMax(contact); |
94 |
146520 |
cr.setMinPos(i); |
95 |
146520 |
cr.setMaxPos(i); |
96 |
|
} |
97 |
|
else |
98 |
|
{ |
99 |
313227 |
if (cr.getMax() < contact) |
100 |
|
{ |
101 |
72871 |
cr.setMax(contact); |
102 |
72871 |
cr.setMaxPos(i); |
103 |
|
} |
104 |
313227 |
if (cr.getMin() < contact) |
105 |
|
{ |
106 |
72871 |
cr.setMin(contact); |
107 |
72871 |
cr.setMinPos(i); |
108 |
|
} |
109 |
|
} |
110 |
|
} |
111 |
146518 |
if (tot > 0 && to_column > from_column) |
112 |
|
{ |
113 |
126507 |
cr.setMean(tot / (1 + to_column - from_column)); |
114 |
|
} |
115 |
|
else |
116 |
|
{ |
117 |
20011 |
cr.setMean(tot); |
118 |
|
} |
119 |
146518 |
return cr; |
120 |
|
} |
121 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
122 |
146474 |
@Override... |
123 |
|
public int[] getMappedPositionsFor(int cStart, int cEnd) |
124 |
|
{ |
125 |
146474 |
return clist.getMappedPositionsFor(cStart, cEnd); |
126 |
|
} |
127 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
128 |
3661 |
@Override... |
129 |
|
public Color getColourForGroup() |
130 |
|
{ |
131 |
3661 |
return clist.getColourForGroup(); |
132 |
|
} |
133 |
|
} |