}
});
}
private NodeId calcRemoveNodeId(ItemId itemId) throws MalformedPathException {
NodeId nodeId = (NodeId) itemId;
Path p = itemId.getPath();
if (p != null) {
removedNodeIds.add(itemId);
int index = p.getNameElement().getNormalizedIndex();
if (index > Path.INDEX_DEFAULT) {
Path.Element[] elems = p.getElements();
PathBuilder pb = new PathBuilder();
for (int i = 0; i <= elems.length - 2; i++) {
pb.addLast(elems[i]);
}
pb.addLast(p.getNameElement().getName(), index - 1);
NodeId prevSibling = idFactory.createNodeId(itemId.getUniqueID(), pb.getPath());
if (removedNodeIds.contains(prevSibling)) {
nodeId = prevSibling;
}
}
}