1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 * Creates an array spanning a range of integer values.
7 * @param {number} start The first number in the range.
8 * @param {number} end The last number in the range inclusive.
9 * @return {!Array.<number>}
11 function range(start, end) {
13 for (var i = start; i <= end; i++) {
20 * Modifies a selection model.
21 * @param {!ListSelectionModel} model The selection model to adjust.
22 * @param {number} index Starting index of the edit.
23 * @param {number} removed Number of entries to remove from the list.
24 * @param {number} added Number of entries to add to the list.
26 function adjust(model, index, removed, added) {
28 for (var i = 0; i < index; i++) {
31 for (var i = 0; i < removed; i++) {
34 for (var i = index + removed; i < model.length; i++) {
35 permutation.push(i - removed + added);
37 model.adjustLength(model.length - removed + added);
38 model.adjustToReordering(permutation);