Kernel-Collections.deploy.js 83 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138
  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, "_basicAt_", [aKey])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_at_", [aKey])]);})() : 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, "_basicAt_", [aKey]), "_ifNil_ifNotNil_", [anotherBlock, (function(){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_at_", [aKey])]);})]);
  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. var str=nil;
  1174. (str=smalltalk.send("", "_writeStream", []));
  1175. smalltalk.send(str, "_nextPutAll_", [smalltalk.send(smalltalk.send(self, "_printString", [], smalltalk.SequenceableCollection.superclass || nil), "__comma", [" ("])]);
  1176. smalltalk.send(self, "_do_separatedBy_", [(function(each){return smalltalk.send(str, "_nextPutAll_", [smalltalk.send(each, "_printString", [])]);}), (function(){return smalltalk.send(str, "_nextPutAll_", [" "]);})]);
  1177. smalltalk.send(str, "_nextPutAll_", [")"]);
  1178. return smalltalk.send(str, "_contents", []);
  1179. return self;}
  1180. }),
  1181. smalltalk.SequenceableCollection);
  1182. smalltalk.addMethod(
  1183. "_removeLast",
  1184. smalltalk.method({
  1185. selector: "removeLast",
  1186. fn: function () {
  1187. var self=this;
  1188. smalltalk.send(self, "_remove_", [smalltalk.send(self, "_last", [])]);
  1189. return self;}
  1190. }),
  1191. smalltalk.SequenceableCollection);
  1192. smalltalk.addMethod(
  1193. "_reversed",
  1194. smalltalk.method({
  1195. selector: "reversed",
  1196. fn: function () {
  1197. var self=this;
  1198. smalltalk.send(self, "_subclassResponsibility", []);
  1199. return self;}
  1200. }),
  1201. smalltalk.SequenceableCollection);
  1202. smalltalk.addMethod(
  1203. "_second",
  1204. smalltalk.method({
  1205. selector: "second",
  1206. fn: function () {
  1207. var self=this;
  1208. return smalltalk.send(self, "_at_", [(2)]);
  1209. return self;}
  1210. }),
  1211. smalltalk.SequenceableCollection);
  1212. smalltalk.addMethod(
  1213. "_shallowCopy",
  1214. smalltalk.method({
  1215. selector: "shallowCopy",
  1216. fn: function () {
  1217. var self=this;
  1218. var newCollection=nil;
  1219. (newCollection=smalltalk.send(smalltalk.send(self, "_class", []), "_new_", [smalltalk.send(self, "_size", [])]));
  1220. smalltalk.send(self, "_withIndexDo_", [(function(each, index){return smalltalk.send(newCollection, "_at_put_", [index, each]);})]);
  1221. return newCollection;
  1222. return self;}
  1223. }),
  1224. smalltalk.SequenceableCollection);
  1225. smalltalk.addMethod(
  1226. "_third",
  1227. smalltalk.method({
  1228. selector: "third",
  1229. fn: function () {
  1230. var self=this;
  1231. return smalltalk.send(self, "_at_", [(3)]);
  1232. return self;}
  1233. }),
  1234. smalltalk.SequenceableCollection);
  1235. smalltalk.addMethod(
  1236. "_withIndexDo_",
  1237. smalltalk.method({
  1238. selector: "withIndexDo:",
  1239. fn: function (aBlock) {
  1240. var self=this;
  1241. for(var i=0;i<self.length;i++){aBlock(self[i], i+1);};
  1242. return self;}
  1243. }),
  1244. smalltalk.SequenceableCollection);
  1245. smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  1246. smalltalk.addMethod(
  1247. "_add_",
  1248. smalltalk.method({
  1249. selector: "add:",
  1250. fn: function (anObject) {
  1251. var self=this;
  1252. self.push(anObject); return anObject;;
  1253. return self;}
  1254. }),
  1255. smalltalk.Array);
  1256. smalltalk.addMethod(
  1257. "_asJavascript",
  1258. smalltalk.method({
  1259. selector: "asJavascript",
  1260. fn: function () {
  1261. var self=this;
  1262. return smalltalk.send(smalltalk.send("[", "__comma", [smalltalk.send(smalltalk.send(self, "_collect_", [(function(each){return smalltalk.send(each, "_asJavascript", []);})]), "_join_", [", "])]), "__comma", ["]"]);
  1263. return self;}
  1264. }),
  1265. smalltalk.Array);
  1266. smalltalk.addMethod(
  1267. "_at_ifAbsent_",
  1268. smalltalk.method({
  1269. selector: "at:ifAbsent:",
  1270. fn: function (anIndex, aBlock) {
  1271. var self=this;
  1272. if((anIndex < 1) || (self.length < anIndex)) {return aBlock()};
  1273. return self[anIndex - 1];
  1274. ;
  1275. return self;}
  1276. }),
  1277. smalltalk.Array);
  1278. smalltalk.addMethod(
  1279. "_at_put_",
  1280. smalltalk.method({
  1281. selector: "at:put:",
  1282. fn: function (anIndex, anObject) {
  1283. var self=this;
  1284. return self[anIndex - 1] = anObject;
  1285. return self;}
  1286. }),
  1287. smalltalk.Array);
  1288. smalltalk.addMethod(
  1289. "_join_",
  1290. smalltalk.method({
  1291. selector: "join:",
  1292. fn: function (aString) {
  1293. var self=this;
  1294. return self.join(aString);
  1295. return self;}
  1296. }),
  1297. smalltalk.Array);
  1298. smalltalk.addMethod(
  1299. "_remove_",
  1300. smalltalk.method({
  1301. selector: "remove:",
  1302. fn: function (anObject) {
  1303. var self=this;
  1304. for(var i=0;i<self.length;i++) {
  1305. if(self[i] == anObject) {
  1306. self.splice(i,1);
  1307. break;
  1308. }
  1309. }
  1310. ;
  1311. return self;}
  1312. }),
  1313. smalltalk.Array);
  1314. smalltalk.addMethod(
  1315. "_removeFrom_to_",
  1316. smalltalk.method({
  1317. selector: "removeFrom:to:",
  1318. fn: function (aNumber, anotherNumber) {
  1319. var self=this;
  1320. self.splice(aNumber - 1,anotherNumber - 1);
  1321. return self;}
  1322. }),
  1323. smalltalk.Array);
  1324. smalltalk.addMethod(
  1325. "_reversed",
  1326. smalltalk.method({
  1327. selector: "reversed",
  1328. fn: function () {
  1329. var self=this;
  1330. return self._copy().reverse();
  1331. return self;}
  1332. }),
  1333. smalltalk.Array);
  1334. smalltalk.addMethod(
  1335. "_size",
  1336. smalltalk.method({
  1337. selector: "size",
  1338. fn: function () {
  1339. var self=this;
  1340. return self.length;
  1341. return self;}
  1342. }),
  1343. smalltalk.Array);
  1344. smalltalk.addMethod(
  1345. "_sort",
  1346. smalltalk.method({
  1347. selector: "sort",
  1348. fn: function () {
  1349. var self=this;
  1350. return smalltalk.send(self, "_basicPerform_", ["sort"]);
  1351. return self;}
  1352. }),
  1353. smalltalk.Array);
  1354. smalltalk.addMethod(
  1355. "_sort_",
  1356. smalltalk.method({
  1357. selector: "sort:",
  1358. fn: function (aBlock) {
  1359. var self=this;
  1360. return self.sort(function(a, b) {
  1361. if(aBlock(a,b)) {return -1} else {return 1}
  1362. })
  1363. ;
  1364. return self;}
  1365. }),
  1366. smalltalk.Array);
  1367. smalltalk.addMethod(
  1368. "_sorted",
  1369. smalltalk.method({
  1370. selector: "sorted",
  1371. fn: function () {
  1372. var self=this;
  1373. return smalltalk.send(smalltalk.send(self, "_copy", []), "_sort", []);
  1374. return self;}
  1375. }),
  1376. smalltalk.Array);
  1377. smalltalk.addMethod(
  1378. "_sorted_",
  1379. smalltalk.method({
  1380. selector: "sorted:",
  1381. fn: function (aBlock) {
  1382. var self=this;
  1383. return smalltalk.send(smalltalk.send(self, "_copy", []), "_sort_", [aBlock]);
  1384. return self;}
  1385. }),
  1386. smalltalk.Array);
  1387. smalltalk.addMethod(
  1388. "_new_",
  1389. smalltalk.method({
  1390. selector: "new:",
  1391. fn: function (anInteger) {
  1392. var self=this;
  1393. return new Array(anInteger);
  1394. return self;}
  1395. }),
  1396. smalltalk.Array.klass);
  1397. smalltalk.addMethod(
  1398. "_with_",
  1399. smalltalk.method({
  1400. selector: "with:",
  1401. fn: function (anObject) {
  1402. var self=this;
  1403. return (function($rec){smalltalk.send($rec, "_at_put_", [(1), anObject]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new_", [(1)]));
  1404. return self;}
  1405. }),
  1406. smalltalk.Array.klass);
  1407. smalltalk.addMethod(
  1408. "_with_with_",
  1409. smalltalk.method({
  1410. selector: "with:with:",
  1411. fn: function (anObject, anObject2) {
  1412. var self=this;
  1413. 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)]));
  1414. return self;}
  1415. }),
  1416. smalltalk.Array.klass);
  1417. smalltalk.addMethod(
  1418. "_with_with_with_",
  1419. smalltalk.method({
  1420. selector: "with:with:with:",
  1421. fn: function (anObject, anObject2, anObject3) {
  1422. var self=this;
  1423. 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)]));
  1424. return self;}
  1425. }),
  1426. smalltalk.Array.klass);
  1427. smalltalk.addMethod(
  1428. "_withAll_",
  1429. smalltalk.method({
  1430. selector: "withAll:",
  1431. fn: function (aCollection) {
  1432. var self=this;
  1433. var instance=nil;
  1434. (instance=smalltalk.send(self, "_new_", [smalltalk.send(aCollection, "_size", [])]));
  1435. smalltalk.send(aCollection, "_withIndexDo_", [(function(each, index){return smalltalk.send(instance, "_at_put_", [index, each]);})]);
  1436. return instance;
  1437. return self;}
  1438. }),
  1439. smalltalk.Array.klass);
  1440. smalltalk.addClass('CharacterArray', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  1441. smalltalk.addMethod(
  1442. "__comma",
  1443. smalltalk.method({
  1444. selector: ",",
  1445. fn: function (aString) {
  1446. var self=this;
  1447. return smalltalk.send(smalltalk.send(self, "_asString", []), "__comma", [smalltalk.send(aString, "_asString", [])]);
  1448. return self;}
  1449. }),
  1450. smalltalk.CharacterArray);
  1451. smalltalk.addMethod(
  1452. "_add_",
  1453. smalltalk.method({
  1454. selector: "add:",
  1455. fn: function (anObject) {
  1456. var self=this;
  1457. smalltalk.send(self, "_errorReadOnly", []);
  1458. return self;}
  1459. }),
  1460. smalltalk.CharacterArray);
  1461. smalltalk.addMethod(
  1462. "_asLowercase",
  1463. smalltalk.method({
  1464. selector: "asLowercase",
  1465. fn: function () {
  1466. var self=this;
  1467. return smalltalk.send(smalltalk.send(self, "_class", []), "_fromString_", [smalltalk.send(smalltalk.send(self, "_asString", []), "_asLowercase", [])]);
  1468. return self;}
  1469. }),
  1470. smalltalk.CharacterArray);
  1471. smalltalk.addMethod(
  1472. "_asNumber",
  1473. smalltalk.method({
  1474. selector: "asNumber",
  1475. fn: function () {
  1476. var self=this;
  1477. return smalltalk.send(smalltalk.send(self, "_asString", []), "_asNumber", []);
  1478. return self;}
  1479. }),
  1480. smalltalk.CharacterArray);
  1481. smalltalk.addMethod(
  1482. "_asString",
  1483. smalltalk.method({
  1484. selector: "asString",
  1485. fn: function () {
  1486. var self=this;
  1487. return smalltalk.send(self, "_subclassResponsibility", []);
  1488. return self;}
  1489. }),
  1490. smalltalk.CharacterArray);
  1491. smalltalk.addMethod(
  1492. "_asSymbol",
  1493. smalltalk.method({
  1494. selector: "asSymbol",
  1495. fn: function () {
  1496. var self=this;
  1497. return smalltalk.send(self, "_subclassResponsibility", []);
  1498. return self;}
  1499. }),
  1500. smalltalk.CharacterArray);
  1501. smalltalk.addMethod(
  1502. "_asUppercase",
  1503. smalltalk.method({
  1504. selector: "asUppercase",
  1505. fn: function () {
  1506. var self=this;
  1507. return smalltalk.send(smalltalk.send(self, "_class", []), "_fromString_", [smalltalk.send(smalltalk.send(self, "_asString", []), "_asUppercase", [])]);
  1508. return self;}
  1509. }),
  1510. smalltalk.CharacterArray);
  1511. smalltalk.addMethod(
  1512. "_at_put_",
  1513. smalltalk.method({
  1514. selector: "at:put:",
  1515. fn: function (anIndex, anObject) {
  1516. var self=this;
  1517. smalltalk.send(self, "_errorReadOnly", []);
  1518. return self;}
  1519. }),
  1520. smalltalk.CharacterArray);
  1521. smalltalk.addMethod(
  1522. "_errorReadOnly",
  1523. smalltalk.method({
  1524. selector: "errorReadOnly",
  1525. fn: function () {
  1526. var self=this;
  1527. smalltalk.send(self, "_error_", ["Object is read-only"]);
  1528. return self;}
  1529. }),
  1530. smalltalk.CharacterArray);
  1531. smalltalk.addMethod(
  1532. "_printString",
  1533. smalltalk.method({
  1534. selector: "printString",
  1535. fn: function () {
  1536. var self=this;
  1537. return smalltalk.send(smalltalk.send(self, "_asString", []), "_printString", []);
  1538. return self;}
  1539. }),
  1540. smalltalk.CharacterArray);
  1541. smalltalk.addMethod(
  1542. "_remove_",
  1543. smalltalk.method({
  1544. selector: "remove:",
  1545. fn: function (anObject) {
  1546. var self=this;
  1547. smalltalk.send(self, "_errorReadOnly", []);
  1548. return self;}
  1549. }),
  1550. smalltalk.CharacterArray);
  1551. smalltalk.addMethod(
  1552. "_fromString_",
  1553. smalltalk.method({
  1554. selector: "fromString:",
  1555. fn: function (aString) {
  1556. var self=this;
  1557. smalltalk.send(self, "_subclassResponsibility", []);
  1558. return self;}
  1559. }),
  1560. smalltalk.CharacterArray.klass);
  1561. smalltalk.addClass('String', smalltalk.CharacterArray, [], 'Kernel-Collections');
  1562. smalltalk.addMethod(
  1563. "__comma",
  1564. smalltalk.method({
  1565. selector: ",",
  1566. fn: function (aString) {
  1567. var self=this;
  1568. return self + aString;
  1569. return self;}
  1570. }),
  1571. smalltalk.String);
  1572. smalltalk.addMethod(
  1573. "__lt",
  1574. smalltalk.method({
  1575. selector: "<",
  1576. fn: function (aString) {
  1577. var self=this;
  1578. return String(self) < aString._asString();
  1579. return self;}
  1580. }),
  1581. smalltalk.String);
  1582. smalltalk.addMethod(
  1583. "__lt_eq",
  1584. smalltalk.method({
  1585. selector: "<=",
  1586. fn: function (aString) {
  1587. var self=this;
  1588. return String(self) <= aString._asString();
  1589. return self;}
  1590. }),
  1591. smalltalk.String);
  1592. smalltalk.addMethod(
  1593. "__eq",
  1594. smalltalk.method({
  1595. selector: "=",
  1596. fn: function (aString) {
  1597. var self=this;
  1598. var $early={};
  1599. 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]})();})]));
  1600. return String(self) === String(aString);
  1601. return self;
  1602. } catch(e) {if(e===$early)return e[0]; throw e}}
  1603. }),
  1604. smalltalk.String);
  1605. smalltalk.addMethod(
  1606. "__eq_eq",
  1607. smalltalk.method({
  1608. selector: "==",
  1609. fn: function (aString) {
  1610. var self=this;
  1611. return smalltalk.send(self, "__eq", [aString]);
  1612. return self;}
  1613. }),
  1614. smalltalk.String);
  1615. smalltalk.addMethod(
  1616. "__gt",
  1617. smalltalk.method({
  1618. selector: ">",
  1619. fn: function (aString) {
  1620. var self=this;
  1621. return String(self) > aString._asString();
  1622. return self;}
  1623. }),
  1624. smalltalk.String);
  1625. smalltalk.addMethod(
  1626. "__gt_eq",
  1627. smalltalk.method({
  1628. selector: ">=",
  1629. fn: function (aString) {
  1630. var self=this;
  1631. return String(self) >= aString._asString();
  1632. return self;}
  1633. }),
  1634. smalltalk.String);
  1635. smalltalk.addMethod(
  1636. "_asJSON",
  1637. smalltalk.method({
  1638. selector: "asJSON",
  1639. fn: function () {
  1640. var self=this;
  1641. return self;
  1642. return self;}
  1643. }),
  1644. smalltalk.String);
  1645. smalltalk.addMethod(
  1646. "_asJavaScriptSelector",
  1647. smalltalk.method({
  1648. selector: "asJavaScriptSelector",
  1649. fn: function () {
  1650. var self=this;
  1651. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_asSelector", []), "_replace_with_", ["^_", ""]), "_replace_with_", ["_.*", ""]);
  1652. return self;}
  1653. }),
  1654. smalltalk.String);
  1655. smalltalk.addMethod(
  1656. "_asJavascript",
  1657. smalltalk.method({
  1658. selector: "asJavascript",
  1659. fn: function () {
  1660. var self=this;
  1661. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  1662. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  1663. else
  1664. return "\"" + self + "\"";
  1665. ;
  1666. return self;}
  1667. }),
  1668. smalltalk.String);
  1669. smalltalk.addMethod(
  1670. "_asLowercase",
  1671. smalltalk.method({
  1672. selector: "asLowercase",
  1673. fn: function () {
  1674. var self=this;
  1675. return self.toLowerCase();
  1676. return self;}
  1677. }),
  1678. smalltalk.String);
  1679. smalltalk.addMethod(
  1680. "_asNumber",
  1681. smalltalk.method({
  1682. selector: "asNumber",
  1683. fn: function () {
  1684. var self=this;
  1685. return Number(self);
  1686. return self;}
  1687. }),
  1688. smalltalk.String);
  1689. smalltalk.addMethod(
  1690. "_asSelector",
  1691. smalltalk.method({
  1692. selector: "asSelector",
  1693. fn: function () {
  1694. var self=this;
  1695. var selector=nil;
  1696. (selector=smalltalk.send("_", "__comma", [self]));
  1697. (selector=smalltalk.send(selector, "_replace_with_", [":", "_"]));
  1698. (selector=smalltalk.send(selector, "_replace_with_", ["[+]", "_plus"]));
  1699. (selector=smalltalk.send(selector, "_replace_with_", ["-", "_minus"]));
  1700. (selector=smalltalk.send(selector, "_replace_with_", ["[*]", "_star"]));
  1701. (selector=smalltalk.send(selector, "_replace_with_", ["[/]", "_slash"]));
  1702. (selector=smalltalk.send(selector, "_replace_with_", [">", "_gt"]));
  1703. (selector=smalltalk.send(selector, "_replace_with_", ["<", "_lt"]));
  1704. (selector=smalltalk.send(selector, "_replace_with_", ["=", "_eq"]));
  1705. (selector=smalltalk.send(selector, "_replace_with_", [",", "_comma"]));
  1706. (selector=smalltalk.send(selector, "_replace_with_", ["[@]", "_at"]));
  1707. return selector;
  1708. return self;}
  1709. }),
  1710. smalltalk.String);
  1711. smalltalk.addMethod(
  1712. "_asString",
  1713. smalltalk.method({
  1714. selector: "asString",
  1715. fn: function () {
  1716. var self=this;
  1717. return self;
  1718. return self;}
  1719. }),
  1720. smalltalk.String);
  1721. smalltalk.addMethod(
  1722. "_asSymbol",
  1723. smalltalk.method({
  1724. selector: "asSymbol",
  1725. fn: function () {
  1726. var self=this;
  1727. return smalltalk.send((smalltalk.Symbol || Symbol), "_lookup_", [self]);
  1728. return self;}
  1729. }),
  1730. smalltalk.String);
  1731. smalltalk.addMethod(
  1732. "_asUppercase",
  1733. smalltalk.method({
  1734. selector: "asUppercase",
  1735. fn: function () {
  1736. var self=this;
  1737. return self.toUpperCase();
  1738. return self;}
  1739. }),
  1740. smalltalk.String);
  1741. smalltalk.addMethod(
  1742. "_asciiValue",
  1743. smalltalk.method({
  1744. selector: "asciiValue",
  1745. fn: function () {
  1746. var self=this;
  1747. return self.charCodeAt(0);;
  1748. return self;}
  1749. }),
  1750. smalltalk.String);
  1751. smalltalk.addMethod(
  1752. "_at_ifAbsent_",
  1753. smalltalk.method({
  1754. selector: "at:ifAbsent:",
  1755. fn: function (anIndex, aBlock) {
  1756. var self=this;
  1757. return self[anIndex - 1] || aBlock();
  1758. return self;}
  1759. }),
  1760. smalltalk.String);
  1761. smalltalk.addMethod(
  1762. "_copyFrom_to_",
  1763. smalltalk.method({
  1764. selector: "copyFrom:to:",
  1765. fn: function (anIndex, anotherIndex) {
  1766. var self=this;
  1767. return self.substring(anIndex - 1, anotherIndex);
  1768. return self;}
  1769. }),
  1770. smalltalk.String);
  1771. smalltalk.addMethod(
  1772. "_deepCopy",
  1773. smalltalk.method({
  1774. selector: "deepCopy",
  1775. fn: function () {
  1776. var self=this;
  1777. return smalltalk.send(self, "_shallowCopy", []);
  1778. return self;}
  1779. }),
  1780. smalltalk.String);
  1781. smalltalk.addMethod(
  1782. "_escaped",
  1783. smalltalk.method({
  1784. selector: "escaped",
  1785. fn: function () {
  1786. var self=this;
  1787. return escape(self);
  1788. return self;}
  1789. }),
  1790. smalltalk.String);
  1791. smalltalk.addMethod(
  1792. "_includesSubString_",
  1793. smalltalk.method({
  1794. selector: "includesSubString:",
  1795. fn: function (subString) {
  1796. var self=this;
  1797. return self.indexOf(subString) != -1 ;
  1798. return self;}
  1799. }),
  1800. smalltalk.String);
  1801. smalltalk.addMethod(
  1802. "_isString",
  1803. smalltalk.method({
  1804. selector: "isString",
  1805. fn: function () {
  1806. var self=this;
  1807. return true;
  1808. return self;}
  1809. }),
  1810. smalltalk.String);
  1811. smalltalk.addMethod(
  1812. "_join_",
  1813. smalltalk.method({
  1814. selector: "join:",
  1815. fn: function (aCollection) {
  1816. var self=this;
  1817. 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]);})]);})]);
  1818. return self;}
  1819. }),
  1820. smalltalk.String);
  1821. smalltalk.addMethod(
  1822. "_lineIndicesDo_",
  1823. smalltalk.method({
  1824. selector: "lineIndicesDo:",
  1825. fn: function (aBlock) {
  1826. var self=this;
  1827. var $early={};
  1828. try{var cr=nil;
  1829. var lf=nil;
  1830. var start=nil;
  1831. var sz=nil;
  1832. var nextLF=nil;
  1833. var nextCR=nil;
  1834. (start=(1));
  1835. (sz=smalltalk.send(self, "_size", []));
  1836. (cr=smalltalk.send((smalltalk.String || String), "_cr", []));
  1837. (nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, (1)]));
  1838. (lf=smalltalk.send((smalltalk.String || String), "_lf", []));
  1839. (nextLF=smalltalk.send(self, "_indexOf_startingAt_", [lf, (1)]));
  1840. (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]));})]));})]));})()}})();
  1841. return self;
  1842. } catch(e) {if(e===$early)return e[0]; throw e}}
  1843. }),
  1844. smalltalk.String);
  1845. smalltalk.addMethod(
  1846. "_lineNumber_",
  1847. smalltalk.method({
  1848. selector: "lineNumber:",
  1849. fn: function (anIndex) {
  1850. var self=this;
  1851. var $early={};
  1852. try{var lineCount=nil;
  1853. (lineCount=(0));
  1854. 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])]})();})]));})]);
  1855. return nil;
  1856. return self;
  1857. } catch(e) {if(e===$early)return e[0]; throw e}}
  1858. }),
  1859. smalltalk.String);
  1860. smalltalk.addMethod(
  1861. "_lines",
  1862. smalltalk.method({
  1863. selector: "lines",
  1864. fn: function () {
  1865. var self=this;
  1866. var lines=nil;
  1867. (lines=smalltalk.send((smalltalk.Array || Array), "_new", []));
  1868. smalltalk.send(self, "_linesDo_", [(function(aLine){return smalltalk.send(lines, "_add_", [aLine]);})]);
  1869. return lines;
  1870. return self;}
  1871. }),
  1872. smalltalk.String);
  1873. smalltalk.addMethod(
  1874. "_linesDo_",
  1875. smalltalk.method({
  1876. selector: "linesDo:",
  1877. fn: function (aBlock) {
  1878. var self=this;
  1879. smalltalk.send(self, "_lineIndicesDo_", [(function(start, endWithoutDelimiters, end){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_copyFrom_to_", [start, endWithoutDelimiters])]);})]);
  1880. return self;}
  1881. }),
  1882. smalltalk.String);
  1883. smalltalk.addMethod(
  1884. "_match_",
  1885. smalltalk.method({
  1886. selector: "match:",
  1887. fn: function (aRegexp) {
  1888. var self=this;
  1889. return self.search(aRegexp) != -1;
  1890. return self;}
  1891. }),
  1892. smalltalk.String);
  1893. smalltalk.addMethod(
  1894. "_matchesOf_",
  1895. smalltalk.method({
  1896. selector: "matchesOf:",
  1897. fn: function (aRegularExpression) {
  1898. var self=this;
  1899. return self.match(aRegularExpression);
  1900. return self;}
  1901. }),
  1902. smalltalk.String);
  1903. smalltalk.addMethod(
  1904. "_printNl",
  1905. smalltalk.method({
  1906. selector: "printNl",
  1907. fn: function () {
  1908. var self=this;
  1909. console.log(self);
  1910. return self;}
  1911. }),
  1912. smalltalk.String);
  1913. smalltalk.addMethod(
  1914. "_printString",
  1915. smalltalk.method({
  1916. selector: "printString",
  1917. fn: function () {
  1918. var self=this;
  1919. return smalltalk.send(smalltalk.send("'", "__comma", [self]), "__comma", ["'"]);
  1920. return self;}
  1921. }),
  1922. smalltalk.String);
  1923. smalltalk.addMethod(
  1924. "_replace_with_",
  1925. smalltalk.method({
  1926. selector: "replace:with:",
  1927. fn: function (aString, anotherString) {
  1928. var self=this;
  1929. return smalltalk.send(self, "_replaceRegexp_with_", [smalltalk.send((smalltalk.RegularExpression || RegularExpression), "_fromString_flag_", [aString, "g"]), anotherString]);
  1930. return self;}
  1931. }),
  1932. smalltalk.String);
  1933. smalltalk.addMethod(
  1934. "_replaceRegexp_with_",
  1935. smalltalk.method({
  1936. selector: "replaceRegexp:with:",
  1937. fn: function (aRegexp, aString) {
  1938. var self=this;
  1939. return self.replace(aRegexp, aString);
  1940. return self;}
  1941. }),
  1942. smalltalk.String);
  1943. smalltalk.addMethod(
  1944. "_reversed",
  1945. smalltalk.method({
  1946. selector: "reversed",
  1947. fn: function () {
  1948. var self=this;
  1949. return self.split("").reverse().join("");
  1950. return self;}
  1951. }),
  1952. smalltalk.String);
  1953. smalltalk.addMethod(
  1954. "_shallowCopy",
  1955. smalltalk.method({
  1956. selector: "shallowCopy",
  1957. fn: function () {
  1958. var self=this;
  1959. return smalltalk.send(smalltalk.send(self, "_class", []), "_fromString_", [self]);
  1960. return self;}
  1961. }),
  1962. smalltalk.String);
  1963. smalltalk.addMethod(
  1964. "_size",
  1965. smalltalk.method({
  1966. selector: "size",
  1967. fn: function () {
  1968. var self=this;
  1969. return self.length;
  1970. return self;}
  1971. }),
  1972. smalltalk.String);
  1973. smalltalk.addMethod(
  1974. "_tokenize_",
  1975. smalltalk.method({
  1976. selector: "tokenize:",
  1977. fn: function (aString) {
  1978. var self=this;
  1979. return self.split(aString);
  1980. return self;}
  1981. }),
  1982. smalltalk.String);
  1983. smalltalk.addMethod(
  1984. "_trimBoth",
  1985. smalltalk.method({
  1986. selector: "trimBoth",
  1987. fn: function () {
  1988. var self=this;
  1989. return smalltalk.send(self, "_trimBoth_", ["\x5cs"]);
  1990. return self;}
  1991. }),
  1992. smalltalk.String);
  1993. smalltalk.addMethod(
  1994. "_trimBoth_",
  1995. smalltalk.method({
  1996. selector: "trimBoth:",
  1997. fn: function (separators) {
  1998. var self=this;
  1999. return smalltalk.send(smalltalk.send(self, "_trimLeft_", [separators]), "_trimRight_", [separators]);
  2000. return self;}
  2001. }),
  2002. smalltalk.String);
  2003. smalltalk.addMethod(
  2004. "_trimLeft",
  2005. smalltalk.method({
  2006. selector: "trimLeft",
  2007. fn: function () {
  2008. var self=this;
  2009. return smalltalk.send(self, "_trimLeft_", ["\x5cs"]);
  2010. return self;}
  2011. }),
  2012. smalltalk.String);
  2013. smalltalk.addMethod(
  2014. "_trimLeft_",
  2015. smalltalk.method({
  2016. selector: "trimLeft:",
  2017. fn: function (separators) {
  2018. var self=this;
  2019. return smalltalk.send(self, "_replaceRegexp_with_", [smalltalk.send((smalltalk.RegularExpression || RegularExpression), "_fromString_flag_", [smalltalk.send(smalltalk.send("^[", "__comma", [separators]), "__comma", ["]+"]), "g"]), ""]);
  2020. return self;}
  2021. }),
  2022. smalltalk.String);
  2023. smalltalk.addMethod(
  2024. "_trimRight",
  2025. smalltalk.method({
  2026. selector: "trimRight",
  2027. fn: function () {
  2028. var self=this;
  2029. return smalltalk.send(self, "_trimRight_", ["\x5cs"]);
  2030. return self;}
  2031. }),
  2032. smalltalk.String);
  2033. smalltalk.addMethod(
  2034. "_trimRight_",
  2035. smalltalk.method({
  2036. selector: "trimRight:",
  2037. fn: function (separators) {
  2038. var self=this;
  2039. return smalltalk.send(self, "_replaceRegexp_with_", [smalltalk.send((smalltalk.RegularExpression || RegularExpression), "_fromString_flag_", [smalltalk.send(smalltalk.send("[", "__comma", [separators]), "__comma", ["]+$"]), "g"]), ""]);
  2040. return self;}
  2041. }),
  2042. smalltalk.String);
  2043. smalltalk.addMethod(
  2044. "_unescaped",
  2045. smalltalk.method({
  2046. selector: "unescaped",
  2047. fn: function () {
  2048. var self=this;
  2049. return unescape(self);
  2050. return self;}
  2051. }),
  2052. smalltalk.String);
  2053. smalltalk.addMethod(
  2054. "_cr",
  2055. smalltalk.method({
  2056. selector: "cr",
  2057. fn: function () {
  2058. var self=this;
  2059. return '\r';
  2060. return self;}
  2061. }),
  2062. smalltalk.String.klass);
  2063. smalltalk.addMethod(
  2064. "_crlf",
  2065. smalltalk.method({
  2066. selector: "crlf",
  2067. fn: function () {
  2068. var self=this;
  2069. return '\r\n';
  2070. return self;}
  2071. }),
  2072. smalltalk.String.klass);
  2073. smalltalk.addMethod(
  2074. "_fromString_",
  2075. smalltalk.method({
  2076. selector: "fromString:",
  2077. fn: function (aString) {
  2078. var self=this;
  2079. return new self.fn(aString);
  2080. return self;}
  2081. }),
  2082. smalltalk.String.klass);
  2083. smalltalk.addMethod(
  2084. "_lf",
  2085. smalltalk.method({
  2086. selector: "lf",
  2087. fn: function () {
  2088. var self=this;
  2089. return '\n';
  2090. return self;}
  2091. }),
  2092. smalltalk.String.klass);
  2093. smalltalk.addMethod(
  2094. "_space",
  2095. smalltalk.method({
  2096. selector: "space",
  2097. fn: function () {
  2098. var self=this;
  2099. return ' ';
  2100. return self;}
  2101. }),
  2102. smalltalk.String.klass);
  2103. smalltalk.addMethod(
  2104. "_streamClass",
  2105. smalltalk.method({
  2106. selector: "streamClass",
  2107. fn: function () {
  2108. var self=this;
  2109. return (smalltalk.StringStream || StringStream);
  2110. return self;}
  2111. }),
  2112. smalltalk.String.klass);
  2113. smalltalk.addMethod(
  2114. "_streamContents_",
  2115. smalltalk.method({
  2116. selector: "streamContents:",
  2117. fn: function (blockWithArg) {
  2118. var self=this;
  2119. var stream=nil;
  2120. (stream=smalltalk.send(smalltalk.send(self, "_streamClass", []), "_on_", [smalltalk.send((smalltalk.String || String), "_new", [])]));
  2121. smalltalk.send(blockWithArg, "_value_", [stream]);
  2122. return smalltalk.send(stream, "_contents", []);
  2123. return self;}
  2124. }),
  2125. smalltalk.String.klass);
  2126. smalltalk.addMethod(
  2127. "_tab",
  2128. smalltalk.method({
  2129. selector: "tab",
  2130. fn: function () {
  2131. var self=this;
  2132. return '\t';
  2133. return self;}
  2134. }),
  2135. smalltalk.String.klass);
  2136. smalltalk.addMethod(
  2137. "_value_",
  2138. smalltalk.method({
  2139. selector: "value:",
  2140. fn: function (aUTFCharCode) {
  2141. var self=this;
  2142. return String.fromCharCode(aUTFCharCode);;
  2143. return self;}
  2144. }),
  2145. smalltalk.String.klass);
  2146. smalltalk.addClass('Symbol', smalltalk.CharacterArray, [], 'Kernel-Collections');
  2147. smalltalk.addMethod(
  2148. "__lt",
  2149. smalltalk.method({
  2150. selector: "<",
  2151. fn: function (aSymbol) {
  2152. var self=this;
  2153. return ((($receiver = smalltalk.send(self, "_asString", [])).klass === smalltalk.Number) ? $receiver <smalltalk.send(aSymbol, "_asString", []) : smalltalk.send($receiver, "__lt", [smalltalk.send(aSymbol, "_asString", [])]));
  2154. return self;}
  2155. }),
  2156. smalltalk.Symbol);
  2157. smalltalk.addMethod(
  2158. "__lt_eq",
  2159. smalltalk.method({
  2160. selector: "<=",
  2161. fn: function (aSymbol) {
  2162. var self=this;
  2163. return ((($receiver = smalltalk.send(self, "_asString", [])).klass === smalltalk.Number) ? $receiver <=smalltalk.send(aSymbol, "_asString", []) : smalltalk.send($receiver, "__lt_eq", [smalltalk.send(aSymbol, "_asString", [])]));
  2164. return self;}
  2165. }),
  2166. smalltalk.Symbol);
  2167. smalltalk.addMethod(
  2168. "__eq",
  2169. smalltalk.method({
  2170. selector: "=",
  2171. fn: function (aSymbol) {
  2172. var self=this;
  2173. var $early={};
  2174. 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]})();})]));
  2175. return smalltalk.send(smalltalk.send(self, "_asString", []), "__eq", [smalltalk.send(aSymbol, "_asString", [])]);
  2176. return self;
  2177. } catch(e) {if(e===$early)return e[0]; throw e}}
  2178. }),
  2179. smalltalk.Symbol);
  2180. smalltalk.addMethod(
  2181. "__gt",
  2182. smalltalk.method({
  2183. selector: ">",
  2184. fn: function (aSymbol) {
  2185. var self=this;
  2186. return ((($receiver = smalltalk.send(self, "_asString", [])).klass === smalltalk.Number) ? $receiver >smalltalk.send(aSymbol, "_asString", []) : smalltalk.send($receiver, "__gt", [smalltalk.send(aSymbol, "_asString", [])]));
  2187. return self;}
  2188. }),
  2189. smalltalk.Symbol);
  2190. smalltalk.addMethod(
  2191. "__gt_eq",
  2192. smalltalk.method({
  2193. selector: ">=",
  2194. fn: function (aSymbol) {
  2195. var self=this;
  2196. return ((($receiver = smalltalk.send(self, "_asString", [])).klass === smalltalk.Number) ? $receiver >=smalltalk.send(aSymbol, "_asString", []) : smalltalk.send($receiver, "__gt_eq", [smalltalk.send(aSymbol, "_asString", [])]));
  2197. return self;}
  2198. }),
  2199. smalltalk.Symbol);
  2200. smalltalk.addMethod(
  2201. "_asJSON",
  2202. smalltalk.method({
  2203. selector: "asJSON",
  2204. fn: function () {
  2205. var self=this;
  2206. return smalltalk.send(smalltalk.send(self, "_asString", []), "_asJSON", []);
  2207. return self;}
  2208. }),
  2209. smalltalk.Symbol);
  2210. smalltalk.addMethod(
  2211. "_asJavascript",
  2212. smalltalk.method({
  2213. selector: "asJavascript",
  2214. fn: function () {
  2215. var self=this;
  2216. return smalltalk.send(smalltalk.send("smalltalk.symbolFor(\x22", "__comma", [smalltalk.send(self, "_asString", [])]), "__comma", ["\x22)"]);
  2217. return self;}
  2218. }),
  2219. smalltalk.Symbol);
  2220. smalltalk.addMethod(
  2221. "_asSelector",
  2222. smalltalk.method({
  2223. selector: "asSelector",
  2224. fn: function () {
  2225. var self=this;
  2226. return smalltalk.send(smalltalk.send(self, "_asString", []), "_asSelector", []);
  2227. return self;}
  2228. }),
  2229. smalltalk.Symbol);
  2230. smalltalk.addMethod(
  2231. "_asString",
  2232. smalltalk.method({
  2233. selector: "asString",
  2234. fn: function () {
  2235. var self=this;
  2236. return self.value;
  2237. return self;}
  2238. }),
  2239. smalltalk.Symbol);
  2240. smalltalk.addMethod(
  2241. "_asSymbol",
  2242. smalltalk.method({
  2243. selector: "asSymbol",
  2244. fn: function () {
  2245. var self=this;
  2246. return self;
  2247. return self;}
  2248. }),
  2249. smalltalk.Symbol);
  2250. smalltalk.addMethod(
  2251. "_at_ifAbsent_",
  2252. smalltalk.method({
  2253. selector: "at:ifAbsent:",
  2254. fn: function (anIndex, aBlock) {
  2255. var self=this;
  2256. return smalltalk.send(smalltalk.send(self, "_asString", []), "_at_ifAbsent_", [anIndex, aBlock]);
  2257. return self;}
  2258. }),
  2259. smalltalk.Symbol);
  2260. smalltalk.addMethod(
  2261. "_copyFrom_to_",
  2262. smalltalk.method({
  2263. selector: "copyFrom:to:",
  2264. fn: function (anIndex, anotherIndex) {
  2265. var self=this;
  2266. return smalltalk.send(smalltalk.send(self, "_class", []), "_fromString_", [smalltalk.send(smalltalk.send(self, "_asString", []), "_copyFrom_to_", [anIndex, anotherIndex])]);
  2267. return self;}
  2268. }),
  2269. smalltalk.Symbol);
  2270. smalltalk.addMethod(
  2271. "_deepCopy",
  2272. smalltalk.method({
  2273. selector: "deepCopy",
  2274. fn: function () {
  2275. var self=this;
  2276. return self;
  2277. return self;}
  2278. }),
  2279. smalltalk.Symbol);
  2280. smalltalk.addMethod(
  2281. "_isSymbol",
  2282. smalltalk.method({
  2283. selector: "isSymbol",
  2284. fn: function () {
  2285. var self=this;
  2286. return true;
  2287. return self;}
  2288. }),
  2289. smalltalk.Symbol);
  2290. smalltalk.addMethod(
  2291. "_printString",
  2292. smalltalk.method({
  2293. selector: "printString",
  2294. fn: function () {
  2295. var self=this;
  2296. return smalltalk.send("#", "__comma", [smalltalk.send(self, "_asString", [])]);
  2297. return self;}
  2298. }),
  2299. smalltalk.Symbol);
  2300. smalltalk.addMethod(
  2301. "_shallowCopy",
  2302. smalltalk.method({
  2303. selector: "shallowCopy",
  2304. fn: function () {
  2305. var self=this;
  2306. return self;
  2307. return self;}
  2308. }),
  2309. smalltalk.Symbol);
  2310. smalltalk.addMethod(
  2311. "_size",
  2312. smalltalk.method({
  2313. selector: "size",
  2314. fn: function () {
  2315. var self=this;
  2316. return smalltalk.send(smalltalk.send(self, "_asString", []), "_size", []);
  2317. return self;}
  2318. }),
  2319. smalltalk.Symbol);
  2320. smalltalk.addMethod(
  2321. "_basicNew",
  2322. smalltalk.method({
  2323. selector: "basicNew",
  2324. fn: function () {
  2325. var self=this;
  2326. smalltalk.send(self, "_shouldNotImplement", []);
  2327. return self;}
  2328. }),
  2329. smalltalk.Symbol.klass);
  2330. smalltalk.addMethod(
  2331. "_fromString_",
  2332. smalltalk.method({
  2333. selector: "fromString:",
  2334. fn: function (aString) {
  2335. var self=this;
  2336. return smalltalk.send(self, "_lookup_", [aString]);
  2337. return self;}
  2338. }),
  2339. smalltalk.Symbol.klass);
  2340. smalltalk.addMethod(
  2341. "_lookup_",
  2342. smalltalk.method({
  2343. selector: "lookup:",
  2344. fn: function (aString) {
  2345. var self=this;
  2346. return smalltalk.symbolFor(aString);;
  2347. return self;}
  2348. }),
  2349. smalltalk.Symbol.klass);
  2350. smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections');
  2351. smalltalk.addMethod(
  2352. "__eq",
  2353. smalltalk.method({
  2354. selector: "=",
  2355. fn: function (aCollection) {
  2356. var self=this;
  2357. 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", [])]);})]);
  2358. return self;}
  2359. }),
  2360. smalltalk.Set);
  2361. smalltalk.addMethod(
  2362. "_add_",
  2363. smalltalk.method({
  2364. selector: "add:",
  2365. fn: function (anObject) {
  2366. var self=this;
  2367. var found;
  2368. for(var i=0; i < self['@elements'].length; i++) {
  2369. if(anObject == self['@elements'][i]) {
  2370. found = true;
  2371. break;
  2372. }
  2373. }
  2374. if(!found) {self['@elements'].push(anObject)}
  2375. ;
  2376. return self;}
  2377. }),
  2378. smalltalk.Set);
  2379. smalltalk.addMethod(
  2380. "_asArray",
  2381. smalltalk.method({
  2382. selector: "asArray",
  2383. fn: function () {
  2384. var self=this;
  2385. return smalltalk.send(self['@elements'], "_copy", []);
  2386. return self;}
  2387. }),
  2388. smalltalk.Set);
  2389. smalltalk.addMethod(
  2390. "_detect_ifNone_",
  2391. smalltalk.method({
  2392. selector: "detect:ifNone:",
  2393. fn: function (aBlock, anotherBlock) {
  2394. var self=this;
  2395. return smalltalk.send(self['@elements'], "_detect_ifNone_", [aBlock, anotherBlock]);
  2396. return self;}
  2397. }),
  2398. smalltalk.Set);
  2399. smalltalk.addMethod(
  2400. "_do_",
  2401. smalltalk.method({
  2402. selector: "do:",
  2403. fn: function (aBlock) {
  2404. var self=this;
  2405. smalltalk.send(self['@elements'], "_do_", [aBlock]);
  2406. return self;}
  2407. }),
  2408. smalltalk.Set);
  2409. smalltalk.addMethod(
  2410. "_includes_",
  2411. smalltalk.method({
  2412. selector: "includes:",
  2413. fn: function (anObject) {
  2414. var self=this;
  2415. return smalltalk.send(self['@elements'], "_includes_", [anObject]);
  2416. return self;}
  2417. }),
  2418. smalltalk.Set);
  2419. smalltalk.addMethod(
  2420. "_initialize",
  2421. smalltalk.method({
  2422. selector: "initialize",
  2423. fn: function () {
  2424. var self=this;
  2425. smalltalk.send(self, "_initialize", [], smalltalk.Set.superclass || nil);
  2426. (self['@elements']=[]);
  2427. return self;}
  2428. }),
  2429. smalltalk.Set);
  2430. smalltalk.addMethod(
  2431. "_remove_",
  2432. smalltalk.method({
  2433. selector: "remove:",
  2434. fn: function (anObject) {
  2435. var self=this;
  2436. smalltalk.send(self['@elements'], "_remove_", [anObject]);
  2437. return self;}
  2438. }),
  2439. smalltalk.Set);
  2440. smalltalk.addMethod(
  2441. "_select_",
  2442. smalltalk.method({
  2443. selector: "select:",
  2444. fn: function (aBlock) {
  2445. var self=this;
  2446. var collection=nil;
  2447. (collection=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []));
  2448. 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]);})]));})]);
  2449. return collection;
  2450. return self;}
  2451. }),
  2452. smalltalk.Set);
  2453. smalltalk.addMethod(
  2454. "_size",
  2455. smalltalk.method({
  2456. selector: "size",
  2457. fn: function () {
  2458. var self=this;
  2459. return smalltalk.send(self['@elements'], "_size", []);
  2460. return self;}
  2461. }),
  2462. smalltalk.Set);
  2463. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
  2464. smalltalk.addMethod(
  2465. "_compile_",
  2466. smalltalk.method({
  2467. selector: "compile:",
  2468. fn: function (aString) {
  2469. var self=this;
  2470. return self.compile(aString);
  2471. return self;}
  2472. }),
  2473. smalltalk.RegularExpression);
  2474. smalltalk.addMethod(
  2475. "_exec_",
  2476. smalltalk.method({
  2477. selector: "exec:",
  2478. fn: function (aString) {
  2479. var self=this;
  2480. return self.exec(aString) || nil;
  2481. return self;}
  2482. }),
  2483. smalltalk.RegularExpression);
  2484. smalltalk.addMethod(
  2485. "_test_",
  2486. smalltalk.method({
  2487. selector: "test:",
  2488. fn: function (aString) {
  2489. var self=this;
  2490. return self.test(aString);
  2491. return self;}
  2492. }),
  2493. smalltalk.RegularExpression);
  2494. smalltalk.addMethod(
  2495. "_fromString_",
  2496. smalltalk.method({
  2497. selector: "fromString:",
  2498. fn: function (aString) {
  2499. var self=this;
  2500. return smalltalk.send(self, "_fromString_flag_", [aString, ""]);
  2501. return self;}
  2502. }),
  2503. smalltalk.RegularExpression.klass);
  2504. smalltalk.addMethod(
  2505. "_fromString_flag_",
  2506. smalltalk.method({
  2507. selector: "fromString:flag:",
  2508. fn: function (aString, anotherString) {
  2509. var self=this;
  2510. return new RegExp(aString, anotherString);
  2511. return self;}
  2512. }),
  2513. smalltalk.RegularExpression.klass);
  2514. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  2515. smalltalk.addMethod(
  2516. "_atEnd",
  2517. smalltalk.method({
  2518. selector: "atEnd",
  2519. fn: function () {
  2520. var self=this;
  2521. return smalltalk.send(smalltalk.send(self, "_position", []), "__eq", [smalltalk.send(self, "_size", [])]);
  2522. return self;}
  2523. }),
  2524. smalltalk.Stream);
  2525. smalltalk.addMethod(
  2526. "_atStart",
  2527. smalltalk.method({
  2528. selector: "atStart",
  2529. fn: function () {
  2530. var self=this;
  2531. return smalltalk.send(smalltalk.send(self, "_position", []), "__eq", [(0)]);
  2532. return self;}
  2533. }),
  2534. smalltalk.Stream);
  2535. smalltalk.addMethod(
  2536. "_close",
  2537. smalltalk.method({
  2538. selector: "close",
  2539. fn: function () {
  2540. var self=this;
  2541. return self;}
  2542. }),
  2543. smalltalk.Stream);
  2544. smalltalk.addMethod(
  2545. "_collection",
  2546. smalltalk.method({
  2547. selector: "collection",
  2548. fn: function () {
  2549. var self=this;
  2550. return self['@collection'];
  2551. return self;}
  2552. }),
  2553. smalltalk.Stream);
  2554. smalltalk.addMethod(
  2555. "_contents",
  2556. smalltalk.method({
  2557. selector: "contents",
  2558. fn: function () {
  2559. var self=this;
  2560. return smalltalk.send(smalltalk.send(self, "_collection", []), "_copyFrom_to_", [(1), smalltalk.send(self, "_streamSize", [])]);
  2561. return self;}
  2562. }),
  2563. smalltalk.Stream);
  2564. smalltalk.addMethod(
  2565. "_do_",
  2566. smalltalk.method({
  2567. selector: "do:",
  2568. fn: function (aBlock) {
  2569. var self=this;
  2570. (function(){while(!(function(){return smalltalk.send(self, "_atEnd", []);})()) {(function(){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_next", [])]);})()}})();
  2571. return self;}
  2572. }),
  2573. smalltalk.Stream);
  2574. smalltalk.addMethod(
  2575. "_flush",
  2576. smalltalk.method({
  2577. selector: "flush",
  2578. fn: function () {
  2579. var self=this;
  2580. return self;}
  2581. }),
  2582. smalltalk.Stream);
  2583. smalltalk.addMethod(
  2584. "_isEmpty",
  2585. smalltalk.method({
  2586. selector: "isEmpty",
  2587. fn: function () {
  2588. var self=this;
  2589. return smalltalk.send(smalltalk.send(self, "_size", []), "__eq", [(0)]);
  2590. return self;}
  2591. }),
  2592. smalltalk.Stream);
  2593. smalltalk.addMethod(
  2594. "_next",
  2595. smalltalk.method({
  2596. selector: "next",
  2597. fn: function () {
  2598. var self=this;
  2599. 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", [])]);})]));
  2600. return self;}
  2601. }),
  2602. smalltalk.Stream);
  2603. smalltalk.addMethod(
  2604. "_next_",
  2605. smalltalk.method({
  2606. selector: "next:",
  2607. fn: function (anInteger) {
  2608. var self=this;
  2609. var tempCollection=nil;
  2610. (tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_class", []), "_new", []));
  2611. 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", [])]);})]));})]);
  2612. return tempCollection;
  2613. return self;}
  2614. }),
  2615. smalltalk.Stream);
  2616. smalltalk.addMethod(
  2617. "_nextPut_",
  2618. smalltalk.method({
  2619. selector: "nextPut:",
  2620. fn: function (anObject) {
  2621. var self=this;
  2622. smalltalk.send(self, "_position_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);
  2623. smalltalk.send(smalltalk.send(self, "_collection", []), "_at_put_", [smalltalk.send(self, "_position", []), anObject]);
  2624. smalltalk.send(self, "_setStreamSize_", [smalltalk.send(smalltalk.send(self, "_streamSize", []), "_max_", [smalltalk.send(self, "_position", [])])]);
  2625. return self;}
  2626. }),
  2627. smalltalk.Stream);
  2628. smalltalk.addMethod(
  2629. "_nextPutAll_",
  2630. smalltalk.method({
  2631. selector: "nextPutAll:",
  2632. fn: function (aCollection) {
  2633. var self=this;
  2634. smalltalk.send(aCollection, "_do_", [(function(each){return smalltalk.send(self, "_nextPut_", [each]);})]);
  2635. return self;}
  2636. }),
  2637. smalltalk.Stream);
  2638. smalltalk.addMethod(
  2639. "_peek",
  2640. smalltalk.method({
  2641. selector: "peek",
  2642. fn: function () {
  2643. var self=this;
  2644. 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)]))]);})]));
  2645. return self;}
  2646. }),
  2647. smalltalk.Stream);
  2648. smalltalk.addMethod(
  2649. "_position",
  2650. smalltalk.method({
  2651. selector: "position",
  2652. fn: function () {
  2653. var self=this;
  2654. return (($receiver = self['@position']) == nil || $receiver == undefined) ? (function(){return (self['@position']=(0));})() : $receiver;
  2655. return self;}
  2656. }),
  2657. smalltalk.Stream);
  2658. smalltalk.addMethod(
  2659. "_position_",
  2660. smalltalk.method({
  2661. selector: "position:",
  2662. fn: function (anInteger) {
  2663. var self=this;
  2664. (self['@position']=anInteger);
  2665. return self;}
  2666. }),
  2667. smalltalk.Stream);
  2668. smalltalk.addMethod(
  2669. "_reset",
  2670. smalltalk.method({
  2671. selector: "reset",
  2672. fn: function () {
  2673. var self=this;
  2674. smalltalk.send(self, "_position_", [(0)]);
  2675. return self;}
  2676. }),
  2677. smalltalk.Stream);
  2678. smalltalk.addMethod(
  2679. "_resetContents",
  2680. smalltalk.method({
  2681. selector: "resetContents",
  2682. fn: function () {
  2683. var self=this;
  2684. smalltalk.send(self, "_reset", []);
  2685. smalltalk.send(self, "_setStreamSize_", [(0)]);
  2686. return self;}
  2687. }),
  2688. smalltalk.Stream);
  2689. smalltalk.addMethod(
  2690. "_setCollection_",
  2691. smalltalk.method({
  2692. selector: "setCollection:",
  2693. fn: function (aCollection) {
  2694. var self=this;
  2695. (self['@collection']=aCollection);
  2696. return self;}
  2697. }),
  2698. smalltalk.Stream);
  2699. smalltalk.addMethod(
  2700. "_setStreamSize_",
  2701. smalltalk.method({
  2702. selector: "setStreamSize:",
  2703. fn: function (anInteger) {
  2704. var self=this;
  2705. (self['@streamSize']=anInteger);
  2706. return self;}
  2707. }),
  2708. smalltalk.Stream);
  2709. smalltalk.addMethod(
  2710. "_setToEnd",
  2711. smalltalk.method({
  2712. selector: "setToEnd",
  2713. fn: function () {
  2714. var self=this;
  2715. smalltalk.send(self, "_position_", [smalltalk.send(self, "_size", [])]);
  2716. return self;}
  2717. }),
  2718. smalltalk.Stream);
  2719. smalltalk.addMethod(
  2720. "_size",
  2721. smalltalk.method({
  2722. selector: "size",
  2723. fn: function () {
  2724. var self=this;
  2725. return smalltalk.send(self, "_streamSize", []);
  2726. return self;}
  2727. }),
  2728. smalltalk.Stream);
  2729. smalltalk.addMethod(
  2730. "_skip_",
  2731. smalltalk.method({
  2732. selector: "skip:",
  2733. fn: function (anInteger) {
  2734. var self=this;
  2735. 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)])]);
  2736. return self;}
  2737. }),
  2738. smalltalk.Stream);
  2739. smalltalk.addMethod(
  2740. "_streamSize",
  2741. smalltalk.method({
  2742. selector: "streamSize",
  2743. fn: function () {
  2744. var self=this;
  2745. return self['@streamSize'];
  2746. return self;}
  2747. }),
  2748. smalltalk.Stream);
  2749. smalltalk.addMethod(
  2750. "_on_",
  2751. smalltalk.method({
  2752. selector: "on:",
  2753. fn: function (aCollection) {
  2754. var self=this;
  2755. 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", []));
  2756. return self;}
  2757. }),
  2758. smalltalk.Stream.klass);
  2759. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections');
  2760. smalltalk.addMethod(
  2761. "_cr",
  2762. smalltalk.method({
  2763. selector: "cr",
  2764. fn: function () {
  2765. var self=this;
  2766. return smalltalk.send(self, "_nextPutAll_", [smalltalk.send((smalltalk.String || String), "_cr", [])]);
  2767. return self;}
  2768. }),
  2769. smalltalk.StringStream);
  2770. smalltalk.addMethod(
  2771. "_crlf",
  2772. smalltalk.method({
  2773. selector: "crlf",
  2774. fn: function () {
  2775. var self=this;
  2776. return smalltalk.send(self, "_nextPutAll_", [smalltalk.send((smalltalk.String || String), "_crlf", [])]);
  2777. return self;}
  2778. }),
  2779. smalltalk.StringStream);
  2780. smalltalk.addMethod(
  2781. "_lf",
  2782. smalltalk.method({
  2783. selector: "lf",
  2784. fn: function () {
  2785. var self=this;
  2786. return smalltalk.send(self, "_nextPutAll_", [smalltalk.send((smalltalk.String || String), "_lf", [])]);
  2787. return self;}
  2788. }),
  2789. smalltalk.StringStream);
  2790. smalltalk.addMethod(
  2791. "_next_",
  2792. smalltalk.method({
  2793. selector: "next:",
  2794. fn: function (anInteger) {
  2795. var self=this;
  2796. var tempCollection=nil;
  2797. (tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_class", []), "_new", []));
  2798. 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", [])]));})]));})]);
  2799. return tempCollection;
  2800. return self;}
  2801. }),
  2802. smalltalk.StringStream);
  2803. smalltalk.addMethod(
  2804. "_nextPut_",
  2805. smalltalk.method({
  2806. selector: "nextPut:",
  2807. fn: function (aString) {
  2808. var self=this;
  2809. smalltalk.send(self, "_nextPutAll_", [aString]);
  2810. return self;}
  2811. }),
  2812. smalltalk.StringStream);
  2813. smalltalk.addMethod(
  2814. "_nextPutAll_",
  2815. smalltalk.method({
  2816. selector: "nextPutAll:",
  2817. fn: function (aString) {
  2818. var self=this;
  2819. 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", [])])])]);
  2820. 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", [])]))]);
  2821. smalltalk.send(self, "_setStreamSize_", [smalltalk.send(smalltalk.send(self, "_streamSize", []), "_max_", [smalltalk.send(self, "_position", [])])]);
  2822. return self;}
  2823. }),
  2824. smalltalk.StringStream);
  2825. smalltalk.addMethod(
  2826. "_space",
  2827. smalltalk.method({
  2828. selector: "space",
  2829. fn: function () {
  2830. var self=this;
  2831. smalltalk.send(self, "_nextPut_", [" "]);
  2832. return self;}
  2833. }),
  2834. smalltalk.StringStream);