X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=yang%2Fyang-data-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fdata%2Fapi%2Fschema%2Ftree%2FDataTreeCandidateNodes.java;h=8625b4e07856006e01f51f96ff861235af1e27fe;hb=6bb7f3a20168a59eeeea366d7d30fa29702e522f;hp=d36a4816a598580348fcfad18e9029ed83b5761d;hpb=ac6b1c788424ca50221ce7b243e4255a8b6fe4c4;p=yangtools.git diff --git a/yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/DataTreeCandidateNodes.java b/yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/DataTreeCandidateNodes.java index d36a4816a5..8625b4e078 100644 --- a/yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/DataTreeCandidateNodes.java +++ b/yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/DataTreeCandidateNodes.java @@ -28,42 +28,45 @@ public final class DataTreeCandidateNodes { /** * Applies the {@code node} to the {@code cursor}, note that if the top node of (@code node} is RootNode - * you need to use {@link #applyRootedNodeToCursor(DataTreeModificationCursor, YangInstanceIdentifier, DataTreeCandidateNode) applyRootedNodeToCursor} - * method that works with rooted node candidates + * you need to use {@link #applyRootedNodeToCursor(DataTreeModificationCursor, YangInstanceIdentifier, + * DataTreeCandidateNode) applyRootedNodeToCursor} method that works with rooted node candidates. + * * @param cursor cursor from the modification we want to apply the {@code node} to * @param node candidate tree to apply */ public static void applyToCursor(final DataTreeModificationCursor cursor, final DataTreeCandidateNode node) { switch (node.getModificationType()) { - case DELETE: - cursor.delete(node.getIdentifier()); - break; - case SUBTREE_MODIFIED: + case DELETE: + cursor.delete(node.getIdentifier()); + break; + case SUBTREE_MODIFIED: cursor.enter(node.getIdentifier()); AbstractNodeIterator iterator = new ExitingNodeIterator(null, node.getChildNodes().iterator()); - do { - iterator = iterator.next(cursor); - } while (iterator != null); - break; - case UNMODIFIED: - // No-op - break; - case WRITE: - cursor.write(node.getIdentifier(), node.getDataAfter().get()); - break; - default: - throw new IllegalArgumentException("Unsupported modification " + node.getModificationType()); + do { + iterator = iterator.next(cursor); + } while (iterator != null); + break; + case UNMODIFIED: + // No-op + break; + case WRITE: + cursor.write(node.getIdentifier(), node.getDataAfter().get()); + break; + default: + throw new IllegalArgumentException("Unsupported modification " + node.getModificationType()); } } /** * Applies the {@code node} that is rooted(doesn't have an identifier) in tree A to tree B's {@code cursor} - * at location specified by {@code rootPath} + * at location specified by {@code rootPath}. + * * @param cursor cursor from the modification we want to apply the {@code node} to * @param rootPath path in the {@code cursor}'s tree we want to apply to candidate to * @param node candidate tree to apply */ - public static void applyRootedNodeToCursor(final DataTreeModificationCursor cursor, final YangInstanceIdentifier rootPath, final DataTreeCandidateNode node) { + public static void applyRootedNodeToCursor(final DataTreeModificationCursor cursor, + final YangInstanceIdentifier rootPath, final DataTreeCandidateNode node) { switch (node.getModificationType()) { case DELETE: cursor.delete(rootPath.getLastPathArgument()); @@ -116,26 +119,26 @@ public final class DataTreeCandidateNodes { while (iterator.hasNext()) { final DataTreeCandidateNode node = iterator.next(); switch (node.getModificationType()) { - case DELETE: - cursor.delete(node.getIdentifier()); - break; - case APPEARED: - case DISAPPEARED: - case SUBTREE_MODIFIED: - final Collection children = node.getChildNodes(); - if (!children.isEmpty()) { - cursor.enter(node.getIdentifier()); + case DELETE: + cursor.delete(node.getIdentifier()); + break; + case APPEARED: + case DISAPPEARED: + case SUBTREE_MODIFIED: + final Collection children = node.getChildNodes(); + if (!children.isEmpty()) { + cursor.enter(node.getIdentifier()); return new ExitingNodeIterator(this, children.iterator()); - } - break; - case UNMODIFIED: - // No-op - break; - case WRITE: - cursor.write(node.getIdentifier(), node.getDataAfter().get()); - break; - default: - throw new IllegalArgumentException("Unsupported modification " + node.getModificationType()); + } + break; + case UNMODIFIED: + // No-op + break; + case WRITE: + cursor.write(node.getIdentifier(), node.getDataAfter().get()); + break; + default: + throw new IllegalArgumentException("Unsupported modification " + node.getModificationType()); } } exitNode(cursor); @@ -168,7 +171,7 @@ public final class DataTreeCandidateNodes { private final AbstractNodeIterator parent; - public ExitingNodeIterator(@Nullable final AbstractNodeIterator parent, + ExitingNodeIterator(@Nullable final AbstractNodeIterator parent, @Nonnull final Iterator iterator) { super(iterator); this.parent = parent;