Kernel-Collections.deploy.js 86 KB

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