1
0

Kernel-Collections.deploy.js 86 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223
  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 stream=nil;
  154. (stream=smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_new", []), "_writeStream", []));
  155. smalltalk.send(self, "_do_", [(function(each){return smalltalk.send(stream, "_nextPut_", [smalltalk.send(aBlock, "_value_", [each])]);})]);
  156. return smalltalk.send(stream, "_contents", []);
  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. var index=nil;
  1430. (index=(1));
  1431. (instance=smalltalk.send(self, "_new_", [smalltalk.send(aCollection, "_size", [])]));
  1432. smalltalk.send(aCollection, "_do_", [(function(each){smalltalk.send(instance, "_at_put_", [index, each]);return (index=((($receiver = index).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})]);
  1433. return instance;
  1434. return self;}
  1435. }),
  1436. smalltalk.Array.klass);
  1437. smalltalk.addClass('CharacterArray', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  1438. smalltalk.addMethod(
  1439. "__comma",
  1440. smalltalk.method({
  1441. selector: ",",
  1442. fn: function (aString) {
  1443. var self=this;
  1444. return smalltalk.send(smalltalk.send(self, "_asString", []), "__comma", [smalltalk.send(aString, "_asString", [])]);
  1445. return self;}
  1446. }),
  1447. smalltalk.CharacterArray);
  1448. smalltalk.addMethod(
  1449. "_add_",
  1450. smalltalk.method({
  1451. selector: "add:",
  1452. fn: function (anObject) {
  1453. var self=this;
  1454. smalltalk.send(self, "_errorReadOnly", []);
  1455. return self;}
  1456. }),
  1457. smalltalk.CharacterArray);
  1458. smalltalk.addMethod(
  1459. "_asLowercase",
  1460. smalltalk.method({
  1461. selector: "asLowercase",
  1462. fn: function () {
  1463. var self=this;
  1464. return smalltalk.send(smalltalk.send(self, "_class", []), "_fromString_", [smalltalk.send(smalltalk.send(self, "_asString", []), "_asLowercase", [])]);
  1465. return self;}
  1466. }),
  1467. smalltalk.CharacterArray);
  1468. smalltalk.addMethod(
  1469. "_asNumber",
  1470. smalltalk.method({
  1471. selector: "asNumber",
  1472. fn: function () {
  1473. var self=this;
  1474. return smalltalk.send(smalltalk.send(self, "_asString", []), "_asNumber", []);
  1475. return self;}
  1476. }),
  1477. smalltalk.CharacterArray);
  1478. smalltalk.addMethod(
  1479. "_asString",
  1480. smalltalk.method({
  1481. selector: "asString",
  1482. fn: function () {
  1483. var self=this;
  1484. return smalltalk.send(self, "_subclassResponsibility", []);
  1485. return self;}
  1486. }),
  1487. smalltalk.CharacterArray);
  1488. smalltalk.addMethod(
  1489. "_asSymbol",
  1490. smalltalk.method({
  1491. selector: "asSymbol",
  1492. fn: function () {
  1493. var self=this;
  1494. return smalltalk.send(self, "_subclassResponsibility", []);
  1495. return self;}
  1496. }),
  1497. smalltalk.CharacterArray);
  1498. smalltalk.addMethod(
  1499. "_asUppercase",
  1500. smalltalk.method({
  1501. selector: "asUppercase",
  1502. fn: function () {
  1503. var self=this;
  1504. return smalltalk.send(smalltalk.send(self, "_class", []), "_fromString_", [smalltalk.send(smalltalk.send(self, "_asString", []), "_asUppercase", [])]);
  1505. return self;}
  1506. }),
  1507. smalltalk.CharacterArray);
  1508. smalltalk.addMethod(
  1509. "_at_put_",
  1510. smalltalk.method({
  1511. selector: "at:put:",
  1512. fn: function (anIndex, anObject) {
  1513. var self=this;
  1514. smalltalk.send(self, "_errorReadOnly", []);
  1515. return self;}
  1516. }),
  1517. smalltalk.CharacterArray);
  1518. smalltalk.addMethod(
  1519. "_errorReadOnly",
  1520. smalltalk.method({
  1521. selector: "errorReadOnly",
  1522. fn: function () {
  1523. var self=this;
  1524. smalltalk.send(self, "_error_", ["Object is read-only"]);
  1525. return self;}
  1526. }),
  1527. smalltalk.CharacterArray);
  1528. smalltalk.addMethod(
  1529. "_printString",
  1530. smalltalk.method({
  1531. selector: "printString",
  1532. fn: function () {
  1533. var self=this;
  1534. return smalltalk.send(smalltalk.send(self, "_asString", []), "_printString", []);
  1535. return self;}
  1536. }),
  1537. smalltalk.CharacterArray);
  1538. smalltalk.addMethod(
  1539. "_remove_",
  1540. smalltalk.method({
  1541. selector: "remove:",
  1542. fn: function (anObject) {
  1543. var self=this;
  1544. smalltalk.send(self, "_errorReadOnly", []);
  1545. return self;}
  1546. }),
  1547. smalltalk.CharacterArray);
  1548. smalltalk.addMethod(
  1549. "_fromString_",
  1550. smalltalk.method({
  1551. selector: "fromString:",
  1552. fn: function (aString) {
  1553. var self=this;
  1554. smalltalk.send(self, "_subclassResponsibility", []);
  1555. return self;}
  1556. }),
  1557. smalltalk.CharacterArray.klass);
  1558. smalltalk.addClass('String', smalltalk.CharacterArray, [], 'Kernel-Collections');
  1559. smalltalk.addMethod(
  1560. "__comma",
  1561. smalltalk.method({
  1562. selector: ",",
  1563. fn: function (aString) {
  1564. var self=this;
  1565. return self + aString;
  1566. return self;}
  1567. }),
  1568. smalltalk.String);
  1569. smalltalk.addMethod(
  1570. "__lt",
  1571. smalltalk.method({
  1572. selector: "<",
  1573. fn: function (aString) {
  1574. var self=this;
  1575. return String(self) < aString._asString();
  1576. return self;}
  1577. }),
  1578. smalltalk.String);
  1579. smalltalk.addMethod(
  1580. "__lt_eq",
  1581. smalltalk.method({
  1582. selector: "<=",
  1583. fn: function (aString) {
  1584. var self=this;
  1585. return String(self) <= aString._asString();
  1586. return self;}
  1587. }),
  1588. smalltalk.String);
  1589. smalltalk.addMethod(
  1590. "__eq",
  1591. smalltalk.method({
  1592. selector: "=",
  1593. fn: function (aString) {
  1594. var self=this;
  1595. var $early={};
  1596. 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]})();})]));
  1597. return String(self) === String(aString);
  1598. return self;
  1599. } catch(e) {if(e===$early)return e[0]; throw e}}
  1600. }),
  1601. smalltalk.String);
  1602. smalltalk.addMethod(
  1603. "__eq_eq",
  1604. smalltalk.method({
  1605. selector: "==",
  1606. fn: function (aString) {
  1607. var self=this;
  1608. return smalltalk.send(self, "__eq", [aString]);
  1609. return self;}
  1610. }),
  1611. smalltalk.String);
  1612. smalltalk.addMethod(
  1613. "__gt",
  1614. smalltalk.method({
  1615. selector: ">",
  1616. fn: function (aString) {
  1617. var self=this;
  1618. return String(self) > aString._asString();
  1619. return self;}
  1620. }),
  1621. smalltalk.String);
  1622. smalltalk.addMethod(
  1623. "__gt_eq",
  1624. smalltalk.method({
  1625. selector: ">=",
  1626. fn: function (aString) {
  1627. var self=this;
  1628. return String(self) >= aString._asString();
  1629. return self;}
  1630. }),
  1631. smalltalk.String);
  1632. smalltalk.addMethod(
  1633. "_asJSON",
  1634. smalltalk.method({
  1635. selector: "asJSON",
  1636. fn: function () {
  1637. var self=this;
  1638. return self;
  1639. return self;}
  1640. }),
  1641. smalltalk.String);
  1642. smalltalk.addMethod(
  1643. "_asJavaScriptSelector",
  1644. smalltalk.method({
  1645. selector: "asJavaScriptSelector",
  1646. fn: function () {
  1647. var self=this;
  1648. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_asSelector", []), "_replace_with_", ["^_", ""]), "_replace_with_", ["_.*", ""]);
  1649. return self;}
  1650. }),
  1651. smalltalk.String);
  1652. smalltalk.addMethod(
  1653. "_asJavascript",
  1654. smalltalk.method({
  1655. selector: "asJavascript",
  1656. fn: function () {
  1657. var self=this;
  1658. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  1659. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  1660. else
  1661. return "\"" + self + "\"";
  1662. ;
  1663. return self;}
  1664. }),
  1665. smalltalk.String);
  1666. smalltalk.addMethod(
  1667. "_asLowercase",
  1668. smalltalk.method({
  1669. selector: "asLowercase",
  1670. fn: function () {
  1671. var self=this;
  1672. return self.toLowerCase();
  1673. return self;}
  1674. }),
  1675. smalltalk.String);
  1676. smalltalk.addMethod(
  1677. "_asNumber",
  1678. smalltalk.method({
  1679. selector: "asNumber",
  1680. fn: function () {
  1681. var self=this;
  1682. return Number(self);
  1683. return self;}
  1684. }),
  1685. smalltalk.String);
  1686. smalltalk.addMethod(
  1687. "_asSelector",
  1688. smalltalk.method({
  1689. selector: "asSelector",
  1690. fn: function () {
  1691. var self=this;
  1692. var selector=nil;
  1693. (selector=smalltalk.send("_", "__comma", [self]));
  1694. (selector=smalltalk.send(selector, "_replace_with_", [":", "_"]));
  1695. (selector=smalltalk.send(selector, "_replace_with_", ["[+]", "_plus"]));
  1696. (selector=smalltalk.send(selector, "_replace_with_", ["-", "_minus"]));
  1697. (selector=smalltalk.send(selector, "_replace_with_", ["[*]", "_star"]));
  1698. (selector=smalltalk.send(selector, "_replace_with_", ["[/]", "_slash"]));
  1699. (selector=smalltalk.send(selector, "_replace_with_", [">", "_gt"]));
  1700. (selector=smalltalk.send(selector, "_replace_with_", ["<", "_lt"]));
  1701. (selector=smalltalk.send(selector, "_replace_with_", ["=", "_eq"]));
  1702. (selector=smalltalk.send(selector, "_replace_with_", [",", "_comma"]));
  1703. (selector=smalltalk.send(selector, "_replace_with_", ["[@]", "_at"]));
  1704. return selector;
  1705. return self;}
  1706. }),
  1707. smalltalk.String);
  1708. smalltalk.addMethod(
  1709. "_asString",
  1710. smalltalk.method({
  1711. selector: "asString",
  1712. fn: function () {
  1713. var self=this;
  1714. return self;
  1715. return self;}
  1716. }),
  1717. smalltalk.String);
  1718. smalltalk.addMethod(
  1719. "_asSymbol",
  1720. smalltalk.method({
  1721. selector: "asSymbol",
  1722. fn: function () {
  1723. var self=this;
  1724. return smalltalk.send((smalltalk.Symbol || Symbol), "_lookup_", [self]);
  1725. return self;}
  1726. }),
  1727. smalltalk.String);
  1728. smalltalk.addMethod(
  1729. "_asUppercase",
  1730. smalltalk.method({
  1731. selector: "asUppercase",
  1732. fn: function () {
  1733. var self=this;
  1734. return self.toUpperCase();
  1735. return self;}
  1736. }),
  1737. smalltalk.String);
  1738. smalltalk.addMethod(
  1739. "_asciiValue",
  1740. smalltalk.method({
  1741. selector: "asciiValue",
  1742. fn: function () {
  1743. var self=this;
  1744. return self.charCodeAt(0);;
  1745. return self;}
  1746. }),
  1747. smalltalk.String);
  1748. smalltalk.addMethod(
  1749. "_at_ifAbsent_",
  1750. smalltalk.method({
  1751. selector: "at:ifAbsent:",
  1752. fn: function (anIndex, aBlock) {
  1753. var self=this;
  1754. return String(self).charAt(anIndex - 1) || aBlock();
  1755. return self;}
  1756. }),
  1757. smalltalk.String);
  1758. smalltalk.addMethod(
  1759. "_copyFrom_to_",
  1760. smalltalk.method({
  1761. selector: "copyFrom:to:",
  1762. fn: function (anIndex, anotherIndex) {
  1763. var self=this;
  1764. return self.substring(anIndex - 1, anotherIndex);
  1765. return self;}
  1766. }),
  1767. smalltalk.String);
  1768. smalltalk.addMethod(
  1769. "_deepCopy",
  1770. smalltalk.method({
  1771. selector: "deepCopy",
  1772. fn: function () {
  1773. var self=this;
  1774. return smalltalk.send(self, "_shallowCopy", []);
  1775. return self;}
  1776. }),
  1777. smalltalk.String);
  1778. smalltalk.addMethod(
  1779. "_do_",
  1780. smalltalk.method({
  1781. selector: "do:",
  1782. fn: function (aBlock) {
  1783. var self=this;
  1784. for(var i=0;i<self.length;i++){aBlock(self.charAt(i));};
  1785. return self;}
  1786. }),
  1787. smalltalk.String);
  1788. smalltalk.addMethod(
  1789. "_escaped",
  1790. smalltalk.method({
  1791. selector: "escaped",
  1792. fn: function () {
  1793. var self=this;
  1794. return escape(self);
  1795. return self;}
  1796. }),
  1797. smalltalk.String);
  1798. smalltalk.addMethod(
  1799. "_includesSubString_",
  1800. smalltalk.method({
  1801. selector: "includesSubString:",
  1802. fn: function (subString) {
  1803. var self=this;
  1804. return self.indexOf(subString) != -1 ;
  1805. return self;}
  1806. }),
  1807. smalltalk.String);
  1808. smalltalk.addMethod(
  1809. "_isString",
  1810. smalltalk.method({
  1811. selector: "isString",
  1812. fn: function () {
  1813. var self=this;
  1814. return true;
  1815. return self;}
  1816. }),
  1817. smalltalk.String);
  1818. smalltalk.addMethod(
  1819. "_join_",
  1820. smalltalk.method({
  1821. selector: "join:",
  1822. fn: function (aCollection) {
  1823. var self=this;
  1824. 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]);})]);})]);
  1825. return self;}
  1826. }),
  1827. smalltalk.String);
  1828. smalltalk.addMethod(
  1829. "_lineIndicesDo_",
  1830. smalltalk.method({
  1831. selector: "lineIndicesDo:",
  1832. fn: function (aBlock) {
  1833. var self=this;
  1834. var $early={};
  1835. try{var cr=nil;
  1836. var lf=nil;
  1837. var start=nil;
  1838. var sz=nil;
  1839. var nextLF=nil;
  1840. var nextCR=nil;
  1841. (start=(1));
  1842. (sz=smalltalk.send(self, "_size", []));
  1843. (cr=smalltalk.send((smalltalk.String || String), "_cr", []));
  1844. (nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, (1)]));
  1845. (lf=smalltalk.send((smalltalk.String || String), "_lf", []));
  1846. (nextLF=smalltalk.send(self, "_indexOf_startingAt_", [lf, (1)]));
  1847. (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]));})]));})]));})()}})();
  1848. return self;
  1849. } catch(e) {if(e===$early)return e[0]; throw e}}
  1850. }),
  1851. smalltalk.String);
  1852. smalltalk.addMethod(
  1853. "_lineNumber_",
  1854. smalltalk.method({
  1855. selector: "lineNumber:",
  1856. fn: function (anIndex) {
  1857. var self=this;
  1858. var $early={};
  1859. try{var lineCount=nil;
  1860. (lineCount=(0));
  1861. 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])]})();})]));})]);
  1862. return nil;
  1863. return self;
  1864. } catch(e) {if(e===$early)return e[0]; throw e}}
  1865. }),
  1866. smalltalk.String);
  1867. smalltalk.addMethod(
  1868. "_lines",
  1869. smalltalk.method({
  1870. selector: "lines",
  1871. fn: function () {
  1872. var self=this;
  1873. var lines=nil;
  1874. (lines=smalltalk.send((smalltalk.Array || Array), "_new", []));
  1875. smalltalk.send(self, "_linesDo_", [(function(aLine){return smalltalk.send(lines, "_add_", [aLine]);})]);
  1876. return lines;
  1877. return self;}
  1878. }),
  1879. smalltalk.String);
  1880. smalltalk.addMethod(
  1881. "_linesDo_",
  1882. smalltalk.method({
  1883. selector: "linesDo:",
  1884. fn: function (aBlock) {
  1885. var self=this;
  1886. smalltalk.send(self, "_lineIndicesDo_", [(function(start, endWithoutDelimiters, end){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_copyFrom_to_", [start, endWithoutDelimiters])]);})]);
  1887. return self;}
  1888. }),
  1889. smalltalk.String);
  1890. smalltalk.addMethod(
  1891. "_match_",
  1892. smalltalk.method({
  1893. selector: "match:",
  1894. fn: function (aRegexp) {
  1895. var self=this;
  1896. return self.search(aRegexp) != -1;
  1897. return self;}
  1898. }),
  1899. smalltalk.String);
  1900. smalltalk.addMethod(
  1901. "_matchesOf_",
  1902. smalltalk.method({
  1903. selector: "matchesOf:",
  1904. fn: function (aRegularExpression) {
  1905. var self=this;
  1906. return self.match(aRegularExpression);
  1907. return self;}
  1908. }),
  1909. smalltalk.String);
  1910. smalltalk.addMethod(
  1911. "_printNl",
  1912. smalltalk.method({
  1913. selector: "printNl",
  1914. fn: function () {
  1915. var self=this;
  1916. console.log(self);
  1917. return self;}
  1918. }),
  1919. smalltalk.String);
  1920. smalltalk.addMethod(
  1921. "_printString",
  1922. smalltalk.method({
  1923. selector: "printString",
  1924. fn: function () {
  1925. var self=this;
  1926. return smalltalk.send(smalltalk.send("'", "__comma", [self]), "__comma", ["'"]);
  1927. return self;}
  1928. }),
  1929. smalltalk.String);
  1930. smalltalk.addMethod(
  1931. "_replace_with_",
  1932. smalltalk.method({
  1933. selector: "replace:with:",
  1934. fn: function (aString, anotherString) {
  1935. var self=this;
  1936. return smalltalk.send(self, "_replaceRegexp_with_", [smalltalk.send((smalltalk.RegularExpression || RegularExpression), "_fromString_flag_", [aString, "g"]), anotherString]);
  1937. return self;}
  1938. }),
  1939. smalltalk.String);
  1940. smalltalk.addMethod(
  1941. "_replaceRegexp_with_",
  1942. smalltalk.method({
  1943. selector: "replaceRegexp:with:",
  1944. fn: function (aRegexp, aString) {
  1945. var self=this;
  1946. return self.replace(aRegexp, aString);
  1947. return self;}
  1948. }),
  1949. smalltalk.String);
  1950. smalltalk.addMethod(
  1951. "_reversed",
  1952. smalltalk.method({
  1953. selector: "reversed",
  1954. fn: function () {
  1955. var self=this;
  1956. return self.split("").reverse().join("");
  1957. return self;}
  1958. }),
  1959. smalltalk.String);
  1960. smalltalk.addMethod(
  1961. "_shallowCopy",
  1962. smalltalk.method({
  1963. selector: "shallowCopy",
  1964. fn: function () {
  1965. var self=this;
  1966. return smalltalk.send(smalltalk.send(self, "_class", []), "_fromString_", [self]);
  1967. return self;}
  1968. }),
  1969. smalltalk.String);
  1970. smalltalk.addMethod(
  1971. "_size",
  1972. smalltalk.method({
  1973. selector: "size",
  1974. fn: function () {
  1975. var self=this;
  1976. return self.length;
  1977. return self;}
  1978. }),
  1979. smalltalk.String);
  1980. smalltalk.addMethod(
  1981. "_tokenize_",
  1982. smalltalk.method({
  1983. selector: "tokenize:",
  1984. fn: function (aString) {
  1985. var self=this;
  1986. return self.split(aString);
  1987. return self;}
  1988. }),
  1989. smalltalk.String);
  1990. smalltalk.addMethod(
  1991. "_trimBoth",
  1992. smalltalk.method({
  1993. selector: "trimBoth",
  1994. fn: function () {
  1995. var self=this;
  1996. return smalltalk.send(self, "_trimBoth_", ["\x5cs"]);
  1997. return self;}
  1998. }),
  1999. smalltalk.String);
  2000. smalltalk.addMethod(
  2001. "_trimBoth_",
  2002. smalltalk.method({
  2003. selector: "trimBoth:",
  2004. fn: function (separators) {
  2005. var self=this;
  2006. return smalltalk.send(smalltalk.send(self, "_trimLeft_", [separators]), "_trimRight_", [separators]);
  2007. return self;}
  2008. }),
  2009. smalltalk.String);
  2010. smalltalk.addMethod(
  2011. "_trimLeft",
  2012. smalltalk.method({
  2013. selector: "trimLeft",
  2014. fn: function () {
  2015. var self=this;
  2016. return smalltalk.send(self, "_trimLeft_", ["\x5cs"]);
  2017. return self;}
  2018. }),
  2019. smalltalk.String);
  2020. smalltalk.addMethod(
  2021. "_trimLeft_",
  2022. smalltalk.method({
  2023. selector: "trimLeft:",
  2024. fn: function (separators) {
  2025. var self=this;
  2026. return smalltalk.send(self, "_replaceRegexp_with_", [smalltalk.send((smalltalk.RegularExpression || RegularExpression), "_fromString_flag_", [smalltalk.send(smalltalk.send("^[", "__comma", [separators]), "__comma", ["]+"]), "g"]), ""]);
  2027. return self;}
  2028. }),
  2029. smalltalk.String);
  2030. smalltalk.addMethod(
  2031. "_trimRight",
  2032. smalltalk.method({
  2033. selector: "trimRight",
  2034. fn: function () {
  2035. var self=this;
  2036. return smalltalk.send(self, "_trimRight_", ["\x5cs"]);
  2037. return self;}
  2038. }),
  2039. smalltalk.String);
  2040. smalltalk.addMethod(
  2041. "_trimRight_",
  2042. smalltalk.method({
  2043. selector: "trimRight:",
  2044. fn: function (separators) {
  2045. var self=this;
  2046. return smalltalk.send(self, "_replaceRegexp_with_", [smalltalk.send((smalltalk.RegularExpression || RegularExpression), "_fromString_flag_", [smalltalk.send(smalltalk.send("[", "__comma", [separators]), "__comma", ["]+$"]), "g"]), ""]);
  2047. return self;}
  2048. }),
  2049. smalltalk.String);
  2050. smalltalk.addMethod(
  2051. "_unescaped",
  2052. smalltalk.method({
  2053. selector: "unescaped",
  2054. fn: function () {
  2055. var self=this;
  2056. return unescape(self);
  2057. return self;}
  2058. }),
  2059. smalltalk.String);
  2060. smalltalk.addMethod(
  2061. "_withIndexDo_",
  2062. smalltalk.method({
  2063. selector: "withIndexDo:",
  2064. fn: function (aBlock) {
  2065. var self=this;
  2066. for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);};
  2067. return self;}
  2068. }),
  2069. smalltalk.String);
  2070. smalltalk.addMethod(
  2071. "_cr",
  2072. smalltalk.method({
  2073. selector: "cr",
  2074. fn: function () {
  2075. var self=this;
  2076. return '\r';
  2077. return self;}
  2078. }),
  2079. smalltalk.String.klass);
  2080. smalltalk.addMethod(
  2081. "_crlf",
  2082. smalltalk.method({
  2083. selector: "crlf",
  2084. fn: function () {
  2085. var self=this;
  2086. return '\r\n';
  2087. return self;}
  2088. }),
  2089. smalltalk.String.klass);
  2090. smalltalk.addMethod(
  2091. "_fromString_",
  2092. smalltalk.method({
  2093. selector: "fromString:",
  2094. fn: function (aString) {
  2095. var self=this;
  2096. return new self.fn(aString);
  2097. return self;}
  2098. }),
  2099. smalltalk.String.klass);
  2100. smalltalk.addMethod(
  2101. "_lf",
  2102. smalltalk.method({
  2103. selector: "lf",
  2104. fn: function () {
  2105. var self=this;
  2106. return '\n';
  2107. return self;}
  2108. }),
  2109. smalltalk.String.klass);
  2110. smalltalk.addMethod(
  2111. "_space",
  2112. smalltalk.method({
  2113. selector: "space",
  2114. fn: function () {
  2115. var self=this;
  2116. return ' ';
  2117. return self;}
  2118. }),
  2119. smalltalk.String.klass);
  2120. smalltalk.addMethod(
  2121. "_streamClass",
  2122. smalltalk.method({
  2123. selector: "streamClass",
  2124. fn: function () {
  2125. var self=this;
  2126. return (smalltalk.StringStream || StringStream);
  2127. return self;}
  2128. }),
  2129. smalltalk.String.klass);
  2130. smalltalk.addMethod(
  2131. "_streamContents_",
  2132. smalltalk.method({
  2133. selector: "streamContents:",
  2134. fn: function (blockWithArg) {
  2135. var self=this;
  2136. var stream=nil;
  2137. (stream=smalltalk.send(smalltalk.send(self, "_streamClass", []), "_on_", [smalltalk.send((smalltalk.String || String), "_new", [])]));
  2138. smalltalk.send(blockWithArg, "_value_", [stream]);
  2139. return smalltalk.send(stream, "_contents", []);
  2140. return self;}
  2141. }),
  2142. smalltalk.String.klass);
  2143. smalltalk.addMethod(
  2144. "_tab",
  2145. smalltalk.method({
  2146. selector: "tab",
  2147. fn: function () {
  2148. var self=this;
  2149. return '\t';
  2150. return self;}
  2151. }),
  2152. smalltalk.String.klass);
  2153. smalltalk.addMethod(
  2154. "_value_",
  2155. smalltalk.method({
  2156. selector: "value:",
  2157. fn: function (aUTFCharCode) {
  2158. var self=this;
  2159. return String.fromCharCode(aUTFCharCode);;
  2160. return self;}
  2161. }),
  2162. smalltalk.String.klass);
  2163. smalltalk.addClass('Symbol', smalltalk.CharacterArray, [], 'Kernel-Collections');
  2164. smalltalk.addMethod(
  2165. "__lt",
  2166. smalltalk.method({
  2167. selector: "<",
  2168. fn: function (aSymbol) {
  2169. var self=this;
  2170. return ((($receiver = smalltalk.send(self, "_asString", [])).klass === smalltalk.Number) ? $receiver <smalltalk.send(aSymbol, "_asString", []) : smalltalk.send($receiver, "__lt", [smalltalk.send(aSymbol, "_asString", [])]));
  2171. return self;}
  2172. }),
  2173. smalltalk.Symbol);
  2174. smalltalk.addMethod(
  2175. "__lt_eq",
  2176. smalltalk.method({
  2177. selector: "<=",
  2178. fn: function (aSymbol) {
  2179. var self=this;
  2180. return ((($receiver = smalltalk.send(self, "_asString", [])).klass === smalltalk.Number) ? $receiver <=smalltalk.send(aSymbol, "_asString", []) : smalltalk.send($receiver, "__lt_eq", [smalltalk.send(aSymbol, "_asString", [])]));
  2181. return self;}
  2182. }),
  2183. smalltalk.Symbol);
  2184. smalltalk.addMethod(
  2185. "__eq",
  2186. smalltalk.method({
  2187. selector: "=",
  2188. fn: function (aSymbol) {
  2189. var self=this;
  2190. var $early={};
  2191. 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]})();})]));
  2192. return smalltalk.send(smalltalk.send(self, "_asString", []), "__eq", [smalltalk.send(aSymbol, "_asString", [])]);
  2193. return self;
  2194. } catch(e) {if(e===$early)return e[0]; throw e}}
  2195. }),
  2196. smalltalk.Symbol);
  2197. smalltalk.addMethod(
  2198. "__gt",
  2199. smalltalk.method({
  2200. selector: ">",
  2201. fn: function (aSymbol) {
  2202. var self=this;
  2203. return ((($receiver = smalltalk.send(self, "_asString", [])).klass === smalltalk.Number) ? $receiver >smalltalk.send(aSymbol, "_asString", []) : smalltalk.send($receiver, "__gt", [smalltalk.send(aSymbol, "_asString", [])]));
  2204. return self;}
  2205. }),
  2206. smalltalk.Symbol);
  2207. smalltalk.addMethod(
  2208. "__gt_eq",
  2209. smalltalk.method({
  2210. selector: ">=",
  2211. fn: function (aSymbol) {
  2212. var self=this;
  2213. return ((($receiver = smalltalk.send(self, "_asString", [])).klass === smalltalk.Number) ? $receiver >=smalltalk.send(aSymbol, "_asString", []) : smalltalk.send($receiver, "__gt_eq", [smalltalk.send(aSymbol, "_asString", [])]));
  2214. return self;}
  2215. }),
  2216. smalltalk.Symbol);
  2217. smalltalk.addMethod(
  2218. "_asJSON",
  2219. smalltalk.method({
  2220. selector: "asJSON",
  2221. fn: function () {
  2222. var self=this;
  2223. return smalltalk.send(smalltalk.send(self, "_asString", []), "_asJSON", []);
  2224. return self;}
  2225. }),
  2226. smalltalk.Symbol);
  2227. smalltalk.addMethod(
  2228. "_asJavascript",
  2229. smalltalk.method({
  2230. selector: "asJavascript",
  2231. fn: function () {
  2232. var self=this;
  2233. return smalltalk.send(smalltalk.send("smalltalk.symbolFor(\x22", "__comma", [smalltalk.send(self, "_asString", [])]), "__comma", ["\x22)"]);
  2234. return self;}
  2235. }),
  2236. smalltalk.Symbol);
  2237. smalltalk.addMethod(
  2238. "_asSelector",
  2239. smalltalk.method({
  2240. selector: "asSelector",
  2241. fn: function () {
  2242. var self=this;
  2243. return smalltalk.send(smalltalk.send(self, "_asString", []), "_asSelector", []);
  2244. return self;}
  2245. }),
  2246. smalltalk.Symbol);
  2247. smalltalk.addMethod(
  2248. "_asString",
  2249. smalltalk.method({
  2250. selector: "asString",
  2251. fn: function () {
  2252. var self=this;
  2253. return self.value;
  2254. return self;}
  2255. }),
  2256. smalltalk.Symbol);
  2257. smalltalk.addMethod(
  2258. "_asSymbol",
  2259. smalltalk.method({
  2260. selector: "asSymbol",
  2261. fn: function () {
  2262. var self=this;
  2263. return self;
  2264. return self;}
  2265. }),
  2266. smalltalk.Symbol);
  2267. smalltalk.addMethod(
  2268. "_at_ifAbsent_",
  2269. smalltalk.method({
  2270. selector: "at:ifAbsent:",
  2271. fn: function (anIndex, aBlock) {
  2272. var self=this;
  2273. return smalltalk.send(smalltalk.send(self, "_asString", []), "_at_ifAbsent_", [anIndex, aBlock]);
  2274. return self;}
  2275. }),
  2276. smalltalk.Symbol);
  2277. smalltalk.addMethod(
  2278. "_collect_",
  2279. smalltalk.method({
  2280. selector: "collect:",
  2281. fn: function (aBlock) {
  2282. var self=this;
  2283. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_asString", []), "_collect_", [aBlock]), "_asSymbol", []);
  2284. return self;}
  2285. }),
  2286. smalltalk.Symbol);
  2287. smalltalk.addMethod(
  2288. "_copyFrom_to_",
  2289. smalltalk.method({
  2290. selector: "copyFrom:to:",
  2291. fn: function (anIndex, anotherIndex) {
  2292. var self=this;
  2293. return smalltalk.send(smalltalk.send(self, "_class", []), "_fromString_", [smalltalk.send(smalltalk.send(self, "_asString", []), "_copyFrom_to_", [anIndex, anotherIndex])]);
  2294. return self;}
  2295. }),
  2296. smalltalk.Symbol);
  2297. smalltalk.addMethod(
  2298. "_deepCopy",
  2299. smalltalk.method({
  2300. selector: "deepCopy",
  2301. fn: function () {
  2302. var self=this;
  2303. return self;
  2304. return self;}
  2305. }),
  2306. smalltalk.Symbol);
  2307. smalltalk.addMethod(
  2308. "_detect_",
  2309. smalltalk.method({
  2310. selector: "detect:",
  2311. fn: function (aBlock) {
  2312. var self=this;
  2313. return smalltalk.send(smalltalk.send(self, "_asString", []), "_detect_", [aBlock]);
  2314. return self;}
  2315. }),
  2316. smalltalk.Symbol);
  2317. smalltalk.addMethod(
  2318. "_do_",
  2319. smalltalk.method({
  2320. selector: "do:",
  2321. fn: function (aBlock) {
  2322. var self=this;
  2323. smalltalk.send(smalltalk.send(self, "_asString", []), "_do_", [aBlock]);
  2324. return self;}
  2325. }),
  2326. smalltalk.Symbol);
  2327. smalltalk.addMethod(
  2328. "_isSymbol",
  2329. smalltalk.method({
  2330. selector: "isSymbol",
  2331. fn: function () {
  2332. var self=this;
  2333. return true;
  2334. return self;}
  2335. }),
  2336. smalltalk.Symbol);
  2337. smalltalk.addMethod(
  2338. "_printString",
  2339. smalltalk.method({
  2340. selector: "printString",
  2341. fn: function () {
  2342. var self=this;
  2343. return smalltalk.send("#", "__comma", [smalltalk.send(self, "_asString", [])]);
  2344. return self;}
  2345. }),
  2346. smalltalk.Symbol);
  2347. smalltalk.addMethod(
  2348. "_select_",
  2349. smalltalk.method({
  2350. selector: "select:",
  2351. fn: function (aBlock) {
  2352. var self=this;
  2353. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_asString", []), "_select_", [aBlock]), "_asSymbol", []);
  2354. return self;}
  2355. }),
  2356. smalltalk.Symbol);
  2357. smalltalk.addMethod(
  2358. "_shallowCopy",
  2359. smalltalk.method({
  2360. selector: "shallowCopy",
  2361. fn: function () {
  2362. var self=this;
  2363. return self;
  2364. return self;}
  2365. }),
  2366. smalltalk.Symbol);
  2367. smalltalk.addMethod(
  2368. "_size",
  2369. smalltalk.method({
  2370. selector: "size",
  2371. fn: function () {
  2372. var self=this;
  2373. return smalltalk.send(smalltalk.send(self, "_asString", []), "_size", []);
  2374. return self;}
  2375. }),
  2376. smalltalk.Symbol);
  2377. smalltalk.addMethod(
  2378. "_withIndexDo_",
  2379. smalltalk.method({
  2380. selector: "withIndexDo:",
  2381. fn: function (aBlock) {
  2382. var self=this;
  2383. smalltalk.send(smalltalk.send(self, "_asString", []), "_withIndexDo_", [aBlock]);
  2384. return self;}
  2385. }),
  2386. smalltalk.Symbol);
  2387. smalltalk.addMethod(
  2388. "_basicNew",
  2389. smalltalk.method({
  2390. selector: "basicNew",
  2391. fn: function () {
  2392. var self=this;
  2393. smalltalk.send(self, "_shouldNotImplement", []);
  2394. return self;}
  2395. }),
  2396. smalltalk.Symbol.klass);
  2397. smalltalk.addMethod(
  2398. "_fromString_",
  2399. smalltalk.method({
  2400. selector: "fromString:",
  2401. fn: function (aString) {
  2402. var self=this;
  2403. return smalltalk.send(self, "_lookup_", [aString]);
  2404. return self;}
  2405. }),
  2406. smalltalk.Symbol.klass);
  2407. smalltalk.addMethod(
  2408. "_lookup_",
  2409. smalltalk.method({
  2410. selector: "lookup:",
  2411. fn: function (aString) {
  2412. var self=this;
  2413. return smalltalk.symbolFor(aString);;
  2414. return self;}
  2415. }),
  2416. smalltalk.Symbol.klass);
  2417. smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections');
  2418. smalltalk.addMethod(
  2419. "__eq",
  2420. smalltalk.method({
  2421. selector: "=",
  2422. fn: function (aCollection) {
  2423. var self=this;
  2424. 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", [])]);})]);
  2425. return self;}
  2426. }),
  2427. smalltalk.Set);
  2428. smalltalk.addMethod(
  2429. "_add_",
  2430. smalltalk.method({
  2431. selector: "add:",
  2432. fn: function (anObject) {
  2433. var self=this;
  2434. var found;
  2435. for(var i=0; i < self['@elements'].length; i++) {
  2436. if(anObject == self['@elements'][i]) {
  2437. found = true;
  2438. break;
  2439. }
  2440. }
  2441. if(!found) {self['@elements'].push(anObject)}
  2442. ;
  2443. return self;}
  2444. }),
  2445. smalltalk.Set);
  2446. smalltalk.addMethod(
  2447. "_asArray",
  2448. smalltalk.method({
  2449. selector: "asArray",
  2450. fn: function () {
  2451. var self=this;
  2452. return smalltalk.send(self['@elements'], "_copy", []);
  2453. return self;}
  2454. }),
  2455. smalltalk.Set);
  2456. smalltalk.addMethod(
  2457. "_detect_ifNone_",
  2458. smalltalk.method({
  2459. selector: "detect:ifNone:",
  2460. fn: function (aBlock, anotherBlock) {
  2461. var self=this;
  2462. return smalltalk.send(self['@elements'], "_detect_ifNone_", [aBlock, anotherBlock]);
  2463. return self;}
  2464. }),
  2465. smalltalk.Set);
  2466. smalltalk.addMethod(
  2467. "_do_",
  2468. smalltalk.method({
  2469. selector: "do:",
  2470. fn: function (aBlock) {
  2471. var self=this;
  2472. smalltalk.send(self['@elements'], "_do_", [aBlock]);
  2473. return self;}
  2474. }),
  2475. smalltalk.Set);
  2476. smalltalk.addMethod(
  2477. "_includes_",
  2478. smalltalk.method({
  2479. selector: "includes:",
  2480. fn: function (anObject) {
  2481. var self=this;
  2482. return smalltalk.send(self['@elements'], "_includes_", [anObject]);
  2483. return self;}
  2484. }),
  2485. smalltalk.Set);
  2486. smalltalk.addMethod(
  2487. "_initialize",
  2488. smalltalk.method({
  2489. selector: "initialize",
  2490. fn: function () {
  2491. var self=this;
  2492. smalltalk.send(self, "_initialize", [], smalltalk.Set.superclass || nil);
  2493. (self['@elements']=[]);
  2494. return self;}
  2495. }),
  2496. smalltalk.Set);
  2497. smalltalk.addMethod(
  2498. "_printString",
  2499. smalltalk.method({
  2500. selector: "printString",
  2501. fn: function () {
  2502. var self=this;
  2503. 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_", [")"]);})]);
  2504. return self;}
  2505. }),
  2506. smalltalk.Set);
  2507. smalltalk.addMethod(
  2508. "_remove_",
  2509. smalltalk.method({
  2510. selector: "remove:",
  2511. fn: function (anObject) {
  2512. var self=this;
  2513. smalltalk.send(self['@elements'], "_remove_", [anObject]);
  2514. return self;}
  2515. }),
  2516. smalltalk.Set);
  2517. smalltalk.addMethod(
  2518. "_select_",
  2519. smalltalk.method({
  2520. selector: "select:",
  2521. fn: function (aBlock) {
  2522. var self=this;
  2523. var collection=nil;
  2524. (collection=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []));
  2525. 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]);})]));})]);
  2526. return collection;
  2527. return self;}
  2528. }),
  2529. smalltalk.Set);
  2530. smalltalk.addMethod(
  2531. "_size",
  2532. smalltalk.method({
  2533. selector: "size",
  2534. fn: function () {
  2535. var self=this;
  2536. return smalltalk.send(self['@elements'], "_size", []);
  2537. return self;}
  2538. }),
  2539. smalltalk.Set);
  2540. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
  2541. smalltalk.addMethod(
  2542. "_compile_",
  2543. smalltalk.method({
  2544. selector: "compile:",
  2545. fn: function (aString) {
  2546. var self=this;
  2547. return self.compile(aString);
  2548. return self;}
  2549. }),
  2550. smalltalk.RegularExpression);
  2551. smalltalk.addMethod(
  2552. "_exec_",
  2553. smalltalk.method({
  2554. selector: "exec:",
  2555. fn: function (aString) {
  2556. var self=this;
  2557. return self.exec(aString) || nil;
  2558. return self;}
  2559. }),
  2560. smalltalk.RegularExpression);
  2561. smalltalk.addMethod(
  2562. "_test_",
  2563. smalltalk.method({
  2564. selector: "test:",
  2565. fn: function (aString) {
  2566. var self=this;
  2567. return self.test(aString);
  2568. return self;}
  2569. }),
  2570. smalltalk.RegularExpression);
  2571. smalltalk.addMethod(
  2572. "_fromString_",
  2573. smalltalk.method({
  2574. selector: "fromString:",
  2575. fn: function (aString) {
  2576. var self=this;
  2577. return smalltalk.send(self, "_fromString_flag_", [aString, ""]);
  2578. return self;}
  2579. }),
  2580. smalltalk.RegularExpression.klass);
  2581. smalltalk.addMethod(
  2582. "_fromString_flag_",
  2583. smalltalk.method({
  2584. selector: "fromString:flag:",
  2585. fn: function (aString, anotherString) {
  2586. var self=this;
  2587. return new RegExp(aString, anotherString);
  2588. return self;}
  2589. }),
  2590. smalltalk.RegularExpression.klass);
  2591. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  2592. smalltalk.addMethod(
  2593. "_atEnd",
  2594. smalltalk.method({
  2595. selector: "atEnd",
  2596. fn: function () {
  2597. var self=this;
  2598. return smalltalk.send(smalltalk.send(self, "_position", []), "__eq", [smalltalk.send(self, "_size", [])]);
  2599. return self;}
  2600. }),
  2601. smalltalk.Stream);
  2602. smalltalk.addMethod(
  2603. "_atStart",
  2604. smalltalk.method({
  2605. selector: "atStart",
  2606. fn: function () {
  2607. var self=this;
  2608. return smalltalk.send(smalltalk.send(self, "_position", []), "__eq", [(0)]);
  2609. return self;}
  2610. }),
  2611. smalltalk.Stream);
  2612. smalltalk.addMethod(
  2613. "_close",
  2614. smalltalk.method({
  2615. selector: "close",
  2616. fn: function () {
  2617. var self=this;
  2618. return self;}
  2619. }),
  2620. smalltalk.Stream);
  2621. smalltalk.addMethod(
  2622. "_collection",
  2623. smalltalk.method({
  2624. selector: "collection",
  2625. fn: function () {
  2626. var self=this;
  2627. return self['@collection'];
  2628. return self;}
  2629. }),
  2630. smalltalk.Stream);
  2631. smalltalk.addMethod(
  2632. "_contents",
  2633. smalltalk.method({
  2634. selector: "contents",
  2635. fn: function () {
  2636. var self=this;
  2637. return smalltalk.send(smalltalk.send(self, "_collection", []), "_copyFrom_to_", [(1), smalltalk.send(self, "_streamSize", [])]);
  2638. return self;}
  2639. }),
  2640. smalltalk.Stream);
  2641. smalltalk.addMethod(
  2642. "_do_",
  2643. smalltalk.method({
  2644. selector: "do:",
  2645. fn: function (aBlock) {
  2646. var self=this;
  2647. (function(){while(!(function(){return smalltalk.send(self, "_atEnd", []);})()) {(function(){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_next", [])]);})()}})();
  2648. return self;}
  2649. }),
  2650. smalltalk.Stream);
  2651. smalltalk.addMethod(
  2652. "_flush",
  2653. smalltalk.method({
  2654. selector: "flush",
  2655. fn: function () {
  2656. var self=this;
  2657. return self;}
  2658. }),
  2659. smalltalk.Stream);
  2660. smalltalk.addMethod(
  2661. "_isEmpty",
  2662. smalltalk.method({
  2663. selector: "isEmpty",
  2664. fn: function () {
  2665. var self=this;
  2666. return smalltalk.send(smalltalk.send(self, "_size", []), "__eq", [(0)]);
  2667. return self;}
  2668. }),
  2669. smalltalk.Stream);
  2670. smalltalk.addMethod(
  2671. "_next",
  2672. smalltalk.method({
  2673. selector: "next",
  2674. fn: function () {
  2675. var self=this;
  2676. 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", [])]);})]));
  2677. return self;}
  2678. }),
  2679. smalltalk.Stream);
  2680. smalltalk.addMethod(
  2681. "_next_",
  2682. smalltalk.method({
  2683. selector: "next:",
  2684. fn: function (anInteger) {
  2685. var self=this;
  2686. var tempCollection=nil;
  2687. (tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_class", []), "_new", []));
  2688. 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", [])]);})]));})]);
  2689. return tempCollection;
  2690. return self;}
  2691. }),
  2692. smalltalk.Stream);
  2693. smalltalk.addMethod(
  2694. "_nextPut_",
  2695. smalltalk.method({
  2696. selector: "nextPut:",
  2697. fn: function (anObject) {
  2698. var self=this;
  2699. smalltalk.send(self, "_position_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);
  2700. smalltalk.send(smalltalk.send(self, "_collection", []), "_at_put_", [smalltalk.send(self, "_position", []), anObject]);
  2701. smalltalk.send(self, "_setStreamSize_", [smalltalk.send(smalltalk.send(self, "_streamSize", []), "_max_", [smalltalk.send(self, "_position", [])])]);
  2702. return self;}
  2703. }),
  2704. smalltalk.Stream);
  2705. smalltalk.addMethod(
  2706. "_nextPutAll_",
  2707. smalltalk.method({
  2708. selector: "nextPutAll:",
  2709. fn: function (aCollection) {
  2710. var self=this;
  2711. smalltalk.send(aCollection, "_do_", [(function(each){return smalltalk.send(self, "_nextPut_", [each]);})]);
  2712. return self;}
  2713. }),
  2714. smalltalk.Stream);
  2715. smalltalk.addMethod(
  2716. "_peek",
  2717. smalltalk.method({
  2718. selector: "peek",
  2719. fn: function () {
  2720. var self=this;
  2721. 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)]))]);})]));
  2722. return self;}
  2723. }),
  2724. smalltalk.Stream);
  2725. smalltalk.addMethod(
  2726. "_position",
  2727. smalltalk.method({
  2728. selector: "position",
  2729. fn: function () {
  2730. var self=this;
  2731. return (($receiver = self['@position']) == nil || $receiver == undefined) ? (function(){return (self['@position']=(0));})() : $receiver;
  2732. return self;}
  2733. }),
  2734. smalltalk.Stream);
  2735. smalltalk.addMethod(
  2736. "_position_",
  2737. smalltalk.method({
  2738. selector: "position:",
  2739. fn: function (anInteger) {
  2740. var self=this;
  2741. (self['@position']=anInteger);
  2742. return self;}
  2743. }),
  2744. smalltalk.Stream);
  2745. smalltalk.addMethod(
  2746. "_reset",
  2747. smalltalk.method({
  2748. selector: "reset",
  2749. fn: function () {
  2750. var self=this;
  2751. smalltalk.send(self, "_position_", [(0)]);
  2752. return self;}
  2753. }),
  2754. smalltalk.Stream);
  2755. smalltalk.addMethod(
  2756. "_resetContents",
  2757. smalltalk.method({
  2758. selector: "resetContents",
  2759. fn: function () {
  2760. var self=this;
  2761. smalltalk.send(self, "_reset", []);
  2762. smalltalk.send(self, "_setStreamSize_", [(0)]);
  2763. return self;}
  2764. }),
  2765. smalltalk.Stream);
  2766. smalltalk.addMethod(
  2767. "_setCollection_",
  2768. smalltalk.method({
  2769. selector: "setCollection:",
  2770. fn: function (aCollection) {
  2771. var self=this;
  2772. (self['@collection']=aCollection);
  2773. return self;}
  2774. }),
  2775. smalltalk.Stream);
  2776. smalltalk.addMethod(
  2777. "_setStreamSize_",
  2778. smalltalk.method({
  2779. selector: "setStreamSize:",
  2780. fn: function (anInteger) {
  2781. var self=this;
  2782. (self['@streamSize']=anInteger);
  2783. return self;}
  2784. }),
  2785. smalltalk.Stream);
  2786. smalltalk.addMethod(
  2787. "_setToEnd",
  2788. smalltalk.method({
  2789. selector: "setToEnd",
  2790. fn: function () {
  2791. var self=this;
  2792. smalltalk.send(self, "_position_", [smalltalk.send(self, "_size", [])]);
  2793. return self;}
  2794. }),
  2795. smalltalk.Stream);
  2796. smalltalk.addMethod(
  2797. "_size",
  2798. smalltalk.method({
  2799. selector: "size",
  2800. fn: function () {
  2801. var self=this;
  2802. return smalltalk.send(self, "_streamSize", []);
  2803. return self;}
  2804. }),
  2805. smalltalk.Stream);
  2806. smalltalk.addMethod(
  2807. "_skip_",
  2808. smalltalk.method({
  2809. selector: "skip:",
  2810. fn: function (anInteger) {
  2811. var self=this;
  2812. 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)])]);
  2813. return self;}
  2814. }),
  2815. smalltalk.Stream);
  2816. smalltalk.addMethod(
  2817. "_streamSize",
  2818. smalltalk.method({
  2819. selector: "streamSize",
  2820. fn: function () {
  2821. var self=this;
  2822. return self['@streamSize'];
  2823. return self;}
  2824. }),
  2825. smalltalk.Stream);
  2826. smalltalk.addMethod(
  2827. "_on_",
  2828. smalltalk.method({
  2829. selector: "on:",
  2830. fn: function (aCollection) {
  2831. var self=this;
  2832. 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", []));
  2833. return self;}
  2834. }),
  2835. smalltalk.Stream.klass);
  2836. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections');
  2837. smalltalk.addMethod(
  2838. "_cr",
  2839. smalltalk.method({
  2840. selector: "cr",
  2841. fn: function () {
  2842. var self=this;
  2843. return smalltalk.send(self, "_nextPutAll_", [smalltalk.send((smalltalk.String || String), "_cr", [])]);
  2844. return self;}
  2845. }),
  2846. smalltalk.StringStream);
  2847. smalltalk.addMethod(
  2848. "_crlf",
  2849. smalltalk.method({
  2850. selector: "crlf",
  2851. fn: function () {
  2852. var self=this;
  2853. return smalltalk.send(self, "_nextPutAll_", [smalltalk.send((smalltalk.String || String), "_crlf", [])]);
  2854. return self;}
  2855. }),
  2856. smalltalk.StringStream);
  2857. smalltalk.addMethod(
  2858. "_lf",
  2859. smalltalk.method({
  2860. selector: "lf",
  2861. fn: function () {
  2862. var self=this;
  2863. return smalltalk.send(self, "_nextPutAll_", [smalltalk.send((smalltalk.String || String), "_lf", [])]);
  2864. return self;}
  2865. }),
  2866. smalltalk.StringStream);
  2867. smalltalk.addMethod(
  2868. "_next_",
  2869. smalltalk.method({
  2870. selector: "next:",
  2871. fn: function (anInteger) {
  2872. var self=this;
  2873. var tempCollection=nil;
  2874. (tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_class", []), "_new", []));
  2875. 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", [])]));})]));})]);
  2876. return tempCollection;
  2877. return self;}
  2878. }),
  2879. smalltalk.StringStream);
  2880. smalltalk.addMethod(
  2881. "_nextPut_",
  2882. smalltalk.method({
  2883. selector: "nextPut:",
  2884. fn: function (aString) {
  2885. var self=this;
  2886. smalltalk.send(self, "_nextPutAll_", [aString]);
  2887. return self;}
  2888. }),
  2889. smalltalk.StringStream);
  2890. smalltalk.addMethod(
  2891. "_nextPutAll_",
  2892. smalltalk.method({
  2893. selector: "nextPutAll:",
  2894. fn: function (aString) {
  2895. var self=this;
  2896. 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", [])])])]);
  2897. 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", [])]))]);
  2898. smalltalk.send(self, "_setStreamSize_", [smalltalk.send(smalltalk.send(self, "_streamSize", []), "_max_", [smalltalk.send(self, "_position", [])])]);
  2899. return self;}
  2900. }),
  2901. smalltalk.StringStream);
  2902. smalltalk.addMethod(
  2903. "_space",
  2904. smalltalk.method({
  2905. selector: "space",
  2906. fn: function () {
  2907. var self=this;
  2908. smalltalk.send(self, "_nextPut_", [" "]);
  2909. return self;}
  2910. }),
  2911. smalltalk.StringStream);