X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=third-party%2Fopenflowj%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenflow%2Fprotocol%2FOFStatisticsMessageBase.java;fp=third-party%2Fopenflowj%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenflow%2Fprotocol%2FOFStatisticsMessageBase.java;h=0000000000000000000000000000000000000000;hp=0014bcfd26e4ff62e355bfdae43af9fec1f8f21c;hb=e1c04c5af263a9604a765f1ab98be51dfc51d8cb;hpb=a935ffda7f26be29de879a47b426d0db7a28d588 diff --git a/third-party/openflowj/src/main/java/org/openflow/protocol/OFStatisticsMessageBase.java b/third-party/openflowj/src/main/java/org/openflow/protocol/OFStatisticsMessageBase.java deleted file mode 100644 index 0014bcfd26..0000000000 --- a/third-party/openflowj/src/main/java/org/openflow/protocol/OFStatisticsMessageBase.java +++ /dev/null @@ -1,140 +0,0 @@ -package org.openflow.protocol; - -import java.nio.ByteBuffer; -import java.util.List; - -import org.openflow.protocol.factory.OFStatisticsFactory; -import org.openflow.protocol.factory.OFStatisticsFactoryAware; -import org.openflow.protocol.statistics.OFStatistics; -import org.openflow.protocol.statistics.OFStatisticsType; - - -/** - * Base class for statistics requests/replies - * - * @author David Erickson (daviderickson@cs.stanford.edu) - Mar 27, 2010 - */ -public abstract class OFStatisticsMessageBase extends OFMessage implements - OFStatisticsFactoryAware { - public static int MINIMUM_LENGTH = 12; - - protected OFStatisticsFactory statisticsFactory; - protected OFStatisticsType statisticType; - protected short flags; - protected List statistics; - - /** - * @return the statisticType - */ - public OFStatisticsType getStatisticType() { - return statisticType; - } - - /** - * @param statisticType the statisticType to set - */ - public void setStatisticType(OFStatisticsType statisticType) { - this.statisticType = statisticType; - } - - /** - * @return the flags - */ - public short getFlags() { - return flags; - } - - /** - * @param flags the flags to set - */ - public void setFlags(short flags) { - this.flags = flags; - } - - /** - * @return the statistics - */ - public List getStatistics() { - return statistics; - } - - /** - * @param statistics the statistics to set - */ - public void setStatistics(List statistics) { - this.statistics = statistics; - } - - @Override - public void setStatisticsFactory(OFStatisticsFactory statisticsFactory) { - this.statisticsFactory = statisticsFactory; - } - - @Override - public void readFrom(ByteBuffer data) { - super.readFrom(data); - this.statisticType = OFStatisticsType.valueOf(data.getShort(), this - .getType()); - this.flags = data.getShort(); - if (this.statisticsFactory == null) - throw new RuntimeException("OFStatisticsFactory not set"); - this.statistics = statisticsFactory.parseStatistics(this.getType(), - this.statisticType, data, super.getLengthU() - MINIMUM_LENGTH); - } - - @Override - public void writeTo(ByteBuffer data) { - super.writeTo(data); - data.putShort(this.statisticType.getTypeValue()); - data.putShort(this.flags); - if (this.statistics != null) { - for (OFStatistics statistic : this.statistics) { - statistic.writeTo(data); - } - } - } - - @Override - public int hashCode() { - final int prime = 317; - int result = super.hashCode(); - result = prime * result + flags; - result = prime * result - + ((statisticType == null) ? 0 : statisticType.hashCode()); - result = prime * result - + ((statistics == null) ? 0 : statistics.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!super.equals(obj)) { - return false; - } - if (!(obj instanceof OFStatisticsMessageBase)) { - return false; - } - OFStatisticsMessageBase other = (OFStatisticsMessageBase) obj; - if (flags != other.flags) { - return false; - } - if (statisticType == null) { - if (other.statisticType != null) { - return false; - } - } else if (!statisticType.equals(other.statisticType)) { - return false; - } - if (statistics == null) { - if (other.statistics != null) { - return false; - } - } else if (!statistics.equals(other.statistics)) { - return false; - } - return true; - } -}