1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.structure; |
22 |
|
|
23 |
|
import java.util.ArrayList; |
24 |
|
import java.util.BitSet; |
25 |
|
import java.util.List; |
26 |
|
import java.util.Map; |
27 |
|
import java.util.TreeMap; |
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
|
|
| 88.1% |
Uncovered Elements: 5 (42) |
Complexity: 12 |
Complexity Density: 0.5 |
|
33 |
|
public class AtomSpecModel |
34 |
|
{ |
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
private Map<String, Map<String, BitSet>> atomSpec; |
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
43 |
54 |
public AtomSpecModel()... |
44 |
|
{ |
45 |
54 |
atomSpec = new TreeMap<>(); |
46 |
|
} |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
@param |
52 |
|
@param |
53 |
|
@param |
54 |
|
@param |
55 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
56 |
770 |
public void addRange(String model, int startPos, int endPos, String chain)... |
57 |
|
{ |
58 |
|
|
59 |
|
|
60 |
|
|
61 |
770 |
Map<String, BitSet> modelData = atomSpec.get(model); |
62 |
770 |
if (modelData == null) |
63 |
|
{ |
64 |
83 |
atomSpec.put(model, modelData = new TreeMap<>()); |
65 |
|
} |
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
770 |
BitSet chainData = modelData.get(chain); |
71 |
770 |
if (chainData == null) |
72 |
|
{ |
73 |
116 |
chainData = new BitSet(); |
74 |
116 |
modelData.put(chain, chainData); |
75 |
|
} |
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
770 |
chainData.set(startPos, endPos + 1); |
81 |
|
} |
82 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
83 |
149 |
public Iterable<String> getModels()... |
84 |
|
{ |
85 |
149 |
return atomSpec.keySet(); |
86 |
|
} |
87 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
88 |
0 |
public int getModelCount()... |
89 |
|
{ |
90 |
0 |
return atomSpec.size(); |
91 |
|
} |
92 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
93 |
205 |
public Iterable<String> getChains(String model)... |
94 |
|
{ |
95 |
205 |
return atomSpec.containsKey(model) ? atomSpec.get(model).keySet() |
96 |
|
: null; |
97 |
|
} |
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
@param |
104 |
|
@param |
105 |
|
@return |
106 |
|
|
|
|
| 88.9% |
Uncovered Elements: 2 (18) |
Complexity: 4 |
Complexity Density: 0.33 |
|
107 |
326 |
public List<int[]> getRanges(String model, String chain)... |
108 |
|
{ |
109 |
326 |
List<int[]> ranges = new ArrayList<>(); |
110 |
326 |
if (atomSpec.containsKey(model)) |
111 |
|
{ |
112 |
326 |
BitSet bs = atomSpec.get(model).get(chain); |
113 |
326 |
int start = 0; |
114 |
326 |
if (bs != null) |
115 |
|
{ |
116 |
326 |
start = bs.nextSetBit(start); |
117 |
326 |
int end = 0; |
118 |
742 |
while (start != -1) |
119 |
|
{ |
120 |
416 |
end = bs.nextClearBit(start); |
121 |
416 |
ranges.add(new int[] { start, end - 1 }); |
122 |
416 |
start = bs.nextSetBit(end); |
123 |
|
} |
124 |
|
} |
125 |
|
} |
126 |
326 |
return ranges; |
127 |
|
} |
128 |
|
} |