1
0

Kernel-Collections.deploy.js 84 KB

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