1
0

Kernel-Collections.deploy.js 72 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688
  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_',
  613. smalltalk.method({
  614. selector: 'at:',
  615. fn: function (anIndex){
  616. var self=this;
  617. return self[anIndex - 1];
  618. return self;}
  619. }),
  620. smalltalk.String);
  621. smalltalk.addMethod(
  622. '_at_put_',
  623. smalltalk.method({
  624. selector: 'at:put:',
  625. fn: function (anIndex, anObject){
  626. var self=this;
  627. smalltalk.send(self, "_errorReadOnly", []);
  628. return self;}
  629. }),
  630. smalltalk.String);
  631. smalltalk.addMethod(
  632. '_at_ifAbsent_',
  633. smalltalk.method({
  634. selector: 'at:ifAbsent:',
  635. fn: function (anIndex, aBlock){
  636. var self=this;
  637. (($receiver = smalltalk.send(self, "_at_", [anIndex])) == nil || $receiver == undefined) ? (function(){return aBlock;})() : $receiver;
  638. return self;}
  639. }),
  640. smalltalk.String);
  641. smalltalk.addMethod(
  642. '_escaped',
  643. smalltalk.method({
  644. selector: 'escaped',
  645. fn: function (){
  646. var self=this;
  647. return escape(self);
  648. return self;}
  649. }),
  650. smalltalk.String);
  651. smalltalk.addMethod(
  652. '_unescaped',
  653. smalltalk.method({
  654. selector: 'unescaped',
  655. fn: function (){
  656. var self=this;
  657. return unescape(self);
  658. return self;}
  659. }),
  660. smalltalk.String);
  661. smalltalk.addMethod(
  662. '_add_',
  663. smalltalk.method({
  664. selector: 'add:',
  665. fn: function (anObject){
  666. var self=this;
  667. smalltalk.send(self, "_errorReadOnly", []);
  668. return self;}
  669. }),
  670. smalltalk.String);
  671. smalltalk.addMethod(
  672. '__comma',
  673. smalltalk.method({
  674. selector: ',',
  675. fn: function (aString){
  676. var self=this;
  677. return self + aString;
  678. return self;}
  679. }),
  680. smalltalk.String);
  681. smalltalk.addMethod(
  682. '_copyFrom_to_',
  683. smalltalk.method({
  684. selector: 'copyFrom:to:',
  685. fn: function (anIndex, anotherIndex){
  686. var self=this;
  687. return self.substring(anIndex - 1, anotherIndex);
  688. return self;}
  689. }),
  690. smalltalk.String);
  691. smalltalk.addMethod(
  692. '_shallowCopy',
  693. smalltalk.method({
  694. selector: 'shallowCopy',
  695. fn: function (){
  696. var self=this;
  697. return smalltalk.send(smalltalk.send(self, "_class", []), "_fromString_", [self]);
  698. return self;}
  699. }),
  700. smalltalk.String);
  701. smalltalk.addMethod(
  702. '_deepCopy',
  703. smalltalk.method({
  704. selector: 'deepCopy',
  705. fn: function (){
  706. var self=this;
  707. return smalltalk.send(self, "_shallowCopy", []);
  708. return self;}
  709. }),
  710. smalltalk.String);
  711. smalltalk.addMethod(
  712. '_asSelector',
  713. smalltalk.method({
  714. selector: 'asSelector',
  715. fn: function (){
  716. var self=this;
  717. var selector=nil;
  718. selector=smalltalk.send("_", "__comma", [self]);
  719. selector=smalltalk.send(selector, "_replace_with_", [":", "_"]);
  720. selector=smalltalk.send(selector, "_replace_with_", [unescape("%5B+%5D"), "_plus"]);
  721. selector=smalltalk.send(selector, "_replace_with_", [unescape("-"), "_minus"]);
  722. selector=smalltalk.send(selector, "_replace_with_", [unescape("%5B*%5D"), "_star"]);
  723. selector=smalltalk.send(selector, "_replace_with_", [unescape("%5B/%5D"), "_slash"]);
  724. selector=smalltalk.send(selector, "_replace_with_", [unescape("%3E"), "_gt"]);
  725. selector=smalltalk.send(selector, "_replace_with_", [unescape("%3C"), "_lt"]);
  726. selector=smalltalk.send(selector, "_replace_with_", [unescape("%3D"), "_eq"]);
  727. selector=smalltalk.send(selector, "_replace_with_", [unescape("%2C"), "_comma"]);
  728. selector=smalltalk.send(selector, "_replace_with_", [unescape("%5B@%5D"), "_at"]);
  729. return selector;
  730. return self;}
  731. }),
  732. smalltalk.String);
  733. smalltalk.addMethod(
  734. '_asJavascript',
  735. smalltalk.method({
  736. selector: 'asJavascript',
  737. fn: function (){
  738. var self=this;
  739. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  740. return "unescape(\"" + escape(self) + "\")";
  741. else
  742. return "\"" + self + "\"";
  743. ;
  744. return self;}
  745. }),
  746. smalltalk.String);
  747. smalltalk.addMethod(
  748. '_replace_with_',
  749. smalltalk.method({
  750. selector: 'replace:with:',
  751. fn: function (aString, anotherString){
  752. var self=this;
  753. return smalltalk.send(self, "_replaceRegexp_with_", [smalltalk.send((smalltalk.RegularExpression || RegularExpression), "_fromString_flag_", [aString, "g"]), anotherString]);
  754. return self;}
  755. }),
  756. smalltalk.String);
  757. smalltalk.addMethod(
  758. '_replaceRegexp_with_',
  759. smalltalk.method({
  760. selector: 'replaceRegexp:with:',
  761. fn: function (aRegexp, aString){
  762. var self=this;
  763. return self.replace(aRegexp, aString);
  764. return self;}
  765. }),
  766. smalltalk.String);
  767. smalltalk.addMethod(
  768. '_tokenize_',
  769. smalltalk.method({
  770. selector: 'tokenize:',
  771. fn: function (aString){
  772. var self=this;
  773. return self.split(aString);
  774. return self;}
  775. }),
  776. smalltalk.String);
  777. smalltalk.addMethod(
  778. '_match_',
  779. smalltalk.method({
  780. selector: 'match:',
  781. fn: function (aRegexp){
  782. var self=this;
  783. return self.search(aRegexp) != -1;
  784. return self;}
  785. }),
  786. smalltalk.String);
  787. smalltalk.addMethod(
  788. '_asString',
  789. smalltalk.method({
  790. selector: 'asString',
  791. fn: function (){
  792. var self=this;
  793. return self;
  794. return self;}
  795. }),
  796. smalltalk.String);
  797. smalltalk.addMethod(
  798. '_asNumber',
  799. smalltalk.method({
  800. selector: 'asNumber',
  801. fn: function (){
  802. var self=this;
  803. return Number(self);
  804. return self;}
  805. }),
  806. smalltalk.String);
  807. smalltalk.addMethod(
  808. '_errorReadOnly',
  809. smalltalk.method({
  810. selector: 'errorReadOnly',
  811. fn: function (){
  812. var self=this;
  813. smalltalk.send(self, "_error_", [unescape("Object%20is%20read-only")]);
  814. return self;}
  815. }),
  816. smalltalk.String);
  817. smalltalk.addMethod(
  818. '_printString',
  819. smalltalk.method({
  820. selector: 'printString',
  821. fn: function (){
  822. var self=this;
  823. return smalltalk.send(smalltalk.send(unescape("%27"), "__comma", [self]), "__comma", [unescape("%27")]);
  824. return self;}
  825. }),
  826. smalltalk.String);
  827. smalltalk.addMethod(
  828. '_printNl',
  829. smalltalk.method({
  830. selector: 'printNl',
  831. fn: function (){
  832. var self=this;
  833. console.log(self);
  834. return self;}
  835. }),
  836. smalltalk.String);
  837. smalltalk.addMethod(
  838. '_isString',
  839. smalltalk.method({
  840. selector: 'isString',
  841. fn: function (){
  842. var self=this;
  843. return true;
  844. return self;}
  845. }),
  846. smalltalk.String);
  847. smalltalk.addMethod(
  848. '__gt',
  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. '__lt',
  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. '__gt_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. '__lt_eq',
  879. smalltalk.method({
  880. selector: '<=',
  881. fn: function (aString){
  882. var self=this;
  883. return String(self) <= aString;
  884. return self;}
  885. }),
  886. smalltalk.String);
  887. smalltalk.addMethod(
  888. '_remove_',
  889. smalltalk.method({
  890. selector: 'remove:',
  891. fn: function (anObject){
  892. var self=this;
  893. smalltalk.send(self, "_errorReadOnly", []);
  894. return self;}
  895. }),
  896. smalltalk.String);
  897. smalltalk.addMethod(
  898. '_trimLeft_',
  899. smalltalk.method({
  900. selector: 'trimLeft:',
  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("%5E%5B"), "__comma", [separators]), "__comma", [unescape("%5D+")]), "g"]), ""]);
  904. return self;}
  905. }),
  906. smalltalk.String);
  907. smalltalk.addMethod(
  908. '_trimRight_',
  909. smalltalk.method({
  910. selector: 'trimRight:',
  911. fn: function (separators){
  912. var self=this;
  913. 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"]), ""]);
  914. return self;}
  915. }),
  916. smalltalk.String);
  917. smalltalk.addMethod(
  918. '_trimLeft',
  919. smalltalk.method({
  920. selector: 'trimLeft',
  921. fn: function (){
  922. var self=this;
  923. return smalltalk.send(self, "_trimLeft_", [unescape("%5Cs")]);
  924. return self;}
  925. }),
  926. smalltalk.String);
  927. smalltalk.addMethod(
  928. '_trimRight',
  929. smalltalk.method({
  930. selector: 'trimRight',
  931. fn: function (){
  932. var self=this;
  933. return smalltalk.send(self, "_trimRight_", [unescape("%5Cs")]);
  934. return self;}
  935. }),
  936. smalltalk.String);
  937. smalltalk.addMethod(
  938. '_trimBoth',
  939. smalltalk.method({
  940. selector: 'trimBoth',
  941. fn: function (){
  942. var self=this;
  943. return smalltalk.send(self, "_trimBoth_", [unescape("%5Cs")]);
  944. return self;}
  945. }),
  946. smalltalk.String);
  947. smalltalk.addMethod(
  948. '_trimBoth_',
  949. smalltalk.method({
  950. selector: 'trimBoth:',
  951. fn: function (separators){
  952. var self=this;
  953. return smalltalk.send(smalltalk.send(self, "_trimLeft_", [separators]), "_trimRight_", [separators]);
  954. return self;}
  955. }),
  956. smalltalk.String);
  957. smalltalk.addMethod(
  958. '_asLowercase',
  959. smalltalk.method({
  960. selector: 'asLowercase',
  961. fn: function (){
  962. var self=this;
  963. return self.toLowerCase();
  964. return self;}
  965. }),
  966. smalltalk.String);
  967. smalltalk.addMethod(
  968. '_asUppercase',
  969. smalltalk.method({
  970. selector: 'asUppercase',
  971. fn: function (){
  972. var self=this;
  973. return self.toUpperCase();
  974. return self;}
  975. }),
  976. smalltalk.String);
  977. smalltalk.addMethod(
  978. '_join_',
  979. smalltalk.method({
  980. selector: 'join:',
  981. fn: function (aCollection){
  982. var self=this;
  983. 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]);})]);})]);
  984. return self;}
  985. }),
  986. smalltalk.String);
  987. smalltalk.addMethod(
  988. '_includesSubString_',
  989. smalltalk.method({
  990. selector: 'includesSubString:',
  991. fn: function (subString){
  992. var self=this;
  993. return self.indexOf(subString) != -1 ;
  994. return self;}
  995. }),
  996. smalltalk.String);
  997. smalltalk.addMethod(
  998. '_asciiValue',
  999. smalltalk.method({
  1000. selector: 'asciiValue',
  1001. fn: function (){
  1002. var self=this;
  1003. return self.charCodeAt(0);;
  1004. return self;}
  1005. }),
  1006. smalltalk.String);
  1007. smalltalk.addMethod(
  1008. '_lineIndicesDo_',
  1009. smalltalk.method({
  1010. selector: 'lineIndicesDo:',
  1011. fn: function (aBlock){
  1012. var self=this;
  1013. try{var cr=nil;
  1014. var lf=nil;
  1015. var start=nil;
  1016. var sz=nil;
  1017. var nextLF=nil;
  1018. var nextCR=nil;
  1019. start=(1);
  1020. sz=smalltalk.send(self, "_size", []);
  1021. cr=smalltalk.send((smalltalk.String || String), "_cr", []);
  1022. nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, (1)]);
  1023. lf=smalltalk.send((smalltalk.String || String), "_lf", []);
  1024. nextLF=smalltalk.send(self, "_indexOf_startingAt_", [lf, (1)]);
  1025. (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]);})]));})]));})()}})();
  1026. return self;
  1027. } catch(e) {if(e.name === 'stReturn' && e.selector === '_lineIndicesDo_'){return e.fn()} throw(e)}}
  1028. }),
  1029. smalltalk.String);
  1030. smalltalk.addMethod(
  1031. '_linesDo_',
  1032. smalltalk.method({
  1033. selector: 'linesDo:',
  1034. fn: function (aBlock){
  1035. var self=this;
  1036. smalltalk.send(self, "_lineIndicesDo_", [(function(start, endWithoutDelimiters, end){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_copyFrom_to_", [start, endWithoutDelimiters])]);})]);
  1037. return self;}
  1038. }),
  1039. smalltalk.String);
  1040. smalltalk.addMethod(
  1041. '_lines',
  1042. smalltalk.method({
  1043. selector: 'lines',
  1044. fn: function (){
  1045. var self=this;
  1046. var lines=nil;
  1047. lines=smalltalk.send((smalltalk.Array || Array), "_new", []);
  1048. smalltalk.send(self, "_linesDo_", [(function(aLine){return smalltalk.send(lines, "_add_", [aLine]);})]);
  1049. return lines;
  1050. return self;}
  1051. }),
  1052. smalltalk.String);
  1053. smalltalk.addMethod(
  1054. '_lineNumber_',
  1055. smalltalk.method({
  1056. selector: 'lineNumber:',
  1057. fn: function (anIndex){
  1058. var self=this;
  1059. try{var lineCount=nil;
  1060. lineCount=(0);
  1061. 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])}})})();})]));})]);
  1062. (function(){throw({name: 'stReturn', selector: '_lineNumber_', fn: function(){return nil}})})();
  1063. return self;
  1064. } catch(e) {if(e.name === 'stReturn' && e.selector === '_lineNumber_'){return e.fn()} throw(e)}}
  1065. }),
  1066. smalltalk.String);
  1067. smalltalk.addMethod(
  1068. '_reversed',
  1069. smalltalk.method({
  1070. selector: 'reversed',
  1071. fn: function (){
  1072. var self=this;
  1073. return self.split("").reverse().join("");
  1074. return self;}
  1075. }),
  1076. smalltalk.String);
  1077. smalltalk.addMethod(
  1078. '__eq_eq',
  1079. smalltalk.method({
  1080. selector: '==',
  1081. fn: function (aString){
  1082. var self=this;
  1083. 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}})})();})]));
  1084. return String(self) === String(aString);
  1085. return self;
  1086. } catch(e) {if(e.name === 'stReturn' && e.selector === '__eq_eq'){return e.fn()} throw(e)}}
  1087. }),
  1088. smalltalk.String);
  1089. smalltalk.addMethod(
  1090. '_asJavaScriptSelector',
  1091. smalltalk.method({
  1092. selector: 'asJavaScriptSelector',
  1093. fn: function (){
  1094. var self=this;
  1095. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_asSelector", []), "_replace_with_", [unescape("%5E_"), ""]), "_replace_with_", [unescape("_.*"), ""]);
  1096. return self;}
  1097. }),
  1098. smalltalk.String);
  1099. smalltalk.addMethod(
  1100. '_asJSONString',
  1101. smalltalk.method({
  1102. selector: 'asJSONString',
  1103. fn: function (){
  1104. var self=this;
  1105. return self;
  1106. return self;}
  1107. }),
  1108. smalltalk.String);
  1109. smalltalk.addMethod(
  1110. '_streamClass',
  1111. smalltalk.method({
  1112. selector: 'streamClass',
  1113. fn: function (){
  1114. var self=this;
  1115. return (smalltalk.StringStream || StringStream);
  1116. return self;}
  1117. }),
  1118. smalltalk.String.klass);
  1119. smalltalk.addMethod(
  1120. '_fromString_',
  1121. smalltalk.method({
  1122. selector: 'fromString:',
  1123. fn: function (aString){
  1124. var self=this;
  1125. return new self.fn(aString);
  1126. return self;}
  1127. }),
  1128. smalltalk.String.klass);
  1129. smalltalk.addMethod(
  1130. '_cr',
  1131. smalltalk.method({
  1132. selector: 'cr',
  1133. fn: function (){
  1134. var self=this;
  1135. return '\r';
  1136. return self;}
  1137. }),
  1138. smalltalk.String.klass);
  1139. smalltalk.addMethod(
  1140. '_lf',
  1141. smalltalk.method({
  1142. selector: 'lf',
  1143. fn: function (){
  1144. var self=this;
  1145. return '\n';
  1146. return self;}
  1147. }),
  1148. smalltalk.String.klass);
  1149. smalltalk.addMethod(
  1150. '_space',
  1151. smalltalk.method({
  1152. selector: 'space',
  1153. fn: function (){
  1154. var self=this;
  1155. return ' ';
  1156. return self;}
  1157. }),
  1158. smalltalk.String.klass);
  1159. smalltalk.addMethod(
  1160. '_tab',
  1161. smalltalk.method({
  1162. selector: 'tab',
  1163. fn: function (){
  1164. var self=this;
  1165. return '\t';
  1166. return self;}
  1167. }),
  1168. smalltalk.String.klass);
  1169. smalltalk.addMethod(
  1170. '_crlf',
  1171. smalltalk.method({
  1172. selector: 'crlf',
  1173. fn: function (){
  1174. var self=this;
  1175. return '\r\n';
  1176. return self;}
  1177. }),
  1178. smalltalk.String.klass);
  1179. smalltalk.addMethod(
  1180. '_streamContents_',
  1181. smalltalk.method({
  1182. selector: 'streamContents:',
  1183. fn: function (blockWithArg){
  1184. var self=this;
  1185. var stream=nil;
  1186. stream=smalltalk.send(smalltalk.send(self, "_streamClass", []), "_on_", [smalltalk.send((smalltalk.String || String), "_new", [])]);
  1187. smalltalk.send(blockWithArg, "_value_", [stream]);
  1188. return smalltalk.send(stream, "_contents", []);
  1189. return self;}
  1190. }),
  1191. smalltalk.String.klass);
  1192. smalltalk.addMethod(
  1193. '_value_',
  1194. smalltalk.method({
  1195. selector: 'value:',
  1196. fn: function (aUTFCharCode){
  1197. var self=this;
  1198. return String.fromCharCode(aUTFCharCode);;
  1199. return self;}
  1200. }),
  1201. smalltalk.String.klass);
  1202. smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  1203. smalltalk.addMethod(
  1204. '_size',
  1205. smalltalk.method({
  1206. selector: 'size',
  1207. fn: function (){
  1208. var self=this;
  1209. return self.length;
  1210. return self;}
  1211. }),
  1212. smalltalk.Array);
  1213. smalltalk.addMethod(
  1214. '_at_put_',
  1215. smalltalk.method({
  1216. selector: 'at:put:',
  1217. fn: function (anIndex, anObject){
  1218. var self=this;
  1219. return self[anIndex - 1] = anObject;
  1220. return self;}
  1221. }),
  1222. smalltalk.Array);
  1223. smalltalk.addMethod(
  1224. '_at_ifAbsent_',
  1225. smalltalk.method({
  1226. selector: 'at:ifAbsent:',
  1227. fn: function (anIndex, aBlock){
  1228. var self=this;
  1229. var value = self[anIndex - 1];
  1230. if(value === undefined) {
  1231. return aBlock();
  1232. } else {
  1233. return value;
  1234. }
  1235. ;
  1236. return self;}
  1237. }),
  1238. smalltalk.Array);
  1239. smalltalk.addMethod(
  1240. '_add_',
  1241. smalltalk.method({
  1242. selector: 'add:',
  1243. fn: function (anObject){
  1244. var self=this;
  1245. self.push(anObject); return anObject;;
  1246. return self;}
  1247. }),
  1248. smalltalk.Array);
  1249. smalltalk.addMethod(
  1250. '_shallowCopy',
  1251. smalltalk.method({
  1252. selector: 'shallowCopy',
  1253. fn: function (){
  1254. var self=this;
  1255. var newCollection=nil;
  1256. newCollection=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []);
  1257. smalltalk.send(self, "_do_", [(function(each){return smalltalk.send(newCollection, "_add_", [each]);})]);
  1258. return newCollection;
  1259. return self;}
  1260. }),
  1261. smalltalk.Array);
  1262. smalltalk.addMethod(
  1263. '_deepCopy',
  1264. smalltalk.method({
  1265. selector: 'deepCopy',
  1266. fn: function (){
  1267. var self=this;
  1268. var newCollection=nil;
  1269. newCollection=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []);
  1270. smalltalk.send(self, "_do_", [(function(each){return smalltalk.send(newCollection, "_add_", [smalltalk.send(each, "_deepCopy", [])]);})]);
  1271. return newCollection;
  1272. return self;}
  1273. }),
  1274. smalltalk.Array);
  1275. smalltalk.addMethod(
  1276. '_copyFrom_to_',
  1277. smalltalk.method({
  1278. selector: 'copyFrom:to:',
  1279. fn: function (anIndex, anotherIndex){
  1280. var self=this;
  1281. var array=nil;
  1282. array=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []);
  1283. smalltalk.send(anIndex, "_to_do_", [anotherIndex, (function(each){return smalltalk.send(array, "_add_", [smalltalk.send(self, "_at_", [each])]);})]);
  1284. return array;
  1285. return self;}
  1286. }),
  1287. smalltalk.Array);
  1288. smalltalk.addMethod(
  1289. '_join_',
  1290. smalltalk.method({
  1291. selector: 'join:',
  1292. fn: function (aString){
  1293. var self=this;
  1294. return self.join(aString);
  1295. return self;}
  1296. }),
  1297. smalltalk.Array);
  1298. smalltalk.addMethod(
  1299. '_asJavascript',
  1300. smalltalk.method({
  1301. selector: 'asJavascript',
  1302. fn: function (){
  1303. var self=this;
  1304. 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")]);
  1305. return self;}
  1306. }),
  1307. smalltalk.Array);
  1308. smalltalk.addMethod(
  1309. '_sort',
  1310. smalltalk.method({
  1311. selector: 'sort',
  1312. fn: function (){
  1313. var self=this;
  1314. return smalltalk.send(self, "_basicPerform_", ["sort"]);
  1315. return self;}
  1316. }),
  1317. smalltalk.Array);
  1318. smalltalk.addMethod(
  1319. '_sort_',
  1320. smalltalk.method({
  1321. selector: 'sort:',
  1322. fn: function (aBlock){
  1323. var self=this;
  1324. return self.sort(function(a, b) {
  1325. if(aBlock(a,b)) {return -1} else {return 1}
  1326. })
  1327. ;
  1328. return self;}
  1329. }),
  1330. smalltalk.Array);
  1331. smalltalk.addMethod(
  1332. '_remove_',
  1333. smalltalk.method({
  1334. selector: 'remove:',
  1335. fn: function (anObject){
  1336. var self=this;
  1337. for(var i=0;i<self.length;i++) {
  1338. if(self[i] == anObject) {
  1339. self.splice(i,1);
  1340. break;
  1341. }
  1342. }
  1343. ;
  1344. return self;}
  1345. }),
  1346. smalltalk.Array);
  1347. smalltalk.addMethod(
  1348. '_sorted',
  1349. smalltalk.method({
  1350. selector: 'sorted',
  1351. fn: function (){
  1352. var self=this;
  1353. return smalltalk.send(smalltalk.send(self, "_copy", []), "_sort", []);
  1354. return self;}
  1355. }),
  1356. smalltalk.Array);
  1357. smalltalk.addMethod(
  1358. '_sorted_',
  1359. smalltalk.method({
  1360. selector: 'sorted:',
  1361. fn: function (aBlock){
  1362. var self=this;
  1363. return smalltalk.send(smalltalk.send(self, "_copy", []), "_sort_", [aBlock]);
  1364. return self;}
  1365. }),
  1366. smalltalk.Array);
  1367. smalltalk.addMethod(
  1368. '_removeFrom_to_',
  1369. smalltalk.method({
  1370. selector: 'removeFrom:to:',
  1371. fn: function (aNumber, anotherNumber){
  1372. var self=this;
  1373. self.splice(aNumber - 1,anotherNumber - 1);
  1374. return self;}
  1375. }),
  1376. smalltalk.Array);
  1377. smalltalk.addMethod(
  1378. '_printString',
  1379. smalltalk.method({
  1380. selector: 'printString',
  1381. fn: function (){
  1382. var self=this;
  1383. var str=nil;
  1384. str=smalltalk.send("", "_writeStream", []);
  1385. smalltalk.send(str, "_nextPutAll_", [smalltalk.send(smalltalk.send(self, "_printString", [], smalltalk.SequenceableCollection), "__comma", [unescape("%20%28")])]);
  1386. smalltalk.send(self, "_do_separatedBy_", [(function(each){return smalltalk.send(str, "_nextPutAll_", [smalltalk.send(each, "_printString", [])]);}), (function(){return smalltalk.send(str, "_nextPutAll_", [" "]);})]);
  1387. smalltalk.send(str, "_nextPutAll_", [unescape("%29")]);
  1388. return smalltalk.send(str, "_contents", []);
  1389. return self;}
  1390. }),
  1391. smalltalk.Array);
  1392. smalltalk.addMethod(
  1393. '_reversed',
  1394. smalltalk.method({
  1395. selector: 'reversed',
  1396. fn: function (){
  1397. var self=this;
  1398. return self._copy().reverse();
  1399. return self;}
  1400. }),
  1401. smalltalk.Array);
  1402. smalltalk.addMethod(
  1403. '__eq',
  1404. smalltalk.method({
  1405. selector: '=',
  1406. fn: function (aCollection){
  1407. var self=this;
  1408. 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}})})();})]));
  1409. 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}})})();})]));})]);
  1410. (function(){throw({name: 'stReturn', selector: '__eq', fn: function(){return true}})})();
  1411. return self;
  1412. } catch(e) {if(e.name === 'stReturn' && e.selector === '__eq'){return e.fn()} throw(e)}}
  1413. }),
  1414. smalltalk.Array);
  1415. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
  1416. smalltalk.addMethod(
  1417. '_compile_',
  1418. smalltalk.method({
  1419. selector: 'compile:',
  1420. fn: function (aString){
  1421. var self=this;
  1422. return self.compile(aString);
  1423. return self;}
  1424. }),
  1425. smalltalk.RegularExpression);
  1426. smalltalk.addMethod(
  1427. '_exec_',
  1428. smalltalk.method({
  1429. selector: 'exec:',
  1430. fn: function (aString){
  1431. var self=this;
  1432. return self.exec(aString) || nil;
  1433. return self;}
  1434. }),
  1435. smalltalk.RegularExpression);
  1436. smalltalk.addMethod(
  1437. '_test_',
  1438. smalltalk.method({
  1439. selector: 'test:',
  1440. fn: function (aString){
  1441. var self=this;
  1442. return self.test(aString);
  1443. return self;}
  1444. }),
  1445. smalltalk.RegularExpression);
  1446. smalltalk.addMethod(
  1447. '_fromString_flag_',
  1448. smalltalk.method({
  1449. selector: 'fromString:flag:',
  1450. fn: function (aString, anotherString){
  1451. var self=this;
  1452. return new RegExp(aString, anotherString);
  1453. return self;}
  1454. }),
  1455. smalltalk.RegularExpression.klass);
  1456. smalltalk.addMethod(
  1457. '_fromString_',
  1458. smalltalk.method({
  1459. selector: 'fromString:',
  1460. fn: function (aString){
  1461. var self=this;
  1462. return smalltalk.send(self, "_fromString_flag_", [aString, ""]);
  1463. return self;}
  1464. }),
  1465. smalltalk.RegularExpression.klass);
  1466. smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel-Collections');
  1467. smalltalk.addMethod(
  1468. '__eq',
  1469. smalltalk.method({
  1470. selector: '=',
  1471. fn: function (anAssociation){
  1472. var self=this;
  1473. 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", [])]);})]);})]);
  1474. return self;}
  1475. }),
  1476. smalltalk.Association);
  1477. smalltalk.addMethod(
  1478. '_key_',
  1479. smalltalk.method({
  1480. selector: 'key:',
  1481. fn: function (aKey){
  1482. var self=this;
  1483. self['@key']=aKey;
  1484. return self;}
  1485. }),
  1486. smalltalk.Association);
  1487. smalltalk.addMethod(
  1488. '_key',
  1489. smalltalk.method({
  1490. selector: 'key',
  1491. fn: function (){
  1492. var self=this;
  1493. return self['@key'];
  1494. return self;}
  1495. }),
  1496. smalltalk.Association);
  1497. smalltalk.addMethod(
  1498. '_value_',
  1499. smalltalk.method({
  1500. selector: 'value:',
  1501. fn: function (aValue){
  1502. var self=this;
  1503. self['@value']=aValue;
  1504. return self;}
  1505. }),
  1506. smalltalk.Association);
  1507. smalltalk.addMethod(
  1508. '_value',
  1509. smalltalk.method({
  1510. selector: 'value',
  1511. fn: function (){
  1512. var self=this;
  1513. return self['@value'];
  1514. return self;}
  1515. }),
  1516. smalltalk.Association);
  1517. smalltalk.addMethod(
  1518. '_storeOn_',
  1519. smalltalk.method({
  1520. selector: 'storeOn:',
  1521. fn: function (aStream){
  1522. var self=this;
  1523. smalltalk.send(self['@key'], "_storeOn_", [aStream]);
  1524. smalltalk.send(aStream, "_nextPutAll_", [unescape("-%3E")]);
  1525. smalltalk.send(self['@value'], "_storeOn_", [aStream]);
  1526. return self;}
  1527. }),
  1528. smalltalk.Association);
  1529. smalltalk.addMethod(
  1530. '_key_value_',
  1531. smalltalk.method({
  1532. selector: 'key:value:',
  1533. fn: function (aKey, aValue){
  1534. var self=this;
  1535. return (function($rec){smalltalk.send($rec, "_key_", [aKey]);smalltalk.send($rec, "_value_", [aValue]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  1536. return self;}
  1537. }),
  1538. smalltalk.Association.klass);
  1539. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  1540. smalltalk.addMethod(
  1541. '_collection',
  1542. smalltalk.method({
  1543. selector: 'collection',
  1544. fn: function (){
  1545. var self=this;
  1546. return self['@collection'];
  1547. return self;}
  1548. }),
  1549. smalltalk.Stream);
  1550. smalltalk.addMethod(
  1551. '_setCollection_',
  1552. smalltalk.method({
  1553. selector: 'setCollection:',
  1554. fn: function (aCollection){
  1555. var self=this;
  1556. self['@collection']=aCollection;
  1557. return self;}
  1558. }),
  1559. smalltalk.Stream);
  1560. smalltalk.addMethod(
  1561. '_position',
  1562. smalltalk.method({
  1563. selector: 'position',
  1564. fn: function (){
  1565. var self=this;
  1566. return (($receiver = self['@position']) == nil || $receiver == undefined) ? (function(){return self['@position']=(0);})() : $receiver;
  1567. return self;}
  1568. }),
  1569. smalltalk.Stream);
  1570. smalltalk.addMethod(
  1571. '_position_',
  1572. smalltalk.method({
  1573. selector: 'position:',
  1574. fn: function (anInteger){
  1575. var self=this;
  1576. self['@position']=anInteger;
  1577. return self;}
  1578. }),
  1579. smalltalk.Stream);
  1580. smalltalk.addMethod(
  1581. '_streamSize',
  1582. smalltalk.method({
  1583. selector: 'streamSize',
  1584. fn: function (){
  1585. var self=this;
  1586. return self['@streamSize'];
  1587. return self;}
  1588. }),
  1589. smalltalk.Stream);
  1590. smalltalk.addMethod(
  1591. '_setStreamSize_',
  1592. smalltalk.method({
  1593. selector: 'setStreamSize:',
  1594. fn: function (anInteger){
  1595. var self=this;
  1596. self['@streamSize']=anInteger;
  1597. return self;}
  1598. }),
  1599. smalltalk.Stream);
  1600. smalltalk.addMethod(
  1601. '_contents',
  1602. smalltalk.method({
  1603. selector: 'contents',
  1604. fn: function (){
  1605. var self=this;
  1606. return smalltalk.send(smalltalk.send(self, "_collection", []), "_copyFrom_to_", [(1), smalltalk.send(self, "_streamSize", [])]);
  1607. return self;}
  1608. }),
  1609. smalltalk.Stream);
  1610. smalltalk.addMethod(
  1611. '_size',
  1612. smalltalk.method({
  1613. selector: 'size',
  1614. fn: function (){
  1615. var self=this;
  1616. return smalltalk.send(self, "_streamSize", []);
  1617. return self;}
  1618. }),
  1619. smalltalk.Stream);
  1620. smalltalk.addMethod(
  1621. '_reset',
  1622. smalltalk.method({
  1623. selector: 'reset',
  1624. fn: function (){
  1625. var self=this;
  1626. smalltalk.send(self, "_position_", [(0)]);
  1627. return self;}
  1628. }),
  1629. smalltalk.Stream);
  1630. smalltalk.addMethod(
  1631. '_close',
  1632. smalltalk.method({
  1633. selector: 'close',
  1634. fn: function (){
  1635. var self=this;
  1636. return self;}
  1637. }),
  1638. smalltalk.Stream);
  1639. smalltalk.addMethod(
  1640. '_flush',
  1641. smalltalk.method({
  1642. selector: 'flush',
  1643. fn: function (){
  1644. var self=this;
  1645. return self;}
  1646. }),
  1647. smalltalk.Stream);
  1648. smalltalk.addMethod(
  1649. '_resetContents',
  1650. smalltalk.method({
  1651. selector: 'resetContents',
  1652. fn: function (){
  1653. var self=this;
  1654. smalltalk.send(self, "_reset", []);
  1655. smalltalk.send(self, "_setStreamSize_", [(0)]);
  1656. return self;}
  1657. }),
  1658. smalltalk.Stream);
  1659. smalltalk.addMethod(
  1660. '_do_',
  1661. smalltalk.method({
  1662. selector: 'do:',
  1663. fn: function (aBlock){
  1664. var self=this;
  1665. (function(){while(!(function(){return smalltalk.send(self, "_atEnd", []);})()) {(function(){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_next", [])]);})()}})();
  1666. return self;}
  1667. }),
  1668. smalltalk.Stream);
  1669. smalltalk.addMethod(
  1670. '_setToEnd',
  1671. smalltalk.method({
  1672. selector: 'setToEnd',
  1673. fn: function (){
  1674. var self=this;
  1675. smalltalk.send(self, "_position_", [smalltalk.send(self, "_size", [])]);
  1676. return self;}
  1677. }),
  1678. smalltalk.Stream);
  1679. smalltalk.addMethod(
  1680. '_skip_',
  1681. smalltalk.method({
  1682. selector: 'skip:',
  1683. fn: function (anInteger){
  1684. var self=this;
  1685. 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)])]);
  1686. return self;}
  1687. }),
  1688. smalltalk.Stream);
  1689. smalltalk.addMethod(
  1690. '_next',
  1691. smalltalk.method({
  1692. selector: 'next',
  1693. fn: function (){
  1694. var self=this;
  1695. smalltalk.send(self, "_position_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);
  1696. return smalltalk.send(self['@collection'], "_at_", [smalltalk.send(self, "_position", [])]);
  1697. return self;}
  1698. }),
  1699. smalltalk.Stream);
  1700. smalltalk.addMethod(
  1701. '_next_',
  1702. smalltalk.method({
  1703. selector: 'next:',
  1704. fn: function (anInteger){
  1705. var self=this;
  1706. var tempCollection=nil;
  1707. tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_class", []), "_new", []);
  1708. 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", [])]);})]));})]);
  1709. return tempCollection;
  1710. return self;}
  1711. }),
  1712. smalltalk.Stream);
  1713. smalltalk.addMethod(
  1714. '_nextPut_',
  1715. smalltalk.method({
  1716. selector: 'nextPut:',
  1717. fn: function (anObject){
  1718. var self=this;
  1719. smalltalk.send(self, "_position_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);
  1720. smalltalk.send(smalltalk.send(self, "_collection", []), "_at_put_", [smalltalk.send(self, "_position", []), anObject]);
  1721. smalltalk.send(self, "_setStreamSize_", [smalltalk.send(smalltalk.send(self, "_streamSize", []), "_max_", [smalltalk.send(self, "_position", [])])]);
  1722. return self;}
  1723. }),
  1724. smalltalk.Stream);
  1725. smalltalk.addMethod(
  1726. '_nextPutAll_',
  1727. smalltalk.method({
  1728. selector: 'nextPutAll:',
  1729. fn: function (aCollection){
  1730. var self=this;
  1731. smalltalk.send(aCollection, "_do_", [(function(each){return smalltalk.send(self, "_nextPut_", [each]);})]);
  1732. return self;}
  1733. }),
  1734. smalltalk.Stream);
  1735. smalltalk.addMethod(
  1736. '_peek',
  1737. smalltalk.method({
  1738. selector: 'peek',
  1739. fn: function (){
  1740. var self=this;
  1741. 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)]))]);})]));
  1742. return self;}
  1743. }),
  1744. smalltalk.Stream);
  1745. smalltalk.addMethod(
  1746. '_atEnd',
  1747. smalltalk.method({
  1748. selector: 'atEnd',
  1749. fn: function (){
  1750. var self=this;
  1751. return smalltalk.send(smalltalk.send(self, "_position", []), "__eq", [smalltalk.send(self, "_size", [])]);
  1752. return self;}
  1753. }),
  1754. smalltalk.Stream);
  1755. smalltalk.addMethod(
  1756. '_atStart',
  1757. smalltalk.method({
  1758. selector: 'atStart',
  1759. fn: function (){
  1760. var self=this;
  1761. return smalltalk.send(smalltalk.send(self, "_position", []), "__eq", [(0)]);
  1762. return self;}
  1763. }),
  1764. smalltalk.Stream);
  1765. smalltalk.addMethod(
  1766. '_isEmpty',
  1767. smalltalk.method({
  1768. selector: 'isEmpty',
  1769. fn: function (){
  1770. var self=this;
  1771. return smalltalk.send(smalltalk.send(self, "_size", []), "__eq", [(0)]);
  1772. return self;}
  1773. }),
  1774. smalltalk.Stream);
  1775. smalltalk.addMethod(
  1776. '_on_',
  1777. smalltalk.method({
  1778. selector: 'on:',
  1779. fn: function (aCollection){
  1780. var self=this;
  1781. 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", []));
  1782. return self;}
  1783. }),
  1784. smalltalk.Stream.klass);
  1785. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections');
  1786. smalltalk.addMethod(
  1787. '_next_',
  1788. smalltalk.method({
  1789. selector: 'next:',
  1790. fn: function (anInteger){
  1791. var self=this;
  1792. var tempCollection=nil;
  1793. tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_class", []), "_new", []);
  1794. 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", [])]);})]));})]);
  1795. return tempCollection;
  1796. return self;}
  1797. }),
  1798. smalltalk.StringStream);
  1799. smalltalk.addMethod(
  1800. '_nextPut_',
  1801. smalltalk.method({
  1802. selector: 'nextPut:',
  1803. fn: function (aString){
  1804. var self=this;
  1805. smalltalk.send(self, "_nextPutAll_", [aString]);
  1806. return self;}
  1807. }),
  1808. smalltalk.StringStream);
  1809. smalltalk.addMethod(
  1810. '_nextPutAll_',
  1811. smalltalk.method({
  1812. selector: 'nextPutAll:',
  1813. fn: function (aString){
  1814. var self=this;
  1815. 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", [])])])]);
  1816. 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", [])]))]);
  1817. smalltalk.send(self, "_setStreamSize_", [smalltalk.send(smalltalk.send(self, "_streamSize", []), "_max_", [smalltalk.send(self, "_position", [])])]);
  1818. return self;}
  1819. }),
  1820. smalltalk.StringStream);
  1821. smalltalk.addMethod(
  1822. '_cr',
  1823. smalltalk.method({
  1824. selector: 'cr',
  1825. fn: function (){
  1826. var self=this;
  1827. return smalltalk.send(self, "_nextPutAll_", [smalltalk.send((smalltalk.String || String), "_cr", [])]);
  1828. return self;}
  1829. }),
  1830. smalltalk.StringStream);
  1831. smalltalk.addMethod(
  1832. '_crlf',
  1833. smalltalk.method({
  1834. selector: 'crlf',
  1835. fn: function (){
  1836. var self=this;
  1837. return smalltalk.send(self, "_nextPutAll_", [smalltalk.send((smalltalk.String || String), "_crlf", [])]);
  1838. return self;}
  1839. }),
  1840. smalltalk.StringStream);
  1841. smalltalk.addMethod(
  1842. '_lf',
  1843. smalltalk.method({
  1844. selector: 'lf',
  1845. fn: function (){
  1846. var self=this;
  1847. return smalltalk.send(self, "_nextPutAll_", [smalltalk.send((smalltalk.String || String), "_lf", [])]);
  1848. return self;}
  1849. }),
  1850. smalltalk.StringStream);
  1851. smalltalk.addMethod(
  1852. '_space',
  1853. smalltalk.method({
  1854. selector: 'space',
  1855. fn: function (){
  1856. var self=this;
  1857. smalltalk.send(self, "_nextPut_", [" "]);
  1858. return self;}
  1859. }),
  1860. smalltalk.StringStream);
  1861. smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections');
  1862. smalltalk.addMethod(
  1863. '_add_',
  1864. smalltalk.method({
  1865. selector: 'add:',
  1866. fn: function (anObject){
  1867. var self=this;
  1868. var found;
  1869. for(var i in self['@elements']) {
  1870. if(anObject == self['@elements'][i]) {
  1871. found = true;
  1872. break;
  1873. }
  1874. }
  1875. if(!found) {self['@elements'].push(anObject)}
  1876. ;
  1877. return self;}
  1878. }),
  1879. smalltalk.Set);
  1880. smalltalk.addMethod(
  1881. '_remove_',
  1882. smalltalk.method({
  1883. selector: 'remove:',
  1884. fn: function (anObject){
  1885. var self=this;
  1886. smalltalk.send(self['@elements'], "_remove_", [anObject]);
  1887. return self;}
  1888. }),
  1889. smalltalk.Set);
  1890. smalltalk.addMethod(
  1891. '_initialize',
  1892. smalltalk.method({
  1893. selector: 'initialize',
  1894. fn: function (){
  1895. var self=this;
  1896. smalltalk.send(self, "_initialize", [], smalltalk.Collection);
  1897. self['@elements']=[];
  1898. return self;}
  1899. }),
  1900. smalltalk.Set);
  1901. smalltalk.addMethod(
  1902. '_size',
  1903. smalltalk.method({
  1904. selector: 'size',
  1905. fn: function (){
  1906. var self=this;
  1907. return smalltalk.send(self['@elements'], "_size", []);
  1908. return self;}
  1909. }),
  1910. smalltalk.Set);
  1911. smalltalk.addMethod(
  1912. '_asArray',
  1913. smalltalk.method({
  1914. selector: 'asArray',
  1915. fn: function (){
  1916. var self=this;
  1917. return smalltalk.send(self['@elements'], "_copy", []);
  1918. return self;}
  1919. }),
  1920. smalltalk.Set);
  1921. smalltalk.addMethod(
  1922. '_detect_ifNone_',
  1923. smalltalk.method({
  1924. selector: 'detect:ifNone:',
  1925. fn: function (aBlock, anotherBlock){
  1926. var self=this;
  1927. return smalltalk.send(self['@elements'], "_detect_ifNone_", [aBlock, anotherBlock]);
  1928. return self;}
  1929. }),
  1930. smalltalk.Set);
  1931. smalltalk.addMethod(
  1932. '_do_',
  1933. smalltalk.method({
  1934. selector: 'do:',
  1935. fn: function (aBlock){
  1936. var self=this;
  1937. smalltalk.send(self['@elements'], "_do_", [aBlock]);
  1938. return self;}
  1939. }),
  1940. smalltalk.Set);
  1941. smalltalk.addMethod(
  1942. '_includes_',
  1943. smalltalk.method({
  1944. selector: 'includes:',
  1945. fn: function (anObject){
  1946. var self=this;
  1947. return smalltalk.send(self['@elements'], "_includes_", [anObject]);
  1948. return self;}
  1949. }),
  1950. smalltalk.Set);
  1951. smalltalk.addMethod(
  1952. '__eq',
  1953. smalltalk.method({
  1954. selector: '=',
  1955. fn: function (aCollection){
  1956. var self=this;
  1957. 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", [])]);})]);
  1958. return self;}
  1959. }),
  1960. smalltalk.Set);
  1961. smalltalk.addClass('HashedCollection', smalltalk.Collection, [], 'Kernel-Collections');
  1962. smalltalk.addMethod(
  1963. '_size',
  1964. smalltalk.method({
  1965. selector: 'size',
  1966. fn: function (){
  1967. var self=this;
  1968. return smalltalk.send(smalltalk.send(self, "_keys", []), "_size", []);
  1969. return self;}
  1970. }),
  1971. smalltalk.HashedCollection);
  1972. smalltalk.addMethod(
  1973. '_associations',
  1974. smalltalk.method({
  1975. selector: 'associations',
  1976. fn: function (){
  1977. var self=this;
  1978. var associations=nil;
  1979. associations=[];
  1980. 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])])]);})]);
  1981. return associations;
  1982. return self;}
  1983. }),
  1984. smalltalk.HashedCollection);
  1985. smalltalk.addMethod(
  1986. '_keys',
  1987. smalltalk.method({
  1988. selector: 'keys',
  1989. fn: function (){
  1990. var self=this;
  1991. var keys = [];
  1992. for(var i in self) {
  1993. if(self.hasOwnProperty(i)) {
  1994. keys.push(i);
  1995. }
  1996. };
  1997. return keys;
  1998. ;
  1999. return self;}
  2000. }),
  2001. smalltalk.HashedCollection);
  2002. smalltalk.addMethod(
  2003. '_values',
  2004. smalltalk.method({
  2005. selector: 'values',
  2006. fn: function (){
  2007. var self=this;
  2008. return smalltalk.send(smalltalk.send(self, "_keys", []), "_collect_", [(function(each){return smalltalk.send(self, "_at_", [each]);})]);
  2009. return self;}
  2010. }),
  2011. smalltalk.HashedCollection);
  2012. smalltalk.addMethod(
  2013. '_at_put_',
  2014. smalltalk.method({
  2015. selector: 'at:put:',
  2016. fn: function (aKey, aValue){
  2017. var self=this;
  2018. return smalltalk.send(self, "_basicAt_put_", [aKey, aValue]);
  2019. return self;}
  2020. }),
  2021. smalltalk.HashedCollection);
  2022. smalltalk.addMethod(
  2023. '_at_ifAbsent_',
  2024. smalltalk.method({
  2025. selector: 'at:ifAbsent:',
  2026. fn: function (aKey, aBlock){
  2027. var self=this;
  2028. return smalltalk.send(smalltalk.send(self, "_includesKey_", [aKey]), "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self, "_basicAt_", [aKey]);}), aBlock]);
  2029. return self;}
  2030. }),
  2031. smalltalk.HashedCollection);
  2032. smalltalk.addMethod(
  2033. '_at_ifAbsentPut_',
  2034. smalltalk.method({
  2035. selector: 'at:ifAbsentPut:',
  2036. fn: function (aKey, aBlock){
  2037. var self=this;
  2038. return smalltalk.send(self, "_at_ifAbsent_", [aKey, (function(){return smalltalk.send(self, "_at_put_", [aKey, smalltalk.send(aBlock, "_value", [])]);})]);
  2039. return self;}
  2040. }),
  2041. smalltalk.HashedCollection);
  2042. smalltalk.addMethod(
  2043. '_at_ifPresent_',
  2044. smalltalk.method({
  2045. selector: 'at:ifPresent:',
  2046. fn: function (aKey, aBlock){
  2047. var self=this;
  2048. return (($receiver = smalltalk.send(self, "_basicAt_", [aKey])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_at_", [aKey])]);})() : nil;
  2049. return self;}
  2050. }),
  2051. smalltalk.HashedCollection);
  2052. smalltalk.addMethod(
  2053. '_at_ifPresent_ifAbsent_',
  2054. smalltalk.method({
  2055. selector: 'at:ifPresent:ifAbsent:',
  2056. fn: function (aKey, aBlock, anotherBlock){
  2057. var self=this;
  2058. return smalltalk.send(smalltalk.send(self, "_basicAt_", [aKey]), "_ifNil_ifNotNil_", [anotherBlock, (function(){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_at_", [aKey])]);})]);
  2059. return self;}
  2060. }),
  2061. smalltalk.HashedCollection);
  2062. smalltalk.addMethod(
  2063. '_at_',
  2064. smalltalk.method({
  2065. selector: 'at:',
  2066. fn: function (aKey){
  2067. var self=this;
  2068. return smalltalk.send(self, "_at_ifAbsent_", [aKey, (function(){return smalltalk.send(self, "_errorNotFound", []);})]);
  2069. return self;}
  2070. }),
  2071. smalltalk.HashedCollection);
  2072. smalltalk.addMethod(
  2073. '_add_',
  2074. smalltalk.method({
  2075. selector: 'add:',
  2076. fn: function (anAssociation){
  2077. var self=this;
  2078. smalltalk.send(self, "_at_put_", [smalltalk.send(anAssociation, "_key", []), smalltalk.send(anAssociation, "_value", [])]);
  2079. return self;}
  2080. }),
  2081. smalltalk.HashedCollection);
  2082. smalltalk.addMethod(
  2083. '_addAll_',
  2084. smalltalk.method({
  2085. selector: 'addAll:',
  2086. fn: function (aHashedCollection){
  2087. var self=this;
  2088. smalltalk.send(self, "_addAll_", [smalltalk.send(aHashedCollection, "_associations", [])], smalltalk.Collection);
  2089. return aHashedCollection;
  2090. return self;}
  2091. }),
  2092. smalltalk.HashedCollection);
  2093. smalltalk.addMethod(
  2094. '_removeKey_',
  2095. smalltalk.method({
  2096. selector: 'removeKey:',
  2097. fn: function (aKey){
  2098. var self=this;
  2099. smalltalk.send(self, "_remove_", [aKey]);
  2100. return self;}
  2101. }),
  2102. smalltalk.HashedCollection);
  2103. smalltalk.addMethod(
  2104. '_remove_ifAbsent_',
  2105. smalltalk.method({
  2106. selector: 'remove:ifAbsent:',
  2107. fn: function (aKey, aBlock){
  2108. var self=this;
  2109. return smalltalk.send(self, "_removeKey_ifAbsent_", [aKey, aBlock]);
  2110. return self;}
  2111. }),
  2112. smalltalk.HashedCollection);
  2113. smalltalk.addMethod(
  2114. '_removeKey_ifAbsent_',
  2115. smalltalk.method({
  2116. selector: 'removeKey:ifAbsent:',
  2117. fn: function (aKey, aBlock){
  2118. var self=this;
  2119. 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]);})]));
  2120. return self;}
  2121. }),
  2122. smalltalk.HashedCollection);
  2123. smalltalk.addMethod(
  2124. '__eq',
  2125. smalltalk.method({
  2126. selector: '=',
  2127. fn: function (aHashedCollection){
  2128. var self=this;
  2129. 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}})})();})]));
  2130. ((($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}})})();})]));
  2131. (function(){throw({name: 'stReturn', selector: '__eq', fn: function(){return smalltalk.send(smalltalk.send(self, "_associations", []), "__eq", [smalltalk.send(aHashedCollection, "_associations", [])])}})})();
  2132. return self;
  2133. } catch(e) {if(e.name === 'stReturn' && e.selector === '__eq'){return e.fn()} throw(e)}}
  2134. }),
  2135. smalltalk.HashedCollection);
  2136. smalltalk.addMethod(
  2137. '_shallowCopy',
  2138. smalltalk.method({
  2139. selector: 'shallowCopy',
  2140. fn: function (){
  2141. var self=this;
  2142. var copy=nil;
  2143. copy=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []);
  2144. smalltalk.send(self, "_associationsDo_", [(function(each){return smalltalk.send(copy, "_at_put_", [smalltalk.send(each, "_key", []), smalltalk.send(each, "_value", [])]);})]);
  2145. return copy;
  2146. return self;}
  2147. }),
  2148. smalltalk.HashedCollection);
  2149. smalltalk.addMethod(
  2150. '__comma',
  2151. smalltalk.method({
  2152. selector: ',',
  2153. fn: function (aCollection){
  2154. var self=this;
  2155. smalltalk.send(self, "_shouldNotImplement", []);
  2156. return self;}
  2157. }),
  2158. smalltalk.HashedCollection);
  2159. smalltalk.addMethod(
  2160. '_copyFrom_to_',
  2161. smalltalk.method({
  2162. selector: 'copyFrom:to:',
  2163. fn: function (anIndex, anotherIndex){
  2164. var self=this;
  2165. smalltalk.send(self, "_shouldNotImplement", []);
  2166. return self;}
  2167. }),
  2168. smalltalk.HashedCollection);
  2169. smalltalk.addMethod(
  2170. '_deepCopy',
  2171. smalltalk.method({
  2172. selector: 'deepCopy',
  2173. fn: function (){
  2174. var self=this;
  2175. var copy=nil;
  2176. copy=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []);
  2177. smalltalk.send(self, "_associationsDo_", [(function(each){return smalltalk.send(copy, "_at_put_", [smalltalk.send(each, "_key", []), smalltalk.send(smalltalk.send(each, "_value", []), "_deepCopy", [])]);})]);
  2178. return copy;
  2179. return self;}
  2180. }),
  2181. smalltalk.HashedCollection);
  2182. smalltalk.addMethod(
  2183. '_associationsDo_',
  2184. smalltalk.method({
  2185. selector: 'associationsDo:',
  2186. fn: function (aBlock){
  2187. var self=this;
  2188. smalltalk.send(smalltalk.send(self, "_associations", []), "_do_", [aBlock]);
  2189. return self;}
  2190. }),
  2191. smalltalk.HashedCollection);
  2192. smalltalk.addMethod(
  2193. '_keysAndValuesDo_',
  2194. smalltalk.method({
  2195. selector: 'keysAndValuesDo:',
  2196. fn: function (aBlock){
  2197. var self=this;
  2198. smalltalk.send(self, "_associationsDo_", [(function(each){return smalltalk.send(aBlock, "_value_value_", [smalltalk.send(each, "_key", []), smalltalk.send(each, "_value", [])]);})]);
  2199. return self;}
  2200. }),
  2201. smalltalk.HashedCollection);
  2202. smalltalk.addMethod(
  2203. '_do_',
  2204. smalltalk.method({
  2205. selector: 'do:',
  2206. fn: function (aBlock){
  2207. var self=this;
  2208. smalltalk.send(smalltalk.send(self, "_values", []), "_do_", [aBlock]);
  2209. return self;}
  2210. }),
  2211. smalltalk.HashedCollection);
  2212. smalltalk.addMethod(
  2213. '_select_',
  2214. smalltalk.method({
  2215. selector: 'select:',
  2216. fn: function (aBlock){
  2217. var self=this;
  2218. var newDict=nil;
  2219. newDict=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []);
  2220. 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]);})]));})]);
  2221. return newDict;
  2222. return self;}
  2223. }),
  2224. smalltalk.HashedCollection);
  2225. smalltalk.addMethod(
  2226. '_collect_',
  2227. smalltalk.method({
  2228. selector: 'collect:',
  2229. fn: function (aBlock){
  2230. var self=this;
  2231. var newDict=nil;
  2232. newDict=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []);
  2233. smalltalk.send(self, "_keysAndValuesDo_", [(function(key, value){return smalltalk.send(newDict, "_at_put_", [key, smalltalk.send(aBlock, "_value_", [value])]);})]);
  2234. return newDict;
  2235. return self;}
  2236. }),
  2237. smalltalk.HashedCollection);
  2238. smalltalk.addMethod(
  2239. '_detect_ifNone_',
  2240. smalltalk.method({
  2241. selector: 'detect:ifNone:',
  2242. fn: function (aBlock, anotherBlock){
  2243. var self=this;
  2244. return smalltalk.send(smalltalk.send(self, "_values", []), "_detect_ifNone_", [aBlock, anotherBlock]);
  2245. return self;}
  2246. }),
  2247. smalltalk.HashedCollection);
  2248. smalltalk.addMethod(
  2249. '_includes_',
  2250. smalltalk.method({
  2251. selector: 'includes:',
  2252. fn: function (anObject){
  2253. var self=this;
  2254. return smalltalk.send(smalltalk.send(self, "_values", []), "_includes_", [anObject]);
  2255. return self;}
  2256. }),
  2257. smalltalk.HashedCollection);
  2258. smalltalk.addMethod(
  2259. '_printString',
  2260. smalltalk.method({
  2261. selector: 'printString',
  2262. fn: function (){
  2263. var self=this;
  2264. 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")]);})]);
  2265. return self;}
  2266. }),
  2267. smalltalk.HashedCollection);
  2268. smalltalk.addMethod(
  2269. '_storeOn_',
  2270. smalltalk.method({
  2271. selector: 'storeOn:',
  2272. fn: function (aStream){
  2273. var self=this;
  2274. smalltalk.send(aStream, "_nextPutAll_", [unescape("%23%7B")]);
  2275. smalltalk.send(smalltalk.send(self, "_associations", []), "_do_separatedBy_", [(function(each){return smalltalk.send(each, "_storeOn_", [aStream]);}), (function(){return smalltalk.send(aStream, "_nextPutAll_", [". "]);})]);
  2276. smalltalk.send(aStream, "_nextPutAll_", [unescape("%7D")]);
  2277. return self;}
  2278. }),
  2279. smalltalk.HashedCollection);
  2280. smalltalk.addMethod(
  2281. '_includesKey_',
  2282. smalltalk.method({
  2283. selector: 'includesKey:',
  2284. fn: function (aKey){
  2285. var self=this;
  2286. return self.hasOwnProperty(aKey);
  2287. return self;}
  2288. }),
  2289. smalltalk.HashedCollection);
  2290. smalltalk.addMethod(
  2291. '_asDictionary',
  2292. smalltalk.method({
  2293. selector: 'asDictionary',
  2294. fn: function (){
  2295. var self=this;
  2296. return smalltalk.send((smalltalk.Dictionary || Dictionary), "_fromPairs_", [smalltalk.send(self, "_associations", [])]);
  2297. return self;}
  2298. }),
  2299. smalltalk.HashedCollection);
  2300. smalltalk.addMethod(
  2301. '_fromPairs_',
  2302. smalltalk.method({
  2303. selector: 'fromPairs:',
  2304. fn: function (aCollection){
  2305. var self=this;
  2306. var dict=nil;
  2307. dict=smalltalk.send(self, "_new", []);
  2308. smalltalk.send(aCollection, "_do_", [(function(each){return smalltalk.send(dict, "_add_", [each]);})]);
  2309. return dict;
  2310. return self;}
  2311. }),
  2312. smalltalk.HashedCollection.klass);
  2313. smalltalk.addClass('Dictionary', smalltalk.HashedCollection, ['keys', 'values'], 'Kernel-Collections');
  2314. smalltalk.addMethod(
  2315. '_at_ifAbsent_',
  2316. smalltalk.method({
  2317. selector: 'at:ifAbsent:',
  2318. fn: function (aKey, aBlock){
  2319. var self=this;
  2320. var index = self['@keys'].indexOf(aKey);
  2321. if(index === -1) {
  2322. return aBlock();
  2323. } else {
  2324. return self['@values'][index];
  2325. }
  2326. ;
  2327. return self;}
  2328. }),
  2329. smalltalk.Dictionary);
  2330. smalltalk.addMethod(
  2331. '_keys',
  2332. smalltalk.method({
  2333. selector: 'keys',
  2334. fn: function (){
  2335. var self=this;
  2336. return smalltalk.send(self['@keys'], "_copy", []);
  2337. return self;}
  2338. }),
  2339. smalltalk.Dictionary);
  2340. smalltalk.addMethod(
  2341. '_values',
  2342. smalltalk.method({
  2343. selector: 'values',
  2344. fn: function (){
  2345. var self=this;
  2346. return smalltalk.send(self['@values'], "_copy", []);
  2347. return self;}
  2348. }),
  2349. smalltalk.Dictionary);
  2350. smalltalk.addMethod(
  2351. '_at_put_',
  2352. smalltalk.method({
  2353. selector: 'at:put:',
  2354. fn: function (aKey, aValue){
  2355. var self=this;
  2356. var index = self['@keys'].indexOf(aKey);
  2357. if(index === -1) {
  2358. self['@values'].push(aValue);
  2359. self['@keys'].push(aKey);
  2360. } else {
  2361. self['@values'][index] = aValue;
  2362. };
  2363. return aValue;
  2364. ;
  2365. return self;}
  2366. }),
  2367. smalltalk.Dictionary);
  2368. smalltalk.addMethod(
  2369. '_removeKey_ifAbsent_',
  2370. smalltalk.method({
  2371. selector: 'removeKey:ifAbsent:',
  2372. fn: function (aKey, aBlock){
  2373. var self=this;
  2374. var index = self['@keys'].indexOf(aKey);
  2375. if(index === -1) {
  2376. return aBlock()
  2377. } else {
  2378. self['@keys'].splice(i, 1);
  2379. self['@values'].splice(i, 1);
  2380. return aKey
  2381. };
  2382. ;
  2383. return self;}
  2384. }),
  2385. smalltalk.Dictionary);
  2386. smalltalk.addMethod(
  2387. '_initialize',
  2388. smalltalk.method({
  2389. selector: 'initialize',
  2390. fn: function (){
  2391. var self=this;
  2392. smalltalk.send(self, "_initialize", [], smalltalk.HashedCollection);
  2393. self['@keys']=[];
  2394. self['@values']=[];
  2395. return self;}
  2396. }),
  2397. smalltalk.Dictionary);
  2398. smalltalk.addMethod(
  2399. '_includesKey_',
  2400. smalltalk.method({
  2401. selector: 'includesKey:',
  2402. fn: function (aKey){
  2403. var self=this;
  2404. return smalltalk.send(self['@keys'], "_includes_", [aKey]);
  2405. return self;}
  2406. }),
  2407. smalltalk.Dictionary);
  2408. smalltalk.addMethod(
  2409. '_asHashedCollection',
  2410. smalltalk.method({
  2411. selector: 'asHashedCollection',
  2412. fn: function (){
  2413. var self=this;
  2414. return smalltalk.send((smalltalk.HashedCollection || HashedCollection), "_fromPairs_", [smalltalk.send(self, "_associations", [])]);
  2415. return self;}
  2416. }),
  2417. smalltalk.Dictionary);
  2418. smalltalk.addMethod(
  2419. '_asJSONString',
  2420. smalltalk.method({
  2421. selector: 'asJSONString',
  2422. fn: function (){
  2423. var self=this;
  2424. return smalltalk.send(smalltalk.send(self, "_asHashedCollection", []), "_asJSONString", []);
  2425. return self;}
  2426. }),
  2427. smalltalk.Dictionary);