From 353555f740fc6566833e36d526efba09509d8e8e Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Mon, 18 Nov 2013 16:55:54 +0100 Subject: [PATCH] Use templates in ol.structs.PriorityQueue --- src/ol/structs/priorityqueue.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/ol/structs/priorityqueue.js b/src/ol/structs/priorityqueue.js index 74bfb08e42..b303d6c64c 100644 --- a/src/ol/structs/priorityqueue.js +++ b/src/ol/structs/priorityqueue.js @@ -15,25 +15,26 @@ goog.require('goog.object'); * @see http://hg.python.org/cpython/file/2.7/Lib/heapq.py * * @constructor - * @param {function(?): number} priorityFunction Priority function. - * @param {function(?): string} keyFunction Key function. + * @param {function(T): number} priorityFunction Priority function. + * @param {function(T): string} keyFunction Key function. + * @template T */ ol.structs.PriorityQueue = function(priorityFunction, keyFunction) { /** - * @type {function(?): number} + * @type {function(T): number} * @private */ this.priorityFunction_ = priorityFunction; /** - * @type {function(?): string} + * @type {function(T): string} * @private */ this.keyFunction_ = keyFunction; /** - * @type {Array} + * @type {Array.} * @private */ this.elements_ = []; @@ -88,7 +89,7 @@ ol.structs.PriorityQueue.prototype.clear = function() { /** * Remove and return the highest-priority element. O(log N). - * @return {*} Element. + * @return {T} Element. */ ol.structs.PriorityQueue.prototype.dequeue = function() { var elements = this.elements_; @@ -112,7 +113,7 @@ ol.structs.PriorityQueue.prototype.dequeue = function() { /** * Enqueue an element. O(log N). - * @param {*} element Element. + * @param {T} element Element. */ ol.structs.PriorityQueue.prototype.enqueue = function(element) { goog.asserts.assert(!(this.keyFunction_(element) in this.queuedElements_)); @@ -197,7 +198,7 @@ ol.structs.PriorityQueue.prototype.isKeyQueued = function(key) { /** - * @param {*} element Element. + * @param {T} element Element. * @return {boolean} Is queued. */ ol.structs.PriorityQueue.prototype.isQueued = function(element) {