Merge "Remove "response" from yang."
[packetcable.git] / packetcable-driver / src / main / java / org / pcmm / gates / impl / SessionClassID.java
1 /**
2  @header@
3  */
4 package org.pcmm.gates.impl;
5
6 import org.pcmm.gates.ISessionClassID;
7
8 /**
9  *
10  */
11 public class SessionClassID implements ISessionClassID {
12
13     private byte priority;
14     private byte preemption;
15
16     // TODO check this;
17     private byte session;
18
19     public SessionClassID() {
20         this((byte) 0);
21     }
22
23     public SessionClassID(byte value) {
24         session = value;
25         priority = 0;
26         preemption = 0;
27         priority |= value >> 2;
28         preemption |= value >> 3;
29
30     }
31
32     /*
33      * (non-Javadoc)
34      *
35      * @see org.pcmm.gates.ISessionClassID#getPriority()
36      */
37     @Override
38     public byte getPriority() {
39         return priority;
40     }
41
42     /*
43      * (non-Javadoc)
44      *
45      * @see org.pcmm.gates.ISessionClassID#setPriority(byte)
46      */
47     @Override
48     public void setPriority(byte value) {
49         this.priority = value;
50     }
51
52     /*
53      * (non-Javadoc)
54      *
55      * @see org.pcmm.gates.ISessionClassID#getPreemption()
56      */
57     @Override
58     public byte getPreemption() {
59         return preemption;
60     }
61
62     /*
63      * (non-Javadoc)
64      *
65      * @see org.pcmm.gates.ISessionClassID#setPreemption(byte)
66      */
67     @Override
68     public void setPreemption(byte value) {
69         this.preemption = value;
70     }
71
72     /*
73      * (non-Javadoc)
74      *
75      * @see org.pcmm.gates.ISessionClassID#toSingleByte()
76      */
77     @Override
78     public byte toSingleByte() {
79         // byte ret = 0;
80         // ret |= (priority << 2);
81         // ret |= (preemption & 0xf);
82         // return ret;
83         return session;
84     }
85 }