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 java.util.Arrays;
13 public class RROPathKeyWith32PCEIDSubobject extends ReportedRouteSubobject {
15 private final int pathKey;
17 private final byte[] pceId;
19 public RROPathKeyWith32PCEIDSubobject(int pathKey, byte[] pceId) {
21 this.pathKey = pathKey;
23 throw new IllegalArgumentException("PCE ID can't be null.");
25 if (pceId.length != 4)
26 throw new IllegalArgumentException("PCE ID is not 4 bytes long.");
31 public int getPathKey() {
35 public byte[] getPceId() {
40 public int hashCode() {
43 result = prime * result + this.pathKey;
44 result = prime * result + Arrays.hashCode(this.pceId);
49 public boolean equals(Object obj) {
54 if (this.getClass() != obj.getClass())
56 final RROPathKeyWith32PCEIDSubobject other = (RROPathKeyWith32PCEIDSubobject) obj;
57 if (this.pathKey != other.pathKey)
59 if (!Arrays.equals(this.pceId, other.pceId))
65 public String toString() {
66 final StringBuilder builder = new StringBuilder();
67 builder.append("RROPathKeyWith32PCEIDSubobject [pathKey=");
68 builder.append(this.pathKey);
69 builder.append(", pceId=");
70 builder.append(Arrays.toString(this.pceId));
72 return builder.toString();