Kernel-Collections.deploy.js 82 KB

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