summaryrefslogtreecommitdiff
path: root/javascripts/Queue.js
diff options
context:
space:
mode:
Diffstat (limited to 'javascripts/Queue.js')
-rw-r--r--javascripts/Queue.js46
1 files changed, 0 insertions, 46 deletions
diff --git a/javascripts/Queue.js b/javascripts/Queue.js
deleted file mode 100644
index 795c433..0000000
--- a/javascripts/Queue.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Item
- *
- */
-
-function Item() {
- var obj;
- var nxt;
-}
-
-
-/*
- * Queue
- *
- */
-function Queue() {
- var topItem;
- var botItem;
-}
-
-Queue.prototype.empty = function() {
- return this.topItem == null;
-}
-
-Queue.prototype.push = function(p) {
- var b = new Item();
-
- if (this.empty()) {
- this.topItem = b;
- } else {
- this.botItem.next = b;
- }
- this.botItem = b;
- this.botItem.obj = p;
-}
-
-
-Queue.prototype.pop = function() {
- if (this.empty()) {
- throw('Queue empty');
- }
- var b = this.topItem;
- this.topItem = b.nxt;
- return b.obj;
-}
-