repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
chore: v2.6.6
[poolifier.git]
/
src
/
queue.ts
diff --git
a/src/queue.ts
b/src/queue.ts
index 7aad6d065ce6338129c70032b266ce5c6bcba600..e7c9dd11fc0332ccbba845e9bd663d4bc682c523 100644
(file)
--- a/
src/queue.ts
+++ b/
src/queue.ts
@@
-6,18
+6,15
@@
* @typeParam T - Type of queue items.
*/
export class Queue<T> {
* @typeParam T - Type of queue items.
*/
export class Queue<T> {
- private items: T[]
- private offset: number
- public size: number
- public maxSize: number
+ private items!: T[]
+ private offset!: number
+ /** The size of the queue. */
+ public size!: number
+ /** The maximum size of the queue. */
+ public maxSize!: number
public constructor () {
public constructor () {
- this.items = []
- this.offset = 0
- /** The size of the queue. */
- this.size = 0
- /** The maximum size of the queue. */
- this.maxSize = 0
+ this.clear()
}
/**
}
/**
@@
-64,4
+61,14
@@
export class Queue<T> {
}
return this.items[this.offset]
}
}
return this.items[this.offset]
}
+
+ /**
+ * Clear the queue.
+ */
+ public clear (): void {
+ this.items = []
+ this.offset = 0
+ this.size = 0
+ this.maxSize = 0
+ }
}
}