Cleaned up git
[iotcloud.git] / version1 / src / js / iotjs / orig / entry.js
diff --git a/version1/src/js/iotjs/orig/entry.js b/version1/src/js/iotjs/orig/entry.js
new file mode 100644 (file)
index 0000000..8421d5a
--- /dev/null
@@ -0,0 +1,53 @@
+class Entry{
+    constructor(slot) {
+        if (slot && slot instanceof Slot) {
+            
+            this.TypeKeyValue = 1;
+            this.TypeLastmessage = 2;
+            this.TypeRejectedMessage = 3;
+            this.TypeTableStatus = 4;
+            this.liveStatus = true;
+            this.parentslot = slot;
+            
+        }
+    }
+    static decode(slot, bytebuffer) {
+        if (slot instanceof Slot && bytebuffer instanceof ByteBuffer) {
+            var type = bytebuffer.readByte();
+            switch (type) {
+                case this.TypeKeyValue:
+                    return KeyValue.decode(slot, bytebuffer);
+                case this.TypeLastmessage:
+                    return LastMessage.decode(slot, bytebuffer);
+                case this.TypeRejectedMessage:
+                    return RejectedMessage.decode(slot, bytebuffer);
+                case this.TypeTableStatus:
+                    return TableStatus.decode(slot, bytebuffer);
+                default:
+                    throw new Error("Unrecognized Entry Type: " + type);
+            }
+        }
+    }
+    isLive(){
+       return this.liveStatus;
+    }
+    setDead() {
+               this.liveStatus = false;
+               parentslot.decrementLiveCount();
+       }
+
+       encode(bytebuffer){
+
+       }
+       getSize(){
+
+       }
+       getType(){
+
+       }
+       getCopy(slot){
+               if(slot && slot instanceof Slot){
+                       
+               }
+       }
+}
\ No newline at end of file