Comparing version 2.11.1 to 2.11.2
@@ -1,2 +0,2 @@ | ||
import ArrayList from '../../../../java/util/ArrayList.js' | ||
import ArrayList from './ArrayList.js' | ||
export default class PriorityQueue { | ||
@@ -6,16 +6,23 @@ constructor() { | ||
} | ||
poll() { | ||
static constructor_() { | ||
this._size = null | ||
this._items = null | ||
this._size = 0 | ||
this._items = new ArrayList() | ||
this._items.add(null) | ||
} | ||
remove_(i) { | ||
if (this.isEmpty()) return null | ||
const minItem = this._items.get(1) | ||
const minItem = this._items.get(i) | ||
this._items.set(1, this._items.get(this._size)) | ||
this._size -= 1 | ||
this.reorder(1) | ||
this.reorder(i) | ||
return minItem | ||
} | ||
poll() { | ||
return this.remove_(1) | ||
} | ||
size() { | ||
return this._size | ||
} | ||
reorder(hole) { | ||
@@ -26,12 +33,7 @@ let child = null | ||
child = hole * 2 | ||
if (child !== this._size && this._items.get(child + 1).compareTo(this._items.get(child)) < 0) | ||
child++ | ||
if (this._items.get(child).compareTo(tmp) < 0) | ||
this._items.set(hole, this._items.get(child)) | ||
else | ||
break | ||
if (child !== this._size && this._items.get(child + 1).compareTo(this._items.get(child)) < 0) child++ | ||
if (this._items.get(child).compareTo(tmp) < 0) this._items.set(hole, this._items.get(child)); else break | ||
} | ||
this._items.set(hole, tmp) | ||
} | ||
clear() { | ||
@@ -41,3 +43,2 @@ this._size = 0 | ||
} | ||
peek() { | ||
@@ -48,11 +49,18 @@ if (this.isEmpty()) return null | ||
} | ||
remove(o) { | ||
return this._items.remove(o) | ||
if (o === undefined) { | ||
o = this._items.get(1) | ||
this.remove_(1) | ||
return o | ||
} else { | ||
const i = this._items.array.indexOf(o) | ||
if (i === -1) | ||
return false | ||
this.remove_(i) | ||
return true | ||
} | ||
} | ||
isEmpty() { | ||
return this._size === 0 | ||
} | ||
add(x) { | ||
@@ -63,21 +71,7 @@ this._items.add(null) | ||
this._items.set(0, x) | ||
for (; x.compareTo(this._items.get(Math.trunc(hole / 2))) < 0; hole /= 2) | ||
for (; x.compareTo(this._items.get(Math.trunc(hole / 2))) < 0; hole /= 2) | ||
this._items.set(hole, this._items.get(Math.trunc(hole / 2))) | ||
this._items.set(hole, x) | ||
} | ||
getClass() { | ||
return PriorityQueue | ||
} | ||
get interfaces_() { | ||
return [] | ||
} | ||
} | ||
PriorityQueue.constructor_ = function() { | ||
this._size = null | ||
this._items = null | ||
this._size = 0 | ||
this._items = new ArrayList() | ||
this._items.add(null) | ||
} |
{ | ||
"name": "jsts", | ||
"description": "A JavaScript library of spatial predicates and functions for processing geometry", | ||
"version": "2.11.1", | ||
"version": "2.11.2", | ||
"author": "Björn Harrtell <bjorn@wololo.org>", | ||
@@ -16,5 +16,5 @@ "keywords": [ | ||
"devDependencies": { | ||
"@babel/core": "7.24.4", | ||
"@babel/eslint-parser": "7.24.1", | ||
"@babel/preset-env": "7.24.4", | ||
"@babel/core": "7.24.5", | ||
"@babel/eslint-parser": "7.24.5", | ||
"@babel/preset-env": "7.24.5", | ||
"@rollup/plugin-babel": "6.0.4", | ||
@@ -25,6 +25,6 @@ "@rollup/plugin-replace": "5.0.5", | ||
"codecov": "3.8.3", | ||
"eslint": "9.0.0", | ||
"eslint": "9.2.0", | ||
"expect.js": "0.3.1", | ||
"jquery": "3.7.1", | ||
"jsdoc": "4.0.2", | ||
"jsdoc": "4.0.3", | ||
"jsdom": "24.0.0", | ||
@@ -34,3 +34,3 @@ "mocha": "10.4.0", | ||
"nyc": "15.1.0", | ||
"rollup": "4.14.3" | ||
"rollup": "4.17.2" | ||
}, | ||
@@ -37,0 +37,0 @@ "type": "module", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36982
3418669