2 * Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may
6 * not use this file except in compliance with the License. You may obtain
7 * a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations
18 package org.openflow.protocol.statistics;
21 import org.jboss.netty.buffer.ChannelBuffer;
24 * Represents an ofp_aggregate_stats_reply structure
25 * @author David Erickson (daviderickson@cs.stanford.edu)
27 public class OFAggregateStatisticsReply implements OFStatistics {
28 protected long packetCount;
29 protected long byteCount;
30 protected int flowCount;
33 * @return the packetCount
35 public long getPacketCount() {
40 * @param packetCount the packetCount to set
42 public void setPacketCount(long packetCount) {
43 this.packetCount = packetCount;
47 * @return the byteCount
49 public long getByteCount() {
54 * @param byteCount the byteCount to set
56 public void setByteCount(long byteCount) {
57 this.byteCount = byteCount;
61 * @return the flowCount
63 public int getFlowCount() {
68 * @param flowCount the flowCount to set
70 public void setFlowCount(int flowCount) {
71 this.flowCount = flowCount;
75 public int getLength() {
80 public void readFrom(ChannelBuffer data) {
81 this.packetCount = data.readLong();
82 this.byteCount = data.readLong();
83 this.flowCount = data.readInt();
84 data.readInt(); // pad
88 public void writeTo(ChannelBuffer data) {
89 data.writeLong(this.packetCount);
90 data.writeLong(this.byteCount);
91 data.writeInt(this.flowCount);
92 data.writeInt(0); // pad
96 public int hashCode() {
97 final int prime = 397;
99 result = prime * result + (int) (byteCount ^ (byteCount >>> 32));
100 result = prime * result + flowCount;
101 result = prime * result + (int) (packetCount ^ (packetCount >>> 32));
106 public boolean equals(Object obj) {
113 if (!(obj instanceof OFAggregateStatisticsReply)) {
116 OFAggregateStatisticsReply other = (OFAggregateStatisticsReply) obj;
117 if (byteCount != other.byteCount) {
120 if (flowCount != other.flowCount) {
123 if (packetCount != other.packetCount) {