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.api.schema.tree.spi;
10 import com.google.common.base.Optional;
11 import com.google.common.base.Preconditions;
15 import org.opendaylight.yangtools.util.MapAdaptor;
16 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
17 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
19 final class MaterializedContainerNode extends ContainerNode {
20 private final Map<PathArgument, TreeNode> children;
22 protected MaterializedContainerNode(final NormalizedNode<?, ?> data, final Version version,
23 final Map<PathArgument, TreeNode> children, final Version subtreeVersion) {
24 super(data, version, subtreeVersion);
25 this.children = Preconditions.checkNotNull(children);
29 public Optional<TreeNode> getChild(final PathArgument key) {
30 return Optional.fromNullable(children.get(key));
34 public MutableTreeNode mutable() {
35 return new Mutable(this, MapAdaptor.getDefaultInstance().takeSnapshot(children));