@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((switchId == null) ? 0 : switchId.hashCode()); result = prime * result + ((type == null) ? 0 : type.ordinal()); return result; }
@SuppressWarnings("unchecked") // big hack; need to fix @Override public OFStatistics getStatistics(final OFType t, final OFStatisticsType st) { Class<? extends OFStatistics> c; if (t == OFType.STATS_REPLY) { if (st.getTypeValue() == -1) { c = OVXVendorStatistics.class; } else { c = OVXMessageFactory.CONVERT_STATS_REPLY_MAP[st.getTypeValue()]; } } else if (t == OFType.STATS_REQUEST) { if (st.getTypeValue() == -1) { c = OVXVendorStatistics.class; } else { c = OVXMessageFactory.CONVERT_STATS_REQUEST_MAP[st.getTypeValue()]; } } else { throw new RuntimeException("non-stats type in stats factory: " + t); } try { return c.getConstructor(new Class[] {}).newInstance(); } catch (final Exception e) { throw new RuntimeException(e); } } }
@Override public OFStatistics getStatistics(final OFType t, final OFStatisticsType st) { return st.newInstance(t); }
@Override public int hashCode() { final int prime = 317; int result = super.hashCode(); result = prime * result + this.flags; result = prime * result + (this.statisticType == null ? 0 : this.statisticType .hashCode()); result = prime * result + (this.statistics == null ? 0 : this.statistics.hashCode()); return result; }
OFStatisticsType.addMapping(this.type, OFType.STATS_REQUEST, this); OFStatisticsType.addMapping(this.type, OFType.STATS_REPLY, this);
return false; } else if (!this.statisticType.equals(other.statisticType)) { return false;
@Override public void readFrom(final ChannelBuffer data) { super.readFrom(data); this.statisticType = OFStatisticsType.valueOf(data.readShort(), this.getType()); this.flags = data.readShort(); if (this.statisticsFactory == null) { throw new RuntimeException("OFStatisticsFactory not set"); } this.statistics = this.statisticsFactory.parseStatistics( this.getType(), this.statisticType, data, super.getLengthU() - OFStatisticsMessageBase.MINIMUM_LENGTH); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((switchId == null) ? 0 : switchId.hashCode()); result = prime * result + ((type == null) ? 0 : type.ordinal()); return result; }
@Override public void writeTo(final ChannelBuffer data) { super.writeTo(data); data.writeShort(this.statisticType.getTypeValue()); data.writeShort(this.flags); if (this.statistics != null) { for (final OFStatistics statistic : this.statistics) { statistic.writeTo(data); } } }