1
0

Kernel-Collections.deploy.js 84 KB

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