/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import * as tslib_1 from "tslib";
import { Base, BaseError, typeCast, markType } from "igniteui-react-core/ES5/type";
import { Node } from "./Node";
/**
 * @hidden
 */
var IgQueue$1 = /** @class */ (function (_super) {
    tslib_1.__extends(IgQueue$1, _super);
    function IgQueue$1($t) {
        var _this = _super.call(this) || this;
        _this.$t = null;
        _this.e = 0;
        _this.b = null;
        _this.a = null;
        _this.c = null;
        _this.$t = $t;
        _this.$type = _this.$type.specialize(_this.$t);
        return _this;
    }
    Object.defineProperty(IgQueue$1.prototype, "d", {
        get: function () {
            return (this.e == 0);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgQueue$1.prototype, "f", {
        get: function () {
            return this.e;
        },
        enumerable: true,
        configurable: true
    });
    IgQueue$1.prototype.h = function (a) {
        if (this.e == 0) {
            this.b = this.a = new Node(a, this.b);
        }
        else {
            this.a.a = new Node(a, this.a.a);
            this.a = this.a.a;
        }
        this.e++;
    };
    IgQueue$1.prototype.g = function (a) {
        this.c = this.b;
        if (this.e == 0) {
            throw new BaseError(1, "tried to serve from an empty Queue");
        }
        this.b = this.b.a;
        this.e--;
        a = typeCast(this.$t, this.c.b);
        return {
            p0: a
        };
    };
    IgQueue$1.$t = markType(IgQueue$1, 'IgQueue$1');
    return IgQueue$1;
}(Base));
export { IgQueue$1 };
