2 * Copyright (c) 2016 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.openflowplugin.applications.frsync.util;
10 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
14 * Data entry of before and after data for syncup in
15 * {@link org.opendaylight.openflowplugin.applications.frsync.SyncReactor}.
17 public class SyncupEntry {
18 private final FlowCapableNode after;
19 private final LogicalDatastoreType dsTypeAfter;
20 private final FlowCapableNode before;
21 private final LogicalDatastoreType dsTypeBefore;
23 public SyncupEntry(final FlowCapableNode after, final LogicalDatastoreType dsTypeAfter,
24 final FlowCapableNode before, final LogicalDatastoreType dsTypeBefore) {
26 this.dsTypeAfter = dsTypeAfter;
28 this.dsTypeBefore = dsTypeBefore;
31 public FlowCapableNode getAfter() {
35 public FlowCapableNode getBefore() {
39 public LogicalDatastoreType getDsTypeAfter() {
43 public LogicalDatastoreType getDsTypeBefore() {
47 public boolean isOptimizedConfigDelta() {
48 return dsTypeAfter == LogicalDatastoreType.CONFIGURATION && dsTypeBefore == LogicalDatastoreType.CONFIGURATION;
52 public boolean equals(Object obj) {
56 if (obj == null || getClass() != obj.getClass()) {
60 SyncupEntry that = (SyncupEntry) obj;
62 if (after != null ? !after.equals(that.after) : that.after != null) {
65 if (dsTypeAfter != that.dsTypeAfter) {
68 if (before != null ? !before.equals(that.before) : that.before != null) {
71 return dsTypeBefore == that.dsTypeBefore;
75 public int hashCode() {
77 int result = after != null ? after.hashCode() : 0;
78 result = prime * result + (dsTypeAfter != null ? dsTypeAfter.hashCode() : 0);
79 result = prime * result + (before != null ? before.hashCode() : 0);
80 result = prime * result + (dsTypeBefore != null ? dsTypeBefore.hashCode() : 0);