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 org.opendaylight.protocol.concepts.IPv4Address;
12 import org.opendaylight.protocol.pcep.concepts.UnnumberedInterfaceIdentifier;
15 * Structure of unnumbered Iterface Subobject.
17 * @see <a href="http://tools.ietf.org/html/rfc3477">Section 4: Signalling
18 * Unnumbered Links in EROs</a>
20 public class RROUnnumberedInterfaceSubobject extends ReportedRouteSubobject {
21 private final UnnumberedInterfaceIdentifier interfaceID;
22 private final IPv4Address routerID;
25 * Constructs new Unnumbered Interface Subobject.
30 * UnnumberedInterfaceIdentifier
32 public RROUnnumberedInterfaceSubobject(final IPv4Address routerID, final UnnumberedInterfaceIdentifier interfaceID) {
34 this.routerID = routerID;
35 this.interfaceID = interfaceID;
39 * Gets {@link IPv4Address} representation of router ID.
43 public IPv4Address getRouterID() {
48 * Gets {@link UnnumberedInterfaceIdentifier} representation of Interface
51 * @return UnnumberedInterfaceIdentifier
53 public UnnumberedInterfaceIdentifier getInterfaceID() {
54 return this.interfaceID;
58 public int hashCode() {
61 result = prime * result + ((this.interfaceID == null) ? 0 : this.interfaceID.hashCode());
62 result = prime * result + ((this.routerID == null) ? 0 : this.routerID.hashCode());
67 public boolean equals(Object obj) {
72 if (this.getClass() != obj.getClass())
74 final RROUnnumberedInterfaceSubobject other = (RROUnnumberedInterfaceSubobject) obj;
75 if (this.interfaceID == null) {
76 if (other.interfaceID != null)
78 } else if (!this.interfaceID.equals(other.interfaceID))
80 if (this.routerID == null) {
81 if (other.routerID != null)
83 } else if (!this.routerID.equals(other.routerID))
89 public String toString() {
90 final StringBuilder builder = new StringBuilder();
91 builder.append("RROUnnumberedInterfaceSubobject [interfaceID=");
92 builder.append(this.interfaceID);
93 builder.append(", routerID=");
94 builder.append(this.routerID);
96 return builder.toString();