2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
8 package org.opendaylight.yangtools.yang.data.impl;
\r
10 import java.util.ArrayList;
\r
11 import java.util.List;
\r
12 import java.util.Map;
\r
14 import org.opendaylight.yangtools.yang.common.QName;
\r
15 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
\r
16 import org.opendaylight.yangtools.yang.data.api.ModifyAction;
\r
17 import org.opendaylight.yangtools.yang.data.api.MutableCompositeNode;
\r
18 import org.opendaylight.yangtools.yang.data.api.Node;
\r
21 * @author michal.rehak
\r
24 public class MutableCompositeNodeTOImpl extends CompositeNodeTOImpl
\r
25 implements MutableCompositeNode {
\r
27 private Map<QName, List<Node<?>>> nodeMap;
\r
28 private CompositeNode original;
\r
34 * @param modifyAction
\r
36 public MutableCompositeNodeTOImpl(QName qname, CompositeNode parent,
\r
37 List<Node<?>> value, ModifyAction modifyAction) {
\r
38 super(qname, parent, value, modifyAction);
\r
42 * update nodeMap - it should be invoked after children was changed
\r
45 public void init() {
\r
46 if (!getChildren().isEmpty()) {
\r
47 nodeMap = NodeUtils.buildNodeMap(getChildren());
\r
52 public List<Node<?>> getChildren() {
\r
53 return getValue() == null ? new ArrayList<Node<?>>() : getValue();
\r
57 public List<Node<?>> setValue(List<Node<?>> value) {
\r
58 List<Node<?>> oldVal = super.setValue(value);
\r
64 public void setModifyAction(ModifyAction action) {
\r
65 super.setModificationAction(action);
\r
69 protected Map<QName, List<Node<?>>> getNodeMap() {
\r
74 public MutableCompositeNode asMutable() {
\r
79 public CompositeNode getOriginal() {
\r
84 * @param original the original to set
\r
86 public void setOriginal(CompositeNode original) {
\r
87 this.original = original;
\r