Revision c5aa066b
Added by Katja Luther about 8 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/PolytomousKeyNode.java | ||
---|---|---|
432 | 432 |
* <i>this</i> feature node. |
433 | 433 |
*/ |
434 | 434 |
public List<PolytomousKeyNode> getChildren() { |
435 |
removeNullValueFromChildren(); |
|
435 | 436 |
return children; |
436 | 437 |
} |
437 | 438 |
|
... | ... | |
471 | 472 |
if (index < 0 || index > children.size() + 1) { |
472 | 473 |
throw new IndexOutOfBoundsException("Wrong index: " + index); |
473 | 474 |
} |
475 |
removeNullValueFromChildren(); |
|
474 | 476 |
|
475 | 477 |
if(nodeNumber == null) { |
476 |
nodeNumber = getMaxNodeNumberFromRoot() + 1; |
|
477 |
} |
|
478 |
nodeNumber = getMaxNodeNumberFromRoot() + 1; |
|
479 |
} |
|
480 |
|
|
478 | 481 |
|
479 | 482 |
children.add(index, child); |
480 | 483 |
child.setKey(this.getKey()); |
... | ... | |
502 | 505 |
*/ |
503 | 506 |
public void removeChild(PolytomousKeyNode child) { |
504 | 507 |
int index = children.indexOf(child); |
505 |
if (children.contains(null)){ |
|
506 |
while(children.contains(null)){ |
|
507 |
children.remove(null); |
|
508 |
} |
|
509 |
} |
|
508 |
removeNullValueFromChildren(); |
|
510 | 509 |
if (index >= 0) { |
511 | 510 |
removeChild(index); |
512 | 511 |
} |
513 | 512 |
} |
514 | 513 |
|
514 |
|
|
515 |
private void removeNullValueFromChildren(){ |
|
516 |
if (children.contains(null)){ |
|
517 |
while(children.contains(null)){ |
|
518 |
children.remove(null); |
|
519 |
} |
|
520 |
} |
|
521 |
} |
|
515 | 522 |
/** |
516 | 523 |
* Removes the feature node placed at the given (index + 1) position from |
517 | 524 |
* the list of {@link #getChildren() children} of <i>this</i> feature node. |
Also available in: Unified diff
fix move taxonnode and remove null values from childrenlists in several places