Merge "Spec: OFPGC_ADD_OR_MOD support in openflowplugin"
[openflowplugin.git] / openflowjava / openflow-protocol-api / src / main / java / org / opendaylight / openflowjava / protocol / api / keys / TypeToClassKey.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.keys;
9
10 /**
11  * Key for a class type.
12  *
13  * @author michal.polkorab
14  */
15 public class TypeToClassKey {
16
17     private final short version;
18     private final int type;
19
20     /**
21      * Constructor.
22      *
23      * @param version wire protocol version
24      * @param type message type / code
25      */
26     public TypeToClassKey(short version, int type) {
27         this.version = version;
28         this.type = type;
29     }
30
31     @Override
32     public int hashCode() {
33         final int prime = 31;
34         int result = 1;
35         result = prime * result + type;
36         return result;
37     }
38
39     @Override
40     public boolean equals(Object obj) {
41         if (this == obj) {
42             return true;
43         }
44         if (obj == null) {
45             return false;
46         }
47         if (getClass() != obj.getClass()) {
48             return false;
49         }
50         TypeToClassKey other = (TypeToClassKey) obj;
51         if (type != other.type) {
52             return false;
53         }
54         if (version != other.version) {
55             return false;
56         }
57         return true;
58     }
59 }