Fix checkstyle warnings in netconf-cli
[controller.git] / third-party / openflowj / src / main / java / org / openflow / protocol / action / OFActionVirtualLanIdentifier.java
1 /**
2  * @author David Erickson (daviderickson@cs.stanford.edu) - Mar 11, 2010
3  */
4 package org.openflow.protocol.action;
5
6 import java.nio.ByteBuffer;
7
8 /**
9  * Represents an ofp_action_vlan_vid
10  * @author David Erickson (daviderickson@cs.stanford.edu) - Mar 11, 2010
11  */
12 public class OFActionVirtualLanIdentifier extends OFAction {
13     public static int MINIMUM_LENGTH = 8;
14
15     protected short virtualLanIdentifier;
16
17     public OFActionVirtualLanIdentifier() {
18         super.setType(OFActionType.SET_VLAN_VID);
19         super.setLength((short) MINIMUM_LENGTH);
20     }
21
22     /**
23      * @return the virtualLanIdentifier
24      */
25     public short getVirtualLanIdentifier() {
26         return virtualLanIdentifier;
27     }
28
29     /**
30      * @param virtualLanIdentifier the virtualLanIdentifier to set
31      */
32     public void setVirtualLanIdentifier(short virtualLanIdentifier) {
33         this.virtualLanIdentifier = virtualLanIdentifier;
34     }
35
36     @Override
37     public void readFrom(ByteBuffer data) {
38         super.readFrom(data);
39         this.virtualLanIdentifier = data.getShort();
40         data.getShort();
41     }
42
43     @Override
44     public void writeTo(ByteBuffer data) {
45         super.writeTo(data);
46         data.putShort(this.virtualLanIdentifier);
47         data.putShort((short) 0);
48     }
49
50     @Override
51     public int hashCode() {
52         final int prime = 383;
53         int result = super.hashCode();
54         result = prime * result + virtualLanIdentifier;
55         return result;
56     }
57
58     @Override
59     public boolean equals(Object obj) {
60         if (this == obj) {
61             return true;
62         }
63         if (!super.equals(obj)) {
64             return false;
65         }
66         if (!(obj instanceof OFActionVirtualLanIdentifier)) {
67             return false;
68         }
69         OFActionVirtualLanIdentifier other = (OFActionVirtualLanIdentifier) obj;
70         if (virtualLanIdentifier != other.virtualLanIdentifier) {
71             return false;
72         }
73         return true;
74     }
75 }