當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript arrays.mergeSort函數代碼示例

本文整理匯總了TypeScript中vs/base/common/arrays.mergeSort函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript mergeSort函數的具體用法?TypeScript mergeSort怎麽用?TypeScript mergeSort使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了mergeSort函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: test

	test('stableSort', () => {
		let counter = 0;
		let data = arrays.fill(10000, () => ({ n: 1, m: counter++ }));

		arrays.mergeSort(data, (a, b) => a.n - b.n);

		let lastM = -1;
		for (const element of data) {
			assert.ok(lastM < element.m);
			lastM = element.m;
		}
	});
開發者ID:DonJayamanne,項目名稱:vscode,代碼行數:12,代碼來源:arrays.test.ts

示例2: test

	test('stableSort', () => {
		function fill<T>(num: number, valueFn: () => T, arr: T[] = []): T[] {
			for (let i = 0; i < num; i++) {
				arr[i] = valueFn();
			}

			return arr;
		}

		let counter = 0;
		let data = fill(10000, () => ({ n: 1, m: counter++ }));

		arrays.mergeSort(data, (a, b) => a.n - b.n);

		let lastM = -1;
		for (const element of data) {
			assert.ok(lastM < element.m);
			lastM = element.m;
		}
	});
開發者ID:PKRoma,項目名稱:vscode,代碼行數:20,代碼來源:arrays.test.ts

示例3: mergeSort

	return TPromise.join(promises).then(() => {

		return mergeSort(symbols, (a, b) => {
			// sort by lineNumber, provider-rank, and column
			if (a.symbol.range.startLineNumber < b.symbol.range.startLineNumber) {
				return -1;
			} else if (a.symbol.range.startLineNumber > b.symbol.range.startLineNumber) {
				return 1;
			} else if (provider.indexOf(a.provider) < provider.indexOf(b.provider)) {
				return -1;
			} else if (provider.indexOf(a.provider) > provider.indexOf(b.provider)) {
				return 1;
			} else if (a.symbol.range.startColumn < b.symbol.range.startColumn) {
				return -1;
			} else if (a.symbol.range.startColumn > b.symbol.range.startColumn) {
				return 1;
			} else {
				return 0;
			}
		});
	});
開發者ID:Chan-PH,項目名稱:vscode,代碼行數:21,代碼來源:codelens.ts

示例4: mergeSort

		.then(allCodeActions => mergeSort(allCodeActions, codeActionsComparator));
開發者ID:AllureFer,項目名稱:vscode,代碼行數:1,代碼來源:codeAction.ts

示例5: mergeSort

		() => mergeSort(allResults, codeActionsComparator)
開發者ID:costincaraivan,項目名稱:vscode,代碼行數:1,代碼來源:quickFix.ts

示例6: constructor

	public constructor(actions: CodeAction[]) {
		this.actions = mergeSort(actions, CodeActionSet.codeActionsComparator);
	}
開發者ID:eamodio,項目名稱:vscode,代碼行數:3,代碼來源:codeAction.ts


注:本文中的vs/base/common/arrays.mergeSort函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。