From 6b3304014dce8be0ff98b2cf42a11066a92746fb Mon Sep 17 00:00:00 2001 From: ythri Date: Wed, 19 Feb 2014 10:36:54 +0100 Subject: [PATCH] first version of research helper --- buckets-minified.js | 40 ++++++++++++++ index.html | 125 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 165 insertions(+) create mode 100644 buckets-minified.js create mode 100644 index.html diff --git a/buckets-minified.js b/buckets-minified.js new file mode 100644 index 0000000..551c938 --- /dev/null +++ b/buckets-minified.js @@ -0,0 +1,40 @@ +var buckets={defaultCompare:function(a,b){return ab)return!1;a.splice(b,1);return!0};buckets.arrays.frequency=function(a,b,c){c=c||buckets.defaultEquals;for(var d=a.length,e=0,f=0;fb||b>=a.length||0>c||c>=a.length)return!1;var d=a[b];a[b]=a[c];a[c]=d;return!0};buckets.arrays.forEach=function(a,b){for(var c=a.length,d=0;db||b>this.nElements||buckets.isUndefined(a))return!1;var c=this.createNode(a);if(0===this.nElements)this.lastNode=this.firstNode=c;else if(b===this.nElements)this.lastNode=this.lastNode.next=c;else if(0===b)c.next=this.firstNode,this.firstNode=c;else{var d=this.nodeAtIndex(b-1);c.next=d.next;d.next=c}this.nElements++;return!0};buckets.LinkedList.prototype.first=function(){if(null!==this.firstNode)return this.firstNode.element}; +buckets.LinkedList.prototype.last=function(){if(null!==this.lastNode)return this.lastNode.element};buckets.LinkedList.prototype.elementAtIndex=function(a){a=this.nodeAtIndex(a);return null===a?void 0:a.element};buckets.LinkedList.prototype.indexOf=function(a,b){var c=b||buckets.defaultEquals;if(buckets.isUndefined(a))return-1;for(var d=this.firstNode,e=0;null!==d;){if(c(d.element,a))return e;e++;d=d.next}return-1};buckets.LinkedList.prototype.contains=function(a,b){return 0<=this.indexOf(a,b)}; +buckets.LinkedList.prototype.remove=function(a,b){var c=b||buckets.defaultEquals;if(1>this.nElements||buckets.isUndefined(a))return!1;for(var d=null,e=this.firstNode;null!==e;){if(c(e.element,a))return e===this.firstNode?(this.firstNode=this.firstNode.next,e===this.lastNode&&(this.lastNode=null)):(e===this.lastNode&&(this.lastNode=d),d.next=e.next,e.next=null),this.nElements--,!0;d=e;e=e.next}return!1}; +buckets.LinkedList.prototype.clear=function(){this.lastNode=this.firstNode=null;this.nElements=0};buckets.LinkedList.prototype.equals=function(a,b){var c=b||buckets.defaultEquals;return!(a instanceof buckets.LinkedList)||this.size()!==a.size()?!1:this.equalsAux(this.firstNode,a.firstNode,c)};buckets.LinkedList.prototype.equalsAux=function(a,b,c){for(;null!==a;){if(!c(a.element,b.element))return!1;a=a.next;b=b.next}return!0}; +buckets.LinkedList.prototype.removeElementAtIndex=function(a){if(!(0>a||a>=this.nElements)){var b;1===this.nElements?(b=this.firstNode.element,this.lastNode=this.firstNode=null):(a=this.nodeAtIndex(a-1),null===a?(b=this.firstNode.element,this.firstNode=this.firstNode.next):a.next===this.lastNode&&(b=this.lastNode.element,this.lastNode=a),null!==a&&(b=a.next.element,a.next=a.next.next));this.nElements--;return b}}; +buckets.LinkedList.prototype.forEach=function(a){for(var b=this.firstNode;null!==b&&!1!==a(b.element);)b=b.next};buckets.LinkedList.prototype.reverse=function(){for(var a=null,b=this.firstNode,c=null;null!==b;)c=b.next,b.next=a,a=b,b=c;c=this.firstNode;this.firstNode=this.lastNode;this.lastNode=c};buckets.LinkedList.prototype.toArray=function(){for(var a=[],b=this.firstNode;null!==b;)a.push(b.element),b=b.next;return a};buckets.LinkedList.prototype.size=function(){return this.nElements}; +buckets.LinkedList.prototype.isEmpty=function(){return 0>=this.nElements};buckets.LinkedList.prototype.nodeAtIndex=function(a){if(0>a||a>=this.nElements)return null;if(a===this.nElements-1)return this.lastNode;for(var b=this.firstNode,c=0;c=this.nElements}; +buckets.MultiDictionary=function(a,b){this.parent=new buckets.Dictionary(a);this.equalsF=b||buckets.defaultEquals};buckets.MultiDictionary.prototype.get=function(a){a=this.parent.get(a);return buckets.isUndefined(a)?[]:buckets.arrays.copy(a)};buckets.MultiDictionary.prototype.set=function(a,b){if(buckets.isUndefined(a)||buckets.isUndefined(b))return!1;if(!this.containsKey(a))return this.parent.set(a,[b]),!0;var c=this.parent.get(a);if(buckets.arrays.contains(c,b,this.equalsF))return!1;c.push(b);return!0}; +buckets.MultiDictionary.prototype.remove=function(a,b){if(buckets.isUndefined(b)){var c=this.parent.remove(a);return buckets.isUndefined(c)?!1:!0}c=this.parent.get(a);return buckets.arrays.remove(c,b,this.equalsF)?(0===c.length&&this.parent.remove(a),!0):!1};buckets.MultiDictionary.prototype.keys=function(){return this.parent.keys()};buckets.MultiDictionary.prototype.values=function(){for(var a=this.parent.values(),b=[],c=0;c=this.data.length?a>=this.data.length?-1:a:0>=this.compare(this.data[a],this.data[b])?a:b};buckets.Heap.prototype.siftUp=function(a){for(var b=this.parentIndex(a);0=this.data.length}; +buckets.Heap.prototype.clear=function(){this.data.length=0};buckets.Heap.prototype.forEach=function(a){buckets.arrays.forEach(this.data,a)};buckets.Stack=function(){this.list=new buckets.LinkedList};buckets.Stack.prototype.push=function(a){return this.list.add(a,0)};buckets.Stack.prototype.add=function(a){return this.list.add(a,0)};buckets.Stack.prototype.pop=function(){return this.list.removeElementAtIndex(0)};buckets.Stack.prototype.peek=function(){return this.list.first()}; +buckets.Stack.prototype.size=function(){return this.list.size()};buckets.Stack.prototype.contains=function(a,b){return this.list.contains(a,b)};buckets.Stack.prototype.isEmpty=function(){return this.list.isEmpty()};buckets.Stack.prototype.clear=function(){this.list.clear()};buckets.Stack.prototype.forEach=function(a){this.list.forEach(a)};buckets.Queue=function(){this.list=new buckets.LinkedList};buckets.Queue.prototype.enqueue=function(a){return this.list.add(a)};buckets.Queue.prototype.add=function(a){return this.list.add(a)}; +buckets.Queue.prototype.dequeue=function(){if(0!==this.list.size()){var a=this.list.first();this.list.removeElementAtIndex(0);return a}};buckets.Queue.prototype.peek=function(){if(0!==this.list.size())return this.list.first()};buckets.Queue.prototype.size=function(){return this.list.size()};buckets.Queue.prototype.contains=function(a,b){return this.list.contains(a,b)};buckets.Queue.prototype.isEmpty=function(){return 0>=this.list.size()};buckets.Queue.prototype.clear=function(){this.list.clear()}; +buckets.Queue.prototype.forEach=function(a){this.list.forEach(a)};buckets.PriorityQueue=function(a){this.heap=new buckets.Heap(buckets.reverseCompareFunction(a))};buckets.PriorityQueue.prototype.enqueue=function(a){return this.heap.add(a)};buckets.PriorityQueue.prototype.add=function(a){return this.heap.add(a)};buckets.PriorityQueue.prototype.dequeue=function(){if(0!==this.heap.size()){var a=this.heap.peek();this.heap.removeRoot();return a}};buckets.PriorityQueue.prototype.peek=function(){return this.heap.peek()}; +buckets.PriorityQueue.prototype.contains=function(a){return this.heap.contains(a)};buckets.PriorityQueue.prototype.isEmpty=function(){return this.heap.isEmpty()};buckets.PriorityQueue.prototype.size=function(){return this.heap.size()};buckets.PriorityQueue.prototype.clear=function(){this.heap.clear()};buckets.PriorityQueue.prototype.forEach=function(a){this.heap.forEach(a)};buckets.Set=function(a){this.dictionary=new buckets.Dictionary(a)};buckets.Set.prototype.contains=function(a){return this.dictionary.containsKey(a)}; +buckets.Set.prototype.add=function(a){if(this.contains(a)||buckets.isUndefined(a))return!1;this.dictionary.set(a,a);return!0};buckets.Set.prototype.intersection=function(a){var b=this;this.forEach(function(c){a.contains(c)||b.remove(c)})};buckets.Set.prototype.union=function(a){var b=this;a.forEach(function(a){b.add(a)})};buckets.Set.prototype.difference=function(a){var b=this;a.forEach(function(a){b.remove(a)})}; +buckets.Set.prototype.isSubsetOf=function(a){if(this.size()>a.size())return!1;var b=!0;this.forEach(function(c){if(!a.contains(c))return b=!1});return b};buckets.Set.prototype.remove=function(a){return this.contains(a)?(this.dictionary.remove(a),!0):!1};buckets.Set.prototype.forEach=function(a){this.dictionary.forEach(function(b,c){return a(c)})};buckets.Set.prototype.toArray=function(){return this.dictionary.values()};buckets.Set.prototype.isEmpty=function(){return this.dictionary.isEmpty()}; +buckets.Set.prototype.size=function(){return this.dictionary.size()};buckets.Set.prototype.clear=function(){this.dictionary.clear()};buckets.Bag=function(a){this.toStrF=a||buckets.defaultToString;this.dictionary=new buckets.Dictionary(this.toStrF);this.nElements=0};buckets.Bag.prototype.add=function(a,b){if(isNaN(b)||buckets.isUndefined(b))b=1;if(buckets.isUndefined(a)||0>=b)return!1;this.contains(a)?this.dictionary.get(a).copies+=b:this.dictionary.set(a,{value:a,copies:b});this.nElements+=b;return!0}; +buckets.Bag.prototype.count=function(a){return this.contains(a)?this.dictionary.get(a).copies:0};buckets.Bag.prototype.contains=function(a){return this.dictionary.containsKey(a)};buckets.Bag.prototype.remove=function(a,b){if(isNaN(b)||buckets.isUndefined(b))b=1;if(!(buckets.isUndefined(a)||0>=b)&&this.contains(a)){var c=this.dictionary.get(a);this.nElements=b>c.copies?this.nElements-c.copies:this.nElements-b;c.copies-=b;0>=c.copies&&this.dictionary.remove(a);return!0}return!1}; +buckets.Bag.prototype.toArray=function(){for(var a=[],b=this.dictionary.values(),c=b.length,d=0;dc?a=a.leftCh:0d?(b=c,c=c.leftCh):(b=c,c=c.rightCh)}a.parent=b;null===b?this.root=a:0>this.compare(a.element,b.element)?b.leftCh=a:b.rightCh=a;return a};buckets.BSTree.prototype.createNode=function(a){return{element:a,leftCh:null,rightCh:null,parent:null}};"undefined"!==typeof module&&(module.exports=buckets); diff --git a/index.html b/index.html new file mode 100644 index 0000000..0c8ef77 --- /dev/null +++ b/index.html @@ -0,0 +1,125 @@ + + + + + Thaumcraft 4.1 Research Helper + + + + +

Thaumcraft 4.1 Research Helper

+ + + + + + +
Available
Aspects:
From:
To:
Min. Steps:
Find Connection
+ +