Kernel-Collections.deploy.js 83 KB

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