2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.data.impl.schema.tree;
10 import javax.annotation.Nonnull;
11 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
12 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
13 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
14 import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.TreeNode;
16 final class InMemoryDataTreeCandidate extends AbstractDataTreeCandidate {
18 private static final class RootNode extends AbstractModifiedNodeBasedCandidateNode {
19 public RootNode(final ModifiedNode mod, final TreeNode oldMeta, final TreeNode newMeta) {
20 super(mod, oldMeta, newMeta);
25 public PathArgument getIdentifier() {
26 throw new IllegalStateException("Attempted to get identifier of the root node");
30 private final RootNode root;
32 InMemoryDataTreeCandidate(final YangInstanceIdentifier rootPath, final ModifiedNode modificationRoot,
33 final TreeNode beforeRoot, final TreeNode afterRoot) {
35 this.root = new RootNode(modificationRoot, beforeRoot, afterRoot);
40 protected TreeNode getTipRoot() {
41 return root.getNewMeta();
44 TreeNode getBeforeRoot() {
45 return root.getOldMeta();
49 public DataTreeCandidateNode getRootNode() {