Mass replace CRLF->LF
[openflowjava.git] / openflow-protocol-api / src / main / java / org / opendaylight / openflowjava / protocol / api / extensibility / EnhancedMessageCodeKey.java
1 /*
2  * Copyright (c) 2013 Pantheon Technologies s.r.o. 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.openflowjava.protocol.api.extensibility;
9
10 /**
11  * @author michal.polkorab
12  *
13  */
14 public class EnhancedMessageCodeKey extends MessageCodeKey {
15
16     private int msgType2;
17
18     /**
19      * Constructor
20      * @param version wire protocol version
21      * @param value used as distinguisher
22      * @param value2 used as detailed distinguisher
23      * @param clazz class of object that is going to be deserialized
24      */
25     public EnhancedMessageCodeKey(short version, int value, int value2, Class<?> clazz) {
26         super(version, value, clazz);
27         this.msgType2 = value2;
28     }
29
30     @Override
31     public int hashCode() {
32         final int prime = 31;
33         int result = super.hashCode();
34         result = prime * result + msgType2;
35         return result;
36     }
37
38     @Override
39     public boolean equals(Object obj) {
40         if (this == obj) {
41             return true;
42         }
43         if (!super.equals(obj)) {
44             return false;
45         }
46         if (getClass() != obj.getClass()) {
47             return false;
48         }
49         EnhancedMessageCodeKey other = (EnhancedMessageCodeKey) obj;
50         if (msgType2 != other.msgType2) {
51             return false;
52         }
53         return true;
54     }
55
56     @Override
57     public String toString() {
58         return super.toString() + " msgType2: " + msgType2;
59     }
60 }