Merge "Bug 2347: DOMConcurrentDataCommitCoordinator uses wrong phase name"
[controller.git] / third-party / openflowj / src / main / java / org / openflow / protocol / action / OFActionNetworkLayerAddress.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_nw_addr
10  * @author David Erickson (daviderickson@cs.stanford.edu) - Mar 11, 2010
11  */
12 public abstract class OFActionNetworkLayerAddress extends OFAction {
13     public static int MINIMUM_LENGTH = 8;
14
15     protected int networkAddress;
16
17     /**
18      * @return the networkAddress
19      */
20     public int getNetworkAddress() {
21         return networkAddress;
22     }
23
24     /**
25      * @param networkAddress the networkAddress to set
26      */
27     public void setNetworkAddress(int networkAddress) {
28         this.networkAddress = networkAddress;
29     }
30
31     @Override
32     public void readFrom(ByteBuffer data) {
33         super.readFrom(data);
34         this.networkAddress = data.getInt();
35     }
36
37     @Override
38     public void writeTo(ByteBuffer data) {
39         super.writeTo(data);
40         data.putInt(this.networkAddress);
41     }
42
43     @Override
44     public int hashCode() {
45         final int prime = 353;
46         int result = super.hashCode();
47         result = prime * result + networkAddress;
48         return result;
49     }
50
51     @Override
52     public boolean equals(Object obj) {
53         if (this == obj) {
54             return true;
55         }
56         if (!super.equals(obj)) {
57             return false;
58         }
59         if (!(obj instanceof OFActionNetworkLayerAddress)) {
60             return false;
61         }
62         OFActionNetworkLayerAddress other = (OFActionNetworkLayerAddress) obj;
63         if (networkAddress != other.networkAddress) {
64             return false;
65         }
66         return true;
67     }
68 }