2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.protocol.pcep.object;
10 import org.opendaylight.protocol.pcep.PCEPObject;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nps.concepts.rev130930.Bandwidth;
13 import com.google.common.base.Objects.ToStringHelper;
16 * Structure for PCEP Load Balancing Object.
18 * @see <a href="http://tools.ietf.org/html/rfc5440#section-7.16">PCEP Load Balancing Object</a>
20 public class PCEPLoadBalancingObject extends PCEPObject {
22 private final int maxLSP;
24 private final Bandwidth minBandwidth;
27 * Constructs Load Balancing Object.
30 * @param minBandwidth Bandwidth
31 * @param processed boolean
33 public PCEPLoadBalancingObject(final int maxLSP, final Bandwidth minBandwidth, final boolean processed) {
34 super(processed, false);
36 this.minBandwidth = minBandwidth;
44 public int getMaxLSP() {
49 * Gets Minimal bandwidth.
53 public Bandwidth getMinBandwidth() {
54 return this.minBandwidth;
58 public int hashCode() {
60 int result = super.hashCode();
61 result = prime * result + this.maxLSP;
62 result = prime * result + ((this.minBandwidth == null) ? 0 : this.minBandwidth.hashCode());
67 public boolean equals(final Object obj) {
70 if (!super.equals(obj))
72 if (this.getClass() != obj.getClass())
74 final PCEPLoadBalancingObject other = (PCEPLoadBalancingObject) obj;
75 if (this.maxLSP != other.maxLSP)
77 if (this.minBandwidth == null) {
78 if (other.minBandwidth != null)
80 } else if (!this.minBandwidth.equals(other.minBandwidth))
86 protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
87 toStringHelper.add("maxLSP", this.maxLSP);
88 toStringHelper.add("minBandwidth", this.minBandwidth);
89 return super.addToStringAttributes(toStringHelper);