X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=third-party%2Fopenflow-codec%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenflow%2Fcodec%2Fprotocol%2FOFPMultipartMessageBase.java;fp=third-party%2Fopenflow-codec%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenflow%2Fcodec%2Fprotocol%2FOFPMultipartMessageBase.java;h=0000000000000000000000000000000000000000;hb=64fe0fbca1a6c2b77ad25f568d73a7eb64236d16;hp=d0bff3f812f605226b55bca822a1ed98103e0f2b;hpb=8b9a3ff2bbc83941254b46b818cbbae5cc1a3a5b;p=openflowjava.git diff --git a/third-party/openflow-codec/src/main/java/org/openflow/codec/protocol/OFPMultipartMessageBase.java b/third-party/openflow-codec/src/main/java/org/openflow/codec/protocol/OFPMultipartMessageBase.java deleted file mode 100644 index d0bff3f8..00000000 --- a/third-party/openflow-codec/src/main/java/org/openflow/codec/protocol/OFPMultipartMessageBase.java +++ /dev/null @@ -1,141 +0,0 @@ -package org.openflow.codec.protocol; - -import java.util.List; - -import org.openflow.codec.io.IDataBuffer; -import org.openflow.codec.protocol.factory.OFPStatisticsFactory; -import org.openflow.codec.protocol.factory.OFPStatisticsFactoryAware; -import org.openflow.codec.protocol.statistics.OFPMultipartTypes; -import org.openflow.codec.protocol.statistics.OFPStatistics; - -/** - * Base class for Multipart requests/replies - * - * @author David Erickson (daviderickson@cs.stanford.edu) - Mar 27, 2010 - * @author AnilGujele - */ -public abstract class OFPMultipartMessageBase extends OFPMessage implements OFPStatisticsFactoryAware { - public static int MINIMUM_LENGTH = 16; - - protected OFPStatisticsFactory statisticsFactory; - protected OFPMultipartTypes multipartType; - protected short flags; - protected List statistics; - - /** - * @return the multipartType - */ - public OFPMultipartTypes getMultipartType() { - return multipartType; - } - - /** - * @param multipartType - * the multipartType to set - */ - public void setMultipartType(OFPMultipartTypes multipartType) { - this.multipartType = multipartType; - } - - /** - * @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(OFPStatisticsFactory statisticsFactory) { - this.statisticsFactory = statisticsFactory; - } - - @Override - public void readFrom(IDataBuffer data) { - super.readFrom(data); - this.multipartType = OFPMultipartTypes.valueOf(data.getShort(), this.getType()); - this.flags = data.getShort(); - data.getInt(); // pad - if (this.statisticsFactory == null) - throw new RuntimeException("OFPStatisticsFactory not set"); - this.statistics = statisticsFactory.parseStatistics(this.getType(), this.multipartType, data, - super.getLengthU() - MINIMUM_LENGTH); - } - - @Override - public void writeTo(IDataBuffer data) { - super.writeTo(data); - data.putShort(this.multipartType.getTypeValue()); - data.putShort(this.flags); - data.putInt(0); // pad - if (this.statistics != null) { - for (OFPStatistics 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 + ((multipartType == null) ? 0 : multipartType.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 OFPMultipartMessageBase)) { - return false; - } - OFPMultipartMessageBase other = (OFPMultipartMessageBase) obj; - if (flags != other.flags) { - return false; - } - if (multipartType == null) { - if (other.multipartType != null) { - return false; - } - } else if (!multipartType.equals(other.multipartType)) { - return false; - } - if (statistics == null) { - if (other.statistics != null) { - return false; - } - } else if (!statistics.equals(other.statistics)) { - return false; - } - return true; - } -}