2
0

Kernel-Collections.deploy.js 83 KB

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