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 |
|
|
24 |
|
|
25 |
|
|
26 |
|
@author |
27 |
|
@version |
28 |
|
|
|
|
| 53.3% |
Uncovered Elements: 35 (75) |
Complexity: 30 |
Complexity Density: 0.71 |
|
29 |
|
public class BinaryNode |
30 |
|
{ |
31 |
|
Object element; |
32 |
|
|
33 |
|
String name; |
34 |
|
|
35 |
|
BinaryNode left; |
36 |
|
|
37 |
|
BinaryNode right; |
38 |
|
|
39 |
|
BinaryNode parent; |
40 |
|
|
41 |
|
|
42 |
|
public int bootstrap; |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
47 |
18 |
public BinaryNode()... |
48 |
|
{ |
49 |
18 |
left = right = parent = null; |
50 |
18 |
bootstrap = 0; |
51 |
|
} |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
@param |
57 |
|
|
58 |
|
@param |
59 |
|
|
60 |
|
@param |
61 |
|
|
62 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
63 |
298 |
public BinaryNode(Object element, BinaryNode parent, String name)... |
64 |
|
{ |
65 |
298 |
this.element = element; |
66 |
298 |
this.parent = parent; |
67 |
298 |
this.name = name; |
68 |
|
|
69 |
298 |
left = right = null; |
70 |
|
} |
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
@return |
76 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
77 |
10922 |
public Object element()... |
78 |
|
{ |
79 |
10922 |
return element; |
80 |
|
} |
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
@param |
86 |
|
|
87 |
|
|
88 |
|
@return |
89 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
90 |
158 |
public Object setElement(Object v)... |
91 |
|
{ |
92 |
158 |
return element = v; |
93 |
|
} |
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
@return |
99 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
100 |
19268 |
public BinaryNode left()... |
101 |
|
{ |
102 |
19268 |
return left; |
103 |
|
} |
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
@param |
109 |
|
|
110 |
|
|
111 |
|
@return |
112 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
113 |
140 |
public BinaryNode setLeft(BinaryNode n)... |
114 |
|
{ |
115 |
140 |
return left = n; |
116 |
|
} |
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
|
121 |
|
@return |
122 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
123 |
15338 |
public BinaryNode right()... |
124 |
|
{ |
125 |
15338 |
return right; |
126 |
|
} |
127 |
|
|
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
@param |
132 |
|
|
133 |
|
|
134 |
|
@return |
135 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
136 |
158 |
public BinaryNode setRight(BinaryNode n)... |
137 |
|
{ |
138 |
158 |
return right = n; |
139 |
|
} |
140 |
|
|
141 |
|
|
142 |
|
|
143 |
|
|
144 |
|
@return |
145 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
146 |
1208 |
public BinaryNode parent()... |
147 |
|
{ |
148 |
1208 |
return parent; |
149 |
|
} |
150 |
|
|
151 |
|
|
152 |
|
|
153 |
|
|
154 |
|
@param |
155 |
|
|
156 |
|
|
157 |
|
@return |
158 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
159 |
0 |
public BinaryNode setParent(BinaryNode n)... |
160 |
|
{ |
161 |
0 |
return parent = n; |
162 |
|
} |
163 |
|
|
164 |
|
|
165 |
|
|
166 |
|
|
167 |
|
@return |
168 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
169 |
73 |
public boolean isLeaf()... |
170 |
|
{ |
171 |
73 |
return (left == null) && (right == null); |
172 |
|
} |
173 |
|
|
174 |
|
|
175 |
|
|
176 |
|
|
177 |
|
|
178 |
|
|
179 |
|
|
180 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
181 |
0 |
public void SetChildren(BinaryNode leftchild, BinaryNode rightchild)... |
182 |
|
{ |
183 |
0 |
if (leftchild != null) |
184 |
|
{ |
185 |
0 |
this.setLeft(leftchild); |
186 |
0 |
leftchild.detach(); |
187 |
0 |
leftchild.setParent(this); |
188 |
|
} |
189 |
|
|
190 |
0 |
if (rightchild != null) |
191 |
|
{ |
192 |
0 |
this.setRight(rightchild); |
193 |
0 |
rightchild.detach(); |
194 |
0 |
rightchild.setParent(this); |
195 |
|
} |
196 |
|
} |
197 |
|
|
198 |
|
|
199 |
|
|
200 |
|
|
201 |
|
@return |
202 |
|
|
|
|
| 69.2% |
Uncovered Elements: 4 (13) |
Complexity: 4 |
Complexity Density: 0.57 |
|
203 |
18 |
public BinaryNode detach()... |
204 |
|
{ |
205 |
18 |
if (this.parent != null) |
206 |
|
{ |
207 |
18 |
if (this.parent.left == this) |
208 |
|
{ |
209 |
0 |
this.parent.left = null; |
210 |
|
} |
211 |
|
else |
212 |
|
{ |
213 |
18 |
if (this.parent.right == this) |
214 |
|
{ |
215 |
18 |
this.parent.right = null; |
216 |
|
} |
217 |
|
} |
218 |
|
} |
219 |
|
|
220 |
18 |
this.parent = null; |
221 |
|
|
222 |
18 |
return this; |
223 |
|
} |
224 |
|
|
225 |
|
|
226 |
|
|
227 |
|
|
228 |
|
|
229 |
|
@return |
230 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 4 |
Complexity Density: 1 |
|
231 |
0 |
public BinaryNode ascendLeft()... |
232 |
|
{ |
233 |
0 |
BinaryNode c = this; |
234 |
|
|
235 |
0 |
do |
236 |
|
{ |
237 |
0 |
c = c.parent(); |
238 |
0 |
} while ((c != null) && (c.left() != null) && !c.left().isLeaf()); |
239 |
|
|
240 |
0 |
return c; |
241 |
|
} |
242 |
|
|
243 |
|
|
244 |
|
|
245 |
|
|
246 |
|
|
247 |
|
|
248 |
|
@return |
249 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 4 |
Complexity Density: 1 |
|
250 |
0 |
public BinaryNode ascendRight()... |
251 |
|
{ |
252 |
0 |
BinaryNode c = this; |
253 |
|
|
254 |
0 |
do |
255 |
|
{ |
256 |
0 |
c = c.parent(); |
257 |
0 |
} while ((c != null) && (c.right() != null) && !c.right().isLeaf()); |
258 |
|
|
259 |
0 |
return c; |
260 |
|
} |
261 |
|
|
262 |
|
|
263 |
|
|
264 |
|
|
265 |
|
|
266 |
|
@param |
267 |
|
|
268 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
269 |
140 |
public void setName(String name)... |
270 |
|
{ |
271 |
140 |
this.name = name; |
272 |
|
} |
273 |
|
|
274 |
|
|
275 |
|
|
276 |
|
|
277 |
|
@return |
278 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
279 |
3848 |
public String getName()... |
280 |
|
{ |
281 |
3848 |
return this.name; |
282 |
|
} |
283 |
|
|
284 |
|
|
285 |
|
|
286 |
|
|
287 |
|
@param |
288 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
289 |
140 |
public void setBootstrap(int boot)... |
290 |
|
{ |
291 |
140 |
this.bootstrap = boot; |
292 |
|
} |
293 |
|
|
294 |
|
|
295 |
|
|
296 |
|
|
297 |
|
@return |
298 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
299 |
0 |
public int getBootstrap()... |
300 |
|
{ |
301 |
0 |
return bootstrap; |
302 |
|
} |
303 |
|
} |