use of org.sirix.node.interfaces.immutable.ImmutableNode in project sirix by sirixdb.
the class XdmNodeWriterTrxImpl method checkAncestors.
/**
* Check ancestors of current node.
*
* @throws IllegalStateException if one of the ancestors is the node/subtree rooted at the node to
* move
*/
private void checkAncestors(final Node node) {
assert node != null;
final ImmutableNode item = getCurrentNode();
while (getCurrentNode().hasParent()) {
moveToParent();
if (getCurrentNode().getNodeKey() == node.getNodeKey()) {
throw new IllegalStateException("Moving one of the ancestor nodes is not permitted!");
}
}
moveTo(item.getNodeKey());
}
Aggregations