Cleaned up git
[iotcloud.git] / version1 / src / js / iotjs / orig / entry.js
1 class Entry{
2     constructor(slot) {
3         if (slot && slot instanceof Slot) {
4             
5             this.TypeKeyValue = 1;
6             this.TypeLastmessage = 2;
7             this.TypeRejectedMessage = 3;
8             this.TypeTableStatus = 4;
9             this.liveStatus = true;
10             this.parentslot = slot;
11             
12         }
13     }
14     static decode(slot, bytebuffer) {
15         if (slot instanceof Slot && bytebuffer instanceof ByteBuffer) {
16             var type = bytebuffer.readByte();
17             switch (type) {
18                 case this.TypeKeyValue:
19                     return KeyValue.decode(slot, bytebuffer);
20                 case this.TypeLastmessage:
21                     return LastMessage.decode(slot, bytebuffer);
22                 case this.TypeRejectedMessage:
23                     return RejectedMessage.decode(slot, bytebuffer);
24                 case this.TypeTableStatus:
25                     return TableStatus.decode(slot, bytebuffer);
26                 default:
27                     throw new Error("Unrecognized Entry Type: " + type);
28             }
29         }
30     }
31     isLive(){
32         return this.liveStatus;
33     }
34     setDead() {
35                 this.liveStatus = false;
36                 parentslot.decrementLiveCount();
37         }
38
39         encode(bytebuffer){
40
41         }
42         getSize(){
43
44         }
45         getType(){
46
47         }
48         getCopy(slot){
49                 if(slot && slot instanceof Slot){
50                         
51                 }
52         }
53 }