"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * Unbounded queue backed by a mutable javascript array.
 */
var MutableQueue = /** @class */ (function () {
    function MutableQueue() {
        this.queue = [];
    }
    MutableQueue.prototype.dequeue = function () {
        if (this.queue.length === 0) {
            throw new Error("Queue is empty");
        }
        var dequeued = this.queue.pop();
        if (dequeued === undefined) {
            throw new Error("dequeued item was undefined");
        }
        return dequeued;
    };
    MutableQueue.prototype.enqueue = function (item) {
        this.queue.unshift(item);
    };
    MutableQueue.prototype.isEmpty = function () {
        return this.queue.length === 0;
    };
    MutableQueue.prototype.size = function () {
        return this.queue.length;
    };
    return MutableQueue;
}());
exports.MutableQueue = MutableQueue;
//# sourceMappingURL=MutableQueue.js.map