ELAN FT Support for BE
[vpnservice.git] / mdsalutil / mdsalutil-api / src / main / java / org / opendaylight / vpnservice / mdsalutil / FlowInfoKey.java
1 /*
2  * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. 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 package org.opendaylight.vpnservice.mdsalutil;
9
10 import java.math.BigInteger;
11
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
13
14 public final class FlowInfoKey {
15
16     private final BigInteger dpId;
17     private final short tableId;
18     private final Match matches;
19     private final String flowId;
20
21     public FlowInfoKey(BigInteger dpId, short tableId, Match matches, String flowId) {
22         this.dpId = dpId;
23         this.tableId = tableId;
24         this.matches = matches;
25         this.flowId = flowId;
26     }
27
28     public short getTableId() {
29         return tableId;
30     }
31
32     public Match getMatches() {
33         return matches;
34     }
35
36     public BigInteger getDpId() {
37         return dpId;
38     }
39
40     public String getFlowId() {
41         return flowId;
42     }
43
44     @Override
45     public int hashCode() {
46         final int prime = 31;
47         int result = 1;
48         result = prime * result + ((dpId == null) ? 0 : dpId.hashCode());
49         result = prime * result + ((matches == null) ? 0 : matches.hashCode());
50         result = prime * result + tableId;
51         return result;
52     }
53
54     @Override
55     public boolean equals(Object obj) {
56         if (this == obj)
57             return true;
58         if (obj == null)
59             return false;
60         if (getClass() != obj.getClass())
61             return false;
62         FlowInfoKey other = (FlowInfoKey) obj;
63         if (dpId == null) {
64             if (other.dpId != null)
65                 return false;
66         } else if (!dpId.equals(other.dpId))
67             return false;
68         if (matches == null) {
69             if (other.matches != null)
70                 return false;
71         } else if (!matches.equals(other.matches))
72             return false;
73         if (tableId != other.tableId)
74             return false;
75         return true;
76     }
77
78     @Override
79     public String toString() {
80         return "FlowStatisticsKey [dpId=" + dpId + ", tableId=" + tableId + ", matches=" + matches + "]";
81     }
82
83 }