/*
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 { IFastItemColumnInternal_$type } from "./IFastItemColumnInternal";
import { IFastItemColumn$1_$type } from "./IFastItemColumn$1";
import { Base, typeGetValue, Number_$type, markType } from "./type";
import { List$1 } from "./List$1";
import { NotImplementedException } from "./NotImplementedException";
import { FastItemColumn } from "./FastItemColumn";
export class FastItemIntColumn extends Base {
    constructor(a, b, c, d) {
        super();
        this.f = null;
        this.c = false;
        this.a = null;
        this._propertyName = null;
        this.h = 0;
        this.g = 0;
        this.e = null;
        this.f = c;
        this.c = d;
        this.propertyName = b;
        this.b = a;
    }
    get b() {
        return this.a;
    }
    set b(a) {
        this.a = a;
        this.reset();
    }
    get propertyName() {
        return this._propertyName;
    }
    set propertyName(a) {
        this._propertyName = a;
    }
    get minimum() {
        return this.h;
    }
    set minimum(a) {
        this.h = a;
    }
    get maximum() {
        return this.g;
    }
    set maximum(a) {
        this.g = a;
    }
    item(a, b) {
        if (arguments.length === 2) {
            return b;
        }
        else {
            return this.e._inner[a];
        }
    }
    getEnumerator() {
        return this.e.getEnumerator();
    }
    getEnumeratorObject() {
        return this.e.getEnumerator();
    }
    contains(a) {
        return this.e.contains(a);
    }
    copyTo(a, b) {
        this.e.copyTo(a, b);
    }
    get count() {
        return this.e.count;
    }
    get isReadOnly() {
        return true;
    }
    indexOf(a) {
        return this.e.indexOf(a);
    }
    add(a) {
        throw new NotImplementedException(0);
    }
    clear() {
        throw new NotImplementedException(0);
    }
    remove(a) {
        throw new NotImplementedException(0);
    }
    insert(a, b) {
        throw new NotImplementedException(0);
    }
    removeAt(a) {
        throw new NotImplementedException(0);
    }
    reset() {
        this.e = null;
        return this.b != null ? this.insertRange(0, this.b.count) : true;
    }
    insertRange(a, b) {
        let c = new Array(b);
        let source_ = this.a.asArray();
        let item_;
        let d = this.minimum;
        let e = this.maximum;
        let f = 0;
        let g = this.f;
        let propertyName_ = this._propertyName;
        let sourceItem_;
        if (this.f != null || this.c) {
            for (let i_ = a; i_ < a + b; ++i_) {
                sourceItem_ = source_[i_];
                item_ = (source_[i_][propertyName_]);
                if (this.c) {
                    if ((typeof (item_) == 'function')) {
                        item_ = item_.apply(sourceItem_);
                    }
                }
                if (g != null) {
                    item_ = g(item_);
                }
                let h = item_ == null ? 0 : typeGetValue(item_);
                c[f] = h;
                f++;
            }
        }
        else {
            for (let i_ = a; i_ < a + b; ++i_) {
                item_ = (source_[i_][propertyName_]);
                let i = item_ == null ? 0 : typeGetValue(item_);
                c[f] = i;
                f++;
            }
        }
        if (this.e == null) {
            this.e = new List$1(Number_$type, 1, c);
        }
        else {
            this.e.t(a, c);
        }
        return true;
    }
    replaceRange(a, b) {
        let c = false;
        for (let d = 0; d < b; ++d) {
            let e = this.e._inner[a + d];
            let f = this.i(this.b.item(a + d));
            if (e != f) {
                this.e._inner[a + d] = f;
                c = true;
            }
        }
        return c;
    }
    removeRange(a, b) {
        this.e.v(a, b);
        return true;
    }
    i(a) {
        let sourceItem_ = a;
        let from_ = a;
        let propertyName_ = this._propertyName;
        a = from_[propertyName_];
        if (this.c) {
            from_ = a;
            if ((typeof (from_) == 'function')) {
                a = from_.apply(sourceItem_);
            }
        }
        if (this.f != null) {
            a = this.f(a);
        }
        if (a == null) {
            return 0;
        }
        return typeGetValue(a);
    }
    get mayContainUnknowns() {
        return true;
    }
    d() {
        return FastItemColumn.e(this.e, (a, b) => {
            let c = typeGetValue(a);
            let d = typeGetValue(b);
            if (c < d) {
                return -1;
            }
            if (c > d) {
                return 1;
            }
            return 0;
        });
    }
    asArray() {
        return this.e.asArray();
    }
    getItem(a) {
        return this.item(a);
    }
}
FastItemIntColumn.$t = markType(FastItemIntColumn, 'FastItemIntColumn', Base.$, [IFastItemColumnInternal_$type, IFastItemColumn$1_$type.specialize(Number_$type)]);
//# sourceMappingURL=FastItemIntColumn.js.map