UNPKG

markov-typescript

Version:

A Markov Chain library written in Typescript.

41 lines 1.5 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var Collections = require("typescript-collections"); var FixedQueue = (function (_super) { __extends(FixedQueue, _super); function FixedQueue(maxSize) { var _this = _super.call(this) || this; _this.maxSize = 0; _this.maxSize = maxSize; return _this; } FixedQueue.prototype.enqueue = function (elem) { var val = _super.prototype.enqueue.call(this, elem); this.enforceSize(); return val; }; FixedQueue.prototype.add = function (elem) { var val = _super.prototype.add.call(this, elem); this.enforceSize(); return val; }; FixedQueue.prototype.enforceSize = function () { while (this.size() > this.maxSize) { this.dequeue(); } }; return FixedQueue; }(Collections.Queue)); exports.FixedQueue = FixedQueue; ; //# sourceMappingURL=fixed-queue.js.map