From: Robert Varga Date: Wed, 21 Oct 2015 23:16:18 +0000 (+0200) Subject: Simplify check for tree/node match X-Git-Tag: release/beryllium~120 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F72%2F28672%2F4;p=yangtools.git Simplify check for tree/node match The check can be inverted to check for: All nodes belong in TreeType.OPERATIONAL. Nodes which are in TreeType.CONFIGURATION return this as a property. Which can be written as a simple expression. Also expand javadoc a bit. Change-Id: Ie10d9b4bc3f9f1e2d08f592cfec1bf4bc92ea21b Signed-off-by: Robert Varga --- diff --git a/yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/SchemaAwareApplyOperation.java b/yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/SchemaAwareApplyOperation.java index b119a64664..f07844c435 100644 --- a/yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/SchemaAwareApplyOperation.java +++ b/yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/SchemaAwareApplyOperation.java @@ -261,16 +261,14 @@ abstract class SchemaAwareApplyOperation extends ModificationApplyOperation { final Optional current) throws DataValidationFailedException; /** - * Checks if supplied schema node belong to specified Data Tree type. + * Checks if supplied schema node belong to specified Data Tree type. All nodes belong to the operational tree, + * nodes in configuration tree are marked as such. * * @param treeType Tree Type * @param node Schema node * @return */ static boolean belongsToTree(final TreeType treeType, final DataSchemaNode node) { - if(treeType == TreeType.CONFIGURATION) { - return node.isConfiguration(); - } - return true; + return treeType == TreeType.OPERATIONAL || node.isConfiguration(); } }