Skip to content

Commit a48b4fd

Browse files
committed
feat: DiffNode::stealChildrenOf at time
1 parent 6b2bcb0 commit a48b4fd

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

  • src/main/java/org/variantsync/diffdetective/variation/diff

src/main/java/org/variantsync/diffdetective/variation/diff/DiffNode.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,21 @@ public List<DiffNode<L>> removeChildren(Time time) {
367367
}
368368

369369
/**
370-
* Removes all children from the given node and adds them as children to this node at the respective times.
370+
* Removes all children from the given node and adds them as children to this node at the given time.
371+
* The given node will have no children afterwards at the given time.
372+
* @param other The node whose children should be stolen for the given time.
373+
*/
374+
public void stealChildrenOf(Time time, final DiffNode<L> other) {
375+
addChildren(other.removeChildren(time), time);
376+
}
377+
378+
/**
379+
* Removes all children from the given node and adds them as children to this node (at all times).
371380
* The given node will have no children afterwards.
372381
* @param other The node whose children should be stolen.
373382
*/
374383
public void stealChildrenOf(final DiffNode<L> other) {
375-
Time.forAll(time -> addChildren(other.removeChildren(time), time));
384+
Time.forAll(time -> stealChildrenOf(time, other));
376385
}
377386

378387
/**

0 commit comments

Comments
 (0)