2 * Copyright (c) 2015 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;
11 import org.opendaylight.yangtools.util.MapAdaptor;
12 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
15 * A container node which may need further materialization. Materialized nodes are tracked in a map, which is consulted
16 * before creating a new child node from backing data. Since the child is immutable, we do not have to track it.
18 final class LazyMutableContainerNode extends AbstractMutableContainerNode {
19 LazyMutableContainerNode(final AbstractContainerNode parent) {
20 this(parent, MapAdaptor.getDefaultInstance().initialSnapshot(1));
23 LazyMutableContainerNode(final AbstractContainerNode parent, final Map<PathArgument, TreeNode> children) {
24 super(parent, children);
28 public TreeNode childByArg(final PathArgument arg) {
29 final TreeNode modified = getModifiedChild(arg);
30 return modified != null ? modified : AbstractContainerNode.getChildFromData(getData(), arg, getVersion());