BUG 1839 - HTTP delete of non existing data
[controller.git] / opendaylight / md-sal / statistics-manager / src / main / java / org / opendaylight / controller / md / statistics / manager / FlowStatsEntry.java
1 /*
2  * Copyright IBM Corporation, 2013.  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.controller.md.statistics.manager;
9
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
11
12 final class FlowStatsEntry {
13     private final Short tableId;
14     private final Flow flow;
15
16     public FlowStatsEntry(Short tableId, Flow flow){
17         this.tableId = tableId;
18         this.flow = flow;
19     }
20
21     public Short getTableId() {
22         return tableId;
23     }
24
25     public Flow getFlow() {
26         return flow;
27     }
28
29     @Override
30     public int hashCode() {
31         final int prime = 31;
32         int result = 1;
33         result = prime * result + ((flow == null) ? 0 : flow.hashCode());
34         result = prime * result + ((tableId == null) ? 0 : tableId.hashCode());
35         return result;
36     }
37
38     @Override
39     public boolean equals(Object obj) {
40         if (this == obj)
41             return true;
42         if (obj == null)
43             return false;
44         if (getClass() != obj.getClass())
45             return false;
46         FlowStatsEntry other = (FlowStatsEntry) obj;
47         if (flow == null) {
48             if (other.flow != null)
49                 return false;
50         } else if (!flow.equals(other.flow))
51             return false;
52         if (tableId == null) {
53             if (other.tableId != null)
54                 return false;
55         } else if (!tableId.equals(other.tableId))
56             return false;
57         return true;
58     }
59
60     @Override
61     public String toString() {
62         return "FlowStatsEntry [tableId=" + tableId + ", flow=" + flow + "]";
63     }
64 }