Mass replace CRLF->LF
[openflowjava.git] / openflow-protocol-api / src / main / java / org / opendaylight / openflowjava / protocol / api / keys / MatchEntryDeserializerKey.java
1 /*
2  * Copyright (c) 2014 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
9 package org.opendaylight.openflowjava.protocol.api.keys;
10
11 import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
12 import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterDeserializerKey;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
14
15 /**
16  * @author michal.polkorab
17  *
18  */
19 public final class MatchEntryDeserializerKey extends MessageCodeKey
20         implements ExperimenterDeserializerKey {
21
22     private int oxmField;
23     private Long experimenterId;
24
25     /**
26      * @param version protocol wire version
27      * @param oxmClass oxm_class (see specification)
28      * @param oxmField oxm_field (see specification)
29      */
30     public MatchEntryDeserializerKey(short version,
31             int oxmClass, int oxmField) {
32         super(version, oxmClass, MatchEntries.class);
33         this.oxmField = oxmField;
34     }
35
36     /**
37      * @param experimenterId experimenter / vendor ID
38      */
39     public void setExperimenterId(Long experimenterId) {
40         this.experimenterId = experimenterId;
41     }
42
43     @Override
44     public int hashCode() {
45         final int prime = 31;
46         int result = super.hashCode();
47         result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
48         result = prime * result + oxmField;
49         return result;
50     }
51
52     @Override
53     public boolean equals(Object obj) {
54         if (this == obj) {
55             return true;
56         }
57         if (!super.equals(obj)) {
58             return false;
59         }
60         if (getClass() != obj.getClass()) {
61             return false;
62         }
63         MatchEntryDeserializerKey other = (MatchEntryDeserializerKey) obj;
64         if (experimenterId == null) {
65             if (other.experimenterId != null) {
66                 return false;
67             }
68         } else if (!experimenterId.equals(other.experimenterId)) {
69             return false;
70         }
71         if (oxmField != other.oxmField) {
72             return false;
73         }
74         return true;
75     }
76
77     @Override
78     public String toString() {
79         return super.toString() + " oxm_field: " + oxmField + " experimenterID: " + experimenterId;
80     }
81 }