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.concepts;
10 import org.opendaylight.protocol.concepts.Identifier;
13 * A 32-bit (unsigned) identifying an interface within a router. This identifier
14 * is explicitly local to the router, e.g. each router has its own namespace.
16 public final class UnnumberedInterfaceIdentifier implements Comparable<UnnumberedInterfaceIdentifier>, Identifier {
18 private static final long serialVersionUID = -8488014237579913120L;
20 private final long interfaceId;
23 * Creates an instance of UnnumberedInterfaceIdentifier from long number.
26 * long the value of the UnnumberedInterfaceIdentifier
28 public UnnumberedInterfaceIdentifier(final long interfaceId) {
29 if (interfaceId < 0 || interfaceId > 4294967295L)
30 throw new IllegalArgumentException("Invalid link identifier");
31 this.interfaceId = interfaceId;
35 * Getter for Interface Id represented as long.
37 * @return long representation of Interface Id. From 0 to 4294967295.
39 public long getInterfaceId() {
40 return this.interfaceId;
44 public int compareTo(final UnnumberedInterfaceIdentifier o) {
45 if (this.interfaceId < o.getInterfaceId())
47 if (this.interfaceId > o.getInterfaceId())
53 public int hashCode() {
56 result = prime * result + (int) (this.interfaceId ^ (this.interfaceId >>> 32));
61 public boolean equals(Object obj) {
66 if (this.getClass() != obj.getClass())
68 final UnnumberedInterfaceIdentifier other = (UnnumberedInterfaceIdentifier) obj;
69 if (this.interfaceId != other.interfaceId)
75 public String toString() {
76 final StringBuilder builder = new StringBuilder();
77 builder.append("UnnumberedInterfaceIdentifier [interfaceId=");
78 builder.append(this.interfaceId);
80 return builder.toString();