public BandStat build() { return new BandStatImpl(this); }
public BandStatBuilder(BandStat base) { if (base.getKey() == null) { this._key = new BandStatKey( base.getBandId() ); this._bandId = base.getBandId(); } else { this._key = base.getKey(); this._bandId = _key.getBandId(); } this._byteBandCount = base.getByteBandCount(); this._packetBandCount = base.getPacketBandCount(); if (base instanceof BandStatImpl) { BandStatImpl _impl = (BandStatImpl) base; this.augmentation = new HashMap<>(_impl.augmentation); } }
private BandStatImpl(BandStatBuilder base) { if (base.getKey() == null) { this._key = new BandStatKey( base.getBandId() ); this._bandId = base.getBandId(); } else { this._key = base.getKey(); this._bandId = _key.getBandId(); } this._byteBandCount = base.getByteBandCount(); this._packetBandCount = base.getPacketBandCount(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.meter.band.stats.BandStat>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.meter.band.stats.BandStat>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.meter.band.stats.BandStat>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.meter.band.stats.BandStat>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
if (other.getBandId() != null) { return false; } else if(!_bandId.equals(other.getBandId())) { return false; if (other.getByteBandCount() != null) { return false; } else if(!_byteBandCount.equals(other.getByteBandCount())) { return false; if (other.getKey() != null) { return false; } else if(!_key.equals(other.getKey())) { return false; if (other.getPacketBandCount() != null) { return false; } else if(!_packetBandCount.equals(other.getPacketBandCount())) { return false; if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { return false;
BandStatBuilder bandStatBuilder = new BandStatBuilder(); bandStatBuilder.setByteBandCount(new Counter64(meterBandStats.getByteBandCount())); bandStatBuilder.setPacketBandCount(new Counter64(meterBandStats.getPacketBandCount())); BandId bandId = new BandId((long) bandKey); bandStatBuilder.setKey(new BandStatKey(bandId)); bandStatBuilder.setBandId(bandId); bandKey++; listAllBandStats.add(bandStatBuilder.build());
public BandStatBuilder setPacketBandCount(Counter64 value) { if (value != null) { BigInteger _constraint = value.getValue(); boolean isValidRange = false; for (Range<BigInteger> r : _packetBandCount_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _packetBandCount_range)); } } this._packetBandCount = value; return this; } public static List<Range<BigInteger>> _packetBandCount_range() {
public BandStatBuilder setByteBandCount(Counter64 value) { if (value != null) { BigInteger _constraint = value.getValue(); boolean isValidRange = false; for (Range<BigInteger> r : _byteBandCount_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _byteBandCount_range)); } } this._byteBandCount = value; return this; } public static List<Range<BigInteger>> _byteBandCount_range() {
public BandStatBuilder setBandId(BandId value) { if (value != null) { BigInteger _constraint = BigInteger.valueOf(value.getValue()); boolean isValidRange = false; for (Range<BigInteger> r : _bandId_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _bandId_range)); } } this._bandId = value; return this; } public static List<Range<BigInteger>> _bandId_range() {
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((_bandId == null) ? 0 : _bandId.hashCode()); result = prime * result + ((_byteBandCount == null) ? 0 : _byteBandCount.hashCode()); result = prime * result + ((_key == null) ? 0 : _key.hashCode()); result = prime * result + ((_packetBandCount == null) ? 0 : _packetBandCount.hashCode()); result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode()); return result; }
private JsonArrayBuilder createBandStatsJsonArrayObject(List<BandStat> bandStats) { JsonArrayBuilder jsonArrayObject = factory.createArrayBuilder(); for (BandStat bandStat : bandStats) { jsonArrayObject.add(factory.createObjectBuilder() .add(properties.getProperty("BAND_ID"), bandStat.getBandId().getValue()) .add(properties.getProperty("BYT_BAND_COUNT"), bandStat.getByteBandCount().getValue()) .add(properties.getProperty("KEY"), bandStat.getKey().getBandId().getValue()) .add(properties.getProperty("PCK_BAND_COUNT"), bandStat.getPacketBandCount().getValue())); } return jsonArrayObject; }