+
+ static void checkIdentifierReferencesData(final PathArgument arg, final NormalizedNode<?, ?> data) {
+ Preconditions.checkArgument(arg.equals(data.getIdentifier()),
+ "Instance identifier references %s but data identifier is %s", arg, data.getIdentifier());
+ }
+
+ private static void checkIdentifierReferencesData(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
+ if (!path.isEmpty()) {
+ final PathArgument lastArg = path.getLastPathArgument();
+ Preconditions.checkArgument(lastArg != null, "Instance identifier %s has invalid null path argument", path);
+ checkIdentifierReferencesData(lastArg, data);
+ } else {
+ final QName type = data.getNodeType();
+ Preconditions.checkArgument(SchemaContext.NAME.equals(type), "Incorrect name %s of root node", type);
+ }
+ }
+
+ @Override
+ public DataTreeModificationCursor createCursor(final YangInstanceIdentifier path) {
+ final OperationWithModification op = resolveModificationFor(path);
+ return openCursor(new InMemoryDataTreeModificationCursor(this, path, op));
+ }
+
+ @Override
+ public void ready() {
+ final boolean wasRunning = SEALED_UPDATER.compareAndSet(this, 0, 1);
+ Preconditions.checkState(wasRunning, "Attempted to seal an already-sealed Data Tree.");
+
+ AbstractReadyIterator current = AbstractReadyIterator.create(rootNode, strategyTree);
+ do {
+ current = current.process(version);
+ } while (current != null);
+ }