Kernel-Collections.deploy.js 76 KB

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