2 * Copyright (c) 2016 Pantheon Technologies s.r.o. 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.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
12 import org.opendaylight.yangtools.yang.common.Uint8;
15 * Identifier of {@link Flow} in datastore using combination of flow-id and table-id from datastore datapath.
17 public class FlowDescriptor {
19 private final FlowId flowId;
20 private final Uint8 tableId;
22 public FlowDescriptor(Flow flow) {
23 this.flowId = flow.getId();
24 this.tableId = flow.getTableId();
28 public boolean equals(Object obj) {
32 if (obj == null || getClass() != obj.getClass()) {
36 FlowDescriptor that = (FlowDescriptor) obj;
37 if (flowId != null ? !flowId.equals(that.flowId) : that.flowId != null) {
40 return tableId != null ? tableId.equals(that.tableId) : that.tableId == null;
45 public int hashCode() {
46 int result = flowId != null ? flowId.hashCode() : 0;
47 result = 31 * result + (tableId != null ? tableId.hashCode() : 0);