Changes
[iotcloud.git] / version2 / src / 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         }
37
38         byte getType() {
39                 return Entry.TypeTableStatus;
40         }
41
42         Entry getCopy(Slot s) {
43                 return new TableStatus(s, maxslots);
44         }
45 }