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 import com.google.common.base.Objects.ToStringHelper;
15 public class EROPathKeyWith32PCEIDSubobject extends ExplicitRouteSubobject {
17 private final int pathKey;
19 private final byte[] pceId;
21 public EROPathKeyWith32PCEIDSubobject(int pathKey, byte[] pceId, boolean loose) {
23 this.pathKey = pathKey;
25 throw new IllegalArgumentException("PCE ID can't be null.");
27 if (pceId.length != 4)
28 throw new IllegalArgumentException("PCE ID is not 4 bytes long.");
33 public int getPathKey() {
37 public byte[] getPceId() {
42 public int hashCode() {
44 int result = super.hashCode();
45 result = prime * result + this.pathKey;
46 result = prime * result + Arrays.hashCode(this.pceId);
51 public boolean equals(Object obj) {
54 if (!super.equals(obj))
56 if (this.getClass() != obj.getClass())
58 final EROPathKeyWith32PCEIDSubobject other = (EROPathKeyWith32PCEIDSubobject) obj;
59 if (this.pathKey != other.pathKey)
61 if (!Arrays.equals(this.pceId, other.pceId))
67 protected ToStringHelper addToStringAttributes(ToStringHelper toStringHelper) {
68 toStringHelper.add("pathKey", this.pathKey);
69 toStringHelper.add("pceId", this.pceId);
70 return super.addToStringAttributes(toStringHelper);