本文整理匯總了TypeScript中common/CircularList.CircularList類的典型用法代碼示例。如果您正苦於以下問題:TypeScript CircularList類的具體用法?TypeScript CircularList怎麽用?TypeScript CircularList使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了CircularList類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should throw for invalid args', () => {
const list = new CircularList<number>(5);
list.push(1);
assert.throws(() => list.shiftElements(-1, 1, 1), 'start argument out of range');
assert.throws(() => list.shiftElements(1, 1, 1), 'start argument out of range');
assert.throws(() => list.shiftElements(0, 1, -1), 'Cannot shift elements in list beyond index 0');
});
示例2: reflowLargerApplyNewLayout
export function reflowLargerApplyNewLayout(lines: CircularList<IBufferLine>, newLayout: number[]): void {
// Record original lines so they don't get overridden when we rearrange the list
const newLayoutLines: BufferLine[] = [];
for (let i = 0; i < newLayout.length; i++) {
newLayoutLines.push(lines.get(newLayout[i]) as BufferLine);
}
// Rearrange the list
for (let i = 0; i < newLayoutLines.length; i++) {
lines.set(i, newLayoutLines[i]);
}
lines.length = newLayout.length;
}