1
0

Kernel-Collections.deploy.js 84 KB

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