Named exports from ol/structs/PriorityQueue

This commit is contained in:
Frederic Junod
2018-02-20 15:53:46 +01:00
parent 68253bc9a1
commit 57a7750924
4 changed files with 10 additions and 11 deletions

View File

@@ -55,10 +55,9 @@ const PriorityQueue = function(priorityFunction, keyFunction) {
/**
* @const
* @type {number}
*/
PriorityQueue.DROP = Infinity;
export const DROP = Infinity;
/**
@@ -102,7 +101,7 @@ PriorityQueue.prototype.enqueue = function(element) {
assert(!(this.keyFunction_(element) in this.queuedElements_),
31); // Tried to enqueue an `element` that was already added to the queue
const priority = this.priorityFunction_(element);
if (priority != PriorityQueue.DROP) {
if (priority != DROP) {
this.elements_.push(element);
this.priorities_.push(priority);
this.queuedElements_[this.keyFunction_(element)] = true;
@@ -262,7 +261,7 @@ PriorityQueue.prototype.reprioritize = function() {
for (i = 0; i < n; ++i) {
element = elements[i];
priority = priorityFunction(element);
if (priority == PriorityQueue.DROP) {
if (priority == DROP) {
delete this.queuedElements_[this.keyFunction_(element)];
} else {
priorities[index] = priority;