326ab2330681b835d36cb57ba6e646ca92b0e60c
[mdsal.git] / dom / mdsal-dom-inmemory-datastore / src / main / java / org / opendaylight / mdsal / dom / store / inmemory / WriteableNodeWithSubshard.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.mdsal.dom.store.inmemory;
10
11 import com.google.common.collect.ImmutableMap;
12 import java.util.Map;
13 import java.util.Map.Entry;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
15
16 abstract class WriteableNodeWithSubshard extends WriteableModificationNode {
17
18     private final Map<PathArgument, WriteableModificationNode> children;
19
20     WriteableNodeWithSubshard(Map<PathArgument, WriteableModificationNode> children) {
21         this.children = ImmutableMap.copyOf(children);
22     }
23
24     @Override
25     Map<PathArgument, WriteableModificationNode> getChildrenWithSubshards() {
26         return children;
27     }
28
29     @Override
30     WriteableModificationNode getChild(PathArgument node) {
31         return children.get(node);
32     }
33
34     @Override
35     void markDeleted() {
36         for (Entry<PathArgument, WriteableModificationNode> child : children.entrySet()) {
37             child.getValue().markDeleted();
38         }
39     }
40 }