1 package org.openflow.codec.protocol.statistics;
3 import java.io.Serializable;
5 import org.openflow.codec.io.IDataBuffer;
8 * Represents an ofp_table_stats structure
10 * @author David Erickson (daviderickson@cs.stanford.edu)
13 public class OFPTableStatistics implements OFPStatistics, Serializable {
14 private static final int MINIMUM_LENGTH = 24;
16 protected byte tableId;
17 protected int activeCount;
18 protected long lookupCount;
19 protected long matchedCount;
24 public byte getTableId() {
32 public void setTableId(byte tableId) {
33 this.tableId = tableId;
37 * @return the activeCount
39 public int getActiveCount() {
45 * the activeCount to set
47 public void setActiveCount(int activeCount) {
48 this.activeCount = activeCount;
52 * @return the lookupCount
54 public long getLookupCount() {
60 * the lookupCount to set
62 public void setLookupCount(long lookupCount) {
63 this.lookupCount = lookupCount;
67 * @return the matchedCount
69 public long getMatchedCount() {
75 * the matchedCount to set
77 public void setMatchedCount(long matchedCount) {
78 this.matchedCount = matchedCount;
82 public int getLength() {
83 return MINIMUM_LENGTH;
87 public void readFrom(IDataBuffer data) {
88 this.tableId = data.get();
92 this.activeCount = data.getInt();
93 this.lookupCount = data.getLong();
94 this.matchedCount = data.getLong();
98 public void writeTo(IDataBuffer data) {
99 data.put(this.tableId);
100 data.put((byte) 0); // pad
101 data.put((byte) 0); // pad
102 data.put((byte) 0); // pad
103 data.putInt(this.activeCount);
104 data.putLong(this.lookupCount);
105 data.putLong(this.matchedCount);
109 public int hashCode() {
110 final int prime = 449;
112 result = prime * result + activeCount;
113 result = prime * result + (int) (lookupCount ^ (lookupCount >>> 32));
114 result = prime * result + (int) (matchedCount ^ (matchedCount >>> 32));
115 result = prime * result + tableId;
120 public boolean equals(Object obj) {
127 if (!(obj instanceof OFPTableStatistics)) {
130 OFPTableStatistics other = (OFPTableStatistics) obj;
131 if (activeCount != other.activeCount) {
134 if (lookupCount != other.lookupCount) {
137 if (matchedCount != other.matchedCount) {
140 if (tableId != other.tableId) {