BUG 2302 : odl-clustering-test-app should not be part of the odl-restconf-all feature set
[controller.git] / opendaylight / adsal / sal / api / src / main / java / org / opendaylight / controller / sal / reader / NodeTableStatistics.java
1 /*
2  * Copyright (c) 2013 Big Switch Networks, Inc.  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.sal.reader;
9
10 import java.io.Serializable;
11
12 import javax.xml.bind.annotation.XmlAccessType;
13 import javax.xml.bind.annotation.XmlAccessorType;
14 import javax.xml.bind.annotation.XmlElement;
15 import javax.xml.bind.annotation.XmlRootElement;
16
17 import org.opendaylight.controller.sal.core.NodeTable;
18
19 /**
20  * @author Aditya Prakash Vaja <aditya.vaja@bigswitch.com>
21  * Represents the Table statistics for the node
22  *
23  */
24
25 @XmlRootElement
26 @XmlAccessorType(XmlAccessType.NONE)
27 public class NodeTableStatistics implements Serializable {
28     private static final long serialVersionUID = 1L;
29
30     @XmlElement
31     private NodeTable nodeTable;
32     @XmlElement
33     private String name;
34     @XmlElement
35     private int activeCount;
36     @XmlElement
37     private long lookupCount;
38     @XmlElement
39     private long matchedCount;
40     @XmlElement
41     private int maximumEntries;
42
43
44     @Override
45     public int hashCode() {
46         final int prime = 31;
47         int result = 1;
48         result = prime * result + activeCount;
49         result = prime * result + (int) (lookupCount ^ (lookupCount >>> 32));
50         result = prime * result + (int) (matchedCount ^ (matchedCount >>> 32));
51         result = prime * result + maximumEntries;
52         result = prime * result + ((name == null) ? 0 : name.hashCode());
53         result = prime * result + ((nodeTable == null) ? 0 : nodeTable.hashCode());
54         return result;
55     }
56
57     @Override
58     public boolean equals(Object obj) {
59         if (this == obj) {
60             return true;
61         }
62         if (obj == null) {
63             return false;
64         }
65         if (!(obj instanceof NodeTableStatistics)) {
66             return false;
67         }
68         NodeTableStatistics other = (NodeTableStatistics) obj;
69         if (activeCount != other.activeCount) {
70             return false;
71         }
72         if (lookupCount != other.lookupCount) {
73             return false;
74         }
75         if (matchedCount != other.matchedCount) {
76             return false;
77         }
78         if (maximumEntries != other.maximumEntries) {
79             return false;
80         }
81         if (name == null) {
82             if (other.name != null) {
83                 return false;
84             }
85         } else if (!name.equals(other.name)) {
86             return false;
87         }
88         if (nodeTable == null) {
89             if (other.nodeTable != null) {
90                 return false;
91             }
92         } else if (!nodeTable.equals(other.nodeTable)) {
93             return false;
94         }
95         return true;
96     }
97
98     //To Satisfy JAXB
99     public NodeTableStatistics() {
100
101     }
102
103     /**
104      * @return the node table
105      */
106     public NodeTable getNodeTable() {
107         return nodeTable;
108     }
109
110     /**
111      * @param table of the node
112      */
113     public void setNodeTable(NodeTable table) {
114         this.nodeTable = table;
115     }
116
117     /**
118      * @return name of the table
119      */
120     public String getName() {
121         return name;
122     }
123
124     /**
125      * @param name - set the table name to name
126      */
127     public void setName(String name) {
128         this.name = name;
129     }
130
131     /**
132      * @return the activeCount
133      */
134     public int getActiveCount() {
135         return activeCount;
136     }
137
138     /**
139      * @param activeCount the activeCount to set
140      */
141     public void setActiveCount(int activeCount) {
142         this.activeCount = activeCount;
143     }
144
145     /**
146      * @return the lookupCount
147      */
148     public long getLookupCount() {
149         return lookupCount;
150     }
151
152     /**
153      * @param lookupCount the lookupCount to set
154      */
155     public void setLookupCount(long lookupCount) {
156         this.lookupCount = lookupCount;
157     }
158
159     /**
160      * @return the matchedCount
161      */
162     public long getMatchedCount() {
163         return matchedCount;
164     }
165
166     /**
167      * @param matchedCount the matchedCount to set
168      */
169     public void setMatchedCount(long matchedCount) {
170         this.matchedCount = matchedCount;
171     }
172
173     /**
174      * @return the maximumEntries
175      */
176     public int getMaximumEntries() {
177         return maximumEntries;
178     }
179
180     /**
181      * @param maximumEntries the maximumEntries to set
182      */
183     public void setMaximumEntries(int maximumEntries) {
184         this.maximumEntries = maximumEntries;
185     }
186
187     @Override
188     public String toString() {
189         return "NodeTableStats[tableId = " + nodeTable
190                 + ", activeCount = " + activeCount
191                 + ", lookupCount = " + lookupCount
192                 + ", matchedCount = " + matchedCount
193                 + ", maximumEntries = " + maximumEntries + "]";
194     }
195 }