Phone app (based on Ali's Control for iotcloud benchmark) to control alarm in the...
[iot2.git] / benchmarks / other / PhoneInterface / Control / app / src / main / java / iotcloud / TableStatus.java
1 package iotcloud;
2 import java.nio.ByteBuffer;
3
4 /**
5  * TableStatus entries record the current size of the data structure
6  * in slots.  Used to remember the size and to perform resizes.
7  * @author Brian Demsky
8  * @version 1.0
9  */
10
11
12 class TableStatus extends Entry {
13         private int maxslots;
14
15         TableStatus(Slot slot, int _maxslots) {
16                 super(slot);
17                 maxslots=_maxslots;
18         }
19
20         int getMaxSlots() {
21                 return maxslots;
22         }
23
24         static Entry decode(Slot slot, ByteBuffer bb) {
25                 int maxslots=bb.getInt();
26                 return new TableStatus(slot, maxslots);
27         }
28
29         void encode(ByteBuffer bb) {
30                 bb.put(Entry.TypeTableStatus);
31                 bb.putInt(maxslots);
32         }
33
34         int getSize() {
35                 //return Integer.BYTES+Byte.BYTES;
36                 return (Integer.SIZE/8)+(Byte.SIZE/8);
37         }
38
39         byte getType() {
40                 return Entry.TypeTableStatus;
41         }
42
43         Entry getCopy(Slot s) {
44                 return new TableStatus(s, maxslots);
45         }
46 }