/*
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 { Base, BaseError, typeCast, markType } from "igniteui-react-core/ES2015/type";
import { Node } from "./Node";
/**
 * @hidden
 */
export class IgQueue$1 extends Base {
    constructor($t) {
        super();
        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);
    }
    get d() {
        return (this.e == 0);
    }
    get f() {
        return this.e;
    }
    h(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++;
    }
    g(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');
