You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
1.6 KiB
1 lines
1.6 KiB
{"version":3,"file":"Set.js","sourceRoot":"","sources":["../../src/util/Set.ts"],"names":[],"mappings":";AAAA,qBAAqB,QAAQ,CAAC,CAAA;AAa9B;IACE,2DAA2D;IAC3D,kDAAkD;IAClD,MAAM,CAAC;QAAA;YACG,YAAO,GAAQ,EAAE,CAAC;QAmB5B,CAAC;QAjBC,wBAAG,GAAH,UAAI,KAAQ;YACV,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACrB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;QAED,wBAAG,GAAH,UAAI,KAAQ;YACV,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAC5C,CAAC;QAED,sBAAI,4BAAI;iBAAR;gBACE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;YAC7B,CAAC;;;WAAA;QAED,0BAAK,GAAL;YACE,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;QAC1B,CAAC;QACH,iBAAC;IAAD,CAAC,AApBM,GAoBN,CAAC;AACJ,CAAC;AAxBe,sBAAc,iBAwB7B,CAAA;AAEY,WAAG,GAAa,WAAI,CAAC,GAAG,IAAI,cAAc,EAAE,CAAC","sourcesContent":["import { root } from './root';\n\nexport interface ISetCtor {\n new<T>(): ISet<T>;\n}\n\nexport interface ISet<T> {\n add(value: T): void;\n has(value: T): boolean;\n size: number;\n clear(): void;\n}\n\nexport function minimalSetImpl<T>(): ISetCtor {\n // THIS IS NOT a full impl of Set, this is just the minimum\n // bits of functionality we need for this library.\n return class MinimalSet<T> implements ISet<T> {\n private _values: T[] = [];\n\n add(value: T): void {\n if (!this.has(value)) {\n this._values.push(value);\n }\n }\n\n has(value: T): boolean {\n return this._values.indexOf(value) !== -1;\n }\n\n get size(): number {\n return this._values.length;\n }\n\n clear(): void {\n this._values.length = 0;\n }\n };\n}\n\nexport const Set: ISetCtor = root.Set || minimalSetImpl();"]} |