Kernel-Collections.deploy.js 86 KB

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