From 93218e5db4e325441bcb0eec2c8af96366673fb5 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 22 Jul 2014 11:35:36 +0200 Subject: [PATCH] Templatize ol.Collection --- src/ol/collection.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/ol/collection.js b/src/ol/collection.js index d4b9519542..25505c3f0a 100644 --- a/src/ol/collection.js +++ b/src/ol/collection.js @@ -79,7 +79,8 @@ ol.CollectionProperty = { * @constructor * @extends {ol.Object} * @fires ol.CollectionEvent - * @param {Array=} opt_array Array. + * @param {Array.=} opt_array Array. + * @template T * @api stable */ ol.Collection = function(opt_array) { @@ -88,7 +89,7 @@ ol.Collection = function(opt_array) { /** * @private - * @type {Array.<*>} + * @type {Array.} */ this.array_ = opt_array || []; @@ -110,8 +111,8 @@ ol.Collection.prototype.clear = function() { /** - * @param {Array} arr Array. - * @return {ol.Collection} This collection. + * @param {Array.} arr Array. + * @return {ol.Collection.} This collection. * @api stable */ ol.Collection.prototype.extend = function(arr) { @@ -129,7 +130,7 @@ ol.Collection.prototype.extend = function(arr) { * for every element. This function takes 3 arguments (the element, the * index and the array). The return value is ignored. * @param {S=} opt_this The object to use as `this` in `f`. - * @template T,S + * @template S * @api stable */ ol.Collection.prototype.forEach = function(f, opt_this) { @@ -142,7 +143,7 @@ ol.Collection.prototype.forEach = function(f, opt_this) { * is mutated, no events will be dispatched by the collection, and the * collection's "length" property won't be in sync with the actual length * of the array. - * @return {Array} Array. + * @return {Array.} Array. * @api stable */ ol.Collection.prototype.getArray = function() { @@ -153,7 +154,7 @@ ol.Collection.prototype.getArray = function() { /** * Get the element at the provided index. * @param {number} index Index. - * @return {*} Element. + * @return {T} Element. * @api stable */ ol.Collection.prototype.item = function(index) { @@ -175,7 +176,7 @@ ol.Collection.prototype.getLength = function() { /** * Insert an element at the provided index. * @param {number} index Index. - * @param {*} elem Element. + * @param {T} elem Element. * @api stable */ ol.Collection.prototype.insertAt = function(index, elem) { @@ -188,7 +189,7 @@ ol.Collection.prototype.insertAt = function(index, elem) { /** * Remove the last element of the collection. - * @return {*} Element. + * @return {T} Element. * @api stable */ ol.Collection.prototype.pop = function() { @@ -198,7 +199,7 @@ ol.Collection.prototype.pop = function() { /** * Insert the provided element at the end of the collection. - * @param {*} elem Element. + * @param {T} elem Element. * @return {number} Length. * @api stable */ @@ -211,8 +212,8 @@ ol.Collection.prototype.push = function(elem) { /** * Removes the first occurence of elem from the collection. - * @param {*} elem Element. - * @return {*} The removed element or undefined if elem was not found. + * @param {T} elem Element. + * @return {T|undefined} The removed element or undefined if elem was not found. * @api stable */ ol.Collection.prototype.remove = function(elem) { @@ -230,7 +231,7 @@ ol.Collection.prototype.remove = function(elem) { /** * Remove the element at the provided index. * @param {number} index Index. - * @return {*} Value. + * @return {T} Value. * @api stable */ ol.Collection.prototype.removeAt = function(index) { @@ -246,7 +247,7 @@ ol.Collection.prototype.removeAt = function(index) { /** * Set the element at the provided index. * @param {number} index Index. - * @param {*} elem Element. + * @param {T} elem Element. * @api stable */ ol.Collection.prototype.setAt = function(index, elem) {