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
9 package org.opendaylight.protocol.pcep.subobject;
11 import com.google.common.base.Objects;
12 import com.google.common.base.Objects.ToStringHelper;
15 * Structure of Label subobject.
17 * @see <a href="http://tools.ietf.org/html/rfc3473#section-5.1">Label ERO
20 public abstract class RROLabelSubobject extends ReportedRouteSubobject {
22 private final boolean upStream;
25 * Constructs new Label subobject.
28 * if set label is upstream
34 public RROLabelSubobject(boolean upStream) {
35 this.upStream = upStream;
38 public boolean isUpStream() {
43 public int hashCode() {
45 int result = super.hashCode();
46 result = prime * result + (this.upStream ? 1231 : 1237);
51 public boolean equals(Object obj) {
54 if (!super.equals(obj))
56 if (this.getClass() != obj.getClass())
58 final RROLabelSubobject other = (RROLabelSubobject) obj;
59 if (this.upStream != other.upStream)
65 public String toString(){
66 return this.addToStringAttributes(Objects.toStringHelper(this)).toString();
69 protected ToStringHelper addToStringAttributes(ToStringHelper toStringHelper) {
70 toStringHelper.add("upStream", this.upStream);
71 return toStringHelper;