| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview This is a data model representin | 6 * @fileoverview This is a data model representin |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 // The include directives are put into Javascript-style comments to prevent | 9 // The include directives are put into Javascript-style comments to prevent |
| 10 // parsing errors in non-flattened mode. The flattener still sees them. | 10 // parsing errors in non-flattened mode. The flattener still sees them. |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 * @return {number} The new length of the model. | 215 * @return {number} The new length of the model. |
| 216 */ | 216 */ |
| 217 push: function(var_args) { | 217 push: function(var_args) { |
| 218 var args = Array.prototype.slice.call(arguments); | 218 var args = Array.prototype.slice.call(arguments); |
| 219 args.unshift(this.length, 0); | 219 args.unshift(this.length, 0); |
| 220 this.splice.apply(this, args); | 220 this.splice.apply(this, args); |
| 221 return this.length; | 221 return this.length; |
| 222 }, | 222 }, |
| 223 | 223 |
| 224 /** | 224 /** |
| 225 * Removes and returns the last item of the model. | |
| 226 * | |
| 227 * This dispatches a splice event. | |
| 228 * | |
| 229 * @return {*} The last item, or undefined if model has no more items. | |
| 230 */ | |
| 231 pop: function() { | |
| 232 return this.splice(this.array_.length - 1, 1)[0]; | |
| 233 }, | |
| 234 | |
| 235 /** | |
| 236 * Updates the existing item with the new item. | 225 * Updates the existing item with the new item. |
| 237 * | 226 * |
| 238 * The existing item and the new item are regarded as the same item and the | 227 * The existing item and the new item are regarded as the same item and the |
| 239 * permutation tracks these indexes. | 228 * permutation tracks these indexes. |
| 240 * | 229 * |
| 241 * @param {*} oldItem Old item that is contained in the model. If the item | 230 * @param {*} oldItem Old item that is contained in the model. If the item |
| 242 * is not found in the model, the method call is just ignored. | 231 * is not found in the model, the method call is just ignored. |
| 243 * @param {*} newItem New item. | 232 * @param {*} newItem New item. |
| 244 */ | 233 */ |
| 245 replaceItem: function(oldItem, newItem) { | 234 replaceItem: function(oldItem, newItem) { |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 if (a > b) | 441 if (a > b) |
| 453 return 1; | 442 return 1; |
| 454 return 0; | 443 return 0; |
| 455 } | 444 } |
| 456 }; | 445 }; |
| 457 | 446 |
| 458 return { | 447 return { |
| 459 ArrayDataModel: ArrayDataModel | 448 ArrayDataModel: ArrayDataModel |
| 460 }; | 449 }; |
| 461 }); | 450 }); |
| OLD | NEW |