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