| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
package jalview.analysis; |
| 22 |
|
|
| 23 |
|
import jalview.datamodel.AlignmentAnnotation; |
| 24 |
|
import jalview.datamodel.AlignmentView; |
| 25 |
|
import jalview.datamodel.BinaryNode; |
| 26 |
|
import jalview.datamodel.NodeTransformI; |
| 27 |
|
import jalview.datamodel.Sequence; |
| 28 |
|
import jalview.datamodel.SequenceI; |
| 29 |
|
import jalview.datamodel.SequenceNode; |
| 30 |
|
import jalview.io.NewickFile; |
| 31 |
|
|
| 32 |
|
import java.util.ArrayList; |
| 33 |
|
import java.util.Enumeration; |
| 34 |
|
import java.util.List; |
| 35 |
|
import java.util.Vector; |
| 36 |
|
|
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| |
|
| 51.2% |
Uncovered Elements: 126 (258) |
Complexity: 70 |
Complexity Density: 0.44 |
|
| 41 |
|
public class TreeModel |
| 42 |
|
{ |
| 43 |
|
|
| 44 |
|
SequenceI[] sequences; |
| 45 |
|
|
| 46 |
|
|
| 47 |
|
|
| 48 |
|
|
| 49 |
|
|
| 50 |
|
private AlignmentView seqData; |
| 51 |
|
|
| 52 |
|
int noseqs; |
| 53 |
|
|
| 54 |
|
BinaryNode top; |
| 55 |
|
|
| 56 |
|
double maxDistValue; |
| 57 |
|
|
| 58 |
|
double maxheight; |
| 59 |
|
|
| 60 |
|
int ycount; |
| 61 |
|
|
| 62 |
|
Vector<BinaryNode> node; |
| 63 |
|
|
| 64 |
|
boolean hasDistances = true; |
| 65 |
|
|
| 66 |
|
boolean hasBootstrap = false; |
| 67 |
|
|
| 68 |
|
private boolean hasRootDistance = true; |
| 69 |
|
|
| 70 |
|
|
| 71 |
|
|
| 72 |
|
|
| 73 |
|
|
| 74 |
|
@param |
| 75 |
|
|
| 76 |
|
@param |
| 77 |
|
|
| 78 |
|
@param |
| 79 |
|
|
| 80 |
|
@param |
| 81 |
|
|
| 82 |
|
|
| |
|
| 83.3% |
Uncovered Elements: 1 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 83 |
23 |
public TreeModel(SequenceI[] seqs, AlignmentView odata,... |
| 84 |
|
NewickFile treefile, AlignmentAnnotation[] leafAnnotations) |
| 85 |
|
{ |
| 86 |
23 |
this(seqs, treefile.getTree(), treefile.HasDistances(), |
| 87 |
|
treefile.HasBootstrap(), treefile.HasRootDistance()); |
| 88 |
23 |
seqData = odata; |
| 89 |
23 |
if (leafAnnotations != null) |
| 90 |
|
{ |
| 91 |
|
|
| 92 |
|
|
| 93 |
|
|
| 94 |
|
|
| 95 |
|
|
| 96 |
|
|
| 97 |
|
|
| 98 |
|
|
| 99 |
|
} |
| 100 |
|
else |
| 101 |
|
{ |
| 102 |
23 |
associateLeavesToSequences(seqs); |
| 103 |
|
} |
| 104 |
|
} |
| 105 |
|
|
| 106 |
|
|
| 107 |
|
|
| 108 |
|
|
| 109 |
|
@param |
| 110 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 111 |
1 |
public TreeModel(TreeBuilder tree)... |
| 112 |
|
{ |
| 113 |
1 |
this(tree.getSequences(), tree.getTopNode(), tree.hasDistances(), |
| 114 |
|
tree.hasBootstrap(), tree.hasRootDistance()); |
| 115 |
1 |
seqData = tree.getOriginalData(); |
| 116 |
|
} |
| 117 |
|
|
| 118 |
|
|
| 119 |
|
|
| 120 |
|
|
| 121 |
|
@param |
| 122 |
|
@param |
| 123 |
|
@param |
| 124 |
|
@param |
| 125 |
|
@param |
| 126 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
| 127 |
24 |
public TreeModel(SequenceI[] seqs, BinaryNode root, boolean hasDist,... |
| 128 |
|
boolean hasBoot, boolean hasRootDist) |
| 129 |
|
{ |
| 130 |
24 |
this.sequences = seqs; |
| 131 |
24 |
top = root; |
| 132 |
|
|
| 133 |
24 |
hasDistances = hasDist; |
| 134 |
24 |
hasBootstrap = hasBoot; |
| 135 |
24 |
hasRootDistance = hasRootDist; |
| 136 |
|
|
| 137 |
24 |
maxheight = findHeight(top); |
| 138 |
|
} |
| 139 |
|
|
| 140 |
|
|
| 141 |
|
@param |
| 142 |
|
|
| |
|
| 93.1% |
Uncovered Elements: 2 (29) |
Complexity: 5 |
Complexity Density: 0.24 |
|
| 143 |
23 |
public void associateLeavesToSequences(SequenceI[] seqs)... |
| 144 |
|
{ |
| 145 |
23 |
SequenceIdMatcher algnIds = new SequenceIdMatcher(seqs); |
| 146 |
|
|
| 147 |
23 |
Vector<BinaryNode> leaves = findLeaves(top); |
| 148 |
|
|
| 149 |
23 |
int i = 0; |
| 150 |
23 |
int namesleft = seqs.length; |
| 151 |
|
|
| 152 |
23 |
SequenceNode j; |
| 153 |
23 |
SequenceI nam; |
| 154 |
23 |
String realnam; |
| 155 |
23 |
Vector<SequenceI> one2many = new Vector<SequenceI>(); |
| 156 |
|
|
| 157 |
295 |
while (i < leaves.size()) |
| 158 |
|
{ |
| 159 |
|
|
| 160 |
272 |
j = (SequenceNode) leaves.elementAt(i++); |
| 161 |
272 |
realnam = j.getName(); |
| 162 |
272 |
nam = null; |
| 163 |
|
|
| 164 |
272 |
if (namesleft > -1) |
| 165 |
|
{ |
| 166 |
272 |
nam = algnIds.findIdMatch(realnam); |
| 167 |
|
} |
| 168 |
|
|
| 169 |
272 |
if (nam != null) |
| 170 |
|
{ |
| 171 |
198 |
j.setElement(nam); |
| 172 |
198 |
if (one2many.contains(nam)) |
| 173 |
|
{ |
| 174 |
|
|
| 175 |
|
|
| 176 |
|
|
| 177 |
|
|
| 178 |
|
} |
| 179 |
|
else |
| 180 |
|
{ |
| 181 |
198 |
one2many.addElement(nam); |
| 182 |
198 |
namesleft--; |
| 183 |
|
} |
| 184 |
|
} |
| 185 |
|
else |
| 186 |
|
{ |
| 187 |
74 |
j.setElement(new Sequence(realnam, "THISISAPLACEHLDER")); |
| 188 |
74 |
j.setPlaceholder(true); |
| 189 |
|
} |
| 190 |
|
} |
| 191 |
|
|
| 192 |
|
|
| 193 |
|
|
| 194 |
|
|
| 195 |
|
|
| 196 |
|
|
| 197 |
|
} |
| 198 |
|
|
| 199 |
|
|
| 200 |
|
|
| 201 |
|
|
| 202 |
|
@return |
| 203 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 204 |
4 |
public String print()... |
| 205 |
|
{ |
| 206 |
4 |
NewickFile fout = new NewickFile(getTopNode()); |
| 207 |
|
|
| 208 |
4 |
return fout.print(hasBootstrap(), hasDistances(), hasRootDistance()); |
| 209 |
|
|
| 210 |
|
|
| 211 |
|
|
| 212 |
|
|
| 213 |
|
|
| 214 |
|
} |
| 215 |
|
|
| 216 |
|
|
| 217 |
|
|
| 218 |
|
|
| 219 |
|
|
| 220 |
|
@param |
| 221 |
|
|
| 222 |
|
|
| |
|
| 0% |
Uncovered Elements: 35 (35) |
Complexity: 8 |
Complexity Density: 0.38 |
|
| 223 |
0 |
public void updatePlaceHolders(List<SequenceI> list)... |
| 224 |
|
{ |
| 225 |
0 |
Vector<BinaryNode> leaves = findLeaves(top); |
| 226 |
|
|
| 227 |
0 |
int sz = leaves.size(); |
| 228 |
0 |
SequenceIdMatcher seqmatcher = null; |
| 229 |
0 |
int i = 0; |
| 230 |
|
|
| 231 |
0 |
while (i < sz) |
| 232 |
|
{ |
| 233 |
0 |
SequenceNode leaf = (SequenceNode) leaves.elementAt(i++); |
| 234 |
|
|
| 235 |
0 |
if (list.contains(leaf.element())) |
| 236 |
|
{ |
| 237 |
0 |
leaf.setPlaceholder(false); |
| 238 |
|
} |
| 239 |
|
else |
| 240 |
|
{ |
| 241 |
0 |
if (seqmatcher == null) |
| 242 |
|
{ |
| 243 |
|
|
| 244 |
0 |
SequenceI[] seqs = new SequenceI[list.size()]; |
| 245 |
|
|
| 246 |
0 |
for (int j = 0; j < seqs.length; j++) |
| 247 |
|
{ |
| 248 |
0 |
seqs[j] = list.get(j); |
| 249 |
|
} |
| 250 |
|
|
| 251 |
0 |
seqmatcher = new SequenceIdMatcher(seqs); |
| 252 |
|
} |
| 253 |
|
|
| 254 |
0 |
SequenceI nam = seqmatcher.findIdMatch(leaf.getName()); |
| 255 |
|
|
| 256 |
0 |
if (nam != null) |
| 257 |
|
{ |
| 258 |
0 |
if (!leaf.isPlaceholder()) |
| 259 |
|
{ |
| 260 |
|
|
| 261 |
|
|
| 262 |
|
|
| 263 |
|
|
| 264 |
|
} |
| 265 |
0 |
leaf.setPlaceholder(false); |
| 266 |
0 |
leaf.setElement(nam); |
| 267 |
|
} |
| 268 |
|
else |
| 269 |
|
{ |
| 270 |
0 |
if (!leaf.isPlaceholder()) |
| 271 |
|
{ |
| 272 |
|
|
| 273 |
0 |
leaf.setElement( |
| 274 |
|
new Sequence(leaf.getName(), "THISISAPLACEHLDER")); |
| 275 |
|
} |
| 276 |
0 |
leaf.setPlaceholder(true); |
| 277 |
|
|
| 278 |
|
} |
| 279 |
|
} |
| 280 |
|
} |
| 281 |
|
} |
| 282 |
|
|
| 283 |
|
|
| 284 |
|
|
| 285 |
|
|
| 286 |
|
|
| 287 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 288 |
0 |
public void renameAssociatedNodes()... |
| 289 |
|
{ |
| 290 |
0 |
applyToNodes(new NodeTransformI() |
| 291 |
|
{ |
| 292 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
| 293 |
0 |
@Override... |
| 294 |
|
public void transform(BinaryNode nd) |
| 295 |
|
{ |
| 296 |
0 |
Object el = nd.element(); |
| 297 |
0 |
if (el != null && el instanceof SequenceI) |
| 298 |
|
{ |
| 299 |
0 |
nd.setName(((SequenceI) el).getName()); |
| 300 |
|
} |
| 301 |
|
} |
| 302 |
|
}); |
| 303 |
|
} |
| 304 |
|
|
| 305 |
|
|
| 306 |
|
|
| 307 |
|
|
| 308 |
|
@param |
| 309 |
|
|
| 310 |
|
|
| 311 |
|
@return |
| 312 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 313 |
1808 |
public Vector<BinaryNode> findLeaves(BinaryNode top2)... |
| 314 |
|
{ |
| 315 |
1808 |
Vector<BinaryNode> leaves = new Vector<BinaryNode>(); |
| 316 |
1808 |
findLeaves(top2, leaves); |
| 317 |
1808 |
return leaves; |
| 318 |
|
} |
| 319 |
|
|
| 320 |
|
|
| 321 |
|
|
| 322 |
|
|
| 323 |
|
@param |
| 324 |
|
|
| 325 |
|
@param |
| 326 |
|
|
| 327 |
|
|
| 328 |
|
@return |
| 329 |
|
|
| |
|
| 83.3% |
Uncovered Elements: 2 (12) |
Complexity: 4 |
Complexity Density: 0.5 |
|
| 330 |
9624 |
Vector<BinaryNode> findLeaves(BinaryNode nd, Vector<BinaryNode> leaves)... |
| 331 |
|
{ |
| 332 |
9624 |
if (nd == null) |
| 333 |
|
{ |
| 334 |
0 |
return leaves; |
| 335 |
|
} |
| 336 |
|
|
| 337 |
9624 |
if ((nd.left() == null) && (nd.right() == null)) |
| 338 |
|
|
| 339 |
|
{ |
| 340 |
5716 |
leaves.addElement(nd); |
| 341 |
|
|
| 342 |
5716 |
return leaves; |
| 343 |
|
} |
| 344 |
|
else |
| 345 |
|
{ |
| 346 |
|
|
| 347 |
|
|
| 348 |
|
|
| 349 |
|
|
| 350 |
3908 |
findLeaves(nd.left(), leaves); |
| 351 |
3908 |
findLeaves(nd.right(), leaves); |
| 352 |
|
} |
| 353 |
|
|
| 354 |
3908 |
return leaves; |
| 355 |
|
} |
| 356 |
|
|
| 357 |
|
|
| 358 |
|
|
| 359 |
|
|
| 360 |
|
@param |
| 361 |
|
|
| 362 |
|
|
| |
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 4 |
Complexity Density: 0.44 |
|
| 363 |
0 |
void printNode(BinaryNode nd)... |
| 364 |
|
{ |
| 365 |
0 |
if (nd == null) |
| 366 |
|
{ |
| 367 |
0 |
return; |
| 368 |
|
} |
| 369 |
|
|
| 370 |
0 |
if ((nd.left() == null) && (nd.right() == null)) |
| 371 |
|
{ |
| 372 |
|
|
| 373 |
0 |
jalview.bin.Console |
| 374 |
|
.outPrintln("Leaf = " + ((SequenceI) nd.element()).getName()); |
| 375 |
0 |
jalview.bin.Console.outPrintln("Dist " + nd.dist); |
| 376 |
0 |
jalview.bin.Console.outPrintln("Boot " + nd.getBootstrap()); |
| 377 |
|
} |
| 378 |
|
else |
| 379 |
|
{ |
| 380 |
0 |
jalview.bin.Console.outPrintln("Dist " + nd.dist); |
| 381 |
0 |
printNode((BinaryNode) nd.left()); |
| 382 |
0 |
printNode((BinaryNode) nd.right()); |
| 383 |
|
} |
| 384 |
|
} |
| 385 |
|
|
| 386 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 387 |
0 |
public Vector<BinaryNode> getNode()... |
| 388 |
|
{ |
| 389 |
0 |
return node; |
| 390 |
|
} |
| 391 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 392 |
3 |
public void setNode(Vector<BinaryNode> node)... |
| 393 |
|
{ |
| 394 |
3 |
this.node = node; |
| 395 |
|
} |
| 396 |
|
|
| 397 |
|
|
| 398 |
|
|
| 399 |
|
|
| 400 |
|
@return |
| 401 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 402 |
71 |
public double getMaxHeight()... |
| 403 |
|
{ |
| 404 |
71 |
return maxheight; |
| 405 |
|
} |
| 406 |
|
|
| 407 |
|
|
| 408 |
|
|
| 409 |
|
|
| 410 |
|
|
| 411 |
|
|
| 412 |
|
|
| 413 |
|
|
| 414 |
|
|
| 415 |
|
|
| 416 |
|
@param |
| 417 |
|
@see |
| 418 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 419 |
1 |
public List<BinaryNode> groupNodes(float threshold)... |
| 420 |
|
{ |
| 421 |
1 |
List<BinaryNode> groups = new ArrayList<BinaryNode>(); |
| 422 |
1 |
_groupNodes(groups, getTopNode(), threshold); |
| 423 |
1 |
return groups; |
| 424 |
|
} |
| 425 |
|
|
| |
|
| 80% |
Uncovered Elements: 2 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
| 426 |
3 |
protected void _groupNodes(List<BinaryNode> groups, BinaryNode nd,... |
| 427 |
|
float threshold) |
| 428 |
|
{ |
| 429 |
3 |
if (nd == null) |
| 430 |
|
{ |
| 431 |
0 |
return; |
| 432 |
|
} |
| 433 |
|
|
| 434 |
3 |
if ((nd.height / maxheight) > threshold) |
| 435 |
|
{ |
| 436 |
2 |
groups.add(nd); |
| 437 |
|
} |
| 438 |
|
else |
| 439 |
|
{ |
| 440 |
1 |
_groupNodes(groups, nd.left(), threshold); |
| 441 |
1 |
_groupNodes(groups, nd.right(), threshold); |
| 442 |
|
} |
| 443 |
|
} |
| 444 |
|
|
| 445 |
|
|
| 446 |
|
|
| 447 |
|
|
| 448 |
|
@param |
| 449 |
|
|
| 450 |
|
|
| 451 |
|
@return |
| 452 |
|
|
| |
|
| 90.9% |
Uncovered Elements: 2 (22) |
Complexity: 6 |
Complexity Density: 0.43 |
|
| 453 |
1528 |
public double findHeight(BinaryNode nd)... |
| 454 |
|
{ |
| 455 |
1528 |
if (nd == null) |
| 456 |
|
{ |
| 457 |
0 |
return maxheight; |
| 458 |
|
} |
| 459 |
|
|
| 460 |
1528 |
if ((nd.left() == null) && (nd.right() == null)) |
| 461 |
|
{ |
| 462 |
794 |
nd.height = nd.parent().height + nd.dist; |
| 463 |
|
|
| 464 |
794 |
if (nd.height > maxheight) |
| 465 |
|
{ |
| 466 |
94 |
return nd.height; |
| 467 |
|
} |
| 468 |
|
else |
| 469 |
|
{ |
| 470 |
700 |
return maxheight; |
| 471 |
|
} |
| 472 |
|
} |
| 473 |
|
else |
| 474 |
|
{ |
| 475 |
734 |
if (nd.parent() != null) |
| 476 |
|
{ |
| 477 |
674 |
nd.height = nd.parent().height + nd.dist; |
| 478 |
|
} |
| 479 |
|
else |
| 480 |
|
{ |
| 481 |
60 |
maxheight = 0; |
| 482 |
60 |
nd.height = (float) 0.0; |
| 483 |
|
} |
| 484 |
|
|
| 485 |
734 |
maxheight = findHeight((BinaryNode) (nd.left())); |
| 486 |
734 |
maxheight = findHeight((BinaryNode) (nd.right())); |
| 487 |
|
} |
| 488 |
|
|
| 489 |
734 |
return maxheight; |
| 490 |
|
} |
| 491 |
|
|
| 492 |
|
|
| 493 |
|
|
| 494 |
|
|
| 495 |
|
@param |
| 496 |
|
|
| 497 |
|
|
| |
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 4 |
Complexity Density: 0.57 |
|
| 498 |
0 |
void printN(BinaryNode nd)... |
| 499 |
|
{ |
| 500 |
0 |
if (nd == null) |
| 501 |
|
{ |
| 502 |
0 |
return; |
| 503 |
|
} |
| 504 |
|
|
| 505 |
0 |
if ((nd.left() != null) && (nd.right() != null)) |
| 506 |
|
{ |
| 507 |
0 |
printN((BinaryNode) nd.left()); |
| 508 |
0 |
printN((BinaryNode) nd.right()); |
| 509 |
|
} |
| 510 |
|
else |
| 511 |
|
{ |
| 512 |
0 |
jalview.bin.Console.outPrintln( |
| 513 |
|
" name = " + ((SequenceI) nd.element()).getName()); |
| 514 |
|
} |
| 515 |
|
|
| 516 |
0 |
jalview.bin.Console.outPrintln( |
| 517 |
|
" dist = " + nd.dist + " " + nd.count + " " + nd.height); |
| 518 |
|
} |
| 519 |
|
|
| 520 |
|
|
| 521 |
|
|
| 522 |
|
|
| 523 |
|
@param |
| 524 |
|
|
| 525 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 526 |
18 |
public void reCount(BinaryNode nd)... |
| 527 |
|
{ |
| 528 |
18 |
ycount = 0; |
| 529 |
|
|
| 530 |
|
|
| 531 |
18 |
_reCount(nd); |
| 532 |
|
} |
| 533 |
|
|
| 534 |
|
|
| 535 |
|
|
| 536 |
|
|
| 537 |
|
|
| 538 |
|
|
| 539 |
|
@param |
| 540 |
|
|
| 541 |
|
|
| |
|
| 86.7% |
Uncovered Elements: 2 (15) |
Complexity: 4 |
Complexity Density: 0.36 |
|
| 542 |
486 |
void _reCount(BinaryNode nd)... |
| 543 |
|
{ |
| 544 |
|
|
| 545 |
|
|
| 546 |
|
|
| 547 |
|
|
| 548 |
|
|
| 549 |
|
|
| 550 |
486 |
if (nd == null) |
| 551 |
|
{ |
| 552 |
0 |
return; |
| 553 |
|
} |
| 554 |
|
|
| 555 |
|
|
| 556 |
486 |
if ((nd.left() != null) && (nd.right() != null)) |
| 557 |
|
{ |
| 558 |
|
|
| 559 |
234 |
_reCount((BinaryNode) nd.left()); |
| 560 |
234 |
_reCount((BinaryNode) nd.right()); |
| 561 |
|
|
| 562 |
234 |
BinaryNode l = (BinaryNode) nd.left(); |
| 563 |
234 |
BinaryNode r = (BinaryNode) nd.right(); |
| 564 |
|
|
| 565 |
234 |
nd.count = l.count + r.count; |
| 566 |
234 |
nd.ycount = (l.ycount + r.ycount) / 2; |
| 567 |
|
} |
| 568 |
|
else |
| 569 |
|
{ |
| 570 |
252 |
nd.count = 1; |
| 571 |
252 |
nd.ycount = ycount++; |
| 572 |
|
} |
| 573 |
|
|
| 574 |
|
} |
| 575 |
|
|
| 576 |
|
|
| 577 |
|
|
| 578 |
|
|
| 579 |
|
@param |
| 580 |
|
|
| 581 |
|
|
| |
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 582 |
0 |
public void swapNodes(BinaryNode nd)... |
| 583 |
|
{ |
| 584 |
0 |
if (nd == null) |
| 585 |
|
{ |
| 586 |
0 |
return; |
| 587 |
|
} |
| 588 |
|
|
| 589 |
0 |
BinaryNode tmp = (BinaryNode) nd.left(); |
| 590 |
|
|
| 591 |
0 |
nd.setLeft(nd.right()); |
| 592 |
0 |
nd.setRight(tmp); |
| 593 |
|
} |
| 594 |
|
|
| 595 |
|
|
| 596 |
|
|
| 597 |
|
|
| 598 |
|
@param |
| 599 |
|
|
| 600 |
|
@param |
| 601 |
|
|
| 602 |
|
|
| |
|
| 0% |
Uncovered Elements: 34 (34) |
Complexity: 8 |
Complexity Density: 0.4 |
|
| 603 |
0 |
void changeDirection(BinaryNode nd, BinaryNode dir)... |
| 604 |
|
{ |
| 605 |
0 |
if (nd == null) |
| 606 |
|
{ |
| 607 |
0 |
return; |
| 608 |
|
} |
| 609 |
|
|
| 610 |
0 |
if (nd.parent() != top) |
| 611 |
|
{ |
| 612 |
0 |
changeDirection((BinaryNode) nd.parent(), nd); |
| 613 |
|
|
| 614 |
0 |
BinaryNode tmp = (BinaryNode) nd.parent(); |
| 615 |
|
|
| 616 |
0 |
if (dir == nd.left()) |
| 617 |
|
{ |
| 618 |
0 |
nd.setParent(dir); |
| 619 |
0 |
nd.setLeft(tmp); |
| 620 |
|
} |
| 621 |
0 |
else if (dir == nd.right()) |
| 622 |
|
{ |
| 623 |
0 |
nd.setParent(dir); |
| 624 |
0 |
nd.setRight(tmp); |
| 625 |
|
} |
| 626 |
|
} |
| 627 |
|
else |
| 628 |
|
{ |
| 629 |
0 |
if (dir == nd.left()) |
| 630 |
|
{ |
| 631 |
0 |
nd.setParent(nd.left()); |
| 632 |
|
|
| 633 |
0 |
if (top.left() == nd) |
| 634 |
|
{ |
| 635 |
0 |
nd.setRight(top.right()); |
| 636 |
|
} |
| 637 |
|
else |
| 638 |
|
{ |
| 639 |
0 |
nd.setRight(top.left()); |
| 640 |
|
} |
| 641 |
|
} |
| 642 |
|
else |
| 643 |
|
{ |
| 644 |
0 |
nd.setParent(nd.right()); |
| 645 |
|
|
| 646 |
0 |
if (top.left() == nd) |
| 647 |
|
{ |
| 648 |
0 |
nd.setLeft(top.right()); |
| 649 |
|
} |
| 650 |
|
else |
| 651 |
|
{ |
| 652 |
0 |
nd.setLeft(top.left()); |
| 653 |
|
} |
| 654 |
|
} |
| 655 |
|
} |
| 656 |
|
} |
| 657 |
|
|
| 658 |
|
|
| 659 |
|
|
| 660 |
|
|
| 661 |
|
@return |
| 662 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 663 |
258 |
public BinaryNode getTopNode()... |
| 664 |
|
{ |
| 665 |
258 |
return top; |
| 666 |
|
} |
| 667 |
|
|
| 668 |
|
|
| 669 |
|
|
| 670 |
|
@return |
| 671 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 672 |
4 |
public boolean hasDistances()... |
| 673 |
|
{ |
| 674 |
4 |
return hasDistances; |
| 675 |
|
} |
| 676 |
|
|
| 677 |
|
|
| 678 |
|
|
| 679 |
|
@return |
| 680 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 681 |
4 |
public boolean hasBootstrap()... |
| 682 |
|
{ |
| 683 |
4 |
return hasBootstrap; |
| 684 |
|
} |
| 685 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 686 |
4 |
public boolean hasRootDistance()... |
| 687 |
|
{ |
| 688 |
4 |
return hasRootDistance; |
| 689 |
|
} |
| 690 |
|
|
| 691 |
|
|
| 692 |
|
|
| 693 |
|
|
| 694 |
|
@param |
| 695 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
| 696 |
3 |
public void applyToNodes(NodeTransformI nodeTransformI)... |
| 697 |
|
{ |
| 698 |
67 |
for (Enumeration<BinaryNode> nodes = node.elements(); nodes |
| 699 |
|
.hasMoreElements(); nodeTransformI |
| 700 |
|
.transform(nodes.nextElement())) |
| 701 |
|
{ |
| 702 |
64 |
; |
| 703 |
|
} |
| 704 |
|
} |
| 705 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 706 |
17 |
public AlignmentView getOriginalData()... |
| 707 |
|
{ |
| 708 |
17 |
return seqData; |
| 709 |
|
} |
| 710 |
|
} |