use of org.sirix.node.immutable.ImmutableAttribute in project sirix by sirixdb.
the class XdmNodeWriterTrxImpl method adaptSubtreeForMove.
/**
* Adapt subtree regarding the index-structures.
*
* @param toMove node which is moved (either before the move, or after the move)
* @param type the type of change (either deleted from the old position or inserted into the new
* position)
* @throws SirixIOException if an I/O exception occurs
*/
private void adaptSubtreeForMove(final Node node, final ChangeType type) throws SirixIOException {
assert type != null;
final long beforeNodeKey = getNode().getNodeKey();
moveTo(node.getNodeKey());
final Axis axis = new DescendantAxis(this, IncludeSelf.YES);
while (axis.hasNext()) {
axis.next();
for (int i = 0, attCount = getAttributeCount(); i < attCount; i++) {
moveToAttribute(i);
final ImmutableAttribute att = (ImmutableAttribute) getNode();
mIndexController.notifyChange(type, att, att.getPathNodeKey());
moveToParent();
}
for (int i = 0, nspCount = getNamespaceCount(); i < nspCount; i++) {
moveToAttribute(i);
final ImmutableNamespace nsp = (ImmutableNamespace) getNode();
mIndexController.notifyChange(type, nsp, nsp.getPathNodeKey());
moveToParent();
}
long pathNodeKey = -1;
if (getNode() instanceof ValueNode && getNode().getParentKey() != Fixed.DOCUMENT_NODE_KEY.getStandardProperty()) {
final long nodeKey = getNode().getNodeKey();
pathNodeKey = moveToParent().get().getNameNode().getPathNodeKey();
moveTo(nodeKey);
} else if (getNode() instanceof NameNode) {
pathNodeKey = getNameNode().getPathNodeKey();
}
mIndexController.notifyChange(type, getNode(), pathNodeKey);
}
moveTo(beforeNodeKey);
}
Aggregations