var BSharpTree=Class.create({root:null,initialize:function(a){this.root=$A();this.comparator=a||function(b){return b}},add:function(e,a,d){var d=d||this.root;d.objects=d.objects||$A();if(d!=this.root){d.objects.push(a)}if(e.length>0){var c=e.charCodeAt(0)-32;var b=d[c]=c==0?this.root:d[c]||$A();this.add(e.substring(1),a,b)}},getAll:function(){var b=this.root;var a=[];b.forEach(function(c){if(c!==undefined){c.objects.forEach(function(e){a.push(e)})}});return a},getAllSingle:function(){var b=this.root;var a=[];b.forEach(function(c){if(c!==undefined){c.objects.forEach(function(e){if(a.indexOf(e)===-1){a.push(e)}})}});return a},search:function(e,d){var c=this.root;var a=null;while(e.length>0){var b=e.charCodeAt(0)-32;e=e.substring(1);if(b==0){a=this.search(e,a);break}else{c=c[b];if(!c){return $A()}a=c.objects}}if(d){if(c==this.root){return d}else{return this.intersect(a,d)}}else{if(c==this.root){return $A()}else{return a}}},intersect:function(e,d){var g=0;var f=0;var c=$A();e=e.sortBy(this.comparator);d=d.sortBy(this.comparator);while(gthis.comparator(d[f])){f++}else{g++}}}return c}});