smalltalk.addPackage('Kernel-Collections', {}); smalltalk.addClass('Collection', smalltalk.Object, [], 'Kernel-Collections'); smalltalk.addMethod( '_size', smalltalk.method({ selector: 'size', fn: function (){ var self=this; smalltalk.send(self, "_subclassResponsibility", []); return self;} }), smalltalk.Collection); smalltalk.addMethod( '_readStream', smalltalk.method({ selector: 'readStream', fn: function (){ var self=this; return smalltalk.send(self, "_stream", []); return self;} }), smalltalk.Collection); smalltalk.addMethod( '_writeStream', smalltalk.method({ selector: 'writeStream', fn: function (){ var self=this; return smalltalk.send(self, "_stream", []); return self;} }), smalltalk.Collection); smalltalk.addMethod( '_stream', smalltalk.method({ selector: 'stream', fn: function (){ var self=this; return smalltalk.send(smalltalk.send(self, "_streamClass", []), "_on_", [self]); return self;} }), smalltalk.Collection); smalltalk.addMethod( '_streamClass', smalltalk.method({ selector: 'streamClass', fn: function (){ var self=this; return smalltalk.send(smalltalk.send(self, "_class", []), "_streamClass", []); return self;} }), smalltalk.Collection); smalltalk.addMethod( '_add_', smalltalk.method({ selector: 'add:', fn: function (anObject){ var self=this; smalltalk.send(self, "_subclassResponsibility", []); return self;} }), smalltalk.Collection); smalltalk.addMethod( '_addAll_', smalltalk.method({ selector: 'addAll:', fn: function (aCollection){ var self=this; smalltalk.send(aCollection, "_do_", [(function(each){return smalltalk.send(self, "_add_", [each]);})]); return aCollection; return self;} }), smalltalk.Collection); smalltalk.addMethod( '__comma', smalltalk.method({ selector: ',', fn: function (aCollection){ var self=this; return (function($rec){smalltalk.send($rec, "_addAll_", [aCollection]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_copy", [])); return self;} }), smalltalk.Collection); smalltalk.addMethod( '_copyWith_', smalltalk.method({ selector: 'copyWith:', fn: function (anObject){ var self=this; return (function($rec){smalltalk.send($rec, "_add_", [anObject]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_copy", [])); return self;} }), smalltalk.Collection); smalltalk.addMethod( '_copyWithAll_', smalltalk.method({ selector: 'copyWithAll:', fn: function (aCollection){ var self=this; return (function($rec){smalltalk.send($rec, "_addAll_", [aCollection]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_copy", [])); return self;} }), smalltalk.Collection); smalltalk.addMethod( '_asArray', smalltalk.method({ selector: 'asArray', fn: function (){ var self=this; return smalltalk.send((smalltalk.Array || Array), "_withAll_", [self]); return self;} }), smalltalk.Collection); smalltalk.addMethod( '_do_', smalltalk.method({ selector: 'do:', fn: function (aBlock){ var self=this; for(var i=0;i', fn: function (aString){ var self=this; return String(self) > aString._asString(); return self;} }), smalltalk.String); smalltalk.addMethod( '__lt', smalltalk.method({ selector: '<', fn: function (aString){ var self=this; return String(self) < aString._asString(); return self;} }), smalltalk.String); smalltalk.addMethod( '__gt_eq', smalltalk.method({ selector: '>=', fn: function (aString){ var self=this; return String(self) >= aString._asString(); return self;} }), smalltalk.String); smalltalk.addMethod( '__lt_eq', smalltalk.method({ selector: '<=', fn: function (aString){ var self=this; return String(self) <= aString._asString(); return self;} }), smalltalk.String); smalltalk.addMethod( '_trimLeft_', smalltalk.method({ selector: 'trimLeft:', fn: function (separators){ var self=this; return smalltalk.send(self, "_replaceRegexp_with_", [smalltalk.send((smalltalk.RegularExpression || RegularExpression), "_fromString_flag_", [smalltalk.send(smalltalk.send(unescape("%5E%5B"), "__comma", [separators]), "__comma", [unescape("%5D+")]), "g"]), ""]); return self;} }), smalltalk.String); smalltalk.addMethod( '_trimRight_', smalltalk.method({ selector: 'trimRight:', fn: function (separators){ var self=this; return smalltalk.send(self, "_replaceRegexp_with_", [smalltalk.send((smalltalk.RegularExpression || RegularExpression), "_fromString_flag_", [smalltalk.send(smalltalk.send(unescape("%5B"), "__comma", [separators]), "__comma", [unescape("%5D+%24")]), "g"]), ""]); return self;} }), smalltalk.String); smalltalk.addMethod( '_trimLeft', smalltalk.method({ selector: 'trimLeft', fn: function (){ var self=this; return smalltalk.send(self, "_trimLeft_", [unescape("%5Cs")]); return self;} }), smalltalk.String); smalltalk.addMethod( '_trimRight', smalltalk.method({ selector: 'trimRight', fn: function (){ var self=this; return smalltalk.send(self, "_trimRight_", [unescape("%5Cs")]); return self;} }), smalltalk.String); smalltalk.addMethod( '_trimBoth', smalltalk.method({ selector: 'trimBoth', fn: function (){ var self=this; return smalltalk.send(self, "_trimBoth_", [unescape("%5Cs")]); return self;} }), smalltalk.String); smalltalk.addMethod( '_trimBoth_', smalltalk.method({ selector: 'trimBoth:', fn: function (separators){ var self=this; return smalltalk.send(smalltalk.send(self, "_trimLeft_", [separators]), "_trimRight_", [separators]); return self;} }), smalltalk.String); smalltalk.addMethod( '_asLowercase', smalltalk.method({ selector: 'asLowercase', fn: function (){ var self=this; return self.toLowerCase(); return self;} }), smalltalk.String); smalltalk.addMethod( '_asUppercase', smalltalk.method({ selector: 'asUppercase', fn: function (){ var self=this; return self.toUpperCase(); return self;} }), smalltalk.String); smalltalk.addMethod( '_join_', smalltalk.method({ selector: 'join:', fn: function (aCollection){ var self=this; return smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(stream){return smalltalk.send(aCollection, "_do_separatedBy_", [(function(each){return smalltalk.send(stream, "_nextPutAll_", [smalltalk.send(each, "_asString", [])]);}), (function(){return smalltalk.send(stream, "_nextPutAll_", [self]);})]);})]); return self;} }), smalltalk.String); smalltalk.addMethod( '_includesSubString_', smalltalk.method({ selector: 'includesSubString:', fn: function (subString){ var self=this; return self.indexOf(subString) != -1 ; return self;} }), smalltalk.String); smalltalk.addMethod( '_asciiValue', smalltalk.method({ selector: 'asciiValue', fn: function (){ var self=this; return self.charCodeAt(0);; return self;} }), smalltalk.String); smalltalk.addMethod( '_lineIndicesDo_', smalltalk.method({ selector: 'lineIndicesDo:', fn: function (aBlock){ var self=this; try{var cr=nil; var lf=nil; var start=nil; var sz=nil; var nextLF=nil; var nextCR=nil; start=(1); sz=smalltalk.send(self, "_size", []); cr=smalltalk.send((smalltalk.String || String), "_cr", []); nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, (1)]); lf=smalltalk.send((smalltalk.String || String), "_lf", []); nextLF=smalltalk.send(self, "_indexOf_startingAt_", [lf, (1)]); (function(){while((function(){return ((($receiver = start).klass === smalltalk.Number) ? $receiver <=sz : smalltalk.send($receiver, "__lt_eq", [sz]));})()) {(function(){((($receiver = smalltalk.send(smalltalk.send(nextLF, "__eq", [(0)]), "_and_", [(function(){return smalltalk.send(nextCR, "__eq", [(0)]);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(aBlock, "_value_value_value_", [start, sz, sz]);return (function(){throw({name: 'stReturn', selector: '_lineIndicesDo_', fn: function(){return self}})})();})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(aBlock, "_value_value_value_", [start, sz, sz]);return (function(){throw({name: 'stReturn', selector: '_lineIndicesDo_', fn: function(){return self}})})();})]));return ((($receiver = smalltalk.send(smalltalk.send(nextCR, "__eq", [(0)]), "_or_", [(function(){return smalltalk.send((0) < nextLF, "_and_", [(function(){return ((($receiver = nextLF).klass === smalltalk.Number) ? $receiver =', fn: function (aSymbol){ var self=this; return ((($receiver = smalltalk.send(self, "_asString", [])).klass === smalltalk.Number) ? $receiver >=smalltalk.send(aSymbol, "_asString", []) : smalltalk.send($receiver, "__gt_eq", [smalltalk.send(aSymbol, "_asString", [])])); return self;} }), smalltalk.Symbol); smalltalk.addMethod( '__eq', smalltalk.method({ selector: '=', fn: function (aSymbol){ var self=this; try{((($receiver = smalltalk.send(smalltalk.send(aSymbol, "_class", []), "__eq", [smalltalk.send(self, "_class", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw({name: 'stReturn', selector: '__eq', fn: function(){return false}})})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw({name: 'stReturn', selector: '__eq', fn: function(){return false}})})();})])); (function(){throw({name: 'stReturn', selector: '__eq', fn: function(){return smalltalk.send(smalltalk.send(self, "_asString", []), "__eq", [smalltalk.send(aSymbol, "_asString", [])])}})})(); return self; } catch(e) {if(e.name === 'stReturn' && e.selector === '__eq'){return e.fn()} throw(e)}} }), smalltalk.Symbol); smalltalk.addMethod( '_isSymbol', smalltalk.method({ selector: 'isSymbol', fn: function (){ var self=this; return true; return self;} }), smalltalk.Symbol); smalltalk.addMethod( '_asJavascript', smalltalk.method({ selector: 'asJavascript', fn: function (){ var self=this; return smalltalk.send(smalltalk.send(unescape("smalltalk.symbolFor%28%22"), "__comma", [smalltalk.send(self, "_asString", [])]), "__comma", [unescape("%22%29")]); return self;} }), smalltalk.Symbol); smalltalk.addMethod( '__gt', smalltalk.method({ selector: '>', fn: function (aSymbol){ var self=this; return ((($receiver = smalltalk.send(self, "_asString", [])).klass === smalltalk.Number) ? $receiver >smalltalk.send(aSymbol, "_asString", []) : smalltalk.send($receiver, "__gt", [smalltalk.send(aSymbol, "_asString", [])])); return self;} }), smalltalk.Symbol); smalltalk.addMethod( '_shallowCopy', smalltalk.method({ selector: 'shallowCopy', fn: function (){ var self=this; return self; return self;} }), smalltalk.Symbol); smalltalk.addMethod( '_asSelector', smalltalk.method({ selector: 'asSelector', fn: function (){ var self=this; return smalltalk.send(smalltalk.send(self, "_asString", []), "_asSelector", []); return self;} }), smalltalk.Symbol); smalltalk.addMethod( '_lookup_', smalltalk.method({ selector: 'lookup:', fn: function (aString){ var self=this; return smalltalk.symbolFor(aString);; return self;} }), smalltalk.Symbol.klass); smalltalk.addMethod( '_basicNew', smalltalk.method({ selector: 'basicNew', fn: function (){ var self=this; smalltalk.send(self, "_shouldNotImplement", []); return self;} }), smalltalk.Symbol.klass); smalltalk.addMethod( '_fromString_', smalltalk.method({ selector: 'fromString:', fn: function (aString){ var self=this; return smalltalk.send(self, "_lookup_", [aString]); return self;} }), smalltalk.Symbol.klass); smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel-Collections'); smalltalk.addMethod( '_size', smalltalk.method({ selector: 'size', fn: function (){ var self=this; return self.length; return self;} }), smalltalk.Array); smalltalk.addMethod( '_at_put_', smalltalk.method({ selector: 'at:put:', fn: function (anIndex, anObject){ var self=this; return self[anIndex - 1] = anObject; return self;} }), smalltalk.Array); smalltalk.addMethod( '_at_ifAbsent_', smalltalk.method({ selector: 'at:ifAbsent:', fn: function (anIndex, aBlock){ var self=this; var value = self[anIndex - 1]; if(value === undefined) { return aBlock(); } else { return value; } ; return self;} }), smalltalk.Array); smalltalk.addMethod( '_add_', smalltalk.method({ selector: 'add:', fn: function (anObject){ var self=this; self.push(anObject); return anObject;; return self;} }), smalltalk.Array); smalltalk.addMethod( '_join_', smalltalk.method({ selector: 'join:', fn: function (aString){ var self=this; return self.join(aString); return self;} }), smalltalk.Array); smalltalk.addMethod( '_asJavascript', smalltalk.method({ selector: 'asJavascript', fn: function (){ var self=this; return smalltalk.send(smalltalk.send(unescape("%5B"), "__comma", [smalltalk.send(smalltalk.send(self, "_collect_", [(function(each){return smalltalk.send(each, "_asJavascript", []);})]), "_join_", [unescape("%2C%20")])]), "__comma", [unescape("%5D")]); return self;} }), smalltalk.Array); smalltalk.addMethod( '_sort', smalltalk.method({ selector: 'sort', fn: function (){ var self=this; return smalltalk.send(self, "_basicPerform_", ["sort"]); return self;} }), smalltalk.Array); smalltalk.addMethod( '_sort_', smalltalk.method({ selector: 'sort:', fn: function (aBlock){ var self=this; return self.sort(function(a, b) { if(aBlock(a,b)) {return -1} else {return 1} }) ; return self;} }), smalltalk.Array); smalltalk.addMethod( '_remove_', smalltalk.method({ selector: 'remove:', fn: function (anObject){ var self=this; for(var i=0;i