Kernel-Collections.deploy.js 85 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224
  1. smalltalk.addPackage('Kernel-Collections', {});
  2. smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel-Collections');
  3. smalltalk.addMethod(
  4. "__eq",
  5. smalltalk.method({
  6. selector: "=",
  7. fn: function (anAssociation) {
  8. var self=this;
  9. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [smalltalk.send(anAssociation, "_class", [])]), "_and_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(self, "_key", []), "__eq", [smalltalk.send(anAssociation, "_key", [])]), "_and_", [(function(){return smalltalk.send(smalltalk.send(self, "_value", []), "__eq", [smalltalk.send(anAssociation, "_value", [])]);})]);})]);
  10. return self;}
  11. }),
  12. smalltalk.Association);
  13. smalltalk.addMethod(
  14. "_key",
  15. smalltalk.method({
  16. selector: "key",
  17. fn: function () {
  18. var self=this;
  19. return self['@key'];
  20. return self;}
  21. }),
  22. smalltalk.Association);
  23. smalltalk.addMethod(
  24. "_key_",
  25. smalltalk.method({
  26. selector: "key:",
  27. fn: function (aKey) {
  28. var self=this;
  29. (self['@key']=aKey);
  30. return self;}
  31. }),
  32. smalltalk.Association);
  33. smalltalk.addMethod(
  34. "_printString",
  35. smalltalk.method({
  36. selector: "printString",
  37. fn: function () {
  38. var self=this;
  39. return smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(aStream){return smalltalk.send(self, "_storeOn_", [aStream]);})]);
  40. return self;}
  41. }),
  42. smalltalk.Association);
  43. smalltalk.addMethod(
  44. "_storeOn_",
  45. smalltalk.method({
  46. selector: "storeOn:",
  47. fn: function (aStream) {
  48. var self=this;
  49. smalltalk.send(self['@key'], "_storeOn_", [aStream]);
  50. smalltalk.send(aStream, "_nextPutAll_", ["->"]);
  51. smalltalk.send(self['@value'], "_storeOn_", [aStream]);
  52. return self;}
  53. }),
  54. smalltalk.Association);
  55. smalltalk.addMethod(
  56. "_value",
  57. smalltalk.method({
  58. selector: "value",
  59. fn: function () {
  60. var self=this;
  61. return self['@value'];
  62. return self;}
  63. }),
  64. smalltalk.Association);
  65. smalltalk.addMethod(
  66. "_value_",
  67. smalltalk.method({
  68. selector: "value:",
  69. fn: function (aValue) {
  70. var self=this;
  71. (self['@value']=aValue);
  72. return self;}
  73. }),
  74. smalltalk.Association);
  75. smalltalk.addMethod(
  76. "_key_value_",
  77. smalltalk.method({
  78. selector: "key:value:",
  79. fn: function (aKey, aValue) {
  80. var self=this;
  81. return (function($rec){smalltalk.send($rec, "_key_", [aKey]);smalltalk.send($rec, "_value_", [aValue]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  82. return self;}
  83. }),
  84. smalltalk.Association.klass);
  85. smalltalk.addClass('Collection', smalltalk.Object, [], 'Kernel-Collections');
  86. smalltalk.addMethod(
  87. "__comma",
  88. smalltalk.method({
  89. selector: ",",
  90. fn: function (aCollection) {
  91. var self=this;
  92. return (function($rec){smalltalk.send($rec, "_addAll_", [aCollection]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_copy", []));
  93. return self;}
  94. }),
  95. smalltalk.Collection);
  96. smalltalk.addMethod(
  97. "_add_",
  98. smalltalk.method({
  99. selector: "add:",
  100. fn: function (anObject) {
  101. var self=this;
  102. smalltalk.send(self, "_subclassResponsibility", []);
  103. return self;}
  104. }),
  105. smalltalk.Collection);
  106. smalltalk.addMethod(
  107. "_addAll_",
  108. smalltalk.method({
  109. selector: "addAll:",
  110. fn: function (aCollection) {
  111. var self=this;
  112. smalltalk.send(aCollection, "_do_", [(function(each){return smalltalk.send(self, "_add_", [each]);})]);
  113. return aCollection;
  114. return self;}
  115. }),
  116. smalltalk.Collection);
  117. smalltalk.addMethod(
  118. "_asArray",
  119. smalltalk.method({
  120. selector: "asArray",
  121. fn: function () {
  122. var self=this;
  123. return smalltalk.send((smalltalk.Array || Array), "_withAll_", [self]);
  124. return self;}
  125. }),
  126. smalltalk.Collection);
  127. smalltalk.addMethod(
  128. "_asJSON",
  129. smalltalk.method({
  130. selector: "asJSON",
  131. fn: function () {
  132. var self=this;
  133. return smalltalk.send(smalltalk.send(self, "_asArray", []), "_collect_", [(function(each){return smalltalk.send(each, "_asJSON", []);})]);
  134. return self;}
  135. }),
  136. smalltalk.Collection);
  137. smalltalk.addMethod(
  138. "_asOrderedCollection",
  139. smalltalk.method({
  140. selector: "asOrderedCollection",
  141. fn: function () {
  142. var self=this;
  143. return smalltalk.send(self, "_asArray", []);
  144. return self;}
  145. }),
  146. smalltalk.Collection);
  147. smalltalk.addMethod(
  148. "_asSet",
  149. smalltalk.method({
  150. selector: "asSet",
  151. fn: function () {
  152. var self=this;
  153. return smalltalk.send((smalltalk.Set || Set), "_withAll_", [self]);
  154. return self;}
  155. }),
  156. smalltalk.Collection);
  157. smalltalk.addMethod(
  158. "_collect_",
  159. smalltalk.method({
  160. selector: "collect:",
  161. fn: function (aBlock) {
  162. var self=this;
  163. var stream=nil;
  164. (stream=smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_new", []), "_writeStream", []));
  165. smalltalk.send(self, "_do_", [(function(each){return smalltalk.send(stream, "_nextPut_", [smalltalk.send(aBlock, "_value_", [each])]);})]);
  166. return smalltalk.send(stream, "_contents", []);
  167. return self;}
  168. }),
  169. smalltalk.Collection);
  170. smalltalk.addMethod(
  171. "_copyWith_",
  172. smalltalk.method({
  173. selector: "copyWith:",
  174. fn: function (anObject) {
  175. var self=this;
  176. return (function($rec){smalltalk.send($rec, "_add_", [anObject]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_copy", []));
  177. return self;}
  178. }),
  179. smalltalk.Collection);
  180. smalltalk.addMethod(
  181. "_copyWithAll_",
  182. smalltalk.method({
  183. selector: "copyWithAll:",
  184. fn: function (aCollection) {
  185. var self=this;
  186. return (function($rec){smalltalk.send($rec, "_addAll_", [aCollection]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_copy", []));
  187. return self;}
  188. }),
  189. smalltalk.Collection);
  190. smalltalk.addMethod(
  191. "_copyWithoutAll_",
  192. smalltalk.method({
  193. selector: "copyWithoutAll:",
  194. fn: function (aCollection) {
  195. var self=this;
  196. return smalltalk.send(self, "_reject_", [(function(each){return smalltalk.send(aCollection, "_includes_", [each]);})]);
  197. return self;}
  198. }),
  199. smalltalk.Collection);
  200. smalltalk.addMethod(
  201. "_detect_",
  202. smalltalk.method({
  203. selector: "detect:",
  204. fn: function (aBlock) {
  205. var self=this;
  206. return smalltalk.send(self, "_detect_ifNone_", [aBlock, (function(){return smalltalk.send(self, "_errorNotFound", []);})]);
  207. return self;}
  208. }),
  209. smalltalk.Collection);
  210. smalltalk.addMethod(
  211. "_detect_ifNone_",
  212. smalltalk.method({
  213. selector: "detect:ifNone:",
  214. fn: function (aBlock, anotherBlock) {
  215. var self=this;
  216. for(var i = 0; i < self.length; i++)
  217. if(aBlock(self[i]))
  218. return self[i];
  219. return anotherBlock();
  220. ;
  221. return self;}
  222. }),
  223. smalltalk.Collection);
  224. smalltalk.addMethod(
  225. "_do_",
  226. smalltalk.method({
  227. selector: "do:",
  228. fn: function (aBlock) {
  229. var self=this;
  230. for(var i=0;i<self.length;i++){aBlock(self[i]);};
  231. return self;}
  232. }),
  233. smalltalk.Collection);
  234. smalltalk.addMethod(
  235. "_do_separatedBy_",
  236. smalltalk.method({
  237. selector: "do:separatedBy:",
  238. fn: function (aBlock, anotherBlock) {
  239. var self=this;
  240. var first=nil;
  241. (first=true);
  242. smalltalk.send(self, "_do_", [(function(each){((($receiver = first).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (first=false);})() : (function(){return smalltalk.send(anotherBlock, "_value", []);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return (first=false);}), (function(){return smalltalk.send(anotherBlock, "_value", []);})]));return smalltalk.send(aBlock, "_value_", [each]);})]);
  243. return self;}
  244. }),
  245. smalltalk.Collection);
  246. smalltalk.addMethod(
  247. "_errorNotFound",
  248. smalltalk.method({
  249. selector: "errorNotFound",
  250. fn: function () {
  251. var self=this;
  252. smalltalk.send(self, "_error_", ["Object is not in the collection"]);
  253. return self;}
  254. }),
  255. smalltalk.Collection);
  256. smalltalk.addMethod(
  257. "_ifEmpty_",
  258. smalltalk.method({
  259. selector: "ifEmpty:",
  260. fn: function (aBlock) {
  261. var self=this;
  262. return ((($receiver = smalltalk.send(self, "_isEmpty", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(aBlock, "_value", []);})() : (function(){return self;})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(aBlock, "_value", []);}), (function(){return self;})]));
  263. return self;}
  264. }),
  265. smalltalk.Collection);
  266. smalltalk.addMethod(
  267. "_ifNotEmpty_",
  268. smalltalk.method({
  269. selector: "ifNotEmpty:",
  270. fn: function (aBlock) {
  271. var self=this;
  272. smalltalk.send(smalltalk.send(self, "_notEmpty", []), "_ifTrue_", [aBlock]);
  273. return self;}
  274. }),
  275. smalltalk.Collection);
  276. smalltalk.addMethod(
  277. "_includes_",
  278. smalltalk.method({
  279. selector: "includes:",
  280. fn: function (anObject) {
  281. var self=this;
  282. var i = self.length;
  283. while (i--) {
  284. if (smalltalk.send(self[i], "__eq", [anObject])) {return true;}
  285. }
  286. return false
  287. ;
  288. return self;}
  289. }),
  290. smalltalk.Collection);
  291. smalltalk.addMethod(
  292. "_inject_into_",
  293. smalltalk.method({
  294. selector: "inject:into:",
  295. fn: function (anObject, aBlock) {
  296. var self=this;
  297. var result=nil;
  298. (result=anObject);
  299. smalltalk.send(self, "_do_", [(function(each){return (result=smalltalk.send(aBlock, "_value_value_", [result, each]));})]);
  300. return result;
  301. return self;}
  302. }),
  303. smalltalk.Collection);
  304. smalltalk.addMethod(
  305. "_isEmpty",
  306. smalltalk.method({
  307. selector: "isEmpty",
  308. fn: function () {
  309. var self=this;
  310. return smalltalk.send(smalltalk.send(self, "_size", []), "__eq", [(0)]);
  311. return self;}
  312. }),
  313. smalltalk.Collection);
  314. smalltalk.addMethod(
  315. "_notEmpty",
  316. smalltalk.method({
  317. selector: "notEmpty",
  318. fn: function () {
  319. var self=this;
  320. return smalltalk.send(smalltalk.send(self, "_isEmpty", []), "_not", []);
  321. return self;}
  322. }),
  323. smalltalk.Collection);
  324. smalltalk.addMethod(
  325. "_occurrencesOf_",
  326. smalltalk.method({
  327. selector: "occurrencesOf:",
  328. fn: function (anObject) {
  329. var self=this;
  330. var tally=nil;
  331. (tally=(0));
  332. smalltalk.send(self, "_do_", [(function(each){return ((($receiver = smalltalk.send(anObject, "__eq", [each])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (tally=((($receiver = tally).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (tally=((($receiver = tally).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})]));})]);
  333. return tally;
  334. return self;}
  335. }),
  336. smalltalk.Collection);
  337. smalltalk.addMethod(
  338. "_printString",
  339. smalltalk.method({
  340. selector: "printString",
  341. fn: function () {
  342. var self=this;
  343. return smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(aStream){smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(smalltalk.send(self, "_printString", [], smalltalk.Collection.superclass || nil), "__comma", [" ("])]);smalltalk.send(self, "_do_separatedBy_", [(function(each){return smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(each, "_printString", [])]);}), (function(){return smalltalk.send(aStream, "_nextPutAll_", [" "]);})]);return smalltalk.send(aStream, "_nextPutAll_", [")"]);})]);
  344. return self;}
  345. }),
  346. smalltalk.Collection);
  347. smalltalk.addMethod(
  348. "_readStream",
  349. smalltalk.method({
  350. selector: "readStream",
  351. fn: function () {
  352. var self=this;
  353. return smalltalk.send(self, "_stream", []);
  354. return self;}
  355. }),
  356. smalltalk.Collection);
  357. smalltalk.addMethod(
  358. "_reject_",
  359. smalltalk.method({
  360. selector: "reject:",
  361. fn: function (aBlock) {
  362. var self=this;
  363. return smalltalk.send(self, "_select_", [(function(each){return smalltalk.send(smalltalk.send(aBlock, "_value_", [each]), "__eq", [false]);})]);
  364. return self;}
  365. }),
  366. smalltalk.Collection);
  367. smalltalk.addMethod(
  368. "_remove_",
  369. smalltalk.method({
  370. selector: "remove:",
  371. fn: function (anObject) {
  372. var self=this;
  373. return smalltalk.send(self, "_remove_ifAbsent_", [anObject, (function(){return smalltalk.send(self, "_errorNotFound", []);})]);
  374. return self;}
  375. }),
  376. smalltalk.Collection);
  377. smalltalk.addMethod(
  378. "_remove_ifAbsent_",
  379. smalltalk.method({
  380. selector: "remove:ifAbsent:",
  381. fn: function (anObject, aBlock) {
  382. var self=this;
  383. smalltalk.send(self, "_subclassResponsibility", []);
  384. return self;}
  385. }),
  386. smalltalk.Collection);
  387. smalltalk.addMethod(
  388. "_select_",
  389. smalltalk.method({
  390. selector: "select:",
  391. fn: function (aBlock) {
  392. var self=this;
  393. var stream=nil;
  394. (stream=smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_new", []), "_writeStream", []));
  395. smalltalk.send(self, "_do_", [(function(each){return ((($receiver = smalltalk.send(aBlock, "_value_", [each])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(stream, "_nextPut_", [each]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(stream, "_nextPut_", [each]);})]));})]);
  396. return smalltalk.send(stream, "_contents", []);
  397. return self;}
  398. }),
  399. smalltalk.Collection);
  400. smalltalk.addMethod(
  401. "_size",
  402. smalltalk.method({
  403. selector: "size",
  404. fn: function () {
  405. var self=this;
  406. smalltalk.send(self, "_subclassResponsibility", []);
  407. return self;}
  408. }),
  409. smalltalk.Collection);
  410. smalltalk.addMethod(
  411. "_stream",
  412. smalltalk.method({
  413. selector: "stream",
  414. fn: function () {
  415. var self=this;
  416. return smalltalk.send(smalltalk.send(self, "_streamClass", []), "_on_", [self]);
  417. return self;}
  418. }),
  419. smalltalk.Collection);
  420. smalltalk.addMethod(
  421. "_streamClass",
  422. smalltalk.method({
  423. selector: "streamClass",
  424. fn: function () {
  425. var self=this;
  426. return smalltalk.send(smalltalk.send(self, "_class", []), "_streamClass", []);
  427. return self;}
  428. }),
  429. smalltalk.Collection);
  430. smalltalk.addMethod(
  431. "_writeStream",
  432. smalltalk.method({
  433. selector: "writeStream",
  434. fn: function () {
  435. var self=this;
  436. return smalltalk.send(self, "_stream", []);
  437. return self;}
  438. }),
  439. smalltalk.Collection);
  440. smalltalk.addMethod(
  441. "_new_",
  442. smalltalk.method({
  443. selector: "new:",
  444. fn: function (anInteger) {
  445. var self=this;
  446. return smalltalk.send(self, "_new", []);
  447. return self;}
  448. }),
  449. smalltalk.Collection.klass);
  450. smalltalk.addMethod(
  451. "_streamClass",
  452. smalltalk.method({
  453. selector: "streamClass",
  454. fn: function () {
  455. var self=this;
  456. return (smalltalk.Stream || Stream);
  457. return self;}
  458. }),
  459. smalltalk.Collection.klass);
  460. smalltalk.addMethod(
  461. "_with_",
  462. smalltalk.method({
  463. selector: "with:",
  464. fn: function (anObject) {
  465. var self=this;
  466. return (function($rec){smalltalk.send($rec, "_add_", [anObject]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  467. return self;}
  468. }),
  469. smalltalk.Collection.klass);
  470. smalltalk.addMethod(
  471. "_with_with_",
  472. smalltalk.method({
  473. selector: "with:with:",
  474. fn: function (anObject, anotherObject) {
  475. var self=this;
  476. return (function($rec){smalltalk.send($rec, "_add_", [anObject]);smalltalk.send($rec, "_add_", [anotherObject]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  477. return self;}
  478. }),
  479. smalltalk.Collection.klass);
  480. smalltalk.addMethod(
  481. "_with_with_with_",
  482. smalltalk.method({
  483. selector: "with:with:with:",
  484. fn: function (firstObject, secondObject, thirdObject) {
  485. var self=this;
  486. return (function($rec){smalltalk.send($rec, "_add_", [firstObject]);smalltalk.send($rec, "_add_", [secondObject]);smalltalk.send($rec, "_add_", [thirdObject]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  487. return self;}
  488. }),
  489. smalltalk.Collection.klass);
  490. smalltalk.addMethod(
  491. "_withAll_",
  492. smalltalk.method({
  493. selector: "withAll:",
  494. fn: function (aCollection) {
  495. var self=this;
  496. return (function($rec){smalltalk.send($rec, "_addAll_", [aCollection]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  497. return self;}
  498. }),
  499. smalltalk.Collection.klass);
  500. smalltalk.addClass('HashedCollection', smalltalk.Collection, [], 'Kernel-Collections');
  501. smalltalk.addMethod(
  502. "__comma",
  503. smalltalk.method({
  504. selector: ",",
  505. fn: function (aCollection) {
  506. var self=this;
  507. smalltalk.send(self, "_shouldNotImplement", []);
  508. return self;}
  509. }),
  510. smalltalk.HashedCollection);
  511. smalltalk.addMethod(
  512. "__eq",
  513. smalltalk.method({
  514. selector: "=",
  515. fn: function (aHashedCollection) {
  516. var self=this;
  517. var $early={};
  518. try{((($receiver = smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [smalltalk.send(aHashedCollection, "_class", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw $early=[false]})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=[false]})();})]));
  519. ((($receiver = smalltalk.send(smalltalk.send(self, "_size", []), "__eq", [smalltalk.send(aHashedCollection, "_size", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw $early=[false]})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=[false]})();})]));
  520. return smalltalk.send(smalltalk.send(self, "_associations", []), "__eq", [smalltalk.send(aHashedCollection, "_associations", [])]);
  521. return self;
  522. } catch(e) {if(e===$early)return e[0]; throw e}}
  523. }),
  524. smalltalk.HashedCollection);
  525. smalltalk.addMethod(
  526. "_add_",
  527. smalltalk.method({
  528. selector: "add:",
  529. fn: function (anAssociation) {
  530. var self=this;
  531. smalltalk.send(self, "_at_put_", [smalltalk.send(anAssociation, "_key", []), smalltalk.send(anAssociation, "_value", [])]);
  532. return self;}
  533. }),
  534. smalltalk.HashedCollection);
  535. smalltalk.addMethod(
  536. "_addAll_",
  537. smalltalk.method({
  538. selector: "addAll:",
  539. fn: function (aHashedCollection) {
  540. var self=this;
  541. smalltalk.send(self, "_addAll_", [smalltalk.send(aHashedCollection, "_associations", [])], smalltalk.HashedCollection.superclass || nil);
  542. return aHashedCollection;
  543. return self;}
  544. }),
  545. smalltalk.HashedCollection);
  546. smalltalk.addMethod(
  547. "_asDictionary",
  548. smalltalk.method({
  549. selector: "asDictionary",
  550. fn: function () {
  551. var self=this;
  552. return smalltalk.send((smalltalk.Dictionary || Dictionary), "_fromPairs_", [smalltalk.send(self, "_associations", [])]);
  553. return self;}
  554. }),
  555. smalltalk.HashedCollection);
  556. smalltalk.addMethod(
  557. "_asJSON",
  558. smalltalk.method({
  559. selector: "asJSON",
  560. fn: function () {
  561. var self=this;
  562. var c=nil;
  563. (c=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []));
  564. smalltalk.send(self, "_keysAndValuesDo_", [(function(key, value){return smalltalk.send(c, "_at_put_", [key, smalltalk.send(value, "_asJSON", [])]);})]);
  565. return c;
  566. return self;}
  567. }),
  568. smalltalk.HashedCollection);
  569. smalltalk.addMethod(
  570. "_associations",
  571. smalltalk.method({
  572. selector: "associations",
  573. fn: function () {
  574. var self=this;
  575. var associations=nil;
  576. (associations=[]);
  577. smalltalk.send(smalltalk.send(self, "_keys", []), "_do_", [(function(each){return smalltalk.send(associations, "_add_", [smalltalk.send((smalltalk.Association || Association), "_key_value_", [each, smalltalk.send(self, "_at_", [each])])]);})]);
  578. return associations;
  579. return self;}
  580. }),
  581. smalltalk.HashedCollection);
  582. smalltalk.addMethod(
  583. "_associationsDo_",
  584. smalltalk.method({
  585. selector: "associationsDo:",
  586. fn: function (aBlock) {
  587. var self=this;
  588. smalltalk.send(smalltalk.send(self, "_associations", []), "_do_", [aBlock]);
  589. return self;}
  590. }),
  591. smalltalk.HashedCollection);
  592. smalltalk.addMethod(
  593. "_at_",
  594. smalltalk.method({
  595. selector: "at:",
  596. fn: function (aKey) {
  597. var self=this;
  598. return smalltalk.send(self, "_at_ifAbsent_", [aKey, (function(){return smalltalk.send(self, "_errorNotFound", []);})]);
  599. return self;}
  600. }),
  601. smalltalk.HashedCollection);
  602. smalltalk.addMethod(
  603. "_at_ifAbsent_",
  604. smalltalk.method({
  605. selector: "at:ifAbsent:",
  606. fn: function (aKey, aBlock) {
  607. var self=this;
  608. return smalltalk.send(smalltalk.send(self, "_includesKey_", [aKey]), "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self, "_basicAt_", [aKey]);}), aBlock]);
  609. return self;}
  610. }),
  611. smalltalk.HashedCollection);
  612. smalltalk.addMethod(
  613. "_at_ifAbsentPut_",
  614. smalltalk.method({
  615. selector: "at:ifAbsentPut:",
  616. fn: function (aKey, aBlock) {
  617. var self=this;
  618. return smalltalk.send(self, "_at_ifAbsent_", [aKey, (function(){return smalltalk.send(self, "_at_put_", [aKey, smalltalk.send(aBlock, "_value", [])]);})]);
  619. return self;}
  620. }),
  621. smalltalk.HashedCollection);
  622. smalltalk.addMethod(
  623. "_at_ifPresent_",
  624. smalltalk.method({
  625. selector: "at:ifPresent:",
  626. fn: function (aKey, aBlock) {
  627. var self=this;
  628. return ((($receiver = smalltalk.send(self, "_includesKey_", [aKey])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_at_", [aKey])]);})() : (function(){return nil;})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_at_", [aKey])]);}), (function(){return nil;})]));
  629. return self;}
  630. }),
  631. smalltalk.HashedCollection);
  632. smalltalk.addMethod(
  633. "_at_ifPresent_ifAbsent_",
  634. smalltalk.method({
  635. selector: "at:ifPresent:ifAbsent:",
  636. fn: function (aKey, aBlock, anotherBlock) {
  637. var self=this;
  638. return smalltalk.send(smalltalk.send(self, "_includesKey_", [aKey]), "_ifTrue_ifFalse_", [(function(){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_at_", [aKey])]);}), anotherBlock]);
  639. return self;}
  640. }),
  641. smalltalk.HashedCollection);
  642. smalltalk.addMethod(
  643. "_at_put_",
  644. smalltalk.method({
  645. selector: "at:put:",
  646. fn: function (aKey, aValue) {
  647. var self=this;
  648. return smalltalk.send(self, "_basicAt_put_", [aKey, aValue]);
  649. return self;}
  650. }),
  651. smalltalk.HashedCollection);
  652. smalltalk.addMethod(
  653. "_collect_",
  654. smalltalk.method({
  655. selector: "collect:",
  656. fn: function (aBlock) {
  657. var self=this;
  658. var newDict=nil;
  659. (newDict=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []));
  660. smalltalk.send(self, "_keysAndValuesDo_", [(function(key, value){return smalltalk.send(newDict, "_at_put_", [key, smalltalk.send(aBlock, "_value_", [value])]);})]);
  661. return newDict;
  662. return self;}
  663. }),
  664. smalltalk.HashedCollection);
  665. smalltalk.addMethod(
  666. "_copyFrom_to_",
  667. smalltalk.method({
  668. selector: "copyFrom:to:",
  669. fn: function (anIndex, anotherIndex) {
  670. var self=this;
  671. smalltalk.send(self, "_shouldNotImplement", []);
  672. return self;}
  673. }),
  674. smalltalk.HashedCollection);
  675. smalltalk.addMethod(
  676. "_deepCopy",
  677. smalltalk.method({
  678. selector: "deepCopy",
  679. fn: function () {
  680. var self=this;
  681. var copy=nil;
  682. (copy=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []));
  683. smalltalk.send(self, "_associationsDo_", [(function(each){return smalltalk.send(copy, "_at_put_", [smalltalk.send(each, "_key", []), smalltalk.send(smalltalk.send(each, "_value", []), "_deepCopy", [])]);})]);
  684. return copy;
  685. return self;}
  686. }),
  687. smalltalk.HashedCollection);
  688. smalltalk.addMethod(
  689. "_detect_ifNone_",
  690. smalltalk.method({
  691. selector: "detect:ifNone:",
  692. fn: function (aBlock, anotherBlock) {
  693. var self=this;
  694. return smalltalk.send(smalltalk.send(self, "_values", []), "_detect_ifNone_", [aBlock, anotherBlock]);
  695. return self;}
  696. }),
  697. smalltalk.HashedCollection);
  698. smalltalk.addMethod(
  699. "_do_",
  700. smalltalk.method({
  701. selector: "do:",
  702. fn: function (aBlock) {
  703. var self=this;
  704. smalltalk.send(smalltalk.send(self, "_values", []), "_do_", [aBlock]);
  705. return self;}
  706. }),
  707. smalltalk.HashedCollection);
  708. smalltalk.addMethod(
  709. "_includes_",
  710. smalltalk.method({
  711. selector: "includes:",
  712. fn: function (anObject) {
  713. var self=this;
  714. return smalltalk.send(smalltalk.send(self, "_values", []), "_includes_", [anObject]);
  715. return self;}
  716. }),
  717. smalltalk.HashedCollection);
  718. smalltalk.addMethod(
  719. "_includesKey_",
  720. smalltalk.method({
  721. selector: "includesKey:",
  722. fn: function (aKey) {
  723. var self=this;
  724. return self.hasOwnProperty(aKey);
  725. return self;}
  726. }),
  727. smalltalk.HashedCollection);
  728. smalltalk.addMethod(
  729. "_keys",
  730. smalltalk.method({
  731. selector: "keys",
  732. fn: function () {
  733. var self=this;
  734. if ('function'===typeof Object.keys) return Object.keys(self);
  735. var keys = [];
  736. for(var i in self) {
  737. if(self.hasOwnProperty(i)) {
  738. keys.push(i);
  739. }
  740. };
  741. return keys;
  742. ;
  743. return self;}
  744. }),
  745. smalltalk.HashedCollection);
  746. smalltalk.addMethod(
  747. "_keysAndValuesDo_",
  748. smalltalk.method({
  749. selector: "keysAndValuesDo:",
  750. fn: function (aBlock) {
  751. var self=this;
  752. smalltalk.send(self, "_associationsDo_", [(function(each){return smalltalk.send(aBlock, "_value_value_", [smalltalk.send(each, "_key", []), smalltalk.send(each, "_value", [])]);})]);
  753. return self;}
  754. }),
  755. smalltalk.HashedCollection);
  756. smalltalk.addMethod(
  757. "_printString",
  758. smalltalk.method({
  759. selector: "printString",
  760. fn: function () {
  761. var self=this;
  762. return smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(aStream){smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(smalltalk.send("a ", "__comma", [smalltalk.send(smalltalk.send(self, "_class", []), "_name", [])]), "__comma", ["("])]);smalltalk.send(smalltalk.send(self, "_associations", []), "_do_separatedBy_", [(function(each){return smalltalk.send(each, "_storeOn_", [aStream]);}), (function(){return smalltalk.send(aStream, "_nextPutAll_", [" , "]);})]);return smalltalk.send(aStream, "_nextPutAll_", [")"]);})]);
  763. return self;}
  764. }),
  765. smalltalk.HashedCollection);
  766. smalltalk.addMethod(
  767. "_remove_ifAbsent_",
  768. smalltalk.method({
  769. selector: "remove:ifAbsent:",
  770. fn: function (aKey, aBlock) {
  771. var self=this;
  772. return smalltalk.send(self, "_removeKey_ifAbsent_", [aKey, aBlock]);
  773. return self;}
  774. }),
  775. smalltalk.HashedCollection);
  776. smalltalk.addMethod(
  777. "_removeKey_",
  778. smalltalk.method({
  779. selector: "removeKey:",
  780. fn: function (aKey) {
  781. var self=this;
  782. return smalltalk.send(self, "_remove_", [aKey]);
  783. return self;}
  784. }),
  785. smalltalk.HashedCollection);
  786. smalltalk.addMethod(
  787. "_removeKey_ifAbsent_",
  788. smalltalk.method({
  789. selector: "removeKey:ifAbsent:",
  790. fn: function (aKey, aBlock) {
  791. var self=this;
  792. return ((($receiver = smalltalk.send(self, "_includesKey_", [aKey])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(aBlock, "_value", []);})() : (function(){return smalltalk.send(self, "_basicDelete_", [aKey]);})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){return smalltalk.send(aBlock, "_value", []);}), (function(){return smalltalk.send(self, "_basicDelete_", [aKey]);})]));
  793. return self;}
  794. }),
  795. smalltalk.HashedCollection);
  796. smalltalk.addMethod(
  797. "_select_",
  798. smalltalk.method({
  799. selector: "select:",
  800. fn: function (aBlock) {
  801. var self=this;
  802. var newDict=nil;
  803. (newDict=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []));
  804. smalltalk.send(self, "_keysAndValuesDo_", [(function(key, value){return ((($receiver = smalltalk.send(aBlock, "_value_", [value])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(newDict, "_at_put_", [key, value]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(newDict, "_at_put_", [key, value]);})]));})]);
  805. return newDict;
  806. return self;}
  807. }),
  808. smalltalk.HashedCollection);
  809. smalltalk.addMethod(
  810. "_shallowCopy",
  811. smalltalk.method({
  812. selector: "shallowCopy",
  813. fn: function () {
  814. var self=this;
  815. var copy=nil;
  816. (copy=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []));
  817. smalltalk.send(self, "_associationsDo_", [(function(each){return smalltalk.send(copy, "_at_put_", [smalltalk.send(each, "_key", []), smalltalk.send(each, "_value", [])]);})]);
  818. return copy;
  819. return self;}
  820. }),
  821. smalltalk.HashedCollection);
  822. smalltalk.addMethod(
  823. "_size",
  824. smalltalk.method({
  825. selector: "size",
  826. fn: function () {
  827. var self=this;
  828. return smalltalk.send(smalltalk.send(self, "_keys", []), "_size", []);
  829. return self;}
  830. }),
  831. smalltalk.HashedCollection);
  832. smalltalk.addMethod(
  833. "_storeOn_",
  834. smalltalk.method({
  835. selector: "storeOn:",
  836. fn: function (aStream) {
  837. var self=this;
  838. smalltalk.send(aStream, "_nextPutAll_", ["#{"]);
  839. smalltalk.send(smalltalk.send(self, "_associations", []), "_do_separatedBy_", [(function(each){return smalltalk.send(each, "_storeOn_", [aStream]);}), (function(){return smalltalk.send(aStream, "_nextPutAll_", [". "]);})]);
  840. smalltalk.send(aStream, "_nextPutAll_", ["}"]);
  841. return self;}
  842. }),
  843. smalltalk.HashedCollection);
  844. smalltalk.addMethod(
  845. "_values",
  846. smalltalk.method({
  847. selector: "values",
  848. fn: function () {
  849. var self=this;
  850. return smalltalk.send(smalltalk.send(self, "_keys", []), "_collect_", [(function(each){return smalltalk.send(self, "_at_", [each]);})]);
  851. return self;}
  852. }),
  853. smalltalk.HashedCollection);
  854. smalltalk.addMethod(
  855. "_fromPairs_",
  856. smalltalk.method({
  857. selector: "fromPairs:",
  858. fn: function (aCollection) {
  859. var self=this;
  860. var dict=nil;
  861. (dict=smalltalk.send(self, "_new", []));
  862. smalltalk.send(aCollection, "_do_", [(function(each){return smalltalk.send(dict, "_add_", [each]);})]);
  863. return dict;
  864. return self;}
  865. }),
  866. smalltalk.HashedCollection.klass);
  867. smalltalk.addClass('Dictionary', smalltalk.HashedCollection, ['keys', 'values'], 'Kernel-Collections');
  868. smalltalk.addMethod(
  869. "_asHashedCollection",
  870. smalltalk.method({
  871. selector: "asHashedCollection",
  872. fn: function () {
  873. var self=this;
  874. return smalltalk.send((smalltalk.HashedCollection || HashedCollection), "_fromPairs_", [smalltalk.send(self, "_associations", [])]);
  875. return self;}
  876. }),
  877. smalltalk.Dictionary);
  878. smalltalk.addMethod(
  879. "_asJSON",
  880. smalltalk.method({
  881. selector: "asJSON",
  882. fn: function () {
  883. var self=this;
  884. return smalltalk.send(smalltalk.send(self, "_asHashedCollection", []), "_asJSON", []);
  885. return self;}
  886. }),
  887. smalltalk.Dictionary);
  888. smalltalk.addMethod(
  889. "_at_ifAbsent_",
  890. smalltalk.method({
  891. selector: "at:ifAbsent:",
  892. fn: function (aKey, aBlock) {
  893. var self=this;
  894. var index;
  895. for(var i=0;i<self['@keys'].length;i++){
  896. if(self['@keys'][i].__eq(aKey)) {index = i;}
  897. };
  898. if(typeof index === 'undefined') {
  899. return aBlock();
  900. } else {
  901. return self['@values'][index];
  902. }
  903. ;
  904. return self;}
  905. }),
  906. smalltalk.Dictionary);
  907. smalltalk.addMethod(
  908. "_at_put_",
  909. smalltalk.method({
  910. selector: "at:put:",
  911. fn: function (aKey, aValue) {
  912. var self=this;
  913. var index = self['@keys'].indexOf(aKey);
  914. if(index === -1) {
  915. self['@values'].push(aValue);
  916. self['@keys'].push(aKey);
  917. } else {
  918. self['@values'][index] = aValue;
  919. };
  920. return aValue;
  921. ;
  922. return self;}
  923. }),
  924. smalltalk.Dictionary);
  925. smalltalk.addMethod(
  926. "_includesKey_",
  927. smalltalk.method({
  928. selector: "includesKey:",
  929. fn: function (aKey) {
  930. var self=this;
  931. return smalltalk.send(self['@keys'], "_includes_", [aKey]);
  932. return self;}
  933. }),
  934. smalltalk.Dictionary);
  935. smalltalk.addMethod(
  936. "_initialize",
  937. smalltalk.method({
  938. selector: "initialize",
  939. fn: function () {
  940. var self=this;
  941. smalltalk.send(self, "_initialize", [], smalltalk.Dictionary.superclass || nil);
  942. (self['@keys']=[]);
  943. (self['@values']=[]);
  944. return self;}
  945. }),
  946. smalltalk.Dictionary);
  947. smalltalk.addMethod(
  948. "_keys",
  949. smalltalk.method({
  950. selector: "keys",
  951. fn: function () {
  952. var self=this;
  953. return smalltalk.send(self['@keys'], "_copy", []);
  954. return self;}
  955. }),
  956. smalltalk.Dictionary);
  957. smalltalk.addMethod(
  958. "_removeKey_ifAbsent_",
  959. smalltalk.method({
  960. selector: "removeKey:ifAbsent:",
  961. fn: function (aKey, aBlock) {
  962. var self=this;
  963. var index = self['@keys'].indexOf(aKey);
  964. if(index === -1) {
  965. return aBlock()
  966. } else {
  967. var value;
  968. self['@keys'].splice(index, 1);
  969. value = self['@values'].splice(index, 1);
  970. return value[0];
  971. };
  972. ;
  973. return self;}
  974. }),
  975. smalltalk.Dictionary);
  976. smalltalk.addMethod(
  977. "_values",
  978. smalltalk.method({
  979. selector: "values",
  980. fn: function () {
  981. var self=this;
  982. return smalltalk.send(self['@values'], "_copy", []);
  983. return self;}
  984. }),
  985. smalltalk.Dictionary);
  986. smalltalk.addClass('SequenceableCollection', smalltalk.Collection, [], 'Kernel-Collections');
  987. smalltalk.addMethod(
  988. "__eq",
  989. smalltalk.method({
  990. selector: "=",
  991. fn: function (aCollection) {
  992. var self=this;
  993. var $early={};
  994. try{((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [smalltalk.send(aCollection, "_class", [])]), "_and_", [(function(){return smalltalk.send(smalltalk.send(self, "_size", []), "__eq", [smalltalk.send(aCollection, "_size", [])]);})])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw $early=[false]})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=[false]})();})]));
  995. smalltalk.send(self, "_withIndexDo_", [(function(each, i){return ((($receiver = smalltalk.send(smalltalk.send(aCollection, "_at_", [i]), "__eq", [each])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw $early=[false]})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=[false]})();})]));})]);
  996. return true;
  997. return self;
  998. } catch(e) {if(e===$early)return e[0]; throw e}}
  999. }),
  1000. smalltalk.SequenceableCollection);
  1001. smalltalk.addMethod(
  1002. "_addLast_",
  1003. smalltalk.method({
  1004. selector: "addLast:",
  1005. fn: function (anObject) {
  1006. var self=this;
  1007. smalltalk.send(self, "_add_", [anObject]);
  1008. return self;}
  1009. }),
  1010. smalltalk.SequenceableCollection);
  1011. smalltalk.addMethod(
  1012. "_allButFirst",
  1013. smalltalk.method({
  1014. selector: "allButFirst",
  1015. fn: function () {
  1016. var self=this;
  1017. return smalltalk.send(self, "_copyFrom_to_", [(2), smalltalk.send(self, "_size", [])]);
  1018. return self;}
  1019. }),
  1020. smalltalk.SequenceableCollection);
  1021. smalltalk.addMethod(
  1022. "_allButLast",
  1023. smalltalk.method({
  1024. selector: "allButLast",
  1025. fn: function () {
  1026. var self=this;
  1027. return smalltalk.send(self, "_copyFrom_to_", [(1), ((($receiver = smalltalk.send(self, "_size", [])).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)]))]);
  1028. return self;}
  1029. }),
  1030. smalltalk.SequenceableCollection);
  1031. smalltalk.addMethod(
  1032. "_at_",
  1033. smalltalk.method({
  1034. selector: "at:",
  1035. fn: function (anIndex) {
  1036. var self=this;
  1037. return smalltalk.send(self, "_at_ifAbsent_", [anIndex, (function(){return smalltalk.send(self, "_errorNotFound", []);})]);
  1038. return self;}
  1039. }),
  1040. smalltalk.SequenceableCollection);
  1041. smalltalk.addMethod(
  1042. "_at_ifAbsent_",
  1043. smalltalk.method({
  1044. selector: "at:ifAbsent:",
  1045. fn: function (anIndex, aBlock) {
  1046. var self=this;
  1047. smalltalk.send(self, "_subclassResponsibility", []);
  1048. return self;}
  1049. }),
  1050. smalltalk.SequenceableCollection);
  1051. smalltalk.addMethod(
  1052. "_at_put_",
  1053. smalltalk.method({
  1054. selector: "at:put:",
  1055. fn: function (anIndex, anObject) {
  1056. var self=this;
  1057. smalltalk.send(self, "_subclassResponsibility", []);
  1058. return self;}
  1059. }),
  1060. smalltalk.SequenceableCollection);
  1061. smalltalk.addMethod(
  1062. "_atRandom",
  1063. smalltalk.method({
  1064. selector: "atRandom",
  1065. fn: function () {
  1066. var self=this;
  1067. return smalltalk.send(self, "_at_", [smalltalk.send(smalltalk.send(self, "_size", []), "_atRandom", [])]);
  1068. return self;}
  1069. }),
  1070. smalltalk.SequenceableCollection);
  1071. smalltalk.addMethod(
  1072. "_copyFrom_to_",
  1073. smalltalk.method({
  1074. selector: "copyFrom:to:",
  1075. fn: function (anIndex, anotherIndex) {
  1076. var self=this;
  1077. var range=nil;
  1078. var newCollection=nil;
  1079. (range=smalltalk.send(anIndex, "_to_", [anotherIndex]));
  1080. (newCollection=smalltalk.send(smalltalk.send(self, "_class", []), "_new_", [smalltalk.send(range, "_size", [])]));
  1081. smalltalk.send(range, "_withIndexDo_", [(function(each, i){return smalltalk.send(newCollection, "_at_put_", [i, smalltalk.send(self, "_at_", [each])]);})]);
  1082. return newCollection;
  1083. return self;}
  1084. }),
  1085. smalltalk.SequenceableCollection);
  1086. smalltalk.addMethod(
  1087. "_deepCopy",
  1088. smalltalk.method({
  1089. selector: "deepCopy",
  1090. fn: function () {
  1091. var self=this;
  1092. var newCollection=nil;
  1093. (newCollection=smalltalk.send(smalltalk.send(self, "_class", []), "_new_", [smalltalk.send(self, "_size", [])]));
  1094. smalltalk.send(self, "_withIndexDo_", [(function(each, index){return smalltalk.send(newCollection, "_at_put_", [index, smalltalk.send(each, "_deepCopy", [])]);})]);
  1095. return newCollection;
  1096. return self;}
  1097. }),
  1098. smalltalk.SequenceableCollection);
  1099. smalltalk.addMethod(
  1100. "_first",
  1101. smalltalk.method({
  1102. selector: "first",
  1103. fn: function () {
  1104. var self=this;
  1105. return smalltalk.send(self, "_at_", [(1)]);
  1106. return self;}
  1107. }),
  1108. smalltalk.SequenceableCollection);
  1109. smalltalk.addMethod(
  1110. "_first_",
  1111. smalltalk.method({
  1112. selector: "first:",
  1113. fn: function (n) {
  1114. var self=this;
  1115. return smalltalk.send(self, "_copyFrom_to_", [(1), n]);
  1116. return self;}
  1117. }),
  1118. smalltalk.SequenceableCollection);
  1119. smalltalk.addMethod(
  1120. "_fourth",
  1121. smalltalk.method({
  1122. selector: "fourth",
  1123. fn: function () {
  1124. var self=this;
  1125. return smalltalk.send(self, "_at_", [(4)]);
  1126. return self;}
  1127. }),
  1128. smalltalk.SequenceableCollection);
  1129. smalltalk.addMethod(
  1130. "_indexOf_",
  1131. smalltalk.method({
  1132. selector: "indexOf:",
  1133. fn: function (anObject) {
  1134. var self=this;
  1135. return smalltalk.send(self, "_indexOf_ifAbsent_", [anObject, (function(){return smalltalk.send(self, "_errorNotFound", []);})]);
  1136. return self;}
  1137. }),
  1138. smalltalk.SequenceableCollection);
  1139. smalltalk.addMethod(
  1140. "_indexOf_ifAbsent_",
  1141. smalltalk.method({
  1142. selector: "indexOf:ifAbsent:",
  1143. fn: function (anObject, aBlock) {
  1144. var self=this;
  1145. for(var i=0;i<self.length;i++){
  1146. if(self[i].__eq(anObject)) {return i+1}
  1147. }
  1148. return aBlock();
  1149. ;
  1150. return self;}
  1151. }),
  1152. smalltalk.SequenceableCollection);
  1153. smalltalk.addMethod(
  1154. "_indexOf_startingAt_",
  1155. smalltalk.method({
  1156. selector: "indexOf:startingAt:",
  1157. fn: function (anObject, start) {
  1158. var self=this;
  1159. return smalltalk.send(self, "_indexOf_startingAt_ifAbsent_", [anObject, start, (function(){return (0);})]);
  1160. return self;}
  1161. }),
  1162. smalltalk.SequenceableCollection);
  1163. smalltalk.addMethod(
  1164. "_indexOf_startingAt_ifAbsent_",
  1165. smalltalk.method({
  1166. selector: "indexOf:startingAt:ifAbsent:",
  1167. fn: function (anObject, start, aBlock) {
  1168. var self=this;
  1169. for(var i=start-1;i<self.length;i++){
  1170. if(self[i].__eq(anObject)) {return i+1}
  1171. }
  1172. return aBlock();
  1173. ;
  1174. return self;}
  1175. }),
  1176. smalltalk.SequenceableCollection);
  1177. smalltalk.addMethod(
  1178. "_last",
  1179. smalltalk.method({
  1180. selector: "last",
  1181. fn: function () {
  1182. var self=this;
  1183. return smalltalk.send(self, "_at_", [smalltalk.send(self, "_size", [])]);
  1184. return self;}
  1185. }),
  1186. smalltalk.SequenceableCollection);
  1187. smalltalk.addMethod(
  1188. "_removeLast",
  1189. smalltalk.method({
  1190. selector: "removeLast",
  1191. fn: function () {
  1192. var self=this;
  1193. smalltalk.send(self, "_remove_", [smalltalk.send(self, "_last", [])]);
  1194. return self;}
  1195. }),
  1196. smalltalk.SequenceableCollection);
  1197. smalltalk.addMethod(
  1198. "_reversed",
  1199. smalltalk.method({
  1200. selector: "reversed",
  1201. fn: function () {
  1202. var self=this;
  1203. smalltalk.send(self, "_subclassResponsibility", []);
  1204. return self;}
  1205. }),
  1206. smalltalk.SequenceableCollection);
  1207. smalltalk.addMethod(
  1208. "_second",
  1209. smalltalk.method({
  1210. selector: "second",
  1211. fn: function () {
  1212. var self=this;
  1213. return smalltalk.send(self, "_at_", [(2)]);
  1214. return self;}
  1215. }),
  1216. smalltalk.SequenceableCollection);
  1217. smalltalk.addMethod(
  1218. "_shallowCopy",
  1219. smalltalk.method({
  1220. selector: "shallowCopy",
  1221. fn: function () {
  1222. var self=this;
  1223. var newCollection=nil;
  1224. (newCollection=smalltalk.send(smalltalk.send(self, "_class", []), "_new_", [smalltalk.send(self, "_size", [])]));
  1225. smalltalk.send(self, "_withIndexDo_", [(function(each, index){return smalltalk.send(newCollection, "_at_put_", [index, each]);})]);
  1226. return newCollection;
  1227. return self;}
  1228. }),
  1229. smalltalk.SequenceableCollection);
  1230. smalltalk.addMethod(
  1231. "_third",
  1232. smalltalk.method({
  1233. selector: "third",
  1234. fn: function () {
  1235. var self=this;
  1236. return smalltalk.send(self, "_at_", [(3)]);
  1237. return self;}
  1238. }),
  1239. smalltalk.SequenceableCollection);
  1240. smalltalk.addMethod(
  1241. "_withIndexDo_",
  1242. smalltalk.method({
  1243. selector: "withIndexDo:",
  1244. fn: function (aBlock) {
  1245. var self=this;
  1246. for(var i=0;i<self.length;i++){aBlock(self[i], i+1);};
  1247. return self;}
  1248. }),
  1249. smalltalk.SequenceableCollection);
  1250. smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  1251. smalltalk.addMethod(
  1252. "_add_",
  1253. smalltalk.method({
  1254. selector: "add:",
  1255. fn: function (anObject) {
  1256. var self=this;
  1257. self.push(anObject); return anObject;;
  1258. return self;}
  1259. }),
  1260. smalltalk.Array);
  1261. smalltalk.addMethod(
  1262. "_asJavascript",
  1263. smalltalk.method({
  1264. selector: "asJavascript",
  1265. fn: function () {
  1266. var self=this;
  1267. return smalltalk.send(smalltalk.send("[", "__comma", [smalltalk.send(smalltalk.send(self, "_collect_", [(function(each){return smalltalk.send(each, "_asJavascript", []);})]), "_join_", [", "])]), "__comma", ["]"]);
  1268. return self;}
  1269. }),
  1270. smalltalk.Array);
  1271. smalltalk.addMethod(
  1272. "_at_ifAbsent_",
  1273. smalltalk.method({
  1274. selector: "at:ifAbsent:",
  1275. fn: function (anIndex, aBlock) {
  1276. var self=this;
  1277. if((anIndex < 1) || (self.length < anIndex)) {return aBlock()};
  1278. return self[anIndex - 1];
  1279. ;
  1280. return self;}
  1281. }),
  1282. smalltalk.Array);
  1283. smalltalk.addMethod(
  1284. "_at_put_",
  1285. smalltalk.method({
  1286. selector: "at:put:",
  1287. fn: function (anIndex, anObject) {
  1288. var self=this;
  1289. return self[anIndex - 1] = anObject;
  1290. return self;}
  1291. }),
  1292. smalltalk.Array);
  1293. smalltalk.addMethod(
  1294. "_join_",
  1295. smalltalk.method({
  1296. selector: "join:",
  1297. fn: function (aString) {
  1298. var self=this;
  1299. return self.join(aString);
  1300. return self;}
  1301. }),
  1302. smalltalk.Array);
  1303. smalltalk.addMethod(
  1304. "_remove_ifAbsent_",
  1305. smalltalk.method({
  1306. selector: "remove:ifAbsent:",
  1307. fn: function (anObject, aBlock) {
  1308. var self=this;
  1309. for(var i=0;i<self.length;i++) {
  1310. if(self[i] == anObject) {
  1311. self.splice(i,1);
  1312. return self;
  1313. }
  1314. }
  1315. ;
  1316. smalltalk.send(aBlock, "_value", []);
  1317. return self;}
  1318. }),
  1319. smalltalk.Array);
  1320. smalltalk.addMethod(
  1321. "_removeFrom_to_",
  1322. smalltalk.method({
  1323. selector: "removeFrom:to:",
  1324. fn: function (aNumber, anotherNumber) {
  1325. var self=this;
  1326. self.splice(aNumber - 1,anotherNumber - 1);
  1327. return self;}
  1328. }),
  1329. smalltalk.Array);
  1330. smalltalk.addMethod(
  1331. "_reversed",
  1332. smalltalk.method({
  1333. selector: "reversed",
  1334. fn: function () {
  1335. var self=this;
  1336. return self._copy().reverse();
  1337. return self;}
  1338. }),
  1339. smalltalk.Array);
  1340. smalltalk.addMethod(
  1341. "_size",
  1342. smalltalk.method({
  1343. selector: "size",
  1344. fn: function () {
  1345. var self=this;
  1346. return self.length;
  1347. return self;}
  1348. }),
  1349. smalltalk.Array);
  1350. smalltalk.addMethod(
  1351. "_sort",
  1352. smalltalk.method({
  1353. selector: "sort",
  1354. fn: function () {
  1355. var self=this;
  1356. return smalltalk.send(self, "_basicPerform_", ["sort"]);
  1357. return self;}
  1358. }),
  1359. smalltalk.Array);
  1360. smalltalk.addMethod(
  1361. "_sort_",
  1362. smalltalk.method({
  1363. selector: "sort:",
  1364. fn: function (aBlock) {
  1365. var self=this;
  1366. return self.sort(function(a, b) {
  1367. if(aBlock(a,b)) {return -1} else {return 1}
  1368. })
  1369. ;
  1370. return self;}
  1371. }),
  1372. smalltalk.Array);
  1373. smalltalk.addMethod(
  1374. "_sorted",
  1375. smalltalk.method({
  1376. selector: "sorted",
  1377. fn: function () {
  1378. var self=this;
  1379. return smalltalk.send(smalltalk.send(self, "_copy", []), "_sort", []);
  1380. return self;}
  1381. }),
  1382. smalltalk.Array);
  1383. smalltalk.addMethod(
  1384. "_sorted_",
  1385. smalltalk.method({
  1386. selector: "sorted:",
  1387. fn: function (aBlock) {
  1388. var self=this;
  1389. return smalltalk.send(smalltalk.send(self, "_copy", []), "_sort_", [aBlock]);
  1390. return self;}
  1391. }),
  1392. smalltalk.Array);
  1393. smalltalk.addMethod(
  1394. "_new_",
  1395. smalltalk.method({
  1396. selector: "new:",
  1397. fn: function (anInteger) {
  1398. var self=this;
  1399. return new Array(anInteger);
  1400. return self;}
  1401. }),
  1402. smalltalk.Array.klass);
  1403. smalltalk.addMethod(
  1404. "_with_",
  1405. smalltalk.method({
  1406. selector: "with:",
  1407. fn: function (anObject) {
  1408. var self=this;
  1409. return (function($rec){smalltalk.send($rec, "_at_put_", [(1), anObject]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new_", [(1)]));
  1410. return self;}
  1411. }),
  1412. smalltalk.Array.klass);
  1413. smalltalk.addMethod(
  1414. "_with_with_",
  1415. smalltalk.method({
  1416. selector: "with:with:",
  1417. fn: function (anObject, anObject2) {
  1418. var self=this;
  1419. return (function($rec){smalltalk.send($rec, "_at_put_", [(1), anObject]);smalltalk.send($rec, "_at_put_", [(2), anObject2]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new_", [(2)]));
  1420. return self;}
  1421. }),
  1422. smalltalk.Array.klass);
  1423. smalltalk.addMethod(
  1424. "_with_with_with_",
  1425. smalltalk.method({
  1426. selector: "with:with:with:",
  1427. fn: function (anObject, anObject2, anObject3) {
  1428. var self=this;
  1429. return (function($rec){smalltalk.send($rec, "_at_put_", [(1), anObject]);smalltalk.send($rec, "_at_put_", [(2), anObject2]);smalltalk.send($rec, "_at_put_", [(3), anObject3]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new_", [(3)]));
  1430. return self;}
  1431. }),
  1432. smalltalk.Array.klass);
  1433. smalltalk.addMethod(
  1434. "_withAll_",
  1435. smalltalk.method({
  1436. selector: "withAll:",
  1437. fn: function (aCollection) {
  1438. var self=this;
  1439. var instance=nil;
  1440. var index=nil;
  1441. (index=(1));
  1442. (instance=smalltalk.send(self, "_new_", [smalltalk.send(aCollection, "_size", [])]));
  1443. smalltalk.send(aCollection, "_do_", [(function(each){smalltalk.send(instance, "_at_put_", [index, each]);return (index=((($receiver = index).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})]);
  1444. return instance;
  1445. return self;}
  1446. }),
  1447. smalltalk.Array.klass);
  1448. smalltalk.addClass('CharacterArray', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  1449. smalltalk.addMethod(
  1450. "__comma",
  1451. smalltalk.method({
  1452. selector: ",",
  1453. fn: function (aString) {
  1454. var self=this;
  1455. return smalltalk.send(smalltalk.send(self, "_asString", []), "__comma", [smalltalk.send(aString, "_asString", [])]);
  1456. return self;}
  1457. }),
  1458. smalltalk.CharacterArray);
  1459. smalltalk.addMethod(
  1460. "_add_",
  1461. smalltalk.method({
  1462. selector: "add:",
  1463. fn: function (anObject) {
  1464. var self=this;
  1465. smalltalk.send(self, "_errorReadOnly", []);
  1466. return self;}
  1467. }),
  1468. smalltalk.CharacterArray);
  1469. smalltalk.addMethod(
  1470. "_asLowercase",
  1471. smalltalk.method({
  1472. selector: "asLowercase",
  1473. fn: function () {
  1474. var self=this;
  1475. return smalltalk.send(smalltalk.send(self, "_class", []), "_fromString_", [smalltalk.send(smalltalk.send(self, "_asString", []), "_asLowercase", [])]);
  1476. return self;}
  1477. }),
  1478. smalltalk.CharacterArray);
  1479. smalltalk.addMethod(
  1480. "_asNumber",
  1481. smalltalk.method({
  1482. selector: "asNumber",
  1483. fn: function () {
  1484. var self=this;
  1485. return smalltalk.send(smalltalk.send(self, "_asString", []), "_asNumber", []);
  1486. return self;}
  1487. }),
  1488. smalltalk.CharacterArray);
  1489. smalltalk.addMethod(
  1490. "_asString",
  1491. smalltalk.method({
  1492. selector: "asString",
  1493. fn: function () {
  1494. var self=this;
  1495. return smalltalk.send(self, "_subclassResponsibility", []);
  1496. return self;}
  1497. }),
  1498. smalltalk.CharacterArray);
  1499. smalltalk.addMethod(
  1500. "_asSymbol",
  1501. smalltalk.method({
  1502. selector: "asSymbol",
  1503. fn: function () {
  1504. var self=this;
  1505. return smalltalk.send(self, "_subclassResponsibility", []);
  1506. return self;}
  1507. }),
  1508. smalltalk.CharacterArray);
  1509. smalltalk.addMethod(
  1510. "_asUppercase",
  1511. smalltalk.method({
  1512. selector: "asUppercase",
  1513. fn: function () {
  1514. var self=this;
  1515. return smalltalk.send(smalltalk.send(self, "_class", []), "_fromString_", [smalltalk.send(smalltalk.send(self, "_asString", []), "_asUppercase", [])]);
  1516. return self;}
  1517. }),
  1518. smalltalk.CharacterArray);
  1519. smalltalk.addMethod(
  1520. "_at_put_",
  1521. smalltalk.method({
  1522. selector: "at:put:",
  1523. fn: function (anIndex, anObject) {
  1524. var self=this;
  1525. smalltalk.send(self, "_errorReadOnly", []);
  1526. return self;}
  1527. }),
  1528. smalltalk.CharacterArray);
  1529. smalltalk.addMethod(
  1530. "_errorReadOnly",
  1531. smalltalk.method({
  1532. selector: "errorReadOnly",
  1533. fn: function () {
  1534. var self=this;
  1535. smalltalk.send(self, "_error_", ["Object is read-only"]);
  1536. return self;}
  1537. }),
  1538. smalltalk.CharacterArray);
  1539. smalltalk.addMethod(
  1540. "_printString",
  1541. smalltalk.method({
  1542. selector: "printString",
  1543. fn: function () {
  1544. var self=this;
  1545. return smalltalk.send(smalltalk.send(self, "_asString", []), "_printString", []);
  1546. return self;}
  1547. }),
  1548. smalltalk.CharacterArray);
  1549. smalltalk.addMethod(
  1550. "_remove_",
  1551. smalltalk.method({
  1552. selector: "remove:",
  1553. fn: function (anObject) {
  1554. var self=this;
  1555. smalltalk.send(self, "_errorReadOnly", []);
  1556. return self;}
  1557. }),
  1558. smalltalk.CharacterArray);
  1559. smalltalk.addMethod(
  1560. "_fromString_",
  1561. smalltalk.method({
  1562. selector: "fromString:",
  1563. fn: function (aString) {
  1564. var self=this;
  1565. smalltalk.send(self, "_subclassResponsibility", []);
  1566. return self;}
  1567. }),
  1568. smalltalk.CharacterArray.klass);
  1569. smalltalk.addClass('String', smalltalk.CharacterArray, [], 'Kernel-Collections');
  1570. smalltalk.addMethod(
  1571. "__comma",
  1572. smalltalk.method({
  1573. selector: ",",
  1574. fn: function (aString) {
  1575. var self=this;
  1576. return self + aString;
  1577. return self;}
  1578. }),
  1579. smalltalk.String);
  1580. smalltalk.addMethod(
  1581. "__lt",
  1582. smalltalk.method({
  1583. selector: "<",
  1584. fn: function (aString) {
  1585. var self=this;
  1586. return String(self) < aString._asString();
  1587. return self;}
  1588. }),
  1589. smalltalk.String);
  1590. smalltalk.addMethod(
  1591. "__lt_eq",
  1592. smalltalk.method({
  1593. selector: "<=",
  1594. fn: function (aString) {
  1595. var self=this;
  1596. return String(self) <= aString._asString();
  1597. return self;}
  1598. }),
  1599. smalltalk.String);
  1600. smalltalk.addMethod(
  1601. "__eq",
  1602. smalltalk.method({
  1603. selector: "=",
  1604. fn: function (aString) {
  1605. var self=this;
  1606. var $early={};
  1607. try{((($receiver = smalltalk.send(smalltalk.send(aString, "_class", []), "__eq", [smalltalk.send(self, "_class", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw $early=[false]})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=[false]})();})]));
  1608. return String(self) === String(aString);
  1609. return self;
  1610. } catch(e) {if(e===$early)return e[0]; throw e}}
  1611. }),
  1612. smalltalk.String);
  1613. smalltalk.addMethod(
  1614. "__eq_eq",
  1615. smalltalk.method({
  1616. selector: "==",
  1617. fn: function (aString) {
  1618. var self=this;
  1619. return smalltalk.send(self, "__eq", [aString]);
  1620. return self;}
  1621. }),
  1622. smalltalk.String);
  1623. smalltalk.addMethod(
  1624. "__gt",
  1625. smalltalk.method({
  1626. selector: ">",
  1627. fn: function (aString) {
  1628. var self=this;
  1629. return String(self) > aString._asString();
  1630. return self;}
  1631. }),
  1632. smalltalk.String);
  1633. smalltalk.addMethod(
  1634. "__gt_eq",
  1635. smalltalk.method({
  1636. selector: ">=",
  1637. fn: function (aString) {
  1638. var self=this;
  1639. return String(self) >= aString._asString();
  1640. return self;}
  1641. }),
  1642. smalltalk.String);
  1643. smalltalk.addMethod(
  1644. "_asJSON",
  1645. smalltalk.method({
  1646. selector: "asJSON",
  1647. fn: function () {
  1648. var self=this;
  1649. return self;
  1650. return self;}
  1651. }),
  1652. smalltalk.String);
  1653. smalltalk.addMethod(
  1654. "_asJavaScriptSelector",
  1655. smalltalk.method({
  1656. selector: "asJavaScriptSelector",
  1657. fn: function () {
  1658. var self=this;
  1659. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_asSelector", []), "_replace_with_", ["^_", ""]), "_replace_with_", ["_.*", ""]);
  1660. return self;}
  1661. }),
  1662. smalltalk.String);
  1663. smalltalk.addMethod(
  1664. "_asJavascript",
  1665. smalltalk.method({
  1666. selector: "asJavascript",
  1667. fn: function () {
  1668. var self=this;
  1669. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  1670. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  1671. else
  1672. return "\"" + self + "\"";
  1673. ;
  1674. return self;}
  1675. }),
  1676. smalltalk.String);
  1677. smalltalk.addMethod(
  1678. "_asLowercase",
  1679. smalltalk.method({
  1680. selector: "asLowercase",
  1681. fn: function () {
  1682. var self=this;
  1683. return self.toLowerCase();
  1684. return self;}
  1685. }),
  1686. smalltalk.String);
  1687. smalltalk.addMethod(
  1688. "_asNumber",
  1689. smalltalk.method({
  1690. selector: "asNumber",
  1691. fn: function () {
  1692. var self=this;
  1693. return Number(self);
  1694. return self;}
  1695. }),
  1696. smalltalk.String);
  1697. smalltalk.addMethod(
  1698. "_asSelector",
  1699. smalltalk.method({
  1700. selector: "asSelector",
  1701. fn: function () {
  1702. var self=this;
  1703. var selector=nil;
  1704. (selector=smalltalk.send("_", "__comma", [self]));
  1705. (selector=smalltalk.send(selector, "_replace_with_", [":", "_"]));
  1706. (selector=smalltalk.send(selector, "_replace_with_", ["[+]", "_plus"]));
  1707. (selector=smalltalk.send(selector, "_replace_with_", ["-", "_minus"]));
  1708. (selector=smalltalk.send(selector, "_replace_with_", ["[*]", "_star"]));
  1709. (selector=smalltalk.send(selector, "_replace_with_", ["[/]", "_slash"]));
  1710. (selector=smalltalk.send(selector, "_replace_with_", [">", "_gt"]));
  1711. (selector=smalltalk.send(selector, "_replace_with_", ["<", "_lt"]));
  1712. (selector=smalltalk.send(selector, "_replace_with_", ["=", "_eq"]));
  1713. (selector=smalltalk.send(selector, "_replace_with_", [",", "_comma"]));
  1714. (selector=smalltalk.send(selector, "_replace_with_", ["[@]", "_at"]));
  1715. return selector;
  1716. return self;}
  1717. }),
  1718. smalltalk.String);
  1719. smalltalk.addMethod(
  1720. "_asString",
  1721. smalltalk.method({
  1722. selector: "asString",
  1723. fn: function () {
  1724. var self=this;
  1725. return self;
  1726. return self;}
  1727. }),
  1728. smalltalk.String);
  1729. smalltalk.addMethod(
  1730. "_asSymbol",
  1731. smalltalk.method({
  1732. selector: "asSymbol",
  1733. fn: function () {
  1734. var self=this;
  1735. return smalltalk.send((smalltalk.Symbol || Symbol), "_lookup_", [self]);
  1736. return self;}
  1737. }),
  1738. smalltalk.String);
  1739. smalltalk.addMethod(
  1740. "_asUppercase",
  1741. smalltalk.method({
  1742. selector: "asUppercase",
  1743. fn: function () {
  1744. var self=this;
  1745. return self.toUpperCase();
  1746. return self;}
  1747. }),
  1748. smalltalk.String);
  1749. smalltalk.addMethod(
  1750. "_asciiValue",
  1751. smalltalk.method({
  1752. selector: "asciiValue",
  1753. fn: function () {
  1754. var self=this;
  1755. return self.charCodeAt(0);;
  1756. return self;}
  1757. }),
  1758. smalltalk.String);
  1759. smalltalk.addMethod(
  1760. "_at_ifAbsent_",
  1761. smalltalk.method({
  1762. selector: "at:ifAbsent:",
  1763. fn: function (anIndex, aBlock) {
  1764. var self=this;
  1765. return String(self).charAt(anIndex - 1) || aBlock();
  1766. return self;}
  1767. }),
  1768. smalltalk.String);
  1769. smalltalk.addMethod(
  1770. "_copyFrom_to_",
  1771. smalltalk.method({
  1772. selector: "copyFrom:to:",
  1773. fn: function (anIndex, anotherIndex) {
  1774. var self=this;
  1775. return self.substring(anIndex - 1, anotherIndex);
  1776. return self;}
  1777. }),
  1778. smalltalk.String);
  1779. smalltalk.addMethod(
  1780. "_deepCopy",
  1781. smalltalk.method({
  1782. selector: "deepCopy",
  1783. fn: function () {
  1784. var self=this;
  1785. return smalltalk.send(self, "_shallowCopy", []);
  1786. return self;}
  1787. }),
  1788. smalltalk.String);
  1789. smalltalk.addMethod(
  1790. "_do_",
  1791. smalltalk.method({
  1792. selector: "do:",
  1793. fn: function (aBlock) {
  1794. var self=this;
  1795. for(var i=0;i<self.length;i++){aBlock(self.charAt(i));};
  1796. return self;}
  1797. }),
  1798. smalltalk.String);
  1799. smalltalk.addMethod(
  1800. "_escaped",
  1801. smalltalk.method({
  1802. selector: "escaped",
  1803. fn: function () {
  1804. var self=this;
  1805. return escape(self);
  1806. return self;}
  1807. }),
  1808. smalltalk.String);
  1809. smalltalk.addMethod(
  1810. "_includesSubString_",
  1811. smalltalk.method({
  1812. selector: "includesSubString:",
  1813. fn: function (subString) {
  1814. var self=this;
  1815. return self.indexOf(subString) != -1 ;
  1816. return self;}
  1817. }),
  1818. smalltalk.String);
  1819. smalltalk.addMethod(
  1820. "_isString",
  1821. smalltalk.method({
  1822. selector: "isString",
  1823. fn: function () {
  1824. var self=this;
  1825. return true;
  1826. return self;}
  1827. }),
  1828. smalltalk.String);
  1829. smalltalk.addMethod(
  1830. "_join_",
  1831. smalltalk.method({
  1832. selector: "join:",
  1833. fn: function (aCollection) {
  1834. var self=this;
  1835. 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]);})]);})]);
  1836. return self;}
  1837. }),
  1838. smalltalk.String);
  1839. smalltalk.addMethod(
  1840. "_lineIndicesDo_",
  1841. smalltalk.method({
  1842. selector: "lineIndicesDo:",
  1843. fn: function (aBlock) {
  1844. var self=this;
  1845. var $early={};
  1846. try{var cr=nil;
  1847. var lf=nil;
  1848. var start=nil;
  1849. var sz=nil;
  1850. var nextLF=nil;
  1851. var nextCR=nil;
  1852. (start=(1));
  1853. (sz=smalltalk.send(self, "_size", []));
  1854. (cr=smalltalk.send((smalltalk.String || String), "_cr", []));
  1855. (nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, (1)]));
  1856. (lf=smalltalk.send((smalltalk.String || String), "_lf", []));
  1857. (nextLF=smalltalk.send(self, "_indexOf_startingAt_", [lf, (1)]));
  1858. (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 $early=[self]})();})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(aBlock, "_value_value_value_", [start, sz, sz]);return (function(){throw $early=[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 <nextCR : smalltalk.send($receiver, "__lt", [nextCR]));})]);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(aBlock, "_value_value_value_", [start, ((($receiver = nextLF).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)])), nextLF]);(start=(1) + nextLF);return (nextLF=smalltalk.send(self, "_indexOf_startingAt_", [lf, start]));})() : (function(){return ((($receiver = smalltalk.send((1) + nextCR, "__eq", [nextLF])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(aBlock, "_value_value_value_", [start, ((($receiver = nextCR).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)])), nextLF]);(start=(1) + nextLF);(nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, start]));return (nextLF=smalltalk.send(self, "_indexOf_startingAt_", [lf, start]));})() : (function(){smalltalk.send(aBlock, "_value_value_value_", [start, ((($receiver = nextCR).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)])), nextCR]);(start=(1) + nextCR);return (nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, start]));})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){smalltalk.send(aBlock, "_value_value_value_", [start, ((($receiver = nextCR).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)])), nextLF]);(start=(1) + nextLF);(nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, start]));return (nextLF=smalltalk.send(self, "_indexOf_startingAt_", [lf, start]));}), (function(){smalltalk.send(aBlock, "_value_value_value_", [start, ((($receiver = nextCR).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)])), nextCR]);(start=(1) + nextCR);return (nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, start]));})]));})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){smalltalk.send(aBlock, "_value_value_value_", [start, ((($receiver = nextLF).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)])), nextLF]);(start=(1) + nextLF);return (nextLF=smalltalk.send(self, "_indexOf_startingAt_", [lf, start]));}), (function(){return ((($receiver = smalltalk.send((1) + nextCR, "__eq", [nextLF])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(aBlock, "_value_value_value_", [start, ((($receiver = nextCR).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)])), nextLF]);(start=(1) + nextLF);(nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, start]));return (nextLF=smalltalk.send(self, "_indexOf_startingAt_", [lf, start]));})() : (function(){smalltalk.send(aBlock, "_value_value_value_", [start, ((($receiver = nextCR).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)])), nextCR]);(start=(1) + nextCR);return (nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, start]));})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){smalltalk.send(aBlock, "_value_value_value_", [start, ((($receiver = nextCR).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)])), nextLF]);(start=(1) + nextLF);(nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, start]));return (nextLF=smalltalk.send(self, "_indexOf_startingAt_", [lf, start]));}), (function(){smalltalk.send(aBlock, "_value_value_value_", [start, ((($receiver = nextCR).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)])), nextCR]);(start=(1) + nextCR);return (nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, start]));})]));})]));})()}})();
  1859. return self;
  1860. } catch(e) {if(e===$early)return e[0]; throw e}}
  1861. }),
  1862. smalltalk.String);
  1863. smalltalk.addMethod(
  1864. "_lineNumber_",
  1865. smalltalk.method({
  1866. selector: "lineNumber:",
  1867. fn: function (anIndex) {
  1868. var self=this;
  1869. var $early={};
  1870. try{var lineCount=nil;
  1871. (lineCount=(0));
  1872. smalltalk.send(self, "_lineIndicesDo_", [(function(start, endWithoutDelimiters, end){return ((($receiver = smalltalk.send((lineCount=((($receiver = lineCount).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))), "__eq", [anIndex])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function(){throw $early=[smalltalk.send(self, "_copyFrom_to_", [start, endWithoutDelimiters])]})();})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (function(){throw $early=[smalltalk.send(self, "_copyFrom_to_", [start, endWithoutDelimiters])]})();})]));})]);
  1873. return nil;
  1874. return self;
  1875. } catch(e) {if(e===$early)return e[0]; throw e}}
  1876. }),
  1877. smalltalk.String);
  1878. smalltalk.addMethod(
  1879. "_lines",
  1880. smalltalk.method({
  1881. selector: "lines",
  1882. fn: function () {
  1883. var self=this;
  1884. var lines=nil;
  1885. (lines=smalltalk.send((smalltalk.Array || Array), "_new", []));
  1886. smalltalk.send(self, "_linesDo_", [(function(aLine){return smalltalk.send(lines, "_add_", [aLine]);})]);
  1887. return lines;
  1888. return self;}
  1889. }),
  1890. smalltalk.String);
  1891. smalltalk.addMethod(
  1892. "_linesDo_",
  1893. smalltalk.method({
  1894. selector: "linesDo:",
  1895. fn: function (aBlock) {
  1896. var self=this;
  1897. smalltalk.send(self, "_lineIndicesDo_", [(function(start, endWithoutDelimiters, end){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_copyFrom_to_", [start, endWithoutDelimiters])]);})]);
  1898. return self;}
  1899. }),
  1900. smalltalk.String);
  1901. smalltalk.addMethod(
  1902. "_match_",
  1903. smalltalk.method({
  1904. selector: "match:",
  1905. fn: function (aRegexp) {
  1906. var self=this;
  1907. return self.search(aRegexp) != -1;
  1908. return self;}
  1909. }),
  1910. smalltalk.String);
  1911. smalltalk.addMethod(
  1912. "_matchesOf_",
  1913. smalltalk.method({
  1914. selector: "matchesOf:",
  1915. fn: function (aRegularExpression) {
  1916. var self=this;
  1917. return self.match(aRegularExpression);
  1918. return self;}
  1919. }),
  1920. smalltalk.String);
  1921. smalltalk.addMethod(
  1922. "_printNl",
  1923. smalltalk.method({
  1924. selector: "printNl",
  1925. fn: function () {
  1926. var self=this;
  1927. console.log(self);
  1928. return self;}
  1929. }),
  1930. smalltalk.String);
  1931. smalltalk.addMethod(
  1932. "_printString",
  1933. smalltalk.method({
  1934. selector: "printString",
  1935. fn: function () {
  1936. var self=this;
  1937. return smalltalk.send(smalltalk.send("'", "__comma", [self]), "__comma", ["'"]);
  1938. return self;}
  1939. }),
  1940. smalltalk.String);
  1941. smalltalk.addMethod(
  1942. "_replace_with_",
  1943. smalltalk.method({
  1944. selector: "replace:with:",
  1945. fn: function (aString, anotherString) {
  1946. var self=this;
  1947. return smalltalk.send(self, "_replaceRegexp_with_", [smalltalk.send((smalltalk.RegularExpression || RegularExpression), "_fromString_flag_", [aString, "g"]), anotherString]);
  1948. return self;}
  1949. }),
  1950. smalltalk.String);
  1951. smalltalk.addMethod(
  1952. "_replaceRegexp_with_",
  1953. smalltalk.method({
  1954. selector: "replaceRegexp:with:",
  1955. fn: function (aRegexp, aString) {
  1956. var self=this;
  1957. return self.replace(aRegexp, aString);
  1958. return self;}
  1959. }),
  1960. smalltalk.String);
  1961. smalltalk.addMethod(
  1962. "_reversed",
  1963. smalltalk.method({
  1964. selector: "reversed",
  1965. fn: function () {
  1966. var self=this;
  1967. return self.split("").reverse().join("");
  1968. return self;}
  1969. }),
  1970. smalltalk.String);
  1971. smalltalk.addMethod(
  1972. "_shallowCopy",
  1973. smalltalk.method({
  1974. selector: "shallowCopy",
  1975. fn: function () {
  1976. var self=this;
  1977. return smalltalk.send(smalltalk.send(self, "_class", []), "_fromString_", [self]);
  1978. return self;}
  1979. }),
  1980. smalltalk.String);
  1981. smalltalk.addMethod(
  1982. "_size",
  1983. smalltalk.method({
  1984. selector: "size",
  1985. fn: function () {
  1986. var self=this;
  1987. return self.length;
  1988. return self;}
  1989. }),
  1990. smalltalk.String);
  1991. smalltalk.addMethod(
  1992. "_tokenize_",
  1993. smalltalk.method({
  1994. selector: "tokenize:",
  1995. fn: function (aString) {
  1996. var self=this;
  1997. return self.split(aString);
  1998. return self;}
  1999. }),
  2000. smalltalk.String);
  2001. smalltalk.addMethod(
  2002. "_trimBoth",
  2003. smalltalk.method({
  2004. selector: "trimBoth",
  2005. fn: function () {
  2006. var self=this;
  2007. return smalltalk.send(self, "_trimBoth_", ["\x5cs"]);
  2008. return self;}
  2009. }),
  2010. smalltalk.String);
  2011. smalltalk.addMethod(
  2012. "_trimBoth_",
  2013. smalltalk.method({
  2014. selector: "trimBoth:",
  2015. fn: function (separators) {
  2016. var self=this;
  2017. return smalltalk.send(smalltalk.send(self, "_trimLeft_", [separators]), "_trimRight_", [separators]);
  2018. return self;}
  2019. }),
  2020. smalltalk.String);
  2021. smalltalk.addMethod(
  2022. "_trimLeft",
  2023. smalltalk.method({
  2024. selector: "trimLeft",
  2025. fn: function () {
  2026. var self=this;
  2027. return smalltalk.send(self, "_trimLeft_", ["\x5cs"]);
  2028. return self;}
  2029. }),
  2030. smalltalk.String);
  2031. smalltalk.addMethod(
  2032. "_trimLeft_",
  2033. smalltalk.method({
  2034. selector: "trimLeft:",
  2035. fn: function (separators) {
  2036. var self=this;
  2037. return smalltalk.send(self, "_replaceRegexp_with_", [smalltalk.send((smalltalk.RegularExpression || RegularExpression), "_fromString_flag_", [smalltalk.send(smalltalk.send("^[", "__comma", [separators]), "__comma", ["]+"]), "g"]), ""]);
  2038. return self;}
  2039. }),
  2040. smalltalk.String);
  2041. smalltalk.addMethod(
  2042. "_trimRight",
  2043. smalltalk.method({
  2044. selector: "trimRight",
  2045. fn: function () {
  2046. var self=this;
  2047. return smalltalk.send(self, "_trimRight_", ["\x5cs"]);
  2048. return self;}
  2049. }),
  2050. smalltalk.String);
  2051. smalltalk.addMethod(
  2052. "_trimRight_",
  2053. smalltalk.method({
  2054. selector: "trimRight:",
  2055. fn: function (separators) {
  2056. var self=this;
  2057. return smalltalk.send(self, "_replaceRegexp_with_", [smalltalk.send((smalltalk.RegularExpression || RegularExpression), "_fromString_flag_", [smalltalk.send(smalltalk.send("[", "__comma", [separators]), "__comma", ["]+$"]), "g"]), ""]);
  2058. return self;}
  2059. }),
  2060. smalltalk.String);
  2061. smalltalk.addMethod(
  2062. "_unescaped",
  2063. smalltalk.method({
  2064. selector: "unescaped",
  2065. fn: function () {
  2066. var self=this;
  2067. return unescape(self);
  2068. return self;}
  2069. }),
  2070. smalltalk.String);
  2071. smalltalk.addMethod(
  2072. "_withIndexDo_",
  2073. smalltalk.method({
  2074. selector: "withIndexDo:",
  2075. fn: function (aBlock) {
  2076. var self=this;
  2077. for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);};
  2078. return self;}
  2079. }),
  2080. smalltalk.String);
  2081. smalltalk.addMethod(
  2082. "_cr",
  2083. smalltalk.method({
  2084. selector: "cr",
  2085. fn: function () {
  2086. var self=this;
  2087. return '\r';
  2088. return self;}
  2089. }),
  2090. smalltalk.String.klass);
  2091. smalltalk.addMethod(
  2092. "_crlf",
  2093. smalltalk.method({
  2094. selector: "crlf",
  2095. fn: function () {
  2096. var self=this;
  2097. return '\r\n';
  2098. return self;}
  2099. }),
  2100. smalltalk.String.klass);
  2101. smalltalk.addMethod(
  2102. "_fromString_",
  2103. smalltalk.method({
  2104. selector: "fromString:",
  2105. fn: function (aString) {
  2106. var self=this;
  2107. return new self.fn(aString);
  2108. return self;}
  2109. }),
  2110. smalltalk.String.klass);
  2111. smalltalk.addMethod(
  2112. "_lf",
  2113. smalltalk.method({
  2114. selector: "lf",
  2115. fn: function () {
  2116. var self=this;
  2117. return '\n';
  2118. return self;}
  2119. }),
  2120. smalltalk.String.klass);
  2121. smalltalk.addMethod(
  2122. "_space",
  2123. smalltalk.method({
  2124. selector: "space",
  2125. fn: function () {
  2126. var self=this;
  2127. return ' ';
  2128. return self;}
  2129. }),
  2130. smalltalk.String.klass);
  2131. smalltalk.addMethod(
  2132. "_streamClass",
  2133. smalltalk.method({
  2134. selector: "streamClass",
  2135. fn: function () {
  2136. var self=this;
  2137. return (smalltalk.StringStream || StringStream);
  2138. return self;}
  2139. }),
  2140. smalltalk.String.klass);
  2141. smalltalk.addMethod(
  2142. "_streamContents_",
  2143. smalltalk.method({
  2144. selector: "streamContents:",
  2145. fn: function (blockWithArg) {
  2146. var self=this;
  2147. var stream=nil;
  2148. (stream=smalltalk.send(smalltalk.send(self, "_streamClass", []), "_on_", [smalltalk.send((smalltalk.String || String), "_new", [])]));
  2149. smalltalk.send(blockWithArg, "_value_", [stream]);
  2150. return smalltalk.send(stream, "_contents", []);
  2151. return self;}
  2152. }),
  2153. smalltalk.String.klass);
  2154. smalltalk.addMethod(
  2155. "_tab",
  2156. smalltalk.method({
  2157. selector: "tab",
  2158. fn: function () {
  2159. var self=this;
  2160. return '\t';
  2161. return self;}
  2162. }),
  2163. smalltalk.String.klass);
  2164. smalltalk.addMethod(
  2165. "_value_",
  2166. smalltalk.method({
  2167. selector: "value:",
  2168. fn: function (aUTFCharCode) {
  2169. var self=this;
  2170. return String.fromCharCode(aUTFCharCode);;
  2171. return self;}
  2172. }),
  2173. smalltalk.String.klass);
  2174. smalltalk.addClass('Symbol', smalltalk.CharacterArray, [], 'Kernel-Collections');
  2175. smalltalk.addMethod(
  2176. "__lt",
  2177. smalltalk.method({
  2178. selector: "<",
  2179. fn: function (aSymbol) {
  2180. var self=this;
  2181. return ((($receiver = smalltalk.send(self, "_asString", [])).klass === smalltalk.Number) ? $receiver <smalltalk.send(aSymbol, "_asString", []) : smalltalk.send($receiver, "__lt", [smalltalk.send(aSymbol, "_asString", [])]));
  2182. return self;}
  2183. }),
  2184. smalltalk.Symbol);
  2185. smalltalk.addMethod(
  2186. "__lt_eq",
  2187. smalltalk.method({
  2188. selector: "<=",
  2189. fn: function (aSymbol) {
  2190. var self=this;
  2191. return ((($receiver = smalltalk.send(self, "_asString", [])).klass === smalltalk.Number) ? $receiver <=smalltalk.send(aSymbol, "_asString", []) : smalltalk.send($receiver, "__lt_eq", [smalltalk.send(aSymbol, "_asString", [])]));
  2192. return self;}
  2193. }),
  2194. smalltalk.Symbol);
  2195. smalltalk.addMethod(
  2196. "__eq",
  2197. smalltalk.method({
  2198. selector: "=",
  2199. fn: function (aSymbol) {
  2200. var self=this;
  2201. var $early={};
  2202. try{((($receiver = smalltalk.send(smalltalk.send(aSymbol, "_class", []), "__eq", [smalltalk.send(self, "_class", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw $early=[false]})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=[false]})();})]));
  2203. return smalltalk.send(smalltalk.send(self, "_asString", []), "__eq", [smalltalk.send(aSymbol, "_asString", [])]);
  2204. return self;
  2205. } catch(e) {if(e===$early)return e[0]; throw e}}
  2206. }),
  2207. smalltalk.Symbol);
  2208. smalltalk.addMethod(
  2209. "__gt",
  2210. smalltalk.method({
  2211. selector: ">",
  2212. fn: function (aSymbol) {
  2213. var self=this;
  2214. return ((($receiver = smalltalk.send(self, "_asString", [])).klass === smalltalk.Number) ? $receiver >smalltalk.send(aSymbol, "_asString", []) : smalltalk.send($receiver, "__gt", [smalltalk.send(aSymbol, "_asString", [])]));
  2215. return self;}
  2216. }),
  2217. smalltalk.Symbol);
  2218. smalltalk.addMethod(
  2219. "__gt_eq",
  2220. smalltalk.method({
  2221. selector: ">=",
  2222. fn: function (aSymbol) {
  2223. var self=this;
  2224. return ((($receiver = smalltalk.send(self, "_asString", [])).klass === smalltalk.Number) ? $receiver >=smalltalk.send(aSymbol, "_asString", []) : smalltalk.send($receiver, "__gt_eq", [smalltalk.send(aSymbol, "_asString", [])]));
  2225. return self;}
  2226. }),
  2227. smalltalk.Symbol);
  2228. smalltalk.addMethod(
  2229. "_asJSON",
  2230. smalltalk.method({
  2231. selector: "asJSON",
  2232. fn: function () {
  2233. var self=this;
  2234. return smalltalk.send(smalltalk.send(self, "_asString", []), "_asJSON", []);
  2235. return self;}
  2236. }),
  2237. smalltalk.Symbol);
  2238. smalltalk.addMethod(
  2239. "_asJavascript",
  2240. smalltalk.method({
  2241. selector: "asJavascript",
  2242. fn: function () {
  2243. var self=this;
  2244. return smalltalk.send(smalltalk.send("smalltalk.symbolFor(\x22", "__comma", [smalltalk.send(self, "_asString", [])]), "__comma", ["\x22)"]);
  2245. return self;}
  2246. }),
  2247. smalltalk.Symbol);
  2248. smalltalk.addMethod(
  2249. "_asSelector",
  2250. smalltalk.method({
  2251. selector: "asSelector",
  2252. fn: function () {
  2253. var self=this;
  2254. return smalltalk.send(smalltalk.send(self, "_asString", []), "_asSelector", []);
  2255. return self;}
  2256. }),
  2257. smalltalk.Symbol);
  2258. smalltalk.addMethod(
  2259. "_asString",
  2260. smalltalk.method({
  2261. selector: "asString",
  2262. fn: function () {
  2263. var self=this;
  2264. return self.value;
  2265. return self;}
  2266. }),
  2267. smalltalk.Symbol);
  2268. smalltalk.addMethod(
  2269. "_asSymbol",
  2270. smalltalk.method({
  2271. selector: "asSymbol",
  2272. fn: function () {
  2273. var self=this;
  2274. return self;
  2275. return self;}
  2276. }),
  2277. smalltalk.Symbol);
  2278. smalltalk.addMethod(
  2279. "_at_ifAbsent_",
  2280. smalltalk.method({
  2281. selector: "at:ifAbsent:",
  2282. fn: function (anIndex, aBlock) {
  2283. var self=this;
  2284. return smalltalk.send(smalltalk.send(self, "_asString", []), "_at_ifAbsent_", [anIndex, aBlock]);
  2285. return self;}
  2286. }),
  2287. smalltalk.Symbol);
  2288. smalltalk.addMethod(
  2289. "_collect_",
  2290. smalltalk.method({
  2291. selector: "collect:",
  2292. fn: function (aBlock) {
  2293. var self=this;
  2294. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_asString", []), "_collect_", [aBlock]), "_asSymbol", []);
  2295. return self;}
  2296. }),
  2297. smalltalk.Symbol);
  2298. smalltalk.addMethod(
  2299. "_copyFrom_to_",
  2300. smalltalk.method({
  2301. selector: "copyFrom:to:",
  2302. fn: function (anIndex, anotherIndex) {
  2303. var self=this;
  2304. return smalltalk.send(smalltalk.send(self, "_class", []), "_fromString_", [smalltalk.send(smalltalk.send(self, "_asString", []), "_copyFrom_to_", [anIndex, anotherIndex])]);
  2305. return self;}
  2306. }),
  2307. smalltalk.Symbol);
  2308. smalltalk.addMethod(
  2309. "_deepCopy",
  2310. smalltalk.method({
  2311. selector: "deepCopy",
  2312. fn: function () {
  2313. var self=this;
  2314. return self;
  2315. return self;}
  2316. }),
  2317. smalltalk.Symbol);
  2318. smalltalk.addMethod(
  2319. "_detect_",
  2320. smalltalk.method({
  2321. selector: "detect:",
  2322. fn: function (aBlock) {
  2323. var self=this;
  2324. return smalltalk.send(smalltalk.send(self, "_asString", []), "_detect_", [aBlock]);
  2325. return self;}
  2326. }),
  2327. smalltalk.Symbol);
  2328. smalltalk.addMethod(
  2329. "_do_",
  2330. smalltalk.method({
  2331. selector: "do:",
  2332. fn: function (aBlock) {
  2333. var self=this;
  2334. smalltalk.send(smalltalk.send(self, "_asString", []), "_do_", [aBlock]);
  2335. return self;}
  2336. }),
  2337. smalltalk.Symbol);
  2338. smalltalk.addMethod(
  2339. "_isSymbol",
  2340. smalltalk.method({
  2341. selector: "isSymbol",
  2342. fn: function () {
  2343. var self=this;
  2344. return true;
  2345. return self;}
  2346. }),
  2347. smalltalk.Symbol);
  2348. smalltalk.addMethod(
  2349. "_printString",
  2350. smalltalk.method({
  2351. selector: "printString",
  2352. fn: function () {
  2353. var self=this;
  2354. return smalltalk.send("#", "__comma", [smalltalk.send(self, "_asString", [])]);
  2355. return self;}
  2356. }),
  2357. smalltalk.Symbol);
  2358. smalltalk.addMethod(
  2359. "_select_",
  2360. smalltalk.method({
  2361. selector: "select:",
  2362. fn: function (aBlock) {
  2363. var self=this;
  2364. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_asString", []), "_select_", [aBlock]), "_asSymbol", []);
  2365. return self;}
  2366. }),
  2367. smalltalk.Symbol);
  2368. smalltalk.addMethod(
  2369. "_shallowCopy",
  2370. smalltalk.method({
  2371. selector: "shallowCopy",
  2372. fn: function () {
  2373. var self=this;
  2374. return self;
  2375. return self;}
  2376. }),
  2377. smalltalk.Symbol);
  2378. smalltalk.addMethod(
  2379. "_size",
  2380. smalltalk.method({
  2381. selector: "size",
  2382. fn: function () {
  2383. var self=this;
  2384. return smalltalk.send(smalltalk.send(self, "_asString", []), "_size", []);
  2385. return self;}
  2386. }),
  2387. smalltalk.Symbol);
  2388. smalltalk.addMethod(
  2389. "_withIndexDo_",
  2390. smalltalk.method({
  2391. selector: "withIndexDo:",
  2392. fn: function (aBlock) {
  2393. var self=this;
  2394. smalltalk.send(smalltalk.send(self, "_asString", []), "_withIndexDo_", [aBlock]);
  2395. return self;}
  2396. }),
  2397. smalltalk.Symbol);
  2398. smalltalk.addMethod(
  2399. "_basicNew",
  2400. smalltalk.method({
  2401. selector: "basicNew",
  2402. fn: function () {
  2403. var self=this;
  2404. smalltalk.send(self, "_shouldNotImplement", []);
  2405. return self;}
  2406. }),
  2407. smalltalk.Symbol.klass);
  2408. smalltalk.addMethod(
  2409. "_fromString_",
  2410. smalltalk.method({
  2411. selector: "fromString:",
  2412. fn: function (aString) {
  2413. var self=this;
  2414. return smalltalk.send(self, "_lookup_", [aString]);
  2415. return self;}
  2416. }),
  2417. smalltalk.Symbol.klass);
  2418. smalltalk.addMethod(
  2419. "_lookup_",
  2420. smalltalk.method({
  2421. selector: "lookup:",
  2422. fn: function (aString) {
  2423. var self=this;
  2424. return smalltalk.symbolFor(aString);;
  2425. return self;}
  2426. }),
  2427. smalltalk.Symbol.klass);
  2428. smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections');
  2429. smalltalk.addMethod(
  2430. "__eq",
  2431. smalltalk.method({
  2432. selector: "=",
  2433. fn: function (aCollection) {
  2434. var self=this;
  2435. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [smalltalk.send(aCollection, "_class", [])]), "_and_", [(function(){return smalltalk.send(self['@elements'], "__eq", [smalltalk.send(aCollection, "_asArray", [])]);})]);
  2436. return self;}
  2437. }),
  2438. smalltalk.Set);
  2439. smalltalk.addMethod(
  2440. "_add_",
  2441. smalltalk.method({
  2442. selector: "add:",
  2443. fn: function (anObject) {
  2444. var self=this;
  2445. var found;
  2446. for(var i=0; i < self['@elements'].length; i++) {
  2447. if(anObject == self['@elements'][i]) {
  2448. found = true;
  2449. break;
  2450. }
  2451. }
  2452. if(!found) {self['@elements'].push(anObject)}
  2453. ;
  2454. return self;}
  2455. }),
  2456. smalltalk.Set);
  2457. smalltalk.addMethod(
  2458. "_asArray",
  2459. smalltalk.method({
  2460. selector: "asArray",
  2461. fn: function () {
  2462. var self=this;
  2463. return smalltalk.send(self['@elements'], "_copy", []);
  2464. return self;}
  2465. }),
  2466. smalltalk.Set);
  2467. smalltalk.addMethod(
  2468. "_detect_ifNone_",
  2469. smalltalk.method({
  2470. selector: "detect:ifNone:",
  2471. fn: function (aBlock, anotherBlock) {
  2472. var self=this;
  2473. return smalltalk.send(self['@elements'], "_detect_ifNone_", [aBlock, anotherBlock]);
  2474. return self;}
  2475. }),
  2476. smalltalk.Set);
  2477. smalltalk.addMethod(
  2478. "_do_",
  2479. smalltalk.method({
  2480. selector: "do:",
  2481. fn: function (aBlock) {
  2482. var self=this;
  2483. smalltalk.send(self['@elements'], "_do_", [aBlock]);
  2484. return self;}
  2485. }),
  2486. smalltalk.Set);
  2487. smalltalk.addMethod(
  2488. "_includes_",
  2489. smalltalk.method({
  2490. selector: "includes:",
  2491. fn: function (anObject) {
  2492. var self=this;
  2493. return smalltalk.send(self['@elements'], "_includes_", [anObject]);
  2494. return self;}
  2495. }),
  2496. smalltalk.Set);
  2497. smalltalk.addMethod(
  2498. "_initialize",
  2499. smalltalk.method({
  2500. selector: "initialize",
  2501. fn: function () {
  2502. var self=this;
  2503. smalltalk.send(self, "_initialize", [], smalltalk.Set.superclass || nil);
  2504. (self['@elements']=[]);
  2505. return self;}
  2506. }),
  2507. smalltalk.Set);
  2508. smalltalk.addMethod(
  2509. "_remove_",
  2510. smalltalk.method({
  2511. selector: "remove:",
  2512. fn: function (anObject) {
  2513. var self=this;
  2514. smalltalk.send(self['@elements'], "_remove_", [anObject]);
  2515. return self;}
  2516. }),
  2517. smalltalk.Set);
  2518. smalltalk.addMethod(
  2519. "_select_",
  2520. smalltalk.method({
  2521. selector: "select:",
  2522. fn: function (aBlock) {
  2523. var self=this;
  2524. var collection=nil;
  2525. (collection=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []));
  2526. smalltalk.send(self, "_do_", [(function(each){return ((($receiver = smalltalk.send(aBlock, "_value_", [each])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(collection, "_add_", [each]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(collection, "_add_", [each]);})]));})]);
  2527. return collection;
  2528. return self;}
  2529. }),
  2530. smalltalk.Set);
  2531. smalltalk.addMethod(
  2532. "_size",
  2533. smalltalk.method({
  2534. selector: "size",
  2535. fn: function () {
  2536. var self=this;
  2537. return smalltalk.send(self['@elements'], "_size", []);
  2538. return self;}
  2539. }),
  2540. smalltalk.Set);
  2541. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
  2542. smalltalk.addMethod(
  2543. "_compile_",
  2544. smalltalk.method({
  2545. selector: "compile:",
  2546. fn: function (aString) {
  2547. var self=this;
  2548. return self.compile(aString);
  2549. return self;}
  2550. }),
  2551. smalltalk.RegularExpression);
  2552. smalltalk.addMethod(
  2553. "_exec_",
  2554. smalltalk.method({
  2555. selector: "exec:",
  2556. fn: function (aString) {
  2557. var self=this;
  2558. return self.exec(aString) || nil;
  2559. return self;}
  2560. }),
  2561. smalltalk.RegularExpression);
  2562. smalltalk.addMethod(
  2563. "_test_",
  2564. smalltalk.method({
  2565. selector: "test:",
  2566. fn: function (aString) {
  2567. var self=this;
  2568. return self.test(aString);
  2569. return self;}
  2570. }),
  2571. smalltalk.RegularExpression);
  2572. smalltalk.addMethod(
  2573. "_fromString_",
  2574. smalltalk.method({
  2575. selector: "fromString:",
  2576. fn: function (aString) {
  2577. var self=this;
  2578. return smalltalk.send(self, "_fromString_flag_", [aString, ""]);
  2579. return self;}
  2580. }),
  2581. smalltalk.RegularExpression.klass);
  2582. smalltalk.addMethod(
  2583. "_fromString_flag_",
  2584. smalltalk.method({
  2585. selector: "fromString:flag:",
  2586. fn: function (aString, anotherString) {
  2587. var self=this;
  2588. return new RegExp(aString, anotherString);
  2589. return self;}
  2590. }),
  2591. smalltalk.RegularExpression.klass);
  2592. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  2593. smalltalk.addMethod(
  2594. "_atEnd",
  2595. smalltalk.method({
  2596. selector: "atEnd",
  2597. fn: function () {
  2598. var self=this;
  2599. return smalltalk.send(smalltalk.send(self, "_position", []), "__eq", [smalltalk.send(self, "_size", [])]);
  2600. return self;}
  2601. }),
  2602. smalltalk.Stream);
  2603. smalltalk.addMethod(
  2604. "_atStart",
  2605. smalltalk.method({
  2606. selector: "atStart",
  2607. fn: function () {
  2608. var self=this;
  2609. return smalltalk.send(smalltalk.send(self, "_position", []), "__eq", [(0)]);
  2610. return self;}
  2611. }),
  2612. smalltalk.Stream);
  2613. smalltalk.addMethod(
  2614. "_close",
  2615. smalltalk.method({
  2616. selector: "close",
  2617. fn: function () {
  2618. var self=this;
  2619. return self;}
  2620. }),
  2621. smalltalk.Stream);
  2622. smalltalk.addMethod(
  2623. "_collection",
  2624. smalltalk.method({
  2625. selector: "collection",
  2626. fn: function () {
  2627. var self=this;
  2628. return self['@collection'];
  2629. return self;}
  2630. }),
  2631. smalltalk.Stream);
  2632. smalltalk.addMethod(
  2633. "_contents",
  2634. smalltalk.method({
  2635. selector: "contents",
  2636. fn: function () {
  2637. var self=this;
  2638. return smalltalk.send(smalltalk.send(self, "_collection", []), "_copyFrom_to_", [(1), smalltalk.send(self, "_streamSize", [])]);
  2639. return self;}
  2640. }),
  2641. smalltalk.Stream);
  2642. smalltalk.addMethod(
  2643. "_do_",
  2644. smalltalk.method({
  2645. selector: "do:",
  2646. fn: function (aBlock) {
  2647. var self=this;
  2648. (function(){while(!(function(){return smalltalk.send(self, "_atEnd", []);})()) {(function(){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_next", [])]);})()}})();
  2649. return self;}
  2650. }),
  2651. smalltalk.Stream);
  2652. smalltalk.addMethod(
  2653. "_flush",
  2654. smalltalk.method({
  2655. selector: "flush",
  2656. fn: function () {
  2657. var self=this;
  2658. return self;}
  2659. }),
  2660. smalltalk.Stream);
  2661. smalltalk.addMethod(
  2662. "_isEmpty",
  2663. smalltalk.method({
  2664. selector: "isEmpty",
  2665. fn: function () {
  2666. var self=this;
  2667. return smalltalk.send(smalltalk.send(self, "_size", []), "__eq", [(0)]);
  2668. return self;}
  2669. }),
  2670. smalltalk.Stream);
  2671. smalltalk.addMethod(
  2672. "_next",
  2673. smalltalk.method({
  2674. selector: "next",
  2675. fn: function () {
  2676. var self=this;
  2677. return ((($receiver = smalltalk.send(self, "_atEnd", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return nil;})() : (function(){smalltalk.send(self, "_position_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);return smalltalk.send(self['@collection'], "_at_", [smalltalk.send(self, "_position", [])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return nil;}), (function(){smalltalk.send(self, "_position_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);return smalltalk.send(self['@collection'], "_at_", [smalltalk.send(self, "_position", [])]);})]));
  2678. return self;}
  2679. }),
  2680. smalltalk.Stream);
  2681. smalltalk.addMethod(
  2682. "_next_",
  2683. smalltalk.method({
  2684. selector: "next:",
  2685. fn: function (anInteger) {
  2686. var self=this;
  2687. var tempCollection=nil;
  2688. (tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_class", []), "_new", []));
  2689. smalltalk.send(anInteger, "_timesRepeat_", [(function(){return ((($receiver = smalltalk.send(self, "_atEnd", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(tempCollection, "_add_", [smalltalk.send(self, "_next", [])]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(tempCollection, "_add_", [smalltalk.send(self, "_next", [])]);})]));})]);
  2690. return tempCollection;
  2691. return self;}
  2692. }),
  2693. smalltalk.Stream);
  2694. smalltalk.addMethod(
  2695. "_nextPut_",
  2696. smalltalk.method({
  2697. selector: "nextPut:",
  2698. fn: function (anObject) {
  2699. var self=this;
  2700. smalltalk.send(self, "_position_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);
  2701. smalltalk.send(smalltalk.send(self, "_collection", []), "_at_put_", [smalltalk.send(self, "_position", []), anObject]);
  2702. smalltalk.send(self, "_setStreamSize_", [smalltalk.send(smalltalk.send(self, "_streamSize", []), "_max_", [smalltalk.send(self, "_position", [])])]);
  2703. return self;}
  2704. }),
  2705. smalltalk.Stream);
  2706. smalltalk.addMethod(
  2707. "_nextPutAll_",
  2708. smalltalk.method({
  2709. selector: "nextPutAll:",
  2710. fn: function (aCollection) {
  2711. var self=this;
  2712. smalltalk.send(aCollection, "_do_", [(function(each){return smalltalk.send(self, "_nextPut_", [each]);})]);
  2713. return self;}
  2714. }),
  2715. smalltalk.Stream);
  2716. smalltalk.addMethod(
  2717. "_peek",
  2718. smalltalk.method({
  2719. selector: "peek",
  2720. fn: function () {
  2721. var self=this;
  2722. return ((($receiver = smalltalk.send(self, "_atEnd", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(smalltalk.send(self, "_collection", []), "_at_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(self, "_collection", []), "_at_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);})]));
  2723. return self;}
  2724. }),
  2725. smalltalk.Stream);
  2726. smalltalk.addMethod(
  2727. "_position",
  2728. smalltalk.method({
  2729. selector: "position",
  2730. fn: function () {
  2731. var self=this;
  2732. return (($receiver = self['@position']) == nil || $receiver == undefined) ? (function(){return (self['@position']=(0));})() : $receiver;
  2733. return self;}
  2734. }),
  2735. smalltalk.Stream);
  2736. smalltalk.addMethod(
  2737. "_position_",
  2738. smalltalk.method({
  2739. selector: "position:",
  2740. fn: function (anInteger) {
  2741. var self=this;
  2742. (self['@position']=anInteger);
  2743. return self;}
  2744. }),
  2745. smalltalk.Stream);
  2746. smalltalk.addMethod(
  2747. "_reset",
  2748. smalltalk.method({
  2749. selector: "reset",
  2750. fn: function () {
  2751. var self=this;
  2752. smalltalk.send(self, "_position_", [(0)]);
  2753. return self;}
  2754. }),
  2755. smalltalk.Stream);
  2756. smalltalk.addMethod(
  2757. "_resetContents",
  2758. smalltalk.method({
  2759. selector: "resetContents",
  2760. fn: function () {
  2761. var self=this;
  2762. smalltalk.send(self, "_reset", []);
  2763. smalltalk.send(self, "_setStreamSize_", [(0)]);
  2764. return self;}
  2765. }),
  2766. smalltalk.Stream);
  2767. smalltalk.addMethod(
  2768. "_setCollection_",
  2769. smalltalk.method({
  2770. selector: "setCollection:",
  2771. fn: function (aCollection) {
  2772. var self=this;
  2773. (self['@collection']=aCollection);
  2774. return self;}
  2775. }),
  2776. smalltalk.Stream);
  2777. smalltalk.addMethod(
  2778. "_setStreamSize_",
  2779. smalltalk.method({
  2780. selector: "setStreamSize:",
  2781. fn: function (anInteger) {
  2782. var self=this;
  2783. (self['@streamSize']=anInteger);
  2784. return self;}
  2785. }),
  2786. smalltalk.Stream);
  2787. smalltalk.addMethod(
  2788. "_setToEnd",
  2789. smalltalk.method({
  2790. selector: "setToEnd",
  2791. fn: function () {
  2792. var self=this;
  2793. smalltalk.send(self, "_position_", [smalltalk.send(self, "_size", [])]);
  2794. return self;}
  2795. }),
  2796. smalltalk.Stream);
  2797. smalltalk.addMethod(
  2798. "_size",
  2799. smalltalk.method({
  2800. selector: "size",
  2801. fn: function () {
  2802. var self=this;
  2803. return smalltalk.send(self, "_streamSize", []);
  2804. return self;}
  2805. }),
  2806. smalltalk.Stream);
  2807. smalltalk.addMethod(
  2808. "_skip_",
  2809. smalltalk.method({
  2810. selector: "skip:",
  2811. fn: function (anInteger) {
  2812. var self=this;
  2813. smalltalk.send(self, "_position_", [smalltalk.send(((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +anInteger : smalltalk.send($receiver, "__plus", [anInteger])), "_min_max_", [smalltalk.send(self, "_size", []), (0)])]);
  2814. return self;}
  2815. }),
  2816. smalltalk.Stream);
  2817. smalltalk.addMethod(
  2818. "_streamSize",
  2819. smalltalk.method({
  2820. selector: "streamSize",
  2821. fn: function () {
  2822. var self=this;
  2823. return self['@streamSize'];
  2824. return self;}
  2825. }),
  2826. smalltalk.Stream);
  2827. smalltalk.addMethod(
  2828. "_on_",
  2829. smalltalk.method({
  2830. selector: "on:",
  2831. fn: function (aCollection) {
  2832. var self=this;
  2833. return (function($rec){smalltalk.send($rec, "_setCollection_", [aCollection]);smalltalk.send($rec, "_setStreamSize_", [smalltalk.send(aCollection, "_size", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  2834. return self;}
  2835. }),
  2836. smalltalk.Stream.klass);
  2837. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections');
  2838. smalltalk.addMethod(
  2839. "_cr",
  2840. smalltalk.method({
  2841. selector: "cr",
  2842. fn: function () {
  2843. var self=this;
  2844. return smalltalk.send(self, "_nextPutAll_", [smalltalk.send((smalltalk.String || String), "_cr", [])]);
  2845. return self;}
  2846. }),
  2847. smalltalk.StringStream);
  2848. smalltalk.addMethod(
  2849. "_crlf",
  2850. smalltalk.method({
  2851. selector: "crlf",
  2852. fn: function () {
  2853. var self=this;
  2854. return smalltalk.send(self, "_nextPutAll_", [smalltalk.send((smalltalk.String || String), "_crlf", [])]);
  2855. return self;}
  2856. }),
  2857. smalltalk.StringStream);
  2858. smalltalk.addMethod(
  2859. "_lf",
  2860. smalltalk.method({
  2861. selector: "lf",
  2862. fn: function () {
  2863. var self=this;
  2864. return smalltalk.send(self, "_nextPutAll_", [smalltalk.send((smalltalk.String || String), "_lf", [])]);
  2865. return self;}
  2866. }),
  2867. smalltalk.StringStream);
  2868. smalltalk.addMethod(
  2869. "_next_",
  2870. smalltalk.method({
  2871. selector: "next:",
  2872. fn: function (anInteger) {
  2873. var self=this;
  2874. var tempCollection=nil;
  2875. (tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_class", []), "_new", []));
  2876. smalltalk.send(anInteger, "_timesRepeat_", [(function(){return ((($receiver = smalltalk.send(self, "_atEnd", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (tempCollection=smalltalk.send(tempCollection, "__comma", [smalltalk.send(self, "_next", [])]));})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (tempCollection=smalltalk.send(tempCollection, "__comma", [smalltalk.send(self, "_next", [])]));})]));})]);
  2877. return tempCollection;
  2878. return self;}
  2879. }),
  2880. smalltalk.StringStream);
  2881. smalltalk.addMethod(
  2882. "_nextPut_",
  2883. smalltalk.method({
  2884. selector: "nextPut:",
  2885. fn: function (aString) {
  2886. var self=this;
  2887. smalltalk.send(self, "_nextPutAll_", [aString]);
  2888. return self;}
  2889. }),
  2890. smalltalk.StringStream);
  2891. smalltalk.addMethod(
  2892. "_nextPutAll_",
  2893. smalltalk.method({
  2894. selector: "nextPutAll:",
  2895. fn: function (aString) {
  2896. var self=this;
  2897. smalltalk.send(self, "_setCollection_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_copyFrom_to_", [(1), smalltalk.send(self, "_position", [])]), "__comma", [aString]), "__comma", [smalltalk.send(smalltalk.send(self, "_collection", []), "_copyFrom_to_", [((($receiver = ((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))).klass === smalltalk.Number) ? $receiver +smalltalk.send(aString, "_size", []) : smalltalk.send($receiver, "__plus", [smalltalk.send(aString, "_size", [])])), smalltalk.send(smalltalk.send(self, "_collection", []), "_size", [])])])]);
  2898. smalltalk.send(self, "_position_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +smalltalk.send(aString, "_size", []) : smalltalk.send($receiver, "__plus", [smalltalk.send(aString, "_size", [])]))]);
  2899. smalltalk.send(self, "_setStreamSize_", [smalltalk.send(smalltalk.send(self, "_streamSize", []), "_max_", [smalltalk.send(self, "_position", [])])]);
  2900. return self;}
  2901. }),
  2902. smalltalk.StringStream);
  2903. smalltalk.addMethod(
  2904. "_space",
  2905. smalltalk.method({
  2906. selector: "space",
  2907. fn: function () {
  2908. var self=this;
  2909. smalltalk.send(self, "_nextPut_", [" "]);
  2910. return self;}
  2911. }),
  2912. smalltalk.StringStream);