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
9 package org.opendaylight.openflowplugin.applications.frsync.util;
11 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
15 * Data entry of before and after data for syncup in
16 * {@link org.opendaylight.openflowplugin.applications.frsync.SyncReactor}.
18 public class SyncupEntry {
19 private final FlowCapableNode after;
20 private final LogicalDatastoreType dsTypeAfter;
21 private final FlowCapableNode before;
22 private final LogicalDatastoreType dsTypeBefore;
24 public SyncupEntry(final FlowCapableNode after, final LogicalDatastoreType dsTypeAfter,
25 final FlowCapableNode before, final LogicalDatastoreType dsTypeBefore) {
27 this.dsTypeAfter = dsTypeAfter;
29 this.dsTypeBefore = dsTypeBefore;
32 public FlowCapableNode getAfter() {
36 public FlowCapableNode getBefore() {
40 public LogicalDatastoreType getDsTypeAfter() {
44 public LogicalDatastoreType getDsTypeBefore() {
48 public boolean isOptimizedConfigDelta() {
49 return dsTypeAfter == LogicalDatastoreType.CONFIGURATION && dsTypeBefore == LogicalDatastoreType.CONFIGURATION;
53 public boolean equals(Object obj) {
57 if (obj == null || getClass() != obj.getClass()) {
61 SyncupEntry that = (SyncupEntry) obj;
63 if (after != null ? !after.equals(that.after) : that.after != null) {
66 if (dsTypeAfter != that.dsTypeAfter) {
69 if (before != null ? !before.equals(that.before) : that.before != null) {
72 return dsTypeBefore == that.dsTypeBefore;
76 public int hashCode() {
78 int result = after != null ? after.hashCode() : 0;
79 result = prime * result + (dsTypeAfter != null ? dsTypeAfter.hashCode() : 0);
80 result = prime * result + (before != null ? before.hashCode() : 0);
81 result = prime * result + (dsTypeBefore != null ? dsTypeBefore.hashCode() : 0);