Kernel-Collections.deploy.js 72 KB

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