OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 Closure typedefs for MD Bookmarks. | 6 * @fileoverview Closure typedefs for MD Bookmarks. |
7 */ | 7 */ |
8 | 8 |
9 /** | 9 /** |
10 * A normalized version of chrome.bookmarks.BookmarkTreeNode. | 10 * A normalized version of chrome.bookmarks.BookmarkTreeNode. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 /** @type {boolean} */ | 87 /** @type {boolean} */ |
88 this.sameProfile = false; | 88 this.sameProfile = false; |
89 } | 89 } |
90 | 90 |
91 /** @interface */ | 91 /** @interface */ |
92 function StoreObserver() {} | 92 function StoreObserver() {} |
93 | 93 |
94 /** @param {!BookmarksPageState} newState */ | 94 /** @param {!BookmarksPageState} newState */ |
95 StoreObserver.prototype.onStateChanged = function(newState) {}; | 95 StoreObserver.prototype.onStateChanged = function(newState) {}; |
96 | |
97 // TODO(calamity): Remove once | |
98 // https://github.com/google/closure-compiler/pull/2495 is merged. | |
99 Polymer.ArraySplice = {}; | |
100 | |
101 /** | |
102 * Returns an array of splice records indicating the minimum edits required | |
103 * to transform the `previous` array into the `current` array. | |
104 * | |
105 * Splice records are ordered by index and contain the following fields: | |
106 * - `index`: index where edit started | |
107 * - `removed`: array of removed items from this index | |
108 * - `addedCount`: number of items added at this index | |
109 * | |
110 * This function is based on the Levenshtein "minimum edit distance" | |
111 * algorithm. Note that updates are treated as removal followed by addition. | |
112 * | |
113 * The worst-case time complexity of this algorithm is `O(l * p)` | |
114 * l: The length of the current array | |
115 * p: The length of the previous array | |
116 * | |
117 * However, the worst-case complexity is reduced by an `O(n)` optimization | |
118 * to detect any shared prefix & suffix between the two arrays and only | |
119 * perform the more expensive minimum edit distance calculation over the | |
120 * non-shared portions of the arrays. | |
121 * | |
122 * @param {Array} current The "changed" array for which splices will be | |
123 * calculated. | |
124 * @param {Array} previous The "unchanged" original array to compare | |
125 * `current` against to determine the splices. | |
126 * @return {Array} Returns an array of splice record objects. Each of these | |
127 * contains: `index` the location where the splice occurred; `removed` | |
128 * the array of removed items from this location; `addedCount` the number | |
129 * of items added at this location. | |
130 */ | |
131 Polymer.ArraySplice.calculateSplices = function(current, previous) {}; | |
OLD | NEW |