1 package org.opendaylight.controller.md.sal.common.impl.service;
3 import java.util.HashMap;
4 import java.util.HashSet;
6 import java.util.Map.Entry;
9 import org.opendaylight.yangtools.concepts.Path;
11 public class RootedChangeSet<P extends Path<P>,D> {
14 private final Map<P,D> original;
15 private final Map<P,D> created = new HashMap<>();
16 private final Map<P,D> updated = new HashMap<>();
17 private final Set<P> removed = new HashSet<>();
21 public RootedChangeSet(P root,Map<P, D> original) {
24 this.original = original;
27 protected P getRoot() {
31 protected Map<P, D> getOriginal() {
35 protected Map<P, D> getCreated() {
39 protected Map<P, D> getUpdated() {
43 protected Set<P> getRemoved() {
47 public void addCreated(Map<P,D> created) {
48 this.created.putAll(created);
51 public void addCreated(Entry<P,D> entry) {
52 created.put(entry.getKey(), entry.getValue());
55 public void addUpdated(Entry<P,D> entry) {
56 updated.put(entry.getKey(), entry.getValue());
59 public void addRemoval(P path) {
63 public boolean isChange() {
64 return !created.isEmpty() || !updated.isEmpty() || !removed.isEmpty();