import { IgCollection } from './IgCollection';
import { markType } from './type';
import { SyncableObservableCollection$2 } from './SyncableObservableCollection$2';
import { FormatSpecifier as FormatSpecifier_internal } from './FormatSpecifier';
import { IgxFormatSpecifier as IgxFormatSpecifier } from './igx-format-specifier';
export class IgxFormatSpecifierCollection extends IgCollection {
    constructor(list) {
        super();
        if (!IgxFormatSpecifier.$type) {
            IgxFormatSpecifier.$type = markType(IgxFormatSpecifier, "IgxFormatSpecifier");
        }
        if (list) {
            for (let i = 0; i < list.length; i++) {
                this.add(list[i]);
            }
        }
    }
    _createInnerColl() {
        if (!IgxFormatSpecifier.$type) {
            IgxFormatSpecifier.$type = markType(IgxFormatSpecifier, "IgxFormatSpecifier");
        }
        let coll = new SyncableObservableCollection$2(IgxFormatSpecifier.$type, FormatSpecifier_internal.$type, 0);
        coll.compare = (ext, int) => {
            let comp = ext;
            if (comp._implementation) {
                comp = comp._implementation;
            }
            if (comp.equals) {
                return comp.equals(int);
            }
            return comp === int;
        };
        coll.createTo = (ext) => {
            return ext._implementation;
        };
        coll.createFrom = (int) => {
            let ext = int.externalObject;
            if (!ext) {
                ext = new IgxFormatSpecifier();
                if (ext) {
                    ext._implementation = int;
                }
            }
            return ext;
        };
        return coll;
    }
}
