Bug-2230: Revision of module RSVP
[bgpcep.git] / pcep / spi / src / main / java / org / opendaylight / protocol / pcep / spi / PCEPErrorIdentifier.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.protocol.pcep.spi;
9
10 import java.io.Serializable;
11
12 /**
13  * Caret for combination of Error-type and Error-value
14  */
15 final class PCEPErrorIdentifier implements Serializable {
16     private static final long serialVersionUID = 2434590156751699872L;
17     private final short type;
18     private final short value;
19
20     PCEPErrorIdentifier(final short type, final short value) {
21         this.type = type;
22         this.value = value;
23     }
24
25     public short getType() {
26         return this.type;
27     }
28
29     public short getValue() {
30         return this.value;
31     }
32
33     @Override
34     public int hashCode() {
35         final int prime = 31;
36         int result = 1;
37         result = prime * result + this.type;
38         result = prime * result + this.value;
39         return result;
40     }
41
42     @Override
43     public boolean equals(final java.lang.Object obj) {
44         if (this == obj) {
45             return true;
46         }
47         if (obj == null || this.getClass() != obj.getClass()) {
48             return false;
49         }
50         final PCEPErrorIdentifier other = (PCEPErrorIdentifier) obj;
51         if (this.type != other.type || this.value != other.value) {
52             return false;
53         }
54         return true;
55     }
56
57     @Override
58     public String toString() {
59         return "type " + this.type + " value " + this.value;
60     }
61 }