Deleted Redundent Files
[iotcloud.git] / src / js / iotjs / src / tablestatus.js
1 'use strict';
2
3 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4
5 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
7 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
8
9 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
10
11 var TableStatus = function (_Entry) {
12         _inherits(TableStatus, _Entry);
13
14         function TableStatus(slot, _maxslots) {
15                 _classCallCheck(this, TableStatus);
16
17                 var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(TableStatus).call(this, slot));
18
19                 _this.maxslots = _maxslots;
20                 return _this;
21         }
22
23         _createClass(TableStatus, [{
24                 key: 'getMaxSlots',
25                 value: function getMaxSlots() {
26                         return this.maxslots;
27                 }
28         }, {
29                 key: 'encode',
30                 value: function encode(bb) {
31                         bb.writeByte(Entry.TypeTableStatus);
32                         bb.writeInt8(this.maxslots);
33                 }
34         }, {
35                 key: 'getSize',
36                 value: function getSize() {
37                         return 4 + 1;
38                 }
39         }, {
40                 key: 'getType',
41                 value: function getType() {
42                         return Entry.TypeTableStatus;
43                 }
44         }, {
45                 key: 'getcopy',
46                 value: function getcopy(s) {
47                         if (!(s instanceof Slot)) {
48                                 throw new Error('Argument Error: s is not an instanceof Slot');
49                         }
50                         return new TableStatus(s, this.maxslots);
51                 }
52         }], [{
53                 key: 'decode',
54                 value: function decode(slot, bb) {
55                         //bb is an object of the type bytebuffer See main.js file and its require section 
56                         //for more details
57                         if (!(bb instanceof ByteBuffer && slot instanceof Slot)) {
58                                 throw new Error('Argument Error: bb is not an instanceof Bytebuffer');
59                         }
60                         this.maxslots = bb.readByte();
61                         return new TableStatus(slot, this.maxslots);
62                 }
63         }]);
64
65         return TableStatus;
66 }(Entry);