2
0

Kernel-Collections.js 178 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487
  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. category: 'comparing',
  8. fn: function (anAssociation) {
  9. var self=this;
  10. return smalltalk.withContext(function($ctx1) { var $1;
  11. $1=_st(_st(_st(self)._class()).__eq(_st(anAssociation)._class()))._and_((function(){
  12. return smalltalk.withContext(function($ctx2) { return _st(_st(_st(self)._key()).__eq(_st(anAssociation)._key()))._and_((function(){
  13. return smalltalk.withContext(function($ctx3) { return _st(_st(self)._value()).__eq(_st(anAssociation)._value());
  14. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  15. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  16. return $1;
  17. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation}, smalltalk.Association)});},
  18. args: ["anAssociation"],
  19. source: "= anAssociation\x0a\x09^self class = anAssociation class and: [\x0a\x09 self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value]]",
  20. messageSends: ["and:", "=", "value", "key", "class"],
  21. referencedClasses: []
  22. }),
  23. smalltalk.Association);
  24. smalltalk.addMethod(
  25. "_key",
  26. smalltalk.method({
  27. selector: "key",
  28. category: 'accessing',
  29. fn: function () {
  30. var self=this;
  31. return smalltalk.withContext(function($ctx1) { var $1;
  32. $1=self["@key"];
  33. return $1;
  34. }, function($ctx1) {$ctx1.fill(self,"key",{}, smalltalk.Association)});},
  35. args: [],
  36. source: "key\x0a\x09^key",
  37. messageSends: [],
  38. referencedClasses: []
  39. }),
  40. smalltalk.Association);
  41. smalltalk.addMethod(
  42. "_key_",
  43. smalltalk.method({
  44. selector: "key:",
  45. category: 'accessing',
  46. fn: function (aKey) {
  47. var self=this;
  48. return smalltalk.withContext(function($ctx1) { self["@key"]=aKey;
  49. return self}, function($ctx1) {$ctx1.fill(self,"key:",{aKey:aKey}, smalltalk.Association)});},
  50. args: ["aKey"],
  51. source: "key: aKey\x0a\x09key := aKey",
  52. messageSends: [],
  53. referencedClasses: []
  54. }),
  55. smalltalk.Association);
  56. smalltalk.addMethod(
  57. "_printString",
  58. smalltalk.method({
  59. selector: "printString",
  60. category: 'printing',
  61. fn: function () {
  62. var self=this;
  63. return smalltalk.withContext(function($ctx1) { var $1;
  64. $1=_st((smalltalk.String || String))._streamContents_((function(aStream){
  65. return smalltalk.withContext(function($ctx2) { return _st(self)._storeOn_(aStream);
  66. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})}));
  67. return $1;
  68. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Association)});},
  69. args: [],
  70. source: "printString\x0a\x09\x22print the contents of the Association into a string and return the string\x22\x0a\x09^String streamContents: [:aStream |\x0a\x09\x09self storeOn: aStream]",
  71. messageSends: ["streamContents:", "storeOn:"],
  72. referencedClasses: ["String"]
  73. }),
  74. smalltalk.Association);
  75. smalltalk.addMethod(
  76. "_storeOn_",
  77. smalltalk.method({
  78. selector: "storeOn:",
  79. category: 'printing',
  80. fn: function (aStream) {
  81. var self=this;
  82. return smalltalk.withContext(function($ctx1) { _st(self["@key"])._storeOn_(aStream);
  83. _st(aStream)._nextPutAll_("->");
  84. _st(self["@value"])._storeOn_(aStream);
  85. return self}, function($ctx1) {$ctx1.fill(self,"storeOn:",{aStream:aStream}, smalltalk.Association)});},
  86. args: ["aStream"],
  87. source: "storeOn: aStream\x0a\x09\x22Store in the format: key->value\x22\x0a\x0a\x09key storeOn: aStream.\x0a\x09aStream nextPutAll: '->'.\x0a\x09value storeOn: aStream.",
  88. messageSends: ["storeOn:", "nextPutAll:"],
  89. referencedClasses: []
  90. }),
  91. smalltalk.Association);
  92. smalltalk.addMethod(
  93. "_value",
  94. smalltalk.method({
  95. selector: "value",
  96. category: 'accessing',
  97. fn: function () {
  98. var self=this;
  99. return smalltalk.withContext(function($ctx1) { var $1;
  100. $1=self["@value"];
  101. return $1;
  102. }, function($ctx1) {$ctx1.fill(self,"value",{}, smalltalk.Association)});},
  103. args: [],
  104. source: "value\x0a\x09^value",
  105. messageSends: [],
  106. referencedClasses: []
  107. }),
  108. smalltalk.Association);
  109. smalltalk.addMethod(
  110. "_value_",
  111. smalltalk.method({
  112. selector: "value:",
  113. category: 'accessing',
  114. fn: function (aValue) {
  115. var self=this;
  116. return smalltalk.withContext(function($ctx1) { self["@value"]=aValue;
  117. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aValue:aValue}, smalltalk.Association)});},
  118. args: ["aValue"],
  119. source: "value: aValue\x0a\x09value := aValue",
  120. messageSends: [],
  121. referencedClasses: []
  122. }),
  123. smalltalk.Association);
  124. smalltalk.addMethod(
  125. "_key_value_",
  126. smalltalk.method({
  127. selector: "key:value:",
  128. category: 'instance creation',
  129. fn: function (aKey, aValue) {
  130. var self=this;
  131. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  132. $2=_st(self)._new();
  133. _st($2)._key_(aKey);
  134. _st($2)._value_(aValue);
  135. $3=_st($2)._yourself();
  136. $1=$3;
  137. return $1;
  138. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue}, smalltalk.Association.klass)});},
  139. args: ["aKey", "aValue"],
  140. source: "key: aKey value: aValue\x0a\x09 ^self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  141. messageSends: ["key:", "new", "value:", "yourself"],
  142. referencedClasses: []
  143. }),
  144. smalltalk.Association.klass);
  145. smalltalk.addClass('Collection', smalltalk.Object, [], 'Kernel-Collections');
  146. smalltalk.addMethod(
  147. "__comma",
  148. smalltalk.method({
  149. selector: ",",
  150. category: 'copying',
  151. fn: function (aCollection) {
  152. var self=this;
  153. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  154. $2=_st(self)._copy();
  155. _st($2)._addAll_(aCollection);
  156. $3=_st($2)._yourself();
  157. $1=$3;
  158. return $1;
  159. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection}, smalltalk.Collection)});},
  160. args: ["aCollection"],
  161. source: ", aCollection\x0a\x09^self copy \x0a\x09 addAll: aCollection; \x0a\x09 yourself",
  162. messageSends: ["addAll:", "copy", "yourself"],
  163. referencedClasses: []
  164. }),
  165. smalltalk.Collection);
  166. smalltalk.addMethod(
  167. "_add_",
  168. smalltalk.method({
  169. selector: "add:",
  170. category: 'adding/removing',
  171. fn: function (anObject) {
  172. var self=this;
  173. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  174. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject}, smalltalk.Collection)});},
  175. args: ["anObject"],
  176. source: "add: anObject\x0a\x09self subclassResponsibility",
  177. messageSends: ["subclassResponsibility"],
  178. referencedClasses: []
  179. }),
  180. smalltalk.Collection);
  181. smalltalk.addMethod(
  182. "_addAll_",
  183. smalltalk.method({
  184. selector: "addAll:",
  185. category: 'adding/removing',
  186. fn: function (aCollection) {
  187. var self=this;
  188. return smalltalk.withContext(function($ctx1) { var $1;
  189. _st(aCollection)._do_((function(each){
  190. return smalltalk.withContext(function($ctx2) { return _st(self)._add_(each);
  191. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  192. $1=aCollection;
  193. return $1;
  194. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection}, smalltalk.Collection)});},
  195. args: ["aCollection"],
  196. source: "addAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09 self add: each].\x0a\x09^aCollection",
  197. messageSends: ["do:", "add:"],
  198. referencedClasses: []
  199. }),
  200. smalltalk.Collection);
  201. smalltalk.addMethod(
  202. "_asArray",
  203. smalltalk.method({
  204. selector: "asArray",
  205. category: 'converting',
  206. fn: function () {
  207. var self=this;
  208. return smalltalk.withContext(function($ctx1) { var $1;
  209. $1=_st((smalltalk.Array || Array))._withAll_(self);
  210. return $1;
  211. }, function($ctx1) {$ctx1.fill(self,"asArray",{}, smalltalk.Collection)});},
  212. args: [],
  213. source: "asArray\x0a\x09^Array withAll: self",
  214. messageSends: ["withAll:"],
  215. referencedClasses: ["Array"]
  216. }),
  217. smalltalk.Collection);
  218. smalltalk.addMethod(
  219. "_asJSON",
  220. smalltalk.method({
  221. selector: "asJSON",
  222. category: 'converting',
  223. fn: function () {
  224. var self=this;
  225. return smalltalk.withContext(function($ctx1) { var $1;
  226. $1=_st(_st(self)._asArray())._collect_((function(each){
  227. return smalltalk.withContext(function($ctx2) { return _st(each)._asJSON();
  228. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  229. return $1;
  230. }, function($ctx1) {$ctx1.fill(self,"asJSON",{}, smalltalk.Collection)});},
  231. args: [],
  232. source: "asJSON\x0a\x09^self asArray collect: [:each | each asJSON]",
  233. messageSends: ["collect:", "asJSON", "asArray"],
  234. referencedClasses: []
  235. }),
  236. smalltalk.Collection);
  237. smalltalk.addMethod(
  238. "_asOrderedCollection",
  239. smalltalk.method({
  240. selector: "asOrderedCollection",
  241. category: 'converting',
  242. fn: function () {
  243. var self=this;
  244. return smalltalk.withContext(function($ctx1) { var $1;
  245. $1=_st(self)._asArray();
  246. return $1;
  247. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{}, smalltalk.Collection)});},
  248. args: [],
  249. source: "asOrderedCollection\x0a\x09^self asArray",
  250. messageSends: ["asArray"],
  251. referencedClasses: []
  252. }),
  253. smalltalk.Collection);
  254. smalltalk.addMethod(
  255. "_asSet",
  256. smalltalk.method({
  257. selector: "asSet",
  258. category: 'converting',
  259. fn: function () {
  260. var self=this;
  261. return smalltalk.withContext(function($ctx1) { var $1;
  262. $1=_st((smalltalk.Set || Set))._withAll_(self);
  263. return $1;
  264. }, function($ctx1) {$ctx1.fill(self,"asSet",{}, smalltalk.Collection)});},
  265. args: [],
  266. source: "asSet\x0a\x09^Set withAll: self",
  267. messageSends: ["withAll:"],
  268. referencedClasses: ["Set"]
  269. }),
  270. smalltalk.Collection);
  271. smalltalk.addMethod(
  272. "_collect_",
  273. smalltalk.method({
  274. selector: "collect:",
  275. category: 'enumerating',
  276. fn: function (aBlock) {
  277. var self=this;
  278. var stream;
  279. return smalltalk.withContext(function($ctx1) { var $1;
  280. stream=_st(_st(_st(self)._class())._new())._writeStream();
  281. _st(self)._do_((function(each){
  282. return smalltalk.withContext(function($ctx2) { return _st(stream)._nextPut_(_st(aBlock)._value_(each));
  283. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  284. $1=_st(stream)._contents();
  285. return $1;
  286. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream}, smalltalk.Collection)});},
  287. args: ["aBlock"],
  288. source: "collect: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09stream nextPut: (aBlock value: each) ].\x0a\x09^stream contents",
  289. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"],
  290. referencedClasses: []
  291. }),
  292. smalltalk.Collection);
  293. smalltalk.addMethod(
  294. "_copyWith_",
  295. smalltalk.method({
  296. selector: "copyWith:",
  297. category: 'copying',
  298. fn: function (anObject) {
  299. var self=this;
  300. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  301. $2=_st(self)._copy();
  302. _st($2)._add_(anObject);
  303. $3=_st($2)._yourself();
  304. $1=$3;
  305. return $1;
  306. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject}, smalltalk.Collection)});},
  307. args: ["anObject"],
  308. source: "copyWith: anObject\x0a\x09^self copy add: anObject; yourself",
  309. messageSends: ["add:", "copy", "yourself"],
  310. referencedClasses: []
  311. }),
  312. smalltalk.Collection);
  313. smalltalk.addMethod(
  314. "_copyWithAll_",
  315. smalltalk.method({
  316. selector: "copyWithAll:",
  317. category: 'copying',
  318. fn: function (aCollection) {
  319. var self=this;
  320. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  321. $2=_st(self)._copy();
  322. _st($2)._addAll_(aCollection);
  323. $3=_st($2)._yourself();
  324. $1=$3;
  325. return $1;
  326. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection}, smalltalk.Collection)});},
  327. args: ["aCollection"],
  328. source: "copyWithAll: aCollection\x0a\x09^self copy addAll: aCollection; yourself",
  329. messageSends: ["addAll:", "copy", "yourself"],
  330. referencedClasses: []
  331. }),
  332. smalltalk.Collection);
  333. smalltalk.addMethod(
  334. "_copyWithoutAll_",
  335. smalltalk.method({
  336. selector: "copyWithoutAll:",
  337. category: 'copying',
  338. fn: function (aCollection) {
  339. var self=this;
  340. return smalltalk.withContext(function($ctx1) { var $1;
  341. $1=_st(self)._reject_((function(each){
  342. return smalltalk.withContext(function($ctx2) { return _st(aCollection)._includes_(each);
  343. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  344. return $1;
  345. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection}, smalltalk.Collection)});},
  346. args: ["aCollection"],
  347. source: "copyWithoutAll: aCollection\x0a\x09\x22Answer a copy of the receiver that does not contain any elements \x0a\x09equal to those in aCollection.\x22\x0a\x0a\x09^ self reject: [:each | aCollection includes: each]",
  348. messageSends: ["reject:", "includes:"],
  349. referencedClasses: []
  350. }),
  351. smalltalk.Collection);
  352. smalltalk.addMethod(
  353. "_detect_",
  354. smalltalk.method({
  355. selector: "detect:",
  356. category: 'enumerating',
  357. fn: function (aBlock) {
  358. var self=this;
  359. return smalltalk.withContext(function($ctx1) { var $1;
  360. $1=_st(self)._detect_ifNone_(aBlock,(function(){
  361. return smalltalk.withContext(function($ctx2) { return _st(self)._errorNotFound();
  362. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  363. return $1;
  364. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock}, smalltalk.Collection)});},
  365. args: ["aBlock"],
  366. source: "detect: aBlock\x0a\x09^self detect: aBlock ifNone: [self errorNotFound]",
  367. messageSends: ["detect:ifNone:", "errorNotFound"],
  368. referencedClasses: []
  369. }),
  370. smalltalk.Collection);
  371. smalltalk.addMethod(
  372. "_detect_ifNone_",
  373. smalltalk.method({
  374. selector: "detect:ifNone:",
  375. category: 'enumerating',
  376. fn: function (aBlock, anotherBlock) {
  377. var self=this;
  378. return smalltalk.withContext(function($ctx1) {
  379. for(var i = 0; i < self.length; i++)
  380. if(aBlock(self[i]))
  381. return self[i];
  382. return anotherBlock();
  383. ;
  384. return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.Collection)});},
  385. args: ["aBlock", "anotherBlock"],
  386. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock();\x0a\x09>",
  387. messageSends: [],
  388. referencedClasses: []
  389. }),
  390. smalltalk.Collection);
  391. smalltalk.addMethod(
  392. "_do_",
  393. smalltalk.method({
  394. selector: "do:",
  395. category: 'enumerating',
  396. fn: function (aBlock) {
  397. var self=this;
  398. return smalltalk.withContext(function($ctx1) { for(var i=0;i<self.length;i++){aBlock(self[i]);};
  399. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.Collection)});},
  400. args: ["aBlock"],
  401. source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self[i]);}>",
  402. messageSends: [],
  403. referencedClasses: []
  404. }),
  405. smalltalk.Collection);
  406. smalltalk.addMethod(
  407. "_do_separatedBy_",
  408. smalltalk.method({
  409. selector: "do:separatedBy:",
  410. category: 'enumerating',
  411. fn: function (aBlock, anotherBlock) {
  412. var self=this;
  413. var first;
  414. return smalltalk.withContext(function($ctx1) { var $1,$3,$2;
  415. first=true;
  416. $1=self;
  417. $2=(function(each){
  418. return smalltalk.withContext(function($ctx2) { $3=first;
  419. if(smalltalk.assert($3)){
  420. first=false;
  421. first;
  422. } else {
  423. _st(anotherBlock)._value();
  424. };
  425. return _st(aBlock)._value_(each);
  426. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})});
  427. _st($1)._do_($2);
  428. return self}, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,first:first}, smalltalk.Collection)});},
  429. args: ["aBlock", "anotherBlock"],
  430. source: "do: aBlock separatedBy: anotherBlock\x0a\x09| first |\x0a\x09first := true.\x0a\x09self do: [:each |\x0a\x09 first\x0a\x09\x09ifTrue: [first := false]\x0a\x09\x09ifFalse: [anotherBlock value].\x0a\x09 aBlock value: each]",
  431. messageSends: ["do:", "ifTrue:ifFalse:", "value", "value:"],
  432. referencedClasses: []
  433. }),
  434. smalltalk.Collection);
  435. smalltalk.addMethod(
  436. "_errorNotFound",
  437. smalltalk.method({
  438. selector: "errorNotFound",
  439. category: 'error handling',
  440. fn: function () {
  441. var self=this;
  442. return smalltalk.withContext(function($ctx1) { _st(self)._error_("Object is not in the collection");
  443. return self}, function($ctx1) {$ctx1.fill(self,"errorNotFound",{}, smalltalk.Collection)});},
  444. args: [],
  445. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  446. messageSends: ["error:"],
  447. referencedClasses: []
  448. }),
  449. smalltalk.Collection);
  450. smalltalk.addMethod(
  451. "_ifEmpty_",
  452. smalltalk.method({
  453. selector: "ifEmpty:",
  454. category: 'testing',
  455. fn: function (aBlock) {
  456. var self=this;
  457. return smalltalk.withContext(function($ctx1) { var $2,$1;
  458. $2=_st(self)._isEmpty();
  459. if(smalltalk.assert($2)){
  460. $1=_st(aBlock)._value();
  461. } else {
  462. $1=self;
  463. };
  464. return $1;
  465. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock}, smalltalk.Collection)});},
  466. args: ["aBlock"],
  467. source: "ifEmpty: aBlock\x0a\x09\x22Evaluate the given block with the receiver as argument, answering its value if the receiver is empty, otherwise answer the receiver. Note that the fact that this method returns its argument in case the receiver is not empty allows one to write expressions like the following ones: self classifyMethodAs: \x0a\x09\x09(myProtocol ifEmpty: ['As yet unclassified'])\x22\x0a\x09^ self isEmpty \x0a\x09\x09ifTrue: [ aBlock value ]\x0a\x09\x09ifFalse: [ self ]",
  468. messageSends: ["ifTrue:ifFalse:", "value", "isEmpty"],
  469. referencedClasses: []
  470. }),
  471. smalltalk.Collection);
  472. smalltalk.addMethod(
  473. "_ifNotEmpty_",
  474. smalltalk.method({
  475. selector: "ifNotEmpty:",
  476. category: 'testing',
  477. fn: function (aBlock) {
  478. var self=this;
  479. return smalltalk.withContext(function($ctx1) { var $1;
  480. $1=_st(self)._notEmpty();
  481. _st($1)._ifTrue_(aBlock);
  482. return self}, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock}, smalltalk.Collection)});},
  483. args: ["aBlock"],
  484. source: "ifNotEmpty: aBlock\x0a\x09self notEmpty ifTrue: aBlock.",
  485. messageSends: ["ifTrue:", "notEmpty"],
  486. referencedClasses: []
  487. }),
  488. smalltalk.Collection);
  489. smalltalk.addMethod(
  490. "_includes_",
  491. smalltalk.method({
  492. selector: "includes:",
  493. category: 'testing',
  494. fn: function (anObject) {
  495. var self=this;
  496. var sentinel;
  497. return smalltalk.withContext(function($ctx1) { var $1;
  498. sentinel=_st((smalltalk.Object || Object))._new();
  499. $1=_st(_st(self)._detect_ifNone_((function(each){
  500. return smalltalk.withContext(function($ctx2) { return _st(each).__eq(anObject);
  501. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  502. return smalltalk.withContext(function($ctx2) { return sentinel;
  503. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__tild_eq(sentinel);
  504. return $1;
  505. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,sentinel:sentinel}, smalltalk.Collection)});},
  506. args: ["anObject"],
  507. source: "includes: anObject\x0a\x09| sentinel |\x0a sentinel := Object new.\x0a ^(self detect: [ :each | each = anObject] ifNone: [ sentinel ]) ~= sentinel",
  508. messageSends: ["new", "~=", "detect:ifNone:", "="],
  509. referencedClasses: ["Object"]
  510. }),
  511. smalltalk.Collection);
  512. smalltalk.addMethod(
  513. "_inject_into_",
  514. smalltalk.method({
  515. selector: "inject:into:",
  516. category: 'enumerating',
  517. fn: function (anObject, aBlock) {
  518. var self=this;
  519. var result;
  520. return smalltalk.withContext(function($ctx1) { var $1;
  521. result=anObject;
  522. _st(self)._do_((function(each){
  523. return smalltalk.withContext(function($ctx2) { result=_st(aBlock)._value_value_(result,each);
  524. return result;
  525. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  526. $1=result;
  527. return $1;
  528. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result}, smalltalk.Collection)});},
  529. args: ["anObject", "aBlock"],
  530. source: "inject: anObject into: aBlock\x0a\x09| result |\x0a\x09result := anObject.\x0a\x09self do: [:each | \x0a\x09 result := aBlock value: result value: each].\x0a\x09^result",
  531. messageSends: ["do:", "value:value:"],
  532. referencedClasses: []
  533. }),
  534. smalltalk.Collection);
  535. smalltalk.addMethod(
  536. "_intersection_",
  537. smalltalk.method({
  538. selector: "intersection:",
  539. category: 'enumerating',
  540. fn: function (aCollection) {
  541. var self=this;
  542. var set,outputSet;
  543. return smalltalk.withContext(function($ctx1) { var $1,$3,$2,$4;
  544. set=_st(self)._asSet();
  545. outputSet=_st((smalltalk.Set || Set))._new();
  546. $1=aCollection;
  547. $2=(function(each){
  548. return smalltalk.withContext(function($ctx2) { $3=_st(_st(set)._includes_(each))._and_((function(){
  549. return smalltalk.withContext(function($ctx3) { return _st(_st(outputSet)._includes_(each))._not();
  550. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  551. if(smalltalk.assert($3)){
  552. return _st(outputSet)._add_(each);
  553. };
  554. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})});
  555. _st($1)._do_($2);
  556. $4=_st(_st(self)._class())._withAll_(_st(outputSet)._asArray());
  557. return $4;
  558. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet}, smalltalk.Collection)});},
  559. args: ["aCollection"],
  560. source: "intersection: aCollection\x0a\x09\x22Answer the set theoretic intersection of two collections.\x22\x0a\x0a\x09| set outputSet |\x0a\x09\x0a\x09set := self asSet.\x0a\x09outputSet := Set new.\x0a\x09\x0a\x09aCollection do: [ :each |\x0a\x09\x09((set includes: each) and: [(outputSet includes: each) not])\x0a\x09\x09\x09ifTrue: [ \x0a\x09\x09\x09\x09outputSet add: each]].\x0a\x09\x09\x0a\x09^ self class withAll: outputSet asArray",
  561. messageSends: ["asSet", "new", "do:", "ifTrue:", "add:", "and:", "not", "includes:", "withAll:", "asArray", "class"],
  562. referencedClasses: ["Set"]
  563. }),
  564. smalltalk.Collection);
  565. smalltalk.addMethod(
  566. "_isEmpty",
  567. smalltalk.method({
  568. selector: "isEmpty",
  569. category: 'testing',
  570. fn: function () {
  571. var self=this;
  572. return smalltalk.withContext(function($ctx1) { var $1;
  573. $1=_st(_st(self)._size()).__eq((0));
  574. return $1;
  575. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{}, smalltalk.Collection)});},
  576. args: [],
  577. source: "isEmpty\x0a\x09^self size = 0",
  578. messageSends: ["=", "size"],
  579. referencedClasses: []
  580. }),
  581. smalltalk.Collection);
  582. smalltalk.addMethod(
  583. "_notEmpty",
  584. smalltalk.method({
  585. selector: "notEmpty",
  586. category: 'testing',
  587. fn: function () {
  588. var self=this;
  589. return smalltalk.withContext(function($ctx1) { var $1;
  590. $1=_st(_st(self)._isEmpty())._not();
  591. return $1;
  592. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{}, smalltalk.Collection)});},
  593. args: [],
  594. source: "notEmpty\x0a\x09^self isEmpty not",
  595. messageSends: ["not", "isEmpty"],
  596. referencedClasses: []
  597. }),
  598. smalltalk.Collection);
  599. smalltalk.addMethod(
  600. "_occurrencesOf_",
  601. smalltalk.method({
  602. selector: "occurrencesOf:",
  603. category: 'accessing',
  604. fn: function (anObject) {
  605. var self=this;
  606. var tally;
  607. return smalltalk.withContext(function($ctx1) { var $1,$3,$2,$4;
  608. tally=(0);
  609. $1=self;
  610. $2=(function(each){
  611. return smalltalk.withContext(function($ctx2) { $3=_st(anObject).__eq(each);
  612. if(smalltalk.assert($3)){
  613. tally=_st(tally).__plus((1));
  614. return tally;
  615. };
  616. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})});
  617. _st($1)._do_($2);
  618. $4=tally;
  619. return $4;
  620. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally}, smalltalk.Collection)});},
  621. args: ["anObject"],
  622. source: "occurrencesOf: anObject \x0a\x09\x22Answer how many of the receiver's elements are equal to anObject.\x22\x0a\x0a\x09| tally |\x0a\x09tally := 0.\x0a\x09self do: [:each | anObject = each ifTrue: [tally := tally + 1]].\x0a\x09^tally",
  623. messageSends: ["do:", "ifTrue:", "+", "="],
  624. referencedClasses: []
  625. }),
  626. smalltalk.Collection);
  627. smalltalk.addMethod(
  628. "_printString",
  629. smalltalk.method({
  630. selector: "printString",
  631. category: 'printing',
  632. fn: function () {
  633. var self=this;
  634. return smalltalk.withContext(function($ctx1) { var $1;
  635. $1=_st((smalltalk.String || String))._streamContents_((function(aStream){
  636. return smalltalk.withContext(function($ctx2) { _st(aStream)._nextPutAll_(_st(smalltalk.Object.fn.prototype._printString.apply(_st(self), [])).__comma(" ("));
  637. _st(self)._do_separatedBy_((function(each){
  638. return smalltalk.withContext(function($ctx3) { return _st(aStream)._nextPutAll_(_st(each)._printString());
  639. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  640. return smalltalk.withContext(function($ctx3) { return _st(aStream)._nextPutAll_(" ");
  641. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  642. return _st(aStream)._nextPutAll_(")");
  643. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})}));
  644. return $1;
  645. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Collection)});},
  646. args: [],
  647. source: "printString\x0a\x09\x22print the contents of the Collection into a string and return it\x22\x0a\x09^String streamContents: [:aStream |\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: super printString, ' ('.\x0a\x09\x09self do: [:each | aStream nextPutAll: each printString]\x0a\x09\x09\x09separatedBy: [aStream nextPutAll: ' '].\x0a\x09\x09aStream nextPutAll: ')']",
  648. messageSends: ["streamContents:", "nextPutAll:", ",", "printString", "do:separatedBy:"],
  649. referencedClasses: ["String"]
  650. }),
  651. smalltalk.Collection);
  652. smalltalk.addMethod(
  653. "_readStream",
  654. smalltalk.method({
  655. selector: "readStream",
  656. category: 'accessing',
  657. fn: function () {
  658. var self=this;
  659. return smalltalk.withContext(function($ctx1) { var $1;
  660. $1=_st(self)._stream();
  661. return $1;
  662. }, function($ctx1) {$ctx1.fill(self,"readStream",{}, smalltalk.Collection)});},
  663. args: [],
  664. source: "readStream\x0a\x09^self stream",
  665. messageSends: ["stream"],
  666. referencedClasses: []
  667. }),
  668. smalltalk.Collection);
  669. smalltalk.addMethod(
  670. "_reject_",
  671. smalltalk.method({
  672. selector: "reject:",
  673. category: 'enumerating',
  674. fn: function (aBlock) {
  675. var self=this;
  676. return smalltalk.withContext(function($ctx1) { var $1;
  677. $1=_st(self)._select_((function(each){
  678. return smalltalk.withContext(function($ctx2) { return _st(_st(aBlock)._value_(each)).__eq(false);
  679. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  680. return $1;
  681. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock}, smalltalk.Collection)});},
  682. args: ["aBlock"],
  683. source: "reject: aBlock\x0a\x09^self select: [:each | (aBlock value: each) = false]",
  684. messageSends: ["select:", "=", "value:"],
  685. referencedClasses: []
  686. }),
  687. smalltalk.Collection);
  688. smalltalk.addMethod(
  689. "_remove_",
  690. smalltalk.method({
  691. selector: "remove:",
  692. category: 'adding/removing',
  693. fn: function (anObject) {
  694. var self=this;
  695. return smalltalk.withContext(function($ctx1) { var $1;
  696. $1=_st(self)._remove_ifAbsent_(anObject,(function(){
  697. return smalltalk.withContext(function($ctx2) { return _st(self)._errorNotFound();
  698. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  699. return $1;
  700. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject}, smalltalk.Collection)});},
  701. args: ["anObject"],
  702. source: "remove: anObject\x0a ^self remove: anObject ifAbsent: [self errorNotFound]",
  703. messageSends: ["remove:ifAbsent:", "errorNotFound"],
  704. referencedClasses: []
  705. }),
  706. smalltalk.Collection);
  707. smalltalk.addMethod(
  708. "_remove_ifAbsent_",
  709. smalltalk.method({
  710. selector: "remove:ifAbsent:",
  711. category: 'adding/removing',
  712. fn: function (anObject, aBlock) {
  713. var self=this;
  714. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  715. return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock}, smalltalk.Collection)});},
  716. args: ["anObject", "aBlock"],
  717. source: "remove: anObject ifAbsent: aBlock\x0a self subclassResponsibility",
  718. messageSends: ["subclassResponsibility"],
  719. referencedClasses: []
  720. }),
  721. smalltalk.Collection);
  722. smalltalk.addMethod(
  723. "_select_",
  724. smalltalk.method({
  725. selector: "select:",
  726. category: 'enumerating',
  727. fn: function (aBlock) {
  728. var self=this;
  729. var stream;
  730. return smalltalk.withContext(function($ctx1) { var $1,$3,$2,$4;
  731. stream=_st(_st(_st(self)._class())._new())._writeStream();
  732. $1=self;
  733. $2=(function(each){
  734. return smalltalk.withContext(function($ctx2) { $3=_st(aBlock)._value_(each);
  735. if(smalltalk.assert($3)){
  736. return _st(stream)._nextPut_(each);
  737. };
  738. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})});
  739. _st($1)._do_($2);
  740. $4=_st(stream)._contents();
  741. return $4;
  742. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream}, smalltalk.Collection)});},
  743. args: ["aBlock"],
  744. source: "select: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [:each |\x0a\x09 (aBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: each]].\x0a\x09^stream contents",
  745. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "nextPut:", "value:", "contents"],
  746. referencedClasses: []
  747. }),
  748. smalltalk.Collection);
  749. smalltalk.addMethod(
  750. "_size",
  751. smalltalk.method({
  752. selector: "size",
  753. category: 'accessing',
  754. fn: function () {
  755. var self=this;
  756. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  757. return self}, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Collection)});},
  758. args: [],
  759. source: "size\x0a\x09self subclassResponsibility",
  760. messageSends: ["subclassResponsibility"],
  761. referencedClasses: []
  762. }),
  763. smalltalk.Collection);
  764. smalltalk.addMethod(
  765. "_stream",
  766. smalltalk.method({
  767. selector: "stream",
  768. category: 'accessing',
  769. fn: function () {
  770. var self=this;
  771. return smalltalk.withContext(function($ctx1) { var $1;
  772. $1=_st(_st(self)._streamClass())._on_(self);
  773. return $1;
  774. }, function($ctx1) {$ctx1.fill(self,"stream",{}, smalltalk.Collection)});},
  775. args: [],
  776. source: "stream\x0a\x09^self streamClass on: self",
  777. messageSends: ["on:", "streamClass"],
  778. referencedClasses: []
  779. }),
  780. smalltalk.Collection);
  781. smalltalk.addMethod(
  782. "_streamClass",
  783. smalltalk.method({
  784. selector: "streamClass",
  785. category: 'accessing',
  786. fn: function () {
  787. var self=this;
  788. return smalltalk.withContext(function($ctx1) { var $1;
  789. $1=_st(_st(self)._class())._streamClass();
  790. return $1;
  791. }, function($ctx1) {$ctx1.fill(self,"streamClass",{}, smalltalk.Collection)});},
  792. args: [],
  793. source: "streamClass\x0a\x09^self class streamClass",
  794. messageSends: ["streamClass", "class"],
  795. referencedClasses: []
  796. }),
  797. smalltalk.Collection);
  798. smalltalk.addMethod(
  799. "_writeStream",
  800. smalltalk.method({
  801. selector: "writeStream",
  802. category: 'accessing',
  803. fn: function () {
  804. var self=this;
  805. return smalltalk.withContext(function($ctx1) { var $1;
  806. $1=_st(self)._stream();
  807. return $1;
  808. }, function($ctx1) {$ctx1.fill(self,"writeStream",{}, smalltalk.Collection)});},
  809. args: [],
  810. source: "writeStream\x0a\x09^self stream",
  811. messageSends: ["stream"],
  812. referencedClasses: []
  813. }),
  814. smalltalk.Collection);
  815. smalltalk.addMethod(
  816. "_new_",
  817. smalltalk.method({
  818. selector: "new:",
  819. category: 'instance creation',
  820. fn: function (anInteger) {
  821. var self=this;
  822. return smalltalk.withContext(function($ctx1) { var $1;
  823. $1=_st(self)._new();
  824. return $1;
  825. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger}, smalltalk.Collection.klass)});},
  826. args: ["anInteger"],
  827. source: "new: anInteger\x0a\x09^self new",
  828. messageSends: ["new"],
  829. referencedClasses: []
  830. }),
  831. smalltalk.Collection.klass);
  832. smalltalk.addMethod(
  833. "_streamClass",
  834. smalltalk.method({
  835. selector: "streamClass",
  836. category: 'accessing',
  837. fn: function () {
  838. var self=this;
  839. return smalltalk.withContext(function($ctx1) { var $1;
  840. $1=(smalltalk.Stream || Stream);
  841. return $1;
  842. }, function($ctx1) {$ctx1.fill(self,"streamClass",{}, smalltalk.Collection.klass)});},
  843. args: [],
  844. source: "streamClass\x0a\x09 ^Stream",
  845. messageSends: [],
  846. referencedClasses: ["Stream"]
  847. }),
  848. smalltalk.Collection.klass);
  849. smalltalk.addMethod(
  850. "_with_",
  851. smalltalk.method({
  852. selector: "with:",
  853. category: 'instance creation',
  854. fn: function (anObject) {
  855. var self=this;
  856. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  857. $2=_st(self)._new();
  858. _st($2)._add_(anObject);
  859. $3=_st($2)._yourself();
  860. $1=$3;
  861. return $1;
  862. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject}, smalltalk.Collection.klass)});},
  863. args: ["anObject"],
  864. source: "with: anObject\x0a\x09 ^self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  865. messageSends: ["add:", "new", "yourself"],
  866. referencedClasses: []
  867. }),
  868. smalltalk.Collection.klass);
  869. smalltalk.addMethod(
  870. "_with_with_",
  871. smalltalk.method({
  872. selector: "with:with:",
  873. category: 'instance creation',
  874. fn: function (anObject, anotherObject) {
  875. var self=this;
  876. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  877. $2=_st(self)._new();
  878. _st($2)._add_(anObject);
  879. _st($2)._add_(anotherObject);
  880. $3=_st($2)._yourself();
  881. $1=$3;
  882. return $1;
  883. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject}, smalltalk.Collection.klass)});},
  884. args: ["anObject", "anotherObject"],
  885. source: "with: anObject with: anotherObject\x0a\x09 ^self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  886. messageSends: ["add:", "new", "yourself"],
  887. referencedClasses: []
  888. }),
  889. smalltalk.Collection.klass);
  890. smalltalk.addMethod(
  891. "_with_with_with_",
  892. smalltalk.method({
  893. selector: "with:with:with:",
  894. category: 'instance creation',
  895. fn: function (firstObject, secondObject, thirdObject) {
  896. var self=this;
  897. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  898. $2=_st(self)._new();
  899. _st($2)._add_(firstObject);
  900. _st($2)._add_(secondObject);
  901. _st($2)._add_(thirdObject);
  902. $3=_st($2)._yourself();
  903. $1=$3;
  904. return $1;
  905. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject}, smalltalk.Collection.klass)});},
  906. args: ["firstObject", "secondObject", "thirdObject"],
  907. source: "with: firstObject with: secondObject with: thirdObject\x0a\x09 ^self new\x0a\x09\x09add: firstObject;\x0a\x09\x09add: secondObject;\x0a\x09\x09add: thirdObject;\x0a\x09\x09yourself",
  908. messageSends: ["add:", "new", "yourself"],
  909. referencedClasses: []
  910. }),
  911. smalltalk.Collection.klass);
  912. smalltalk.addMethod(
  913. "_withAll_",
  914. smalltalk.method({
  915. selector: "withAll:",
  916. category: 'instance creation',
  917. fn: function (aCollection) {
  918. var self=this;
  919. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  920. $2=_st(self)._new();
  921. _st($2)._addAll_(aCollection);
  922. $3=_st($2)._yourself();
  923. $1=$3;
  924. return $1;
  925. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection}, smalltalk.Collection.klass)});},
  926. args: ["aCollection"],
  927. source: "withAll: aCollection\x0a\x09 ^self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  928. messageSends: ["addAll:", "new", "yourself"],
  929. referencedClasses: []
  930. }),
  931. smalltalk.Collection.klass);
  932. smalltalk.addClass('HashedCollection', smalltalk.Collection, [], 'Kernel-Collections');
  933. smalltalk.HashedCollection.comment="A HashedCollection is a traditional JavaScript object, or a Smalltalk Dictionary.\x0a\x0aUnlike a Dictionary, it can only have strings as keys."
  934. smalltalk.addMethod(
  935. "__comma",
  936. smalltalk.method({
  937. selector: ",",
  938. category: 'copying',
  939. fn: function (aCollection) {
  940. var self=this;
  941. return smalltalk.withContext(function($ctx1) { _st(self)._shouldNotImplement();
  942. return self}, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection}, smalltalk.HashedCollection)});},
  943. args: ["aCollection"],
  944. source: ", aCollection\x0a\x09self shouldNotImplement",
  945. messageSends: ["shouldNotImplement"],
  946. referencedClasses: []
  947. }),
  948. smalltalk.HashedCollection);
  949. smalltalk.addMethod(
  950. "__eq",
  951. smalltalk.method({
  952. selector: "=",
  953. category: 'comparing',
  954. fn: function (aHashedCollection) {
  955. var self=this;
  956. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  957. $1=_st(_st(self)._class()).__eq(_st(aHashedCollection)._class());
  958. if(! smalltalk.assert($1)){
  959. return false;
  960. };
  961. $2=_st(_st(self)._size()).__eq(_st(aHashedCollection)._size());
  962. if(! smalltalk.assert($2)){
  963. return false;
  964. };
  965. $3=_st(_st(self)._associations()).__eq(_st(aHashedCollection)._associations());
  966. return $3;
  967. }, function($ctx1) {$ctx1.fill(self,"=",{aHashedCollection:aHashedCollection}, smalltalk.HashedCollection)});},
  968. args: ["aHashedCollection"],
  969. source: "= aHashedCollection\x0a\x09self class = aHashedCollection class ifFalse: [^false].\x0a\x09self size = aHashedCollection size ifFalse: [^false].\x0a\x09^self associations = aHashedCollection associations",
  970. messageSends: ["ifFalse:", "=", "class", "size", "associations"],
  971. referencedClasses: []
  972. }),
  973. smalltalk.HashedCollection);
  974. smalltalk.addMethod(
  975. "_add_",
  976. smalltalk.method({
  977. selector: "add:",
  978. category: 'adding/removing',
  979. fn: function (anAssociation) {
  980. var self=this;
  981. return smalltalk.withContext(function($ctx1) { _st(self)._at_put_(_st(anAssociation)._key(),_st(anAssociation)._value());
  982. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation}, smalltalk.HashedCollection)});},
  983. args: ["anAssociation"],
  984. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  985. messageSends: ["at:put:", "key", "value"],
  986. referencedClasses: []
  987. }),
  988. smalltalk.HashedCollection);
  989. smalltalk.addMethod(
  990. "_addAll_",
  991. smalltalk.method({
  992. selector: "addAll:",
  993. category: 'adding/removing',
  994. fn: function (aHashedCollection) {
  995. var self=this;
  996. return smalltalk.withContext(function($ctx1) { var $1;
  997. smalltalk.Collection.fn.prototype._addAll_.apply(_st(self), [_st(aHashedCollection)._associations()]);
  998. $1=aHashedCollection;
  999. return $1;
  1000. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aHashedCollection:aHashedCollection}, smalltalk.HashedCollection)});},
  1001. args: ["aHashedCollection"],
  1002. source: "addAll: aHashedCollection\x0a\x09super addAll: aHashedCollection associations.\x0a\x09^aHashedCollection",
  1003. messageSends: ["addAll:", "associations"],
  1004. referencedClasses: []
  1005. }),
  1006. smalltalk.HashedCollection);
  1007. smalltalk.addMethod(
  1008. "_asDictionary",
  1009. smalltalk.method({
  1010. selector: "asDictionary",
  1011. category: 'converting',
  1012. fn: function () {
  1013. var self=this;
  1014. return smalltalk.withContext(function($ctx1) { var $1;
  1015. $1=_st((smalltalk.Dictionary || Dictionary))._fromPairs_(_st(self)._associations());
  1016. return $1;
  1017. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{}, smalltalk.HashedCollection)});},
  1018. args: [],
  1019. source: "asDictionary\x0a\x09^Dictionary fromPairs: self associations",
  1020. messageSends: ["fromPairs:", "associations"],
  1021. referencedClasses: ["Dictionary"]
  1022. }),
  1023. smalltalk.HashedCollection);
  1024. smalltalk.addMethod(
  1025. "_asJSON",
  1026. smalltalk.method({
  1027. selector: "asJSON",
  1028. category: 'converting',
  1029. fn: function () {
  1030. var self=this;
  1031. var c;
  1032. return smalltalk.withContext(function($ctx1) { var $1;
  1033. c=_st(_st(self)._class())._new();
  1034. _st(self)._keysAndValuesDo_((function(key,value){
  1035. return smalltalk.withContext(function($ctx2) { return _st(c)._at_put_(key,_st(value)._asJSON());
  1036. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  1037. $1=c;
  1038. return $1;
  1039. }, function($ctx1) {$ctx1.fill(self,"asJSON",{c:c}, smalltalk.HashedCollection)});},
  1040. args: [],
  1041. source: "asJSON\x0a\x09| c |\x0a\x09c := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09c at: key put: value asJSON].\x0a\x09^c",
  1042. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "asJSON"],
  1043. referencedClasses: []
  1044. }),
  1045. smalltalk.HashedCollection);
  1046. smalltalk.addMethod(
  1047. "_associations",
  1048. smalltalk.method({
  1049. selector: "associations",
  1050. category: 'accessing',
  1051. fn: function () {
  1052. var self=this;
  1053. var associations;
  1054. return smalltalk.withContext(function($ctx1) { var $1;
  1055. associations=[];
  1056. _st(_st(self)._keys())._do_((function(each){
  1057. return smalltalk.withContext(function($ctx2) { return _st(associations)._add_(_st((smalltalk.Association || Association))._key_value_(each,_st(self)._at_(each)));
  1058. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1059. $1=associations;
  1060. return $1;
  1061. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations}, smalltalk.HashedCollection)});},
  1062. args: [],
  1063. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self keys do: [:each |\x0a\x09 associations add: (Association key: each value: (self at: each))].\x0a\x09^associations",
  1064. messageSends: ["do:", "add:", "key:value:", "at:", "keys"],
  1065. referencedClasses: ["Association"]
  1066. }),
  1067. smalltalk.HashedCollection);
  1068. smalltalk.addMethod(
  1069. "_associationsDo_",
  1070. smalltalk.method({
  1071. selector: "associationsDo:",
  1072. category: 'enumerating',
  1073. fn: function (aBlock) {
  1074. var self=this;
  1075. return smalltalk.withContext(function($ctx1) { _st(_st(self)._associations())._do_(aBlock);
  1076. return self}, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock}, smalltalk.HashedCollection)});},
  1077. args: ["aBlock"],
  1078. source: "associationsDo: aBlock\x0a\x09self associations do: aBlock",
  1079. messageSends: ["do:", "associations"],
  1080. referencedClasses: []
  1081. }),
  1082. smalltalk.HashedCollection);
  1083. smalltalk.addMethod(
  1084. "_at_",
  1085. smalltalk.method({
  1086. selector: "at:",
  1087. category: 'accessing',
  1088. fn: function (aKey) {
  1089. var self=this;
  1090. return smalltalk.withContext(function($ctx1) { var $1;
  1091. $1=_st(self)._at_ifAbsent_(aKey,(function(){
  1092. return smalltalk.withContext(function($ctx2) { return _st(self)._errorNotFound();
  1093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1094. return $1;
  1095. }, function($ctx1) {$ctx1.fill(self,"at:",{aKey:aKey}, smalltalk.HashedCollection)});},
  1096. args: ["aKey"],
  1097. source: "at: aKey\x0a\x09^self at: aKey ifAbsent: [self errorNotFound]",
  1098. messageSends: ["at:ifAbsent:", "errorNotFound"],
  1099. referencedClasses: []
  1100. }),
  1101. smalltalk.HashedCollection);
  1102. smalltalk.addMethod(
  1103. "_at_ifAbsent_",
  1104. smalltalk.method({
  1105. selector: "at:ifAbsent:",
  1106. category: 'accessing',
  1107. fn: function (aKey, aBlock) {
  1108. var self=this;
  1109. return smalltalk.withContext(function($ctx1) { var $2,$1;
  1110. $2=_st(self)._includesKey_(aKey);
  1111. $1=_st($2)._ifTrue_ifFalse_((function(){
  1112. return smalltalk.withContext(function($ctx2) { return _st(self)._basicAt_(aKey);
  1113. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock);
  1114. return $1;
  1115. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock}, smalltalk.HashedCollection)});},
  1116. args: ["aKey", "aBlock"],
  1117. source: "at: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [self basicAt: aKey]\x0a\x09\x09ifFalse: aBlock",
  1118. messageSends: ["ifTrue:ifFalse:", "basicAt:", "includesKey:"],
  1119. referencedClasses: []
  1120. }),
  1121. smalltalk.HashedCollection);
  1122. smalltalk.addMethod(
  1123. "_at_ifAbsentPut_",
  1124. smalltalk.method({
  1125. selector: "at:ifAbsentPut:",
  1126. category: 'accessing',
  1127. fn: function (aKey, aBlock) {
  1128. var self=this;
  1129. return smalltalk.withContext(function($ctx1) { var $1;
  1130. $1=_st(self)._at_ifAbsent_(aKey,(function(){
  1131. return smalltalk.withContext(function($ctx2) { return _st(self)._at_put_(aKey,_st(aBlock)._value());
  1132. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1133. return $1;
  1134. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock}, smalltalk.HashedCollection)});},
  1135. args: ["aKey", "aBlock"],
  1136. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^self at: aKey ifAbsent: [\x0a\x09 self at: aKey put: aBlock value]",
  1137. messageSends: ["at:ifAbsent:", "at:put:", "value"],
  1138. referencedClasses: []
  1139. }),
  1140. smalltalk.HashedCollection);
  1141. smalltalk.addMethod(
  1142. "_at_ifPresent_",
  1143. smalltalk.method({
  1144. selector: "at:ifPresent:",
  1145. category: 'accessing',
  1146. fn: function (aKey, aBlock) {
  1147. var self=this;
  1148. return smalltalk.withContext(function($ctx1) { var $2,$1;
  1149. $2=_st(self)._includesKey_(aKey);
  1150. if(smalltalk.assert($2)){
  1151. $1=_st(aBlock)._value_(_st(self)._at_(aKey));
  1152. } else {
  1153. $1=nil;
  1154. };
  1155. return $1;
  1156. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aKey:aKey,aBlock:aBlock}, smalltalk.HashedCollection)});},
  1157. args: ["aKey", "aBlock"],
  1158. source: "at: aKey ifPresent: aBlock\x0a\x09\x22Lookup the given key in the receiver. \x0a\x09If it is present, answer the value of evaluating the given block with the value associated with the key. \x0a\x09Otherwise, answer nil.\x22\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: [ nil ]",
  1159. messageSends: ["ifTrue:ifFalse:", "value:", "at:", "includesKey:"],
  1160. referencedClasses: []
  1161. }),
  1162. smalltalk.HashedCollection);
  1163. smalltalk.addMethod(
  1164. "_at_ifPresent_ifAbsent_",
  1165. smalltalk.method({
  1166. selector: "at:ifPresent:ifAbsent:",
  1167. category: 'accessing',
  1168. fn: function (aKey, aBlock, anotherBlock) {
  1169. var self=this;
  1170. return smalltalk.withContext(function($ctx1) { var $2,$1;
  1171. $2=_st(self)._includesKey_(aKey);
  1172. $1=_st($2)._ifTrue_ifFalse_((function(){
  1173. return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_(_st(self)._at_(aKey));
  1174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),anotherBlock);
  1175. return $1;
  1176. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.HashedCollection)});},
  1177. args: ["aKey", "aBlock", "anotherBlock"],
  1178. source: "at: aKey ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given key in the receiver. \x0a\x09If it is present, answer the value of evaluating the oneArgBlock with the value associated with the key, \x0a\x09otherwise answer the value of absentBlock.\x22\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: anotherBlock",
  1179. messageSends: ["ifTrue:ifFalse:", "value:", "at:", "includesKey:"],
  1180. referencedClasses: []
  1181. }),
  1182. smalltalk.HashedCollection);
  1183. smalltalk.addMethod(
  1184. "_at_put_",
  1185. smalltalk.method({
  1186. selector: "at:put:",
  1187. category: 'accessing',
  1188. fn: function (aKey, aValue) {
  1189. var self=this;
  1190. return smalltalk.withContext(function($ctx1) { var $1;
  1191. $1=_st(self)._basicAt_put_(aKey,aValue);
  1192. return $1;
  1193. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue}, smalltalk.HashedCollection)});},
  1194. args: ["aKey", "aValue"],
  1195. source: "at: aKey put: aValue\x0a\x09^self basicAt: aKey put: aValue",
  1196. messageSends: ["basicAt:put:"],
  1197. referencedClasses: []
  1198. }),
  1199. smalltalk.HashedCollection);
  1200. smalltalk.addMethod(
  1201. "_collect_",
  1202. smalltalk.method({
  1203. selector: "collect:",
  1204. category: 'enumerating',
  1205. fn: function (aBlock) {
  1206. var self=this;
  1207. var newDict;
  1208. return smalltalk.withContext(function($ctx1) { var $1;
  1209. newDict=_st(_st(self)._class())._new();
  1210. _st(self)._keysAndValuesDo_((function(key,value){
  1211. return smalltalk.withContext(function($ctx2) { return _st(newDict)._at_put_(key,_st(aBlock)._value_(value));
  1212. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  1213. $1=newDict;
  1214. return $1;
  1215. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict}, smalltalk.HashedCollection)});},
  1216. args: ["aBlock"],
  1217. source: "collect: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09 newDict at: key put: (aBlock value: value)].\x0a\x09^newDict",
  1218. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"],
  1219. referencedClasses: []
  1220. }),
  1221. smalltalk.HashedCollection);
  1222. smalltalk.addMethod(
  1223. "_copyFrom_to_",
  1224. smalltalk.method({
  1225. selector: "copyFrom:to:",
  1226. category: 'copying',
  1227. fn: function (anIndex, anotherIndex) {
  1228. var self=this;
  1229. return smalltalk.withContext(function($ctx1) { _st(self)._shouldNotImplement();
  1230. return self}, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex}, smalltalk.HashedCollection)});},
  1231. args: ["anIndex", "anotherIndex"],
  1232. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self shouldNotImplement",
  1233. messageSends: ["shouldNotImplement"],
  1234. referencedClasses: []
  1235. }),
  1236. smalltalk.HashedCollection);
  1237. smalltalk.addMethod(
  1238. "_deepCopy",
  1239. smalltalk.method({
  1240. selector: "deepCopy",
  1241. category: 'copying',
  1242. fn: function () {
  1243. var self=this;
  1244. var copy;
  1245. return smalltalk.withContext(function($ctx1) { var $1;
  1246. copy=_st(_st(self)._class())._new();
  1247. _st(self)._associationsDo_((function(each){
  1248. return smalltalk.withContext(function($ctx2) { return _st(copy)._at_put_(_st(each)._key(),_st(_st(each)._value())._deepCopy());
  1249. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1250. $1=copy;
  1251. return $1;
  1252. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy}, smalltalk.HashedCollection)});},
  1253. args: [],
  1254. source: "deepCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self associationsDo: [:each |\x0a\x09 copy at: each key put: each value deepCopy].\x0a\x09^copy",
  1255. messageSends: ["new", "class", "associationsDo:", "at:put:", "key", "deepCopy", "value"],
  1256. referencedClasses: []
  1257. }),
  1258. smalltalk.HashedCollection);
  1259. smalltalk.addMethod(
  1260. "_detect_ifNone_",
  1261. smalltalk.method({
  1262. selector: "detect:ifNone:",
  1263. category: 'enumerating',
  1264. fn: function (aBlock, anotherBlock) {
  1265. var self=this;
  1266. return smalltalk.withContext(function($ctx1) { var $1;
  1267. $1=_st(_st(self)._values())._detect_ifNone_(aBlock,anotherBlock);
  1268. return $1;
  1269. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.HashedCollection)});},
  1270. args: ["aBlock", "anotherBlock"],
  1271. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^self values detect: aBlock ifNone: anotherBlock",
  1272. messageSends: ["detect:ifNone:", "values"],
  1273. referencedClasses: []
  1274. }),
  1275. smalltalk.HashedCollection);
  1276. smalltalk.addMethod(
  1277. "_do_",
  1278. smalltalk.method({
  1279. selector: "do:",
  1280. category: 'enumerating',
  1281. fn: function (aBlock) {
  1282. var self=this;
  1283. return smalltalk.withContext(function($ctx1) { _st(_st(self)._values())._do_(aBlock);
  1284. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.HashedCollection)});},
  1285. args: ["aBlock"],
  1286. source: "do: aBlock\x0a\x09self values do: aBlock",
  1287. messageSends: ["do:", "values"],
  1288. referencedClasses: []
  1289. }),
  1290. smalltalk.HashedCollection);
  1291. smalltalk.addMethod(
  1292. "_includes_",
  1293. smalltalk.method({
  1294. selector: "includes:",
  1295. category: 'enumerating',
  1296. fn: function (anObject) {
  1297. var self=this;
  1298. return smalltalk.withContext(function($ctx1) { var $1;
  1299. $1=_st(_st(self)._values())._includes_(anObject);
  1300. return $1;
  1301. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject}, smalltalk.HashedCollection)});},
  1302. args: ["anObject"],
  1303. source: "includes: anObject\x0a\x09^self values includes: anObject",
  1304. messageSends: ["includes:", "values"],
  1305. referencedClasses: []
  1306. }),
  1307. smalltalk.HashedCollection);
  1308. smalltalk.addMethod(
  1309. "_includesKey_",
  1310. smalltalk.method({
  1311. selector: "includesKey:",
  1312. category: 'testing',
  1313. fn: function (aKey) {
  1314. var self=this;
  1315. return smalltalk.withContext(function($ctx1) { return self.hasOwnProperty(aKey);
  1316. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey}, smalltalk.HashedCollection)});},
  1317. args: ["aKey"],
  1318. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  1319. messageSends: [],
  1320. referencedClasses: []
  1321. }),
  1322. smalltalk.HashedCollection);
  1323. smalltalk.addMethod(
  1324. "_keys",
  1325. smalltalk.method({
  1326. selector: "keys",
  1327. category: 'accessing',
  1328. fn: function () {
  1329. var self=this;
  1330. return smalltalk.withContext(function($ctx1) {
  1331. if ('function'===typeof Object.keys) return Object.keys(self);
  1332. var keys = [];
  1333. for(var i in self) {
  1334. if(self.hasOwnProperty(i)) {
  1335. keys.push(i);
  1336. }
  1337. };
  1338. return keys;
  1339. ;
  1340. return self}, function($ctx1) {$ctx1.fill(self,"keys",{}, smalltalk.HashedCollection)});},
  1341. args: [],
  1342. source: "keys\x0a\x09<\x0a\x09\x09if ('function'===typeof Object.keys) return Object.keys(self);\x0a\x09\x09var keys = [];\x0a\x09\x09for(var i in self) {\x0a\x09\x09\x09if(self.hasOwnProperty(i)) {\x0a\x09\x09\x09\x09keys.push(i);\x0a\x09\x09\x09}\x0a\x09\x09};\x0a\x09\x09return keys;\x0a\x09>",
  1343. messageSends: [],
  1344. referencedClasses: []
  1345. }),
  1346. smalltalk.HashedCollection);
  1347. smalltalk.addMethod(
  1348. "_keysAndValuesDo_",
  1349. smalltalk.method({
  1350. selector: "keysAndValuesDo:",
  1351. category: 'enumerating',
  1352. fn: function (aBlock) {
  1353. var self=this;
  1354. return smalltalk.withContext(function($ctx1) { _st(self)._associationsDo_((function(each){
  1355. return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_value_(_st(each)._key(),_st(each)._value());
  1356. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1357. return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock}, smalltalk.HashedCollection)});},
  1358. args: ["aBlock"],
  1359. source: "keysAndValuesDo: aBlock\x0a\x09self associationsDo: [:each |\x0a\x09 aBlock value: each key value: each value]",
  1360. messageSends: ["associationsDo:", "value:value:", "key", "value"],
  1361. referencedClasses: []
  1362. }),
  1363. smalltalk.HashedCollection);
  1364. smalltalk.addMethod(
  1365. "_printString",
  1366. smalltalk.method({
  1367. selector: "printString",
  1368. category: 'printing',
  1369. fn: function () {
  1370. var self=this;
  1371. return smalltalk.withContext(function($ctx1) { var $1;
  1372. $1=_st((smalltalk.String || String))._streamContents_((function(aStream){
  1373. return smalltalk.withContext(function($ctx2) { _st(aStream)._nextPutAll_(_st(_st("a ").__comma(_st(_st(self)._class())._name())).__comma("("));
  1374. _st(_st(self)._associations())._do_separatedBy_((function(each){
  1375. return smalltalk.withContext(function($ctx3) { return _st(each)._storeOn_(aStream);
  1376. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  1377. return smalltalk.withContext(function($ctx3) { return _st(aStream)._nextPutAll_(" , ");
  1378. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  1379. return _st(aStream)._nextPutAll_(")");
  1380. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})}));
  1381. return $1;
  1382. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.HashedCollection)});},
  1383. args: [],
  1384. source: "printString\x0a\x09\x22print the contents of the HashedCollection into a string and return the string\x22\x0a\x09^String streamContents: [:aStream |\x0a\x09\x09aStream nextPutAll: 'a ', self class name, '('.\x0a\x09\x09self associations\x0a\x09\x09\x09do: [:each | each storeOn: aStream]\x0a\x09\x09\x09separatedBy: [ aStream nextPutAll: ' , '].\x0a\x09\x09aStream nextPutAll: ')']",
  1385. messageSends: ["streamContents:", "nextPutAll:", ",", "name", "class", "do:separatedBy:", "storeOn:", "associations"],
  1386. referencedClasses: ["String"]
  1387. }),
  1388. smalltalk.HashedCollection);
  1389. smalltalk.addMethod(
  1390. "_remove_ifAbsent_",
  1391. smalltalk.method({
  1392. selector: "remove:ifAbsent:",
  1393. category: 'adding/removing',
  1394. fn: function (aKey, aBlock) {
  1395. var self=this;
  1396. return smalltalk.withContext(function($ctx1) { var $1;
  1397. $1=_st(self)._removeKey_ifAbsent_(aKey,aBlock);
  1398. return $1;
  1399. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock}, smalltalk.HashedCollection)});},
  1400. args: ["aKey", "aBlock"],
  1401. source: "remove: aKey ifAbsent: aBlock\x0a ^self removeKey: aKey ifAbsent: aBlock",
  1402. messageSends: ["removeKey:ifAbsent:"],
  1403. referencedClasses: []
  1404. }),
  1405. smalltalk.HashedCollection);
  1406. smalltalk.addMethod(
  1407. "_removeKey_",
  1408. smalltalk.method({
  1409. selector: "removeKey:",
  1410. category: 'adding/removing',
  1411. fn: function (aKey) {
  1412. var self=this;
  1413. return smalltalk.withContext(function($ctx1) { var $1;
  1414. $1=_st(self)._remove_(aKey);
  1415. return $1;
  1416. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey}, smalltalk.HashedCollection)});},
  1417. args: ["aKey"],
  1418. source: "removeKey: aKey\x0a ^self remove: aKey",
  1419. messageSends: ["remove:"],
  1420. referencedClasses: []
  1421. }),
  1422. smalltalk.HashedCollection);
  1423. smalltalk.addMethod(
  1424. "_removeKey_ifAbsent_",
  1425. smalltalk.method({
  1426. selector: "removeKey:ifAbsent:",
  1427. category: 'adding/removing',
  1428. fn: function (aKey, aBlock) {
  1429. var self=this;
  1430. return smalltalk.withContext(function($ctx1) { var $2,$1;
  1431. $2=_st(self)._includesKey_(aKey);
  1432. if(smalltalk.assert($2)){
  1433. $1=_st(self)._basicDelete_(aKey);
  1434. } else {
  1435. $1=_st(aBlock)._value();
  1436. };
  1437. return $1;
  1438. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock}, smalltalk.HashedCollection)});},
  1439. args: ["aKey", "aBlock"],
  1440. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey) \x0a\x09\x09ifFalse: [aBlock value]\x0a\x09\x09ifTrue: [self basicDelete: aKey]",
  1441. messageSends: ["ifFalse:ifTrue:", "value", "basicDelete:", "includesKey:"],
  1442. referencedClasses: []
  1443. }),
  1444. smalltalk.HashedCollection);
  1445. smalltalk.addMethod(
  1446. "_select_",
  1447. smalltalk.method({
  1448. selector: "select:",
  1449. category: 'enumerating',
  1450. fn: function (aBlock) {
  1451. var self=this;
  1452. var newDict;
  1453. return smalltalk.withContext(function($ctx1) { var $1,$3,$2,$4;
  1454. newDict=_st(_st(self)._class())._new();
  1455. $1=self;
  1456. $2=(function(key,value){
  1457. return smalltalk.withContext(function($ctx2) { $3=_st(aBlock)._value_(value);
  1458. if(smalltalk.assert($3)){
  1459. return _st(newDict)._at_put_(key,value);
  1460. };
  1461. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})});
  1462. _st($1)._keysAndValuesDo_($2);
  1463. $4=newDict;
  1464. return $4;
  1465. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict}, smalltalk.HashedCollection)});},
  1466. args: ["aBlock"],
  1467. source: "select: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09 (aBlock value: value) ifTrue: [newDict at: key put: value]].\x0a\x09^newDict",
  1468. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "at:put:", "value:"],
  1469. referencedClasses: []
  1470. }),
  1471. smalltalk.HashedCollection);
  1472. smalltalk.addMethod(
  1473. "_shallowCopy",
  1474. smalltalk.method({
  1475. selector: "shallowCopy",
  1476. category: 'copying',
  1477. fn: function () {
  1478. var self=this;
  1479. var copy;
  1480. return smalltalk.withContext(function($ctx1) { var $1;
  1481. copy=_st(_st(self)._class())._new();
  1482. _st(self)._associationsDo_((function(each){
  1483. return smalltalk.withContext(function($ctx2) { return _st(copy)._at_put_(_st(each)._key(),_st(each)._value());
  1484. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1485. $1=copy;
  1486. return $1;
  1487. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy}, smalltalk.HashedCollection)});},
  1488. args: [],
  1489. source: "shallowCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self associationsDo: [:each |\x0a\x09 copy at: each key put: each value].\x0a\x09^copy",
  1490. messageSends: ["new", "class", "associationsDo:", "at:put:", "key", "value"],
  1491. referencedClasses: []
  1492. }),
  1493. smalltalk.HashedCollection);
  1494. smalltalk.addMethod(
  1495. "_size",
  1496. smalltalk.method({
  1497. selector: "size",
  1498. category: 'accessing',
  1499. fn: function () {
  1500. var self=this;
  1501. return smalltalk.withContext(function($ctx1) { var $1;
  1502. $1=_st(_st(self)._keys())._size();
  1503. return $1;
  1504. }, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.HashedCollection)});},
  1505. args: [],
  1506. source: "size\x0a\x09^self keys size",
  1507. messageSends: ["size", "keys"],
  1508. referencedClasses: []
  1509. }),
  1510. smalltalk.HashedCollection);
  1511. smalltalk.addMethod(
  1512. "_storeOn_",
  1513. smalltalk.method({
  1514. selector: "storeOn:",
  1515. category: 'printing',
  1516. fn: function (aStream) {
  1517. var self=this;
  1518. return smalltalk.withContext(function($ctx1) { _st(aStream)._nextPutAll_("#{");
  1519. _st(_st(self)._associations())._do_separatedBy_((function(each){
  1520. return smalltalk.withContext(function($ctx2) { return _st(each)._storeOn_(aStream);
  1521. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  1522. return smalltalk.withContext(function($ctx2) { return _st(aStream)._nextPutAll_(". ");
  1523. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1524. _st(aStream)._nextPutAll_("}");
  1525. return self}, function($ctx1) {$ctx1.fill(self,"storeOn:",{aStream:aStream}, smalltalk.HashedCollection)});},
  1526. args: ["aStream"],
  1527. source: "storeOn: aStream\x0a\x09aStream nextPutAll: '#{'.\x0a\x09self associations\x0a\x09\x09do: [:each | each storeOn: aStream]\x0a\x09\x09separatedBy: [ aStream nextPutAll: '. '].\x0a\x09aStream nextPutAll: '}'",
  1528. messageSends: ["nextPutAll:", "do:separatedBy:", "storeOn:", "associations"],
  1529. referencedClasses: []
  1530. }),
  1531. smalltalk.HashedCollection);
  1532. smalltalk.addMethod(
  1533. "_values",
  1534. smalltalk.method({
  1535. selector: "values",
  1536. category: 'accessing',
  1537. fn: function () {
  1538. var self=this;
  1539. return smalltalk.withContext(function($ctx1) { var $1;
  1540. $1=_st(_st(self)._keys())._collect_((function(each){
  1541. return smalltalk.withContext(function($ctx2) { return _st(self)._at_(each);
  1542. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1543. return $1;
  1544. }, function($ctx1) {$ctx1.fill(self,"values",{}, smalltalk.HashedCollection)});},
  1545. args: [],
  1546. source: "values\x0a\x09^self keys collect: [:each | self at: each]",
  1547. messageSends: ["collect:", "at:", "keys"],
  1548. referencedClasses: []
  1549. }),
  1550. smalltalk.HashedCollection);
  1551. smalltalk.addMethod(
  1552. "_fromPairs_",
  1553. smalltalk.method({
  1554. selector: "fromPairs:",
  1555. category: 'instance creation',
  1556. fn: function (aCollection) {
  1557. var self=this;
  1558. var dict;
  1559. return smalltalk.withContext(function($ctx1) { var $1;
  1560. dict=_st(self)._new();
  1561. _st(aCollection)._do_((function(each){
  1562. return smalltalk.withContext(function($ctx2) { return _st(dict)._add_(each);
  1563. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1564. $1=dict;
  1565. return $1;
  1566. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection,dict:dict}, smalltalk.HashedCollection.klass)});},
  1567. args: ["aCollection"],
  1568. source: "fromPairs: aCollection\x0a\x09| dict |\x0a\x09dict := self new.\x0a\x09aCollection do: [:each | dict add: each].\x0a\x09^dict",
  1569. messageSends: ["new", "do:", "add:"],
  1570. referencedClasses: []
  1571. }),
  1572. smalltalk.HashedCollection.klass);
  1573. smalltalk.addClass('Dictionary', smalltalk.HashedCollection, ['keys', 'values'], 'Kernel-Collections');
  1574. smalltalk.addMethod(
  1575. "_asHashedCollection",
  1576. smalltalk.method({
  1577. selector: "asHashedCollection",
  1578. category: 'converting',
  1579. fn: function () {
  1580. var self=this;
  1581. return smalltalk.withContext(function($ctx1) { var $1;
  1582. $1=_st((smalltalk.HashedCollection || HashedCollection))._fromPairs_(_st(self)._associations());
  1583. return $1;
  1584. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{}, smalltalk.Dictionary)});},
  1585. args: [],
  1586. source: "asHashedCollection\x0a\x09^HashedCollection fromPairs: self associations",
  1587. messageSends: ["fromPairs:", "associations"],
  1588. referencedClasses: ["HashedCollection"]
  1589. }),
  1590. smalltalk.Dictionary);
  1591. smalltalk.addMethod(
  1592. "_asJSON",
  1593. smalltalk.method({
  1594. selector: "asJSON",
  1595. category: 'converting',
  1596. fn: function () {
  1597. var self=this;
  1598. return smalltalk.withContext(function($ctx1) { var $1;
  1599. $1=_st(_st(self)._asHashedCollection())._asJSON();
  1600. return $1;
  1601. }, function($ctx1) {$ctx1.fill(self,"asJSON",{}, smalltalk.Dictionary)});},
  1602. args: [],
  1603. source: "asJSON\x0a\x09^self asHashedCollection asJSON",
  1604. messageSends: ["asJSON", "asHashedCollection"],
  1605. referencedClasses: []
  1606. }),
  1607. smalltalk.Dictionary);
  1608. smalltalk.addMethod(
  1609. "_at_ifAbsent_",
  1610. smalltalk.method({
  1611. selector: "at:ifAbsent:",
  1612. category: 'accessing',
  1613. fn: function (aKey, aBlock) {
  1614. var self=this;
  1615. return smalltalk.withContext(function($ctx1) {
  1616. var index;
  1617. for(var i=0;i<self['@keys'].length;i++){
  1618. if(self['@keys'][i].__eq(aKey)) {index = i;}
  1619. };
  1620. if(typeof index === 'undefined') {
  1621. return aBlock();
  1622. } else {
  1623. return self['@values'][index];
  1624. }
  1625. ;
  1626. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock}, smalltalk.Dictionary)});},
  1627. args: ["aKey", "aBlock"],
  1628. source: "at: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index;\x0a\x09\x09for(var i=0;i<self['@keys'].length;i++){\x0a\x09\x09\x09if(self['@keys'][i].__eq(aKey)) {index = i;}\x0a\x09\x09};\x0a\x09\x09if(typeof index === 'undefined') {\x0a\x09\x09\x09return aBlock();\x0a\x09\x09} else {\x0a\x09\x09\x09return self['@values'][index];\x0a\x09\x09}\x0a\x09>",
  1629. messageSends: [],
  1630. referencedClasses: []
  1631. }),
  1632. smalltalk.Dictionary);
  1633. smalltalk.addMethod(
  1634. "_at_put_",
  1635. smalltalk.method({
  1636. selector: "at:put:",
  1637. category: 'accessing',
  1638. fn: function (aKey, aValue) {
  1639. var self=this;
  1640. return smalltalk.withContext(function($ctx1) {
  1641. var index = self['@keys'].indexOf(aKey);
  1642. if(index === -1) {
  1643. self['@values'].push(aValue);
  1644. self['@keys'].push(aKey);
  1645. } else {
  1646. self['@values'][index] = aValue;
  1647. };
  1648. return aValue;
  1649. ;
  1650. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue}, smalltalk.Dictionary)});},
  1651. args: ["aKey", "aValue"],
  1652. source: "at: aKey put: aValue\x0a\x09<\x0a\x09\x09var index = self['@keys'].indexOf(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09self['@values'].push(aValue);\x0a\x09\x09\x09self['@keys'].push(aKey);\x0a\x09\x09} else {\x0a\x09\x09\x09self['@values'][index] = aValue;\x0a\x09\x09};\x0a\x0a\x09\x09return aValue;\x0a\x09>",
  1653. messageSends: [],
  1654. referencedClasses: []
  1655. }),
  1656. smalltalk.Dictionary);
  1657. smalltalk.addMethod(
  1658. "_includesKey_",
  1659. smalltalk.method({
  1660. selector: "includesKey:",
  1661. category: 'testing',
  1662. fn: function (aKey) {
  1663. var self=this;
  1664. return smalltalk.withContext(function($ctx1) { var $1;
  1665. $1=_st(self["@keys"])._includes_(aKey);
  1666. return $1;
  1667. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey}, smalltalk.Dictionary)});},
  1668. args: ["aKey"],
  1669. source: "includesKey: aKey\x0a\x09^keys includes: aKey",
  1670. messageSends: ["includes:"],
  1671. referencedClasses: []
  1672. }),
  1673. smalltalk.Dictionary);
  1674. smalltalk.addMethod(
  1675. "_initialize",
  1676. smalltalk.method({
  1677. selector: "initialize",
  1678. category: 'initialization',
  1679. fn: function () {
  1680. var self=this;
  1681. return smalltalk.withContext(function($ctx1) { smalltalk.HashedCollection.fn.prototype._initialize.apply(_st(self), []);
  1682. self["@keys"]=[];
  1683. self["@values"]=[];
  1684. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.Dictionary)});},
  1685. args: [],
  1686. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  1687. messageSends: ["initialize"],
  1688. referencedClasses: []
  1689. }),
  1690. smalltalk.Dictionary);
  1691. smalltalk.addMethod(
  1692. "_keyAtValue_",
  1693. smalltalk.method({
  1694. selector: "keyAtValue:",
  1695. category: 'accessing',
  1696. fn: function (anObject) {
  1697. var self=this;
  1698. return smalltalk.withContext(function($ctx1) { var $1;
  1699. $1=_st(_st(_st(self)._associations())._detect_ifNone_((function(k,v){
  1700. return smalltalk.withContext(function($ctx2) { return _st(v).__eq_eq(anObject);
  1701. }, function($ctx2) {$ctx2.fillBlock({k:k,v:v},$ctx1)})}),(function(){
  1702. return smalltalk.withContext(function($ctx2) { return _st(self)._error_("Not found");
  1703. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._key();
  1704. return $1;
  1705. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject}, smalltalk.Dictionary)});},
  1706. args: ["anObject"],
  1707. source: "keyAtValue: anObject\x0a\x0a\x09^ (self associations \x0a \x09detect:[:k :v| v == anObject] \x0a \x09ifNone:[self error: 'Not found']) key",
  1708. messageSends: ["key", "detect:ifNone:", "==", "error:", "associations"],
  1709. referencedClasses: []
  1710. }),
  1711. smalltalk.Dictionary);
  1712. smalltalk.addMethod(
  1713. "_keys",
  1714. smalltalk.method({
  1715. selector: "keys",
  1716. category: 'accessing',
  1717. fn: function () {
  1718. var self=this;
  1719. return smalltalk.withContext(function($ctx1) { var $1;
  1720. $1=_st(self["@keys"])._copy();
  1721. return $1;
  1722. }, function($ctx1) {$ctx1.fill(self,"keys",{}, smalltalk.Dictionary)});},
  1723. args: [],
  1724. source: "keys\x0a\x09^keys copy",
  1725. messageSends: ["copy"],
  1726. referencedClasses: []
  1727. }),
  1728. smalltalk.Dictionary);
  1729. smalltalk.addMethod(
  1730. "_removeKey_ifAbsent_",
  1731. smalltalk.method({
  1732. selector: "removeKey:ifAbsent:",
  1733. category: 'adding/removing',
  1734. fn: function (aKey, aBlock) {
  1735. var self=this;
  1736. return smalltalk.withContext(function($ctx1) {
  1737. var index = self['@keys'].indexOf(aKey);
  1738. if(index === -1) {
  1739. return aBlock()
  1740. } else {
  1741. var value;
  1742. self['@keys'].splice(index, 1);
  1743. value = self['@values'].splice(index, 1);
  1744. return value[0];
  1745. };
  1746. ;
  1747. return self}, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock}, smalltalk.Dictionary)});},
  1748. args: ["aKey", "aBlock"],
  1749. source: "removeKey: aKey ifAbsent: aBlock\x0a <\x0a var index = self['@keys'].indexOf(aKey);\x0a if(index === -1) {\x0a return aBlock()\x0a } else {\x0a var value;\x0a self['@keys'].splice(index, 1);\x0a value = self['@values'].splice(index, 1);\x0a return value[0];\x0a };\x0a >",
  1750. messageSends: [],
  1751. referencedClasses: []
  1752. }),
  1753. smalltalk.Dictionary);
  1754. smalltalk.addMethod(
  1755. "_valueAt_",
  1756. smalltalk.method({
  1757. selector: "valueAt:",
  1758. category: 'accessing',
  1759. fn: function (anObject) {
  1760. var self=this;
  1761. return smalltalk.withContext(function($ctx1) { var $1;
  1762. $1=_st(self)._associationsDo_((2));
  1763. return $1;
  1764. }, function($ctx1) {$ctx1.fill(self,"valueAt:",{anObject:anObject}, smalltalk.Dictionary)});},
  1765. args: ["anObject"],
  1766. source: "valueAt: anObject\x0a\x0a\x09^ self associationsDo:2",
  1767. messageSends: ["associationsDo:"],
  1768. referencedClasses: []
  1769. }),
  1770. smalltalk.Dictionary);
  1771. smalltalk.addMethod(
  1772. "_values",
  1773. smalltalk.method({
  1774. selector: "values",
  1775. category: 'accessing',
  1776. fn: function () {
  1777. var self=this;
  1778. return smalltalk.withContext(function($ctx1) { var $1;
  1779. $1=_st(self["@values"])._copy();
  1780. return $1;
  1781. }, function($ctx1) {$ctx1.fill(self,"values",{}, smalltalk.Dictionary)});},
  1782. args: [],
  1783. source: "values\x0a\x09^values copy",
  1784. messageSends: ["copy"],
  1785. referencedClasses: []
  1786. }),
  1787. smalltalk.Dictionary);
  1788. smalltalk.addClass('SequenceableCollection', smalltalk.Collection, [], 'Kernel-Collections');
  1789. smalltalk.addMethod(
  1790. "__eq",
  1791. smalltalk.method({
  1792. selector: "=",
  1793. category: 'comparing',
  1794. fn: function (aCollection) {
  1795. var self=this;
  1796. return smalltalk.withContext(function($ctx1) { var $1,$2,$4,$3;
  1797. var $early={};
  1798. try {
  1799. $1=_st(_st(_st(self)._class()).__eq(_st(aCollection)._class()))._and_((function(){
  1800. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._size()).__eq(_st(aCollection)._size());
  1801. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1802. if(! smalltalk.assert($1)){
  1803. return false;
  1804. };
  1805. $2=self;
  1806. $3=(function(each,i){
  1807. return smalltalk.withContext(function($ctx2) { $4=_st(_st(aCollection)._at_(i)).__eq(each);
  1808. if(! smalltalk.assert($4)){
  1809. throw $early=[false];
  1810. };
  1811. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1)})});
  1812. _st($2)._withIndexDo_($3);
  1813. return true;
  1814. }
  1815. catch(e) {if(e===$early)return e[0]; throw e}
  1816. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection}, smalltalk.SequenceableCollection)});},
  1817. args: ["aCollection"],
  1818. source: "= aCollection\x0a\x09(self class = aCollection class and: [\x0a\x09\x09self size = aCollection size]) ifFalse: [^false].\x0a\x09self withIndexDo: [:each :i |\x0a (aCollection at: i) = each ifFalse: [^false]].\x0a\x09^true",
  1819. messageSends: ["ifFalse:", "and:", "=", "size", "class", "withIndexDo:", "at:"],
  1820. referencedClasses: []
  1821. }),
  1822. smalltalk.SequenceableCollection);
  1823. smalltalk.addMethod(
  1824. "_addLast_",
  1825. smalltalk.method({
  1826. selector: "addLast:",
  1827. category: 'adding',
  1828. fn: function (anObject) {
  1829. var self=this;
  1830. return smalltalk.withContext(function($ctx1) { _st(self)._add_(anObject);
  1831. return self}, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject}, smalltalk.SequenceableCollection)});},
  1832. args: ["anObject"],
  1833. source: "addLast: anObject\x0a\x09self add: anObject",
  1834. messageSends: ["add:"],
  1835. referencedClasses: []
  1836. }),
  1837. smalltalk.SequenceableCollection);
  1838. smalltalk.addMethod(
  1839. "_allButFirst",
  1840. smalltalk.method({
  1841. selector: "allButFirst",
  1842. category: 'accessing',
  1843. fn: function () {
  1844. var self=this;
  1845. return smalltalk.withContext(function($ctx1) { var $1;
  1846. $1=_st(self)._copyFrom_to_((2),_st(self)._size());
  1847. return $1;
  1848. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{}, smalltalk.SequenceableCollection)});},
  1849. args: [],
  1850. source: "allButFirst\x0a\x09^self copyFrom: 2 to: self size",
  1851. messageSends: ["copyFrom:to:", "size"],
  1852. referencedClasses: []
  1853. }),
  1854. smalltalk.SequenceableCollection);
  1855. smalltalk.addMethod(
  1856. "_allButLast",
  1857. smalltalk.method({
  1858. selector: "allButLast",
  1859. category: 'accessing',
  1860. fn: function () {
  1861. var self=this;
  1862. return smalltalk.withContext(function($ctx1) { var $1;
  1863. $1=_st(self)._copyFrom_to_((1),_st(_st(self)._size()).__minus((1)));
  1864. return $1;
  1865. }, function($ctx1) {$ctx1.fill(self,"allButLast",{}, smalltalk.SequenceableCollection)});},
  1866. args: [],
  1867. source: "allButLast\x0a\x09^self copyFrom: 1 to: self size - 1",
  1868. messageSends: ["copyFrom:to:", "-", "size"],
  1869. referencedClasses: []
  1870. }),
  1871. smalltalk.SequenceableCollection);
  1872. smalltalk.addMethod(
  1873. "_at_",
  1874. smalltalk.method({
  1875. selector: "at:",
  1876. category: 'accessing',
  1877. fn: function (anIndex) {
  1878. var self=this;
  1879. return smalltalk.withContext(function($ctx1) { var $1;
  1880. $1=_st(self)._at_ifAbsent_(anIndex,(function(){
  1881. return smalltalk.withContext(function($ctx2) { return _st(self)._errorNotFound();
  1882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1883. return $1;
  1884. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex}, smalltalk.SequenceableCollection)});},
  1885. args: ["anIndex"],
  1886. source: "at: anIndex\x0a\x09^self at: anIndex ifAbsent: [\x0a\x09 self errorNotFound]",
  1887. messageSends: ["at:ifAbsent:", "errorNotFound"],
  1888. referencedClasses: []
  1889. }),
  1890. smalltalk.SequenceableCollection);
  1891. smalltalk.addMethod(
  1892. "_at_ifAbsent_",
  1893. smalltalk.method({
  1894. selector: "at:ifAbsent:",
  1895. category: 'accessing',
  1896. fn: function (anIndex, aBlock) {
  1897. var self=this;
  1898. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  1899. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock}, smalltalk.SequenceableCollection)});},
  1900. args: ["anIndex", "aBlock"],
  1901. source: "at: anIndex ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1902. messageSends: ["subclassResponsibility"],
  1903. referencedClasses: []
  1904. }),
  1905. smalltalk.SequenceableCollection);
  1906. smalltalk.addMethod(
  1907. "_at_put_",
  1908. smalltalk.method({
  1909. selector: "at:put:",
  1910. category: 'accessing',
  1911. fn: function (anIndex, anObject) {
  1912. var self=this;
  1913. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  1914. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject}, smalltalk.SequenceableCollection)});},
  1915. args: ["anIndex", "anObject"],
  1916. source: "at: anIndex put: anObject\x0a\x09self subclassResponsibility",
  1917. messageSends: ["subclassResponsibility"],
  1918. referencedClasses: []
  1919. }),
  1920. smalltalk.SequenceableCollection);
  1921. smalltalk.addMethod(
  1922. "_atRandom",
  1923. smalltalk.method({
  1924. selector: "atRandom",
  1925. category: 'accessing',
  1926. fn: function () {
  1927. var self=this;
  1928. return smalltalk.withContext(function($ctx1) { var $1;
  1929. $1=_st(self)._at_(_st(_st(self)._size())._atRandom());
  1930. return $1;
  1931. }, function($ctx1) {$ctx1.fill(self,"atRandom",{}, smalltalk.SequenceableCollection)});},
  1932. args: [],
  1933. source: "atRandom\x0a\x09^ self at: self size atRandom",
  1934. messageSends: ["at:", "atRandom", "size"],
  1935. referencedClasses: []
  1936. }),
  1937. smalltalk.SequenceableCollection);
  1938. smalltalk.addMethod(
  1939. "_copyFrom_to_",
  1940. smalltalk.method({
  1941. selector: "copyFrom:to:",
  1942. category: 'copying',
  1943. fn: function (anIndex, anotherIndex) {
  1944. var self=this;
  1945. var range,newCollection;
  1946. return smalltalk.withContext(function($ctx1) { var $1;
  1947. range=_st(anIndex)._to_(anotherIndex);
  1948. newCollection=_st(_st(self)._class())._new_(_st(range)._size());
  1949. _st(range)._withIndexDo_((function(each,i){
  1950. return smalltalk.withContext(function($ctx2) { return _st(newCollection)._at_put_(i,_st(self)._at_(each));
  1951. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1)})}));
  1952. $1=newCollection;
  1953. return $1;
  1954. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex,range:range,newCollection:newCollection}, smalltalk.SequenceableCollection)});},
  1955. args: ["anIndex", "anotherIndex"],
  1956. source: "copyFrom: anIndex to: anotherIndex\x0a\x09| range newCollection |\x0a\x09range := anIndex to: anotherIndex.\x0a\x09newCollection := self class new: range size.\x0a\x09range withIndexDo: [:each :i |\x0a\x09 newCollection at: i put: (self at: each)].\x0a\x09^newCollection",
  1957. messageSends: ["to:", "new:", "size", "class", "withIndexDo:", "at:put:", "at:"],
  1958. referencedClasses: []
  1959. }),
  1960. smalltalk.SequenceableCollection);
  1961. smalltalk.addMethod(
  1962. "_deepCopy",
  1963. smalltalk.method({
  1964. selector: "deepCopy",
  1965. category: 'copying',
  1966. fn: function () {
  1967. var self=this;
  1968. var newCollection;
  1969. return smalltalk.withContext(function($ctx1) { var $1;
  1970. newCollection=_st(_st(self)._class())._new_(_st(self)._size());
  1971. _st(self)._withIndexDo_((function(each,index){
  1972. return smalltalk.withContext(function($ctx2) { return _st(newCollection)._at_put_(index,_st(each)._deepCopy());
  1973. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
  1974. $1=newCollection;
  1975. return $1;
  1976. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{newCollection:newCollection}, smalltalk.SequenceableCollection)});},
  1977. args: [],
  1978. source: "deepCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [:each :index | \x0a\x09\x09newCollection at: index put: each deepCopy].\x0a\x09^newCollection",
  1979. messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:", "deepCopy"],
  1980. referencedClasses: []
  1981. }),
  1982. smalltalk.SequenceableCollection);
  1983. smalltalk.addMethod(
  1984. "_first",
  1985. smalltalk.method({
  1986. selector: "first",
  1987. category: 'accessing',
  1988. fn: function () {
  1989. var self=this;
  1990. return smalltalk.withContext(function($ctx1) { var $1;
  1991. $1=_st(self)._at_((1));
  1992. return $1;
  1993. }, function($ctx1) {$ctx1.fill(self,"first",{}, smalltalk.SequenceableCollection)});},
  1994. args: [],
  1995. source: "first\x0a\x09^self at: 1",
  1996. messageSends: ["at:"],
  1997. referencedClasses: []
  1998. }),
  1999. smalltalk.SequenceableCollection);
  2000. smalltalk.addMethod(
  2001. "_first_",
  2002. smalltalk.method({
  2003. selector: "first:",
  2004. category: 'accessing',
  2005. fn: function (n) {
  2006. var self=this;
  2007. return smalltalk.withContext(function($ctx1) { var $1;
  2008. $1=_st(self)._copyFrom_to_((1),n);
  2009. return $1;
  2010. }, function($ctx1) {$ctx1.fill(self,"first:",{n:n}, smalltalk.SequenceableCollection)});},
  2011. args: ["n"],
  2012. source: "first: n\x0a\x09\x22Answer the first n elements of the receiver.\x0a\x09Raise an error if there are not enough elements.\x22\x0a\x0a\x09^ self copyFrom: 1 to: n",
  2013. messageSends: ["copyFrom:to:"],
  2014. referencedClasses: []
  2015. }),
  2016. smalltalk.SequenceableCollection);
  2017. smalltalk.addMethod(
  2018. "_fourth",
  2019. smalltalk.method({
  2020. selector: "fourth",
  2021. category: 'accessing',
  2022. fn: function () {
  2023. var self=this;
  2024. return smalltalk.withContext(function($ctx1) { var $1;
  2025. $1=_st(self)._at_((4));
  2026. return $1;
  2027. }, function($ctx1) {$ctx1.fill(self,"fourth",{}, smalltalk.SequenceableCollection)});},
  2028. args: [],
  2029. source: "fourth\x0a\x09^self at: 4",
  2030. messageSends: ["at:"],
  2031. referencedClasses: []
  2032. }),
  2033. smalltalk.SequenceableCollection);
  2034. smalltalk.addMethod(
  2035. "_includes_",
  2036. smalltalk.method({
  2037. selector: "includes:",
  2038. category: 'testing',
  2039. fn: function (anObject) {
  2040. var self=this;
  2041. return smalltalk.withContext(function($ctx1) { var $1;
  2042. $1=_st(_st(self)._indexOf_ifAbsent_(anObject,(function(){
  2043. return smalltalk.withContext(function($ctx2) { return nil;
  2044. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._notNil();
  2045. return $1;
  2046. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject}, smalltalk.SequenceableCollection)});},
  2047. args: ["anObject"],
  2048. source: "includes: anObject\x0a\x09^(self indexOf: anObject ifAbsent: [nil]) notNil",
  2049. messageSends: ["notNil", "indexOf:ifAbsent:"],
  2050. referencedClasses: []
  2051. }),
  2052. smalltalk.SequenceableCollection);
  2053. smalltalk.addMethod(
  2054. "_indexOf_",
  2055. smalltalk.method({
  2056. selector: "indexOf:",
  2057. category: 'accessing',
  2058. fn: function (anObject) {
  2059. var self=this;
  2060. return smalltalk.withContext(function($ctx1) { var $1;
  2061. $1=_st(self)._indexOf_ifAbsent_(anObject,(function(){
  2062. return smalltalk.withContext(function($ctx2) { return _st(self)._errorNotFound();
  2063. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2064. return $1;
  2065. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject}, smalltalk.SequenceableCollection)});},
  2066. args: ["anObject"],
  2067. source: "indexOf: anObject\x0a\x09^self indexOf: anObject ifAbsent: [self errorNotFound]",
  2068. messageSends: ["indexOf:ifAbsent:", "errorNotFound"],
  2069. referencedClasses: []
  2070. }),
  2071. smalltalk.SequenceableCollection);
  2072. smalltalk.addMethod(
  2073. "_indexOf_ifAbsent_",
  2074. smalltalk.method({
  2075. selector: "indexOf:ifAbsent:",
  2076. category: 'accessing',
  2077. fn: function (anObject, aBlock) {
  2078. var self=this;
  2079. return smalltalk.withContext(function($ctx1) {
  2080. for(var i=0;i<self.length;i++) {
  2081. if(self[i].__eq(anObject)) {return i+1}
  2082. };
  2083. return aBlock();
  2084. ;
  2085. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock}, smalltalk.SequenceableCollection)});},
  2086. args: ["anObject", "aBlock"],
  2087. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<\x0a\x09\x09for(var i=0;i<self.length;i++) {\x0a\x09\x09\x09if(self[i].__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock();\x0a\x09>",
  2088. messageSends: [],
  2089. referencedClasses: []
  2090. }),
  2091. smalltalk.SequenceableCollection);
  2092. smalltalk.addMethod(
  2093. "_indexOf_startingAt_",
  2094. smalltalk.method({
  2095. selector: "indexOf:startingAt:",
  2096. category: 'accessing',
  2097. fn: function (anObject, start) {
  2098. var self=this;
  2099. return smalltalk.withContext(function($ctx1) { var $1;
  2100. $1=_st(self)._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  2101. return smalltalk.withContext(function($ctx2) { return (0);
  2102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2103. return $1;
  2104. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start}, smalltalk.SequenceableCollection)});},
  2105. args: ["anObject", "start"],
  2106. source: "indexOf: anObject startingAt: start\x0a\x09\x22Answer the index of the first occurence of anElement after start\x0a\x09within the receiver. If the receiver does not contain anElement, \x0a\x09answer 0.\x22\x0a\x09^self indexOf: anObject startingAt: start ifAbsent: [0]",
  2107. messageSends: ["indexOf:startingAt:ifAbsent:"],
  2108. referencedClasses: []
  2109. }),
  2110. smalltalk.SequenceableCollection);
  2111. smalltalk.addMethod(
  2112. "_indexOf_startingAt_ifAbsent_",
  2113. smalltalk.method({
  2114. selector: "indexOf:startingAt:ifAbsent:",
  2115. category: 'accessing',
  2116. fn: function (anObject, start, aBlock) {
  2117. var self=this;
  2118. return smalltalk.withContext(function($ctx1) {
  2119. for(var i=start-1;i<self.length;i++){
  2120. if(self[i].__eq(anObject)) {return i+1}
  2121. }
  2122. return aBlock();
  2123. ;
  2124. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock}, smalltalk.SequenceableCollection)});},
  2125. args: ["anObject", "start", "aBlock"],
  2126. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<\x0a\x09\x09for(var i=start-1;i<self.length;i++){\x0a\x09\x09\x09if(self[i].__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock();\x0a\x09>",
  2127. messageSends: [],
  2128. referencedClasses: []
  2129. }),
  2130. smalltalk.SequenceableCollection);
  2131. smalltalk.addMethod(
  2132. "_last",
  2133. smalltalk.method({
  2134. selector: "last",
  2135. category: 'accessing',
  2136. fn: function () {
  2137. var self=this;
  2138. return smalltalk.withContext(function($ctx1) { var $1;
  2139. $1=_st(self)._at_(_st(self)._size());
  2140. return $1;
  2141. }, function($ctx1) {$ctx1.fill(self,"last",{}, smalltalk.SequenceableCollection)});},
  2142. args: [],
  2143. source: "last\x0a\x09^self at: self size",
  2144. messageSends: ["at:", "size"],
  2145. referencedClasses: []
  2146. }),
  2147. smalltalk.SequenceableCollection);
  2148. smalltalk.addMethod(
  2149. "_removeLast",
  2150. smalltalk.method({
  2151. selector: "removeLast",
  2152. category: 'adding',
  2153. fn: function () {
  2154. var self=this;
  2155. return smalltalk.withContext(function($ctx1) { _st(self)._remove_(_st(self)._last());
  2156. return self}, function($ctx1) {$ctx1.fill(self,"removeLast",{}, smalltalk.SequenceableCollection)});},
  2157. args: [],
  2158. source: "removeLast\x0a\x09self remove: self last",
  2159. messageSends: ["remove:", "last"],
  2160. referencedClasses: []
  2161. }),
  2162. smalltalk.SequenceableCollection);
  2163. smalltalk.addMethod(
  2164. "_reversed",
  2165. smalltalk.method({
  2166. selector: "reversed",
  2167. category: 'converting',
  2168. fn: function () {
  2169. var self=this;
  2170. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  2171. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{}, smalltalk.SequenceableCollection)});},
  2172. args: [],
  2173. source: "reversed\x0a\x09self subclassResponsibility",
  2174. messageSends: ["subclassResponsibility"],
  2175. referencedClasses: []
  2176. }),
  2177. smalltalk.SequenceableCollection);
  2178. smalltalk.addMethod(
  2179. "_second",
  2180. smalltalk.method({
  2181. selector: "second",
  2182. category: 'accessing',
  2183. fn: function () {
  2184. var self=this;
  2185. return smalltalk.withContext(function($ctx1) { var $1;
  2186. $1=_st(self)._at_((2));
  2187. return $1;
  2188. }, function($ctx1) {$ctx1.fill(self,"second",{}, smalltalk.SequenceableCollection)});},
  2189. args: [],
  2190. source: "second\x0a\x09^self at: 2",
  2191. messageSends: ["at:"],
  2192. referencedClasses: []
  2193. }),
  2194. smalltalk.SequenceableCollection);
  2195. smalltalk.addMethod(
  2196. "_shallowCopy",
  2197. smalltalk.method({
  2198. selector: "shallowCopy",
  2199. category: 'copying',
  2200. fn: function () {
  2201. var self=this;
  2202. var newCollection;
  2203. return smalltalk.withContext(function($ctx1) { var $1;
  2204. newCollection=_st(_st(self)._class())._new_(_st(self)._size());
  2205. _st(self)._withIndexDo_((function(each,index){
  2206. return smalltalk.withContext(function($ctx2) { return _st(newCollection)._at_put_(index,each);
  2207. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
  2208. $1=newCollection;
  2209. return $1;
  2210. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{newCollection:newCollection}, smalltalk.SequenceableCollection)});},
  2211. args: [],
  2212. source: "shallowCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [ :each :index | \x0a\x09\x09newCollection at: index put: each].\x0a\x09^newCollection",
  2213. messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:"],
  2214. referencedClasses: []
  2215. }),
  2216. smalltalk.SequenceableCollection);
  2217. smalltalk.addMethod(
  2218. "_third",
  2219. smalltalk.method({
  2220. selector: "third",
  2221. category: 'accessing',
  2222. fn: function () {
  2223. var self=this;
  2224. return smalltalk.withContext(function($ctx1) { var $1;
  2225. $1=_st(self)._at_((3));
  2226. return $1;
  2227. }, function($ctx1) {$ctx1.fill(self,"third",{}, smalltalk.SequenceableCollection)});},
  2228. args: [],
  2229. source: "third\x0a\x09^self at: 3",
  2230. messageSends: ["at:"],
  2231. referencedClasses: []
  2232. }),
  2233. smalltalk.SequenceableCollection);
  2234. smalltalk.addMethod(
  2235. "_withIndexDo_",
  2236. smalltalk.method({
  2237. selector: "withIndexDo:",
  2238. category: 'enumerating',
  2239. fn: function (aBlock) {
  2240. var self=this;
  2241. return smalltalk.withContext(function($ctx1) { for(var i=0;i<self.length;i++){aBlock(self[i], i+1);};
  2242. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock}, smalltalk.SequenceableCollection)});},
  2243. args: ["aBlock"],
  2244. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self[i], i+1);}>",
  2245. messageSends: [],
  2246. referencedClasses: []
  2247. }),
  2248. smalltalk.SequenceableCollection);
  2249. smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  2250. smalltalk.addMethod(
  2251. "_add_",
  2252. smalltalk.method({
  2253. selector: "add:",
  2254. category: 'adding/removing',
  2255. fn: function (anObject) {
  2256. var self=this;
  2257. return smalltalk.withContext(function($ctx1) { self.push(anObject); return anObject;;
  2258. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject}, smalltalk.Array)});},
  2259. args: ["anObject"],
  2260. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  2261. messageSends: [],
  2262. referencedClasses: []
  2263. }),
  2264. smalltalk.Array);
  2265. smalltalk.addMethod(
  2266. "_asJavascript",
  2267. smalltalk.method({
  2268. selector: "asJavascript",
  2269. category: 'converting',
  2270. fn: function () {
  2271. var self=this;
  2272. return smalltalk.withContext(function($ctx1) { var $1;
  2273. $1=_st(_st("[").__comma(_st(_st(self)._collect_((function(each){
  2274. return smalltalk.withContext(function($ctx2) { return _st(each)._asJavascript();
  2275. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._join_(", "))).__comma("]");
  2276. return $1;
  2277. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{}, smalltalk.Array)});},
  2278. args: [],
  2279. source: "asJavascript\x0a\x09^'[', ((self collect: [:each | each asJavascript]) join: ', '), ']'",
  2280. messageSends: [",", "join:", "collect:", "asJavascript"],
  2281. referencedClasses: []
  2282. }),
  2283. smalltalk.Array);
  2284. smalltalk.addMethod(
  2285. "_at_ifAbsent_",
  2286. smalltalk.method({
  2287. selector: "at:ifAbsent:",
  2288. category: 'accessing',
  2289. fn: function (anIndex, aBlock) {
  2290. var self=this;
  2291. return smalltalk.withContext(function($ctx1) {
  2292. if((anIndex < 1) || (self.length < anIndex)) {return aBlock()};
  2293. return self[anIndex - 1];
  2294. ;
  2295. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock}, smalltalk.Array)});},
  2296. args: ["anIndex", "aBlock"],
  2297. source: "at: anIndex ifAbsent: aBlock\x0a\x09<\x0a\x09\x09if((anIndex < 1) || (self.length < anIndex)) {return aBlock()};\x0a\x09\x09return self[anIndex - 1];\x0a\x09>",
  2298. messageSends: [],
  2299. referencedClasses: []
  2300. }),
  2301. smalltalk.Array);
  2302. smalltalk.addMethod(
  2303. "_at_put_",
  2304. smalltalk.method({
  2305. selector: "at:put:",
  2306. category: 'accessing',
  2307. fn: function (anIndex, anObject) {
  2308. var self=this;
  2309. return smalltalk.withContext(function($ctx1) { return self[anIndex - 1] = anObject;
  2310. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject}, smalltalk.Array)});},
  2311. args: ["anIndex", "anObject"],
  2312. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  2313. messageSends: [],
  2314. referencedClasses: []
  2315. }),
  2316. smalltalk.Array);
  2317. smalltalk.addMethod(
  2318. "_join_",
  2319. smalltalk.method({
  2320. selector: "join:",
  2321. category: 'enumerating',
  2322. fn: function (aString) {
  2323. var self=this;
  2324. return smalltalk.withContext(function($ctx1) { return self.join(aString);
  2325. return self}, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString}, smalltalk.Array)});},
  2326. args: ["aString"],
  2327. source: "join: aString\x0a\x09<return self.join(aString)>",
  2328. messageSends: [],
  2329. referencedClasses: []
  2330. }),
  2331. smalltalk.Array);
  2332. smalltalk.addMethod(
  2333. "_remove_ifAbsent_",
  2334. smalltalk.method({
  2335. selector: "remove:ifAbsent:",
  2336. category: 'adding/removing',
  2337. fn: function (anObject, aBlock) {
  2338. var self=this;
  2339. return smalltalk.withContext(function($ctx1) {
  2340. for(var i=0;i<self.length;i++) {
  2341. if(self[i] == anObject) {
  2342. self.splice(i,1);
  2343. return self;
  2344. }
  2345. };
  2346. aBlock._value();
  2347. ;
  2348. return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock}, smalltalk.Array)});},
  2349. args: ["anObject", "aBlock"],
  2350. source: "remove: anObject ifAbsent: aBlock\x0a\x09<\x0a\x09\x09for(var i=0;i<self.length;i++) {\x0a\x09\x09\x09if(self[i] == anObject) {\x0a\x09\x09\x09\x09self.splice(i,1);\x0a\x09\x09\x09\x09return self;\x0a\x09\x09\x09}\x0a\x09\x09};\x0a aBlock._value();\x0a\x09>",
  2351. messageSends: [],
  2352. referencedClasses: []
  2353. }),
  2354. smalltalk.Array);
  2355. smalltalk.addMethod(
  2356. "_removeFrom_to_",
  2357. smalltalk.method({
  2358. selector: "removeFrom:to:",
  2359. category: 'adding/removing',
  2360. fn: function (aNumber, anotherNumber) {
  2361. var self=this;
  2362. return smalltalk.withContext(function($ctx1) { self.splice(aNumber - 1,anotherNumber - 1);
  2363. return self}, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber}, smalltalk.Array)});},
  2364. args: ["aNumber", "anotherNumber"],
  2365. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber - 1,anotherNumber - 1)>",
  2366. messageSends: [],
  2367. referencedClasses: []
  2368. }),
  2369. smalltalk.Array);
  2370. smalltalk.addMethod(
  2371. "_reversed",
  2372. smalltalk.method({
  2373. selector: "reversed",
  2374. category: 'converting',
  2375. fn: function () {
  2376. var self=this;
  2377. return smalltalk.withContext(function($ctx1) { return self._copy().reverse();
  2378. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{}, smalltalk.Array)});},
  2379. args: [],
  2380. source: "reversed\x0a\x09<return self._copy().reverse()>",
  2381. messageSends: [],
  2382. referencedClasses: []
  2383. }),
  2384. smalltalk.Array);
  2385. smalltalk.addMethod(
  2386. "_size",
  2387. smalltalk.method({
  2388. selector: "size",
  2389. category: 'accessing',
  2390. fn: function () {
  2391. var self=this;
  2392. return smalltalk.withContext(function($ctx1) { return self.length;
  2393. return self}, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Array)});},
  2394. args: [],
  2395. source: "size\x0a\x09<return self.length>",
  2396. messageSends: [],
  2397. referencedClasses: []
  2398. }),
  2399. smalltalk.Array);
  2400. smalltalk.addMethod(
  2401. "_sort",
  2402. smalltalk.method({
  2403. selector: "sort",
  2404. category: 'enumerating',
  2405. fn: function () {
  2406. var self=this;
  2407. return smalltalk.withContext(function($ctx1) { var $1;
  2408. $1=_st(self)._basicPerform_("sort");
  2409. return $1;
  2410. }, function($ctx1) {$ctx1.fill(self,"sort",{}, smalltalk.Array)});},
  2411. args: [],
  2412. source: "sort\x0a ^self basicPerform: 'sort'",
  2413. messageSends: ["basicPerform:"],
  2414. referencedClasses: []
  2415. }),
  2416. smalltalk.Array);
  2417. smalltalk.addMethod(
  2418. "_sort_",
  2419. smalltalk.method({
  2420. selector: "sort:",
  2421. category: 'enumerating',
  2422. fn: function (aBlock) {
  2423. var self=this;
  2424. return smalltalk.withContext(function($ctx1) {
  2425. return self.sort(function(a, b) {
  2426. if(aBlock(a,b)) {return -1} else {return 1}
  2427. })
  2428. ;
  2429. return self}, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock}, smalltalk.Array)});},
  2430. args: ["aBlock"],
  2431. source: "sort: aBlock\x0a\x09<\x0a\x09\x09return self.sort(function(a, b) {\x0a\x09\x09\x09if(aBlock(a,b)) {return -1} else {return 1}\x0a\x09\x09})\x0a\x09>",
  2432. messageSends: [],
  2433. referencedClasses: []
  2434. }),
  2435. smalltalk.Array);
  2436. smalltalk.addMethod(
  2437. "_sorted",
  2438. smalltalk.method({
  2439. selector: "sorted",
  2440. category: 'enumerating',
  2441. fn: function () {
  2442. var self=this;
  2443. return smalltalk.withContext(function($ctx1) { var $1;
  2444. $1=_st(_st(self)._copy())._sort();
  2445. return $1;
  2446. }, function($ctx1) {$ctx1.fill(self,"sorted",{}, smalltalk.Array)});},
  2447. args: [],
  2448. source: "sorted\x0a\x09^self copy sort",
  2449. messageSends: ["sort", "copy"],
  2450. referencedClasses: []
  2451. }),
  2452. smalltalk.Array);
  2453. smalltalk.addMethod(
  2454. "_sorted_",
  2455. smalltalk.method({
  2456. selector: "sorted:",
  2457. category: 'enumerating',
  2458. fn: function (aBlock) {
  2459. var self=this;
  2460. return smalltalk.withContext(function($ctx1) { var $1;
  2461. $1=_st(_st(self)._copy())._sort_(aBlock);
  2462. return $1;
  2463. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock}, smalltalk.Array)});},
  2464. args: ["aBlock"],
  2465. source: "sorted: aBlock\x0a\x09^self copy sort: aBlock",
  2466. messageSends: ["sort:", "copy"],
  2467. referencedClasses: []
  2468. }),
  2469. smalltalk.Array);
  2470. smalltalk.addMethod(
  2471. "_new_",
  2472. smalltalk.method({
  2473. selector: "new:",
  2474. category: 'instance creation',
  2475. fn: function (anInteger) {
  2476. var self=this;
  2477. return smalltalk.withContext(function($ctx1) { return new Array(anInteger);
  2478. return self}, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger}, smalltalk.Array.klass)});},
  2479. args: ["anInteger"],
  2480. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  2481. messageSends: [],
  2482. referencedClasses: []
  2483. }),
  2484. smalltalk.Array.klass);
  2485. smalltalk.addMethod(
  2486. "_with_",
  2487. smalltalk.method({
  2488. selector: "with:",
  2489. category: 'instance creation',
  2490. fn: function (anObject) {
  2491. var self=this;
  2492. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  2493. $2=_st(self)._new_((1));
  2494. _st($2)._at_put_((1),anObject);
  2495. $3=_st($2)._yourself();
  2496. $1=$3;
  2497. return $1;
  2498. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject}, smalltalk.Array.klass)});},
  2499. args: ["anObject"],
  2500. source: "with: anObject\x0a\x09 ^(self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  2501. messageSends: ["at:put:", "new:", "yourself"],
  2502. referencedClasses: []
  2503. }),
  2504. smalltalk.Array.klass);
  2505. smalltalk.addMethod(
  2506. "_with_with_",
  2507. smalltalk.method({
  2508. selector: "with:with:",
  2509. category: 'instance creation',
  2510. fn: function (anObject, anObject2) {
  2511. var self=this;
  2512. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  2513. $2=_st(self)._new_((2));
  2514. _st($2)._at_put_((1),anObject);
  2515. _st($2)._at_put_((2),anObject2);
  2516. $3=_st($2)._yourself();
  2517. $1=$3;
  2518. return $1;
  2519. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2}, smalltalk.Array.klass)});},
  2520. args: ["anObject", "anObject2"],
  2521. source: "with: anObject with: anObject2\x0a\x09 ^(self new: 2)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09yourself",
  2522. messageSends: ["at:put:", "new:", "yourself"],
  2523. referencedClasses: []
  2524. }),
  2525. smalltalk.Array.klass);
  2526. smalltalk.addMethod(
  2527. "_with_with_with_",
  2528. smalltalk.method({
  2529. selector: "with:with:with:",
  2530. category: 'instance creation',
  2531. fn: function (anObject, anObject2, anObject3) {
  2532. var self=this;
  2533. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  2534. $2=_st(self)._new_((3));
  2535. _st($2)._at_put_((1),anObject);
  2536. _st($2)._at_put_((2),anObject2);
  2537. _st($2)._at_put_((3),anObject3);
  2538. $3=_st($2)._yourself();
  2539. $1=$3;
  2540. return $1;
  2541. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3}, smalltalk.Array.klass)});},
  2542. args: ["anObject", "anObject2", "anObject3"],
  2543. source: "with: anObject with: anObject2 with: anObject3\x0a\x09 ^(self new: 3)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09at: 3 put: anObject3;\x0a\x09\x09yourself",
  2544. messageSends: ["at:put:", "new:", "yourself"],
  2545. referencedClasses: []
  2546. }),
  2547. smalltalk.Array.klass);
  2548. smalltalk.addMethod(
  2549. "_withAll_",
  2550. smalltalk.method({
  2551. selector: "withAll:",
  2552. category: 'instance creation',
  2553. fn: function (aCollection) {
  2554. var self=this;
  2555. var instance,index;
  2556. return smalltalk.withContext(function($ctx1) { var $1;
  2557. index=(1);
  2558. instance=_st(self)._new_(_st(aCollection)._size());
  2559. _st(aCollection)._do_((function(each){
  2560. return smalltalk.withContext(function($ctx2) { _st(instance)._at_put_(index,each);
  2561. index=_st(index).__plus((1));
  2562. return index;
  2563. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  2564. $1=instance;
  2565. return $1;
  2566. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index}, smalltalk.Array.klass)});},
  2567. args: ["aCollection"],
  2568. source: "withAll: aCollection\x0a\x09| instance index |\x0a\x09index := 1.\x0a\x09instance := self new: aCollection size.\x0a\x09aCollection do: [:each |\x0a\x09\x09instance at: index put: each.\x0a\x09\x09index := index + 1].\x0a\x09^instance",
  2569. messageSends: ["new:", "size", "do:", "at:put:", "+"],
  2570. referencedClasses: []
  2571. }),
  2572. smalltalk.Array.klass);
  2573. smalltalk.addClass('CharacterArray', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  2574. smalltalk.addMethod(
  2575. "__comma",
  2576. smalltalk.method({
  2577. selector: ",",
  2578. category: 'copying',
  2579. fn: function (aString) {
  2580. var self=this;
  2581. return smalltalk.withContext(function($ctx1) { var $1;
  2582. $1=_st(_st(self)._asString()).__comma(_st(aString)._asString());
  2583. return $1;
  2584. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString}, smalltalk.CharacterArray)});},
  2585. args: ["aString"],
  2586. source: ", aString\x0a\x09^self asString, aString asString",
  2587. messageSends: [",", "asString"],
  2588. referencedClasses: []
  2589. }),
  2590. smalltalk.CharacterArray);
  2591. smalltalk.addMethod(
  2592. "_add_",
  2593. smalltalk.method({
  2594. selector: "add:",
  2595. category: 'adding',
  2596. fn: function (anObject) {
  2597. var self=this;
  2598. return smalltalk.withContext(function($ctx1) { _st(self)._errorReadOnly();
  2599. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject}, smalltalk.CharacterArray)});},
  2600. args: ["anObject"],
  2601. source: "add: anObject\x0a\x09self errorReadOnly",
  2602. messageSends: ["errorReadOnly"],
  2603. referencedClasses: []
  2604. }),
  2605. smalltalk.CharacterArray);
  2606. smalltalk.addMethod(
  2607. "_asLowercase",
  2608. smalltalk.method({
  2609. selector: "asLowercase",
  2610. category: 'converting',
  2611. fn: function () {
  2612. var self=this;
  2613. return smalltalk.withContext(function($ctx1) { var $1;
  2614. $1=_st(_st(self)._class())._fromString_(_st(_st(self)._asString())._asLowercase());
  2615. return $1;
  2616. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{}, smalltalk.CharacterArray)});},
  2617. args: [],
  2618. source: "asLowercase\x0a\x09^self class fromString: self asString asLowercase",
  2619. messageSends: ["fromString:", "asLowercase", "asString", "class"],
  2620. referencedClasses: []
  2621. }),
  2622. smalltalk.CharacterArray);
  2623. smalltalk.addMethod(
  2624. "_asNumber",
  2625. smalltalk.method({
  2626. selector: "asNumber",
  2627. category: 'converting',
  2628. fn: function () {
  2629. var self=this;
  2630. return smalltalk.withContext(function($ctx1) { var $1;
  2631. $1=_st(_st(self)._asString())._asNumber();
  2632. return $1;
  2633. }, function($ctx1) {$ctx1.fill(self,"asNumber",{}, smalltalk.CharacterArray)});},
  2634. args: [],
  2635. source: "asNumber\x0a\x09^self asString asNumber",
  2636. messageSends: ["asNumber", "asString"],
  2637. referencedClasses: []
  2638. }),
  2639. smalltalk.CharacterArray);
  2640. smalltalk.addMethod(
  2641. "_asString",
  2642. smalltalk.method({
  2643. selector: "asString",
  2644. category: 'converting',
  2645. fn: function () {
  2646. var self=this;
  2647. return smalltalk.withContext(function($ctx1) { var $1;
  2648. $1=_st(self)._subclassResponsibility();
  2649. return $1;
  2650. }, function($ctx1) {$ctx1.fill(self,"asString",{}, smalltalk.CharacterArray)});},
  2651. args: [],
  2652. source: "asString\x0a\x09^self subclassResponsibility",
  2653. messageSends: ["subclassResponsibility"],
  2654. referencedClasses: []
  2655. }),
  2656. smalltalk.CharacterArray);
  2657. smalltalk.addMethod(
  2658. "_asSymbol",
  2659. smalltalk.method({
  2660. selector: "asSymbol",
  2661. category: 'converting',
  2662. fn: function () {
  2663. var self=this;
  2664. return smalltalk.withContext(function($ctx1) { var $1;
  2665. $1=_st(self)._subclassResponsibility();
  2666. return $1;
  2667. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{}, smalltalk.CharacterArray)});},
  2668. args: [],
  2669. source: "asSymbol\x0a\x09^self subclassResponsibility",
  2670. messageSends: ["subclassResponsibility"],
  2671. referencedClasses: []
  2672. }),
  2673. smalltalk.CharacterArray);
  2674. smalltalk.addMethod(
  2675. "_asUppercase",
  2676. smalltalk.method({
  2677. selector: "asUppercase",
  2678. category: 'converting',
  2679. fn: function () {
  2680. var self=this;
  2681. return smalltalk.withContext(function($ctx1) { var $1;
  2682. $1=_st(_st(self)._class())._fromString_(_st(_st(self)._asString())._asUppercase());
  2683. return $1;
  2684. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{}, smalltalk.CharacterArray)});},
  2685. args: [],
  2686. source: "asUppercase\x0a\x09^self class fromString: self asString asUppercase",
  2687. messageSends: ["fromString:", "asUppercase", "asString", "class"],
  2688. referencedClasses: []
  2689. }),
  2690. smalltalk.CharacterArray);
  2691. smalltalk.addMethod(
  2692. "_at_put_",
  2693. smalltalk.method({
  2694. selector: "at:put:",
  2695. category: 'accessing',
  2696. fn: function (anIndex, anObject) {
  2697. var self=this;
  2698. return smalltalk.withContext(function($ctx1) { _st(self)._errorReadOnly();
  2699. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject}, smalltalk.CharacterArray)});},
  2700. args: ["anIndex", "anObject"],
  2701. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  2702. messageSends: ["errorReadOnly"],
  2703. referencedClasses: []
  2704. }),
  2705. smalltalk.CharacterArray);
  2706. smalltalk.addMethod(
  2707. "_errorReadOnly",
  2708. smalltalk.method({
  2709. selector: "errorReadOnly",
  2710. category: 'error handling',
  2711. fn: function () {
  2712. var self=this;
  2713. return smalltalk.withContext(function($ctx1) { _st(self)._error_("Object is read-only");
  2714. return self}, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{}, smalltalk.CharacterArray)});},
  2715. args: [],
  2716. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  2717. messageSends: ["error:"],
  2718. referencedClasses: []
  2719. }),
  2720. smalltalk.CharacterArray);
  2721. smalltalk.addMethod(
  2722. "_printString",
  2723. smalltalk.method({
  2724. selector: "printString",
  2725. category: 'printing',
  2726. fn: function () {
  2727. var self=this;
  2728. return smalltalk.withContext(function($ctx1) { var $1;
  2729. $1=_st(_st(self)._asString())._printString();
  2730. return $1;
  2731. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.CharacterArray)});},
  2732. args: [],
  2733. source: "printString\x0a\x09^self asString printString",
  2734. messageSends: ["printString", "asString"],
  2735. referencedClasses: []
  2736. }),
  2737. smalltalk.CharacterArray);
  2738. smalltalk.addMethod(
  2739. "_remove_",
  2740. smalltalk.method({
  2741. selector: "remove:",
  2742. category: 'adding',
  2743. fn: function (anObject) {
  2744. var self=this;
  2745. return smalltalk.withContext(function($ctx1) { _st(self)._errorReadOnly();
  2746. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject}, smalltalk.CharacterArray)});},
  2747. args: ["anObject"],
  2748. source: "remove: anObject\x0a\x09self errorReadOnly",
  2749. messageSends: ["errorReadOnly"],
  2750. referencedClasses: []
  2751. }),
  2752. smalltalk.CharacterArray);
  2753. smalltalk.addMethod(
  2754. "_fromString_",
  2755. smalltalk.method({
  2756. selector: "fromString:",
  2757. category: 'instance creation',
  2758. fn: function (aString) {
  2759. var self=this;
  2760. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  2761. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString}, smalltalk.CharacterArray.klass)});},
  2762. args: ["aString"],
  2763. source: "fromString: aString\x0a\x09self subclassResponsibility",
  2764. messageSends: ["subclassResponsibility"],
  2765. referencedClasses: []
  2766. }),
  2767. smalltalk.CharacterArray.klass);
  2768. smalltalk.addClass('String', smalltalk.CharacterArray, [], 'Kernel-Collections');
  2769. smalltalk.addMethod(
  2770. "__comma",
  2771. smalltalk.method({
  2772. selector: ",",
  2773. category: 'copying',
  2774. fn: function (aString) {
  2775. var self=this;
  2776. return smalltalk.withContext(function($ctx1) { return self + aString;
  2777. return self}, function($ctx1) {$ctx1.fill(self,",",{aString:aString}, smalltalk.String)});},
  2778. args: ["aString"],
  2779. source: ", aString\x0a\x09<return self + aString>",
  2780. messageSends: [],
  2781. referencedClasses: []
  2782. }),
  2783. smalltalk.String);
  2784. smalltalk.addMethod(
  2785. "__lt",
  2786. smalltalk.method({
  2787. selector: "<",
  2788. category: 'comparing',
  2789. fn: function (aString) {
  2790. var self=this;
  2791. return smalltalk.withContext(function($ctx1) { return String(self) < aString._asString();
  2792. return self}, function($ctx1) {$ctx1.fill(self,"<",{aString:aString}, smalltalk.String)});},
  2793. args: ["aString"],
  2794. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  2795. messageSends: [],
  2796. referencedClasses: []
  2797. }),
  2798. smalltalk.String);
  2799. smalltalk.addMethod(
  2800. "__lt_eq",
  2801. smalltalk.method({
  2802. selector: "<=",
  2803. category: 'comparing',
  2804. fn: function (aString) {
  2805. var self=this;
  2806. return smalltalk.withContext(function($ctx1) { return String(self) <= aString._asString();
  2807. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString}, smalltalk.String)});},
  2808. args: ["aString"],
  2809. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  2810. messageSends: [],
  2811. referencedClasses: []
  2812. }),
  2813. smalltalk.String);
  2814. smalltalk.addMethod(
  2815. "__eq",
  2816. smalltalk.method({
  2817. selector: "=",
  2818. category: 'comparing',
  2819. fn: function (aString) {
  2820. var self=this;
  2821. return smalltalk.withContext(function($ctx1) {
  2822. if(! aString._isString || ! aString._isString()) {
  2823. return false;
  2824. }
  2825. return String(self) === String(aString)
  2826. ;
  2827. return self}, function($ctx1) {$ctx1.fill(self,"=",{aString:aString}, smalltalk.String)});},
  2828. args: ["aString"],
  2829. source: "= aString\x0a\x09<\x0a \x09if(! aString._isString || ! aString._isString()) {\x0a \x09return false;\x0a }\x0a \x09return String(self) === String(aString)\x0a >",
  2830. messageSends: [],
  2831. referencedClasses: []
  2832. }),
  2833. smalltalk.String);
  2834. smalltalk.addMethod(
  2835. "__eq_eq",
  2836. smalltalk.method({
  2837. selector: "==",
  2838. category: 'comparing',
  2839. fn: function (aString) {
  2840. var self=this;
  2841. return smalltalk.withContext(function($ctx1) { var $1;
  2842. $1=_st(self).__eq(aString);
  2843. return $1;
  2844. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString}, smalltalk.String)});},
  2845. args: ["aString"],
  2846. source: "== aString\x0a\x09^self = aString",
  2847. messageSends: ["="],
  2848. referencedClasses: []
  2849. }),
  2850. smalltalk.String);
  2851. smalltalk.addMethod(
  2852. "__gt",
  2853. smalltalk.method({
  2854. selector: ">",
  2855. category: 'comparing',
  2856. fn: function (aString) {
  2857. var self=this;
  2858. return smalltalk.withContext(function($ctx1) { return String(self) > aString._asString();
  2859. return self}, function($ctx1) {$ctx1.fill(self,">",{aString:aString}, smalltalk.String)});},
  2860. args: ["aString"],
  2861. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  2862. messageSends: [],
  2863. referencedClasses: []
  2864. }),
  2865. smalltalk.String);
  2866. smalltalk.addMethod(
  2867. "__gt_eq",
  2868. smalltalk.method({
  2869. selector: ">=",
  2870. category: 'comparing',
  2871. fn: function (aString) {
  2872. var self=this;
  2873. return smalltalk.withContext(function($ctx1) { return String(self) >= aString._asString();
  2874. return self}, function($ctx1) {$ctx1.fill(self,">=",{aString:aString}, smalltalk.String)});},
  2875. args: ["aString"],
  2876. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  2877. messageSends: [],
  2878. referencedClasses: []
  2879. }),
  2880. smalltalk.String);
  2881. smalltalk.addMethod(
  2882. "_asJSON",
  2883. smalltalk.method({
  2884. selector: "asJSON",
  2885. category: 'converting',
  2886. fn: function () {
  2887. var self=this;
  2888. return smalltalk.withContext(function($ctx1) { var $1;
  2889. $1=self;
  2890. return $1;
  2891. }, function($ctx1) {$ctx1.fill(self,"asJSON",{}, smalltalk.String)});},
  2892. args: [],
  2893. source: "asJSON\x0a\x09^self",
  2894. messageSends: [],
  2895. referencedClasses: []
  2896. }),
  2897. smalltalk.String);
  2898. smalltalk.addMethod(
  2899. "_asJavaScriptSelector",
  2900. smalltalk.method({
  2901. selector: "asJavaScriptSelector",
  2902. category: 'converting',
  2903. fn: function () {
  2904. var self=this;
  2905. return smalltalk.withContext(function($ctx1) { var $1;
  2906. $1=_st(_st(_st(self)._asSelector())._replace_with_("^_",""))._replace_with_("_.*","");
  2907. return $1;
  2908. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{}, smalltalk.String)});},
  2909. args: [],
  2910. source: "asJavaScriptSelector\x0a\x09^(self asSelector replace: '^_' with: '') replace: '_.*' with: ''.",
  2911. messageSends: ["replace:with:", "asSelector"],
  2912. referencedClasses: []
  2913. }),
  2914. smalltalk.String);
  2915. smalltalk.addMethod(
  2916. "_asJavascript",
  2917. smalltalk.method({
  2918. selector: "asJavascript",
  2919. category: 'converting',
  2920. fn: function () {
  2921. var self=this;
  2922. return smalltalk.withContext(function($ctx1) {
  2923. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  2924. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  2925. else
  2926. return "\"" + self + "\"";
  2927. ;
  2928. return self}, function($ctx1) {$ctx1.fill(self,"asJavascript",{}, smalltalk.String)});},
  2929. args: [],
  2930. source: "asJavascript\x0a\x09<\x0a\x09\x09if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self.replace(/[\x5cx00-\x5cx1f\x22\x5c\x5c\x5cx7f-\x5cx9f]/g, function(ch){var c=ch.charCodeAt(0);return \x22\x5c\x5cx\x22+(\x220\x22+c.toString(16)).slice(-2)}) + \x22\x5c\x22\x22;\x0a\x09\x09else\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self + \x22\x5c\x22\x22;\x0a\x09>",
  2931. messageSends: [],
  2932. referencedClasses: []
  2933. }),
  2934. smalltalk.String);
  2935. smalltalk.addMethod(
  2936. "_asLowercase",
  2937. smalltalk.method({
  2938. selector: "asLowercase",
  2939. category: 'converting',
  2940. fn: function () {
  2941. var self=this;
  2942. return smalltalk.withContext(function($ctx1) { return self.toLowerCase();
  2943. return self}, function($ctx1) {$ctx1.fill(self,"asLowercase",{}, smalltalk.String)});},
  2944. args: [],
  2945. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  2946. messageSends: [],
  2947. referencedClasses: []
  2948. }),
  2949. smalltalk.String);
  2950. smalltalk.addMethod(
  2951. "_asNumber",
  2952. smalltalk.method({
  2953. selector: "asNumber",
  2954. category: 'converting',
  2955. fn: function () {
  2956. var self=this;
  2957. return smalltalk.withContext(function($ctx1) { return Number(self);
  2958. return self}, function($ctx1) {$ctx1.fill(self,"asNumber",{}, smalltalk.String)});},
  2959. args: [],
  2960. source: "asNumber\x0a\x09<return Number(self)>",
  2961. messageSends: [],
  2962. referencedClasses: []
  2963. }),
  2964. smalltalk.String);
  2965. smalltalk.addMethod(
  2966. "_asRegexp",
  2967. smalltalk.method({
  2968. selector: "asRegexp",
  2969. category: 'converting',
  2970. fn: function () {
  2971. var self=this;
  2972. return smalltalk.withContext(function($ctx1) { var $1;
  2973. $1=_st((smalltalk.RegularExpression || RegularExpression))._fromString_(self);
  2974. return $1;
  2975. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{}, smalltalk.String)});},
  2976. args: [],
  2977. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  2978. messageSends: ["fromString:"],
  2979. referencedClasses: ["RegularExpression"]
  2980. }),
  2981. smalltalk.String);
  2982. smalltalk.addMethod(
  2983. "_asSelector",
  2984. smalltalk.method({
  2985. selector: "asSelector",
  2986. category: 'converting',
  2987. fn: function () {
  2988. var self=this;
  2989. return smalltalk.withContext(function($ctx1) { return smalltalk.selector(self);
  2990. return self}, function($ctx1) {$ctx1.fill(self,"asSelector",{}, smalltalk.String)});},
  2991. args: [],
  2992. source: "asSelector\x0a\x09<return smalltalk.selector(self)>",
  2993. messageSends: [],
  2994. referencedClasses: []
  2995. }),
  2996. smalltalk.String);
  2997. smalltalk.addMethod(
  2998. "_asString",
  2999. smalltalk.method({
  3000. selector: "asString",
  3001. category: 'converting',
  3002. fn: function () {
  3003. var self=this;
  3004. return smalltalk.withContext(function($ctx1) { var $1;
  3005. $1=self;
  3006. return $1;
  3007. }, function($ctx1) {$ctx1.fill(self,"asString",{}, smalltalk.String)});},
  3008. args: [],
  3009. source: "asString\x0a\x09^self",
  3010. messageSends: [],
  3011. referencedClasses: []
  3012. }),
  3013. smalltalk.String);
  3014. smalltalk.addMethod(
  3015. "_asSymbol",
  3016. smalltalk.method({
  3017. selector: "asSymbol",
  3018. category: 'converting',
  3019. fn: function () {
  3020. var self=this;
  3021. return smalltalk.withContext(function($ctx1) { var $1;
  3022. $1=_st((smalltalk.Symbol || Symbol))._lookup_(self);
  3023. return $1;
  3024. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{}, smalltalk.String)});},
  3025. args: [],
  3026. source: "asSymbol\x0a\x09^Symbol lookup: self",
  3027. messageSends: ["lookup:"],
  3028. referencedClasses: ["Symbol"]
  3029. }),
  3030. smalltalk.String);
  3031. smalltalk.addMethod(
  3032. "_asUppercase",
  3033. smalltalk.method({
  3034. selector: "asUppercase",
  3035. category: 'converting',
  3036. fn: function () {
  3037. var self=this;
  3038. return smalltalk.withContext(function($ctx1) { return self.toUpperCase();
  3039. return self}, function($ctx1) {$ctx1.fill(self,"asUppercase",{}, smalltalk.String)});},
  3040. args: [],
  3041. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  3042. messageSends: [],
  3043. referencedClasses: []
  3044. }),
  3045. smalltalk.String);
  3046. smalltalk.addMethod(
  3047. "_asciiValue",
  3048. smalltalk.method({
  3049. selector: "asciiValue",
  3050. category: 'accessing',
  3051. fn: function () {
  3052. var self=this;
  3053. return smalltalk.withContext(function($ctx1) { return self.charCodeAt(0);;
  3054. return self}, function($ctx1) {$ctx1.fill(self,"asciiValue",{}, smalltalk.String)});},
  3055. args: [],
  3056. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  3057. messageSends: [],
  3058. referencedClasses: []
  3059. }),
  3060. smalltalk.String);
  3061. smalltalk.addMethod(
  3062. "_at_ifAbsent_",
  3063. smalltalk.method({
  3064. selector: "at:ifAbsent:",
  3065. category: 'accessing',
  3066. fn: function (anIndex, aBlock) {
  3067. var self=this;
  3068. return smalltalk.withContext(function($ctx1) { return String(self).charAt(anIndex - 1) || aBlock();
  3069. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock}, smalltalk.String)});},
  3070. args: ["anIndex", "aBlock"],
  3071. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self).charAt(anIndex - 1) || aBlock()>",
  3072. messageSends: [],
  3073. referencedClasses: []
  3074. }),
  3075. smalltalk.String);
  3076. smalltalk.addMethod(
  3077. "_copyFrom_to_",
  3078. smalltalk.method({
  3079. selector: "copyFrom:to:",
  3080. category: 'copying',
  3081. fn: function (anIndex, anotherIndex) {
  3082. var self=this;
  3083. return smalltalk.withContext(function($ctx1) { return self.substring(anIndex - 1, anotherIndex);
  3084. return self}, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex}, smalltalk.String)});},
  3085. args: ["anIndex", "anotherIndex"],
  3086. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  3087. messageSends: [],
  3088. referencedClasses: []
  3089. }),
  3090. smalltalk.String);
  3091. smalltalk.addMethod(
  3092. "_deepCopy",
  3093. smalltalk.method({
  3094. selector: "deepCopy",
  3095. category: 'copying',
  3096. fn: function () {
  3097. var self=this;
  3098. return smalltalk.withContext(function($ctx1) { var $1;
  3099. $1=_st(self)._shallowCopy();
  3100. return $1;
  3101. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{}, smalltalk.String)});},
  3102. args: [],
  3103. source: "deepCopy\x0a\x09^self shallowCopy",
  3104. messageSends: ["shallowCopy"],
  3105. referencedClasses: []
  3106. }),
  3107. smalltalk.String);
  3108. smalltalk.addMethod(
  3109. "_do_",
  3110. smalltalk.method({
  3111. selector: "do:",
  3112. category: 'enumerating',
  3113. fn: function (aBlock) {
  3114. var self=this;
  3115. return smalltalk.withContext(function($ctx1) { for(var i=0;i<self.length;i++){aBlock(self.charAt(i));};
  3116. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.String)});},
  3117. args: ["aBlock"],
  3118. source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self.charAt(i));}>",
  3119. messageSends: [],
  3120. referencedClasses: []
  3121. }),
  3122. smalltalk.String);
  3123. smalltalk.addMethod(
  3124. "_escaped",
  3125. smalltalk.method({
  3126. selector: "escaped",
  3127. category: 'accessing',
  3128. fn: function () {
  3129. var self=this;
  3130. return smalltalk.withContext(function($ctx1) { return escape(self);
  3131. return self}, function($ctx1) {$ctx1.fill(self,"escaped",{}, smalltalk.String)});},
  3132. args: [],
  3133. source: "escaped\x0a\x09<return escape(self)>",
  3134. messageSends: [],
  3135. referencedClasses: []
  3136. }),
  3137. smalltalk.String);
  3138. smalltalk.addMethod(
  3139. "_includesSubString_",
  3140. smalltalk.method({
  3141. selector: "includesSubString:",
  3142. category: 'testing',
  3143. fn: function (subString) {
  3144. var self=this;
  3145. return smalltalk.withContext(function($ctx1) { return self.indexOf(subString) != -1 ;
  3146. return self}, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString}, smalltalk.String)});},
  3147. args: ["subString"],
  3148. source: "includesSubString: subString\x0a\x09< return self.indexOf(subString) != -1 >",
  3149. messageSends: [],
  3150. referencedClasses: []
  3151. }),
  3152. smalltalk.String);
  3153. smalltalk.addMethod(
  3154. "_isString",
  3155. smalltalk.method({
  3156. selector: "isString",
  3157. category: 'testing',
  3158. fn: function () {
  3159. var self=this;
  3160. return smalltalk.withContext(function($ctx1) { return true;
  3161. }, function($ctx1) {$ctx1.fill(self,"isString",{}, smalltalk.String)});},
  3162. args: [],
  3163. source: "isString\x0a\x09^true",
  3164. messageSends: [],
  3165. referencedClasses: []
  3166. }),
  3167. smalltalk.String);
  3168. smalltalk.addMethod(
  3169. "_join_",
  3170. smalltalk.method({
  3171. selector: "join:",
  3172. category: 'split join',
  3173. fn: function (aCollection) {
  3174. var self=this;
  3175. return smalltalk.withContext(function($ctx1) { var $1;
  3176. $1=_st((smalltalk.String || String))._streamContents_((function(stream){
  3177. return smalltalk.withContext(function($ctx2) { return _st(aCollection)._do_separatedBy_((function(each){
  3178. return smalltalk.withContext(function($ctx3) { return _st(stream)._nextPutAll_(_st(each)._asString());
  3179. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  3180. return smalltalk.withContext(function($ctx3) { return _st(stream)._nextPutAll_(self);
  3181. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  3182. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  3183. return $1;
  3184. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection}, smalltalk.String)});},
  3185. args: ["aCollection"],
  3186. source: "join: aCollection \x0a\x09^ String\x0a\x09\x09streamContents: [:stream | aCollection\x0a\x09\x09\x09\x09do: [:each | stream nextPutAll: each asString] \x0a\x09\x09\x09\x09separatedBy: [stream nextPutAll: self]]",
  3187. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"],
  3188. referencedClasses: ["String"]
  3189. }),
  3190. smalltalk.String);
  3191. smalltalk.addMethod(
  3192. "_lineIndicesDo_",
  3193. smalltalk.method({
  3194. selector: "lineIndicesDo:",
  3195. category: 'split join',
  3196. fn: function (aBlock) {
  3197. var self=this;
  3198. var cr,lf,start,sz,nextLF,nextCR;
  3199. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$5,$6,$8,$7,$2;
  3200. var $early={};
  3201. try {
  3202. start=(1);
  3203. sz=_st(self)._size();
  3204. cr=_st((smalltalk.String || String))._cr();
  3205. nextCR=_st(self)._indexOf_startingAt_(cr,(1));
  3206. lf=_st((smalltalk.String || String))._lf();
  3207. nextLF=_st(self)._indexOf_startingAt_(lf,(1));
  3208. $1=(function(){
  3209. return smalltalk.withContext(function($ctx2) { return _st(start).__lt_eq(sz);
  3210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  3211. $2=(function(){
  3212. return smalltalk.withContext(function($ctx2) { $3=_st(_st(nextLF).__eq((0)))._and_((function(){
  3213. return smalltalk.withContext(function($ctx3) { return _st(nextCR).__eq((0));
  3214. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  3215. if(smalltalk.assert($3)){
  3216. _st(aBlock)._value_value_value_(start,sz,sz);
  3217. $4=self;
  3218. throw $early=[$4];
  3219. };
  3220. $5=_st(_st(nextCR).__eq((0)))._or_((function(){
  3221. return smalltalk.withContext(function($ctx3) { return _st(_st((0)).__lt(nextLF))._and_((function(){
  3222. return smalltalk.withContext(function($ctx4) { return _st(nextLF).__lt(nextCR);
  3223. }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
  3224. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  3225. $6=(function(){
  3226. return smalltalk.withContext(function($ctx3) { _st(aBlock)._value_value_value_(start,_st(nextLF).__minus((1)),nextLF);
  3227. start=_st((1)).__plus(nextLF);
  3228. start;
  3229. nextLF=_st(self)._indexOf_startingAt_(lf,start);
  3230. return nextLF;
  3231. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})});
  3232. $7=(function(){
  3233. return smalltalk.withContext(function($ctx3) { $8=_st(_st((1)).__plus(nextCR)).__eq(nextLF);
  3234. if(smalltalk.assert($8)){
  3235. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextLF);
  3236. start=_st((1)).__plus(nextLF);
  3237. start;
  3238. nextCR=_st(self)._indexOf_startingAt_(cr,start);
  3239. nextCR;
  3240. nextLF=_st(self)._indexOf_startingAt_(lf,start);
  3241. return nextLF;
  3242. } else {
  3243. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextCR);
  3244. start=_st((1)).__plus(nextCR);
  3245. start;
  3246. nextCR=_st(self)._indexOf_startingAt_(cr,start);
  3247. return nextCR;
  3248. };
  3249. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})});
  3250. return _st($5)._ifTrue_ifFalse_($6,$7);
  3251. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  3252. _st($1)._whileTrue_($2);
  3253. return self}
  3254. catch(e) {if(e===$early)return e[0]; throw e}
  3255. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR}, smalltalk.String)});},
  3256. args: ["aBlock"],
  3257. source: "lineIndicesDo: aBlock\x0a\x09\x22execute aBlock with 3 arguments for each line:\x0a\x09- start index of line\x0a\x09- end index of line without line delimiter\x0a\x09- end index of line including line delimiter(s) CR, LF or CRLF\x22\x0a\x09\x0a\x09| cr lf start sz nextLF nextCR |\x0a\x09start := 1.\x0a\x09sz := self size.\x0a\x09cr := String cr.\x0a\x09nextCR := self indexOf: cr startingAt: 1.\x0a\x09lf := String lf.\x0a\x09nextLF := self indexOf: lf startingAt: 1.\x0a\x09[ start <= sz ] whileTrue: [\x0a\x09\x09(nextLF = 0 and: [ nextCR = 0 ])\x0a\x09\x09\x09ifTrue: [ \x22No more CR, nor LF, the string is over\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: sz value: sz.\x0a\x09\x09\x09\x09\x09^self ].\x0a\x09\x09(nextCR = 0 or: [ 0 < nextLF and: [ nextLF < nextCR ] ])\x0a\x09\x09\x09ifTrue: [ \x22Found a LF\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextLF - 1 value: nextLF.\x0a\x09\x09\x09\x09\x09start := 1 + nextLF.\x0a\x09\x09\x09\x09\x09nextLF := self indexOf: lf startingAt: start ]\x0a\x09\x09\x09ifFalse: [ 1 + nextCR = nextLF\x0a\x09\x09\x09\x09ifTrue: [ \x22Found a CR-LF pair\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextCR - 1 value: nextLF.\x0a\x09\x09\x09\x09\x09start := 1 + nextLF.\x0a\x09\x09\x09\x09\x09nextCR := self indexOf: cr startingAt: start.\x0a\x09\x09\x09\x09\x09nextLF := self indexOf: lf startingAt: start ]\x0a\x09\x09\x09\x09ifFalse: [ \x22Found a CR\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextCR - 1 value: nextCR.\x0a\x09\x09\x09\x09\x09start := 1 + nextCR.\x0a\x09\x09\x09\x09\x09nextCR := self indexOf: cr startingAt: start ]]]",
  3258. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "ifTrue:", "value:value:value:", "and:", "=", "ifTrue:ifFalse:", "-", "+", "or:", "<", "<="],
  3259. referencedClasses: ["String"]
  3260. }),
  3261. smalltalk.String);
  3262. smalltalk.addMethod(
  3263. "_lineNumber_",
  3264. smalltalk.method({
  3265. selector: "lineNumber:",
  3266. category: 'split join',
  3267. fn: function (anIndex) {
  3268. var self=this;
  3269. var lineCount;
  3270. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$2;
  3271. var $early={};
  3272. try {
  3273. lineCount=(0);
  3274. $1=self;
  3275. $2=(function(start,endWithoutDelimiters,end){
  3276. return smalltalk.withContext(function($ctx2) { lineCount=_st(lineCount).__plus((1));
  3277. $3=_st(lineCount).__eq(anIndex);
  3278. if(smalltalk.assert($3)){
  3279. $4=_st(self)._copyFrom_to_(start,endWithoutDelimiters);
  3280. throw $early=[$4];
  3281. };
  3282. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1)})});
  3283. _st($1)._lineIndicesDo_($2);
  3284. return nil;
  3285. }
  3286. catch(e) {if(e===$early)return e[0]; throw e}
  3287. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount}, smalltalk.String)});},
  3288. args: ["anIndex"],
  3289. source: "lineNumber: anIndex\x0a\x09\x22Answer a string containing the characters in the given line number.\x22\x0a\x0a\x09| lineCount |\x0a\x09lineCount := 0.\x0a\x09self lineIndicesDo: [:start :endWithoutDelimiters :end |\x0a\x09\x09(lineCount := lineCount + 1) = anIndex ifTrue: [^self copyFrom: start to: endWithoutDelimiters]].\x0a\x09^nil",
  3290. messageSends: ["lineIndicesDo:", "ifTrue:", "copyFrom:to:", "=", "+"],
  3291. referencedClasses: []
  3292. }),
  3293. smalltalk.String);
  3294. smalltalk.addMethod(
  3295. "_lines",
  3296. smalltalk.method({
  3297. selector: "lines",
  3298. category: 'split join',
  3299. fn: function () {
  3300. var self=this;
  3301. var lines;
  3302. return smalltalk.withContext(function($ctx1) { var $1;
  3303. lines=_st((smalltalk.Array || Array))._new();
  3304. _st(self)._linesDo_((function(aLine){
  3305. return smalltalk.withContext(function($ctx2) { return _st(lines)._add_(aLine);
  3306. }, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1)})}));
  3307. $1=lines;
  3308. return $1;
  3309. }, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines}, smalltalk.String)});},
  3310. args: [],
  3311. source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a\x0a\x09| lines |\x0a\x09lines := Array new.\x0a\x09self linesDo: [:aLine | lines add: aLine].\x0a\x09^lines",
  3312. messageSends: ["new", "linesDo:", "add:"],
  3313. referencedClasses: ["Array"]
  3314. }),
  3315. smalltalk.String);
  3316. smalltalk.addMethod(
  3317. "_linesDo_",
  3318. smalltalk.method({
  3319. selector: "linesDo:",
  3320. category: 'split join',
  3321. fn: function (aBlock) {
  3322. var self=this;
  3323. return smalltalk.withContext(function($ctx1) { _st(self)._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  3324. return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_(_st(self)._copyFrom_to_(start,endWithoutDelimiters));
  3325. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1)})}));
  3326. return self}, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock}, smalltalk.String)});},
  3327. args: ["aBlock"],
  3328. source: "linesDo: aBlock\x0a\x09\x22Execute aBlock with each line in this string. The terminating line\x0a\x09delimiters CR, LF or CRLF pairs are not included in what is passed to aBlock\x22\x0a\x0a\x09self lineIndicesDo: [:start :endWithoutDelimiters :end |\x0a\x09\x09aBlock value: (self copyFrom: start to: endWithoutDelimiters)]",
  3329. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"],
  3330. referencedClasses: []
  3331. }),
  3332. smalltalk.String);
  3333. smalltalk.addMethod(
  3334. "_match_",
  3335. smalltalk.method({
  3336. selector: "match:",
  3337. category: 'regular expressions',
  3338. fn: function (aRegexp) {
  3339. var self=this;
  3340. return smalltalk.withContext(function($ctx1) { return self.search(aRegexp) != -1;
  3341. return self}, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp}, smalltalk.String)});},
  3342. args: ["aRegexp"],
  3343. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  3344. messageSends: [],
  3345. referencedClasses: []
  3346. }),
  3347. smalltalk.String);
  3348. smalltalk.addMethod(
  3349. "_matchesOf_",
  3350. smalltalk.method({
  3351. selector: "matchesOf:",
  3352. category: 'regular expressions',
  3353. fn: function (aRegularExpression) {
  3354. var self=this;
  3355. return smalltalk.withContext(function($ctx1) { return self.match(aRegularExpression);
  3356. return self}, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression}, smalltalk.String)});},
  3357. args: ["aRegularExpression"],
  3358. source: "matchesOf: aRegularExpression\x0a <return self.match(aRegularExpression)>",
  3359. messageSends: [],
  3360. referencedClasses: []
  3361. }),
  3362. smalltalk.String);
  3363. smalltalk.addMethod(
  3364. "_printNl",
  3365. smalltalk.method({
  3366. selector: "printNl",
  3367. category: 'printing',
  3368. fn: function () {
  3369. var self=this;
  3370. return smalltalk.withContext(function($ctx1) { console.log(self);
  3371. return self}, function($ctx1) {$ctx1.fill(self,"printNl",{}, smalltalk.String)});},
  3372. args: [],
  3373. source: "printNl\x0a\x09<console.log(self)>",
  3374. messageSends: [],
  3375. referencedClasses: []
  3376. }),
  3377. smalltalk.String);
  3378. smalltalk.addMethod(
  3379. "_printString",
  3380. smalltalk.method({
  3381. selector: "printString",
  3382. category: 'printing',
  3383. fn: function () {
  3384. var self=this;
  3385. return smalltalk.withContext(function($ctx1) { var $1;
  3386. $1=_st(_st("'").__comma(self)).__comma("'");
  3387. return $1;
  3388. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.String)});},
  3389. args: [],
  3390. source: "printString\x0a\x09^'''', self, ''''",
  3391. messageSends: [","],
  3392. referencedClasses: []
  3393. }),
  3394. smalltalk.String);
  3395. smalltalk.addMethod(
  3396. "_replace_with_",
  3397. smalltalk.method({
  3398. selector: "replace:with:",
  3399. category: 'regular expressions',
  3400. fn: function (aString, anotherString) {
  3401. var self=this;
  3402. return smalltalk.withContext(function($ctx1) { var $1;
  3403. $1=_st(self)._replaceRegexp_with_(_st((smalltalk.RegularExpression || RegularExpression))._fromString_flag_(aString,"g"),anotherString);
  3404. return $1;
  3405. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString}, smalltalk.String)});},
  3406. args: ["aString", "anotherString"],
  3407. source: "replace: aString with: anotherString\x0a\x09^self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  3408. messageSends: ["replaceRegexp:with:", "fromString:flag:"],
  3409. referencedClasses: ["RegularExpression"]
  3410. }),
  3411. smalltalk.String);
  3412. smalltalk.addMethod(
  3413. "_replaceRegexp_with_",
  3414. smalltalk.method({
  3415. selector: "replaceRegexp:with:",
  3416. category: 'regular expressions',
  3417. fn: function (aRegexp, aString) {
  3418. var self=this;
  3419. return smalltalk.withContext(function($ctx1) { return self.replace(aRegexp, aString);
  3420. return self}, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString}, smalltalk.String)});},
  3421. args: ["aRegexp", "aString"],
  3422. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  3423. messageSends: [],
  3424. referencedClasses: []
  3425. }),
  3426. smalltalk.String);
  3427. smalltalk.addMethod(
  3428. "_reversed",
  3429. smalltalk.method({
  3430. selector: "reversed",
  3431. category: 'converting',
  3432. fn: function () {
  3433. var self=this;
  3434. return smalltalk.withContext(function($ctx1) { return self.split("").reverse().join("");
  3435. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{}, smalltalk.String)});},
  3436. args: [],
  3437. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  3438. messageSends: [],
  3439. referencedClasses: []
  3440. }),
  3441. smalltalk.String);
  3442. smalltalk.addMethod(
  3443. "_shallowCopy",
  3444. smalltalk.method({
  3445. selector: "shallowCopy",
  3446. category: 'copying',
  3447. fn: function () {
  3448. var self=this;
  3449. return smalltalk.withContext(function($ctx1) { var $1;
  3450. $1=_st(_st(self)._class())._fromString_(self);
  3451. return $1;
  3452. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{}, smalltalk.String)});},
  3453. args: [],
  3454. source: "shallowCopy\x0a\x09^self class fromString: self",
  3455. messageSends: ["fromString:", "class"],
  3456. referencedClasses: []
  3457. }),
  3458. smalltalk.String);
  3459. smalltalk.addMethod(
  3460. "_size",
  3461. smalltalk.method({
  3462. selector: "size",
  3463. category: 'accessing',
  3464. fn: function () {
  3465. var self=this;
  3466. return smalltalk.withContext(function($ctx1) { return self.length;
  3467. return self}, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.String)});},
  3468. args: [],
  3469. source: "size\x0a\x09<return self.length>",
  3470. messageSends: [],
  3471. referencedClasses: []
  3472. }),
  3473. smalltalk.String);
  3474. smalltalk.addMethod(
  3475. "_tokenize_",
  3476. smalltalk.method({
  3477. selector: "tokenize:",
  3478. category: 'converting',
  3479. fn: function (aString) {
  3480. var self=this;
  3481. return smalltalk.withContext(function($ctx1) { return self.split(aString);
  3482. return self}, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString}, smalltalk.String)});},
  3483. args: ["aString"],
  3484. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  3485. messageSends: [],
  3486. referencedClasses: []
  3487. }),
  3488. smalltalk.String);
  3489. smalltalk.addMethod(
  3490. "_trimBoth",
  3491. smalltalk.method({
  3492. selector: "trimBoth",
  3493. category: 'regular expressions',
  3494. fn: function () {
  3495. var self=this;
  3496. return smalltalk.withContext(function($ctx1) { var $1;
  3497. $1=_st(self)._trimBoth_("\x5cs");
  3498. return $1;
  3499. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{}, smalltalk.String)});},
  3500. args: [],
  3501. source: "trimBoth\x0a\x09^self trimBoth: '\x5cs'",
  3502. messageSends: ["trimBoth:"],
  3503. referencedClasses: []
  3504. }),
  3505. smalltalk.String);
  3506. smalltalk.addMethod(
  3507. "_trimBoth_",
  3508. smalltalk.method({
  3509. selector: "trimBoth:",
  3510. category: 'regular expressions',
  3511. fn: function (separators) {
  3512. var self=this;
  3513. return smalltalk.withContext(function($ctx1) { var $1;
  3514. $1=_st(_st(self)._trimLeft_(separators))._trimRight_(separators);
  3515. return $1;
  3516. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators}, smalltalk.String)});},
  3517. args: ["separators"],
  3518. source: "trimBoth: separators\x0a\x0a\x09^(self trimLeft: separators) trimRight: separators",
  3519. messageSends: ["trimRight:", "trimLeft:"],
  3520. referencedClasses: []
  3521. }),
  3522. smalltalk.String);
  3523. smalltalk.addMethod(
  3524. "_trimLeft",
  3525. smalltalk.method({
  3526. selector: "trimLeft",
  3527. category: 'regular expressions',
  3528. fn: function () {
  3529. var self=this;
  3530. return smalltalk.withContext(function($ctx1) { var $1;
  3531. $1=_st(self)._trimLeft_("\x5cs");
  3532. return $1;
  3533. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{}, smalltalk.String)});},
  3534. args: [],
  3535. source: "trimLeft\x0a\x09^self trimLeft: '\x5cs'",
  3536. messageSends: ["trimLeft:"],
  3537. referencedClasses: []
  3538. }),
  3539. smalltalk.String);
  3540. smalltalk.addMethod(
  3541. "_trimLeft_",
  3542. smalltalk.method({
  3543. selector: "trimLeft:",
  3544. category: 'regular expressions',
  3545. fn: function (separators) {
  3546. var self=this;
  3547. return smalltalk.withContext(function($ctx1) { var $1;
  3548. $1=_st(self)._replaceRegexp_with_(_st((smalltalk.RegularExpression || RegularExpression))._fromString_flag_(_st(_st("^[").__comma(separators)).__comma("]+"),"g"),"");
  3549. return $1;
  3550. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators}, smalltalk.String)});},
  3551. args: ["separators"],
  3552. source: "trimLeft: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  3553. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  3554. referencedClasses: ["RegularExpression"]
  3555. }),
  3556. smalltalk.String);
  3557. smalltalk.addMethod(
  3558. "_trimRight",
  3559. smalltalk.method({
  3560. selector: "trimRight",
  3561. category: 'regular expressions',
  3562. fn: function () {
  3563. var self=this;
  3564. return smalltalk.withContext(function($ctx1) { var $1;
  3565. $1=_st(self)._trimRight_("\x5cs");
  3566. return $1;
  3567. }, function($ctx1) {$ctx1.fill(self,"trimRight",{}, smalltalk.String)});},
  3568. args: [],
  3569. source: "trimRight\x0a\x09^self trimRight: '\x5cs'",
  3570. messageSends: ["trimRight:"],
  3571. referencedClasses: []
  3572. }),
  3573. smalltalk.String);
  3574. smalltalk.addMethod(
  3575. "_trimRight_",
  3576. smalltalk.method({
  3577. selector: "trimRight:",
  3578. category: 'regular expressions',
  3579. fn: function (separators) {
  3580. var self=this;
  3581. return smalltalk.withContext(function($ctx1) { var $1;
  3582. $1=_st(self)._replaceRegexp_with_(_st((smalltalk.RegularExpression || RegularExpression))._fromString_flag_(_st(_st("[").__comma(separators)).__comma("]+$"),"g"),"");
  3583. return $1;
  3584. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators}, smalltalk.String)});},
  3585. args: ["separators"],
  3586. source: "trimRight: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  3587. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  3588. referencedClasses: ["RegularExpression"]
  3589. }),
  3590. smalltalk.String);
  3591. smalltalk.addMethod(
  3592. "_unescaped",
  3593. smalltalk.method({
  3594. selector: "unescaped",
  3595. category: 'accessing',
  3596. fn: function () {
  3597. var self=this;
  3598. return smalltalk.withContext(function($ctx1) { return unescape(self);
  3599. return self}, function($ctx1) {$ctx1.fill(self,"unescaped",{}, smalltalk.String)});},
  3600. args: [],
  3601. source: "unescaped\x0a\x09<return unescape(self)>",
  3602. messageSends: [],
  3603. referencedClasses: []
  3604. }),
  3605. smalltalk.String);
  3606. smalltalk.addMethod(
  3607. "_withIndexDo_",
  3608. smalltalk.method({
  3609. selector: "withIndexDo:",
  3610. category: 'enumerating',
  3611. fn: function (aBlock) {
  3612. var self=this;
  3613. return smalltalk.withContext(function($ctx1) { for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);};
  3614. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock}, smalltalk.String)});},
  3615. args: ["aBlock"],
  3616. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);}>",
  3617. messageSends: [],
  3618. referencedClasses: []
  3619. }),
  3620. smalltalk.String);
  3621. smalltalk.addMethod(
  3622. "_cr",
  3623. smalltalk.method({
  3624. selector: "cr",
  3625. category: 'accessing',
  3626. fn: function () {
  3627. var self=this;
  3628. return smalltalk.withContext(function($ctx1) { return '\r';
  3629. return self}, function($ctx1) {$ctx1.fill(self,"cr",{}, smalltalk.String.klass)});},
  3630. args: [],
  3631. source: "cr\x0a\x09<return '\x5cr'>",
  3632. messageSends: [],
  3633. referencedClasses: []
  3634. }),
  3635. smalltalk.String.klass);
  3636. smalltalk.addMethod(
  3637. "_crlf",
  3638. smalltalk.method({
  3639. selector: "crlf",
  3640. category: 'accessing',
  3641. fn: function () {
  3642. var self=this;
  3643. return smalltalk.withContext(function($ctx1) { return '\r\n';
  3644. return self}, function($ctx1) {$ctx1.fill(self,"crlf",{}, smalltalk.String.klass)});},
  3645. args: [],
  3646. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  3647. messageSends: [],
  3648. referencedClasses: []
  3649. }),
  3650. smalltalk.String.klass);
  3651. smalltalk.addMethod(
  3652. "_fromCharCode_",
  3653. smalltalk.method({
  3654. selector: "fromCharCode:",
  3655. category: 'instance creation',
  3656. fn: function (anInteger) {
  3657. var self=this;
  3658. return smalltalk.withContext(function($ctx1) { return String.fromCharCode(anInteger);
  3659. return self}, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger}, smalltalk.String.klass)});},
  3660. args: ["anInteger"],
  3661. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  3662. messageSends: [],
  3663. referencedClasses: []
  3664. }),
  3665. smalltalk.String.klass);
  3666. smalltalk.addMethod(
  3667. "_fromString_",
  3668. smalltalk.method({
  3669. selector: "fromString:",
  3670. category: 'instance creation',
  3671. fn: function (aString) {
  3672. var self=this;
  3673. return smalltalk.withContext(function($ctx1) { return new self.fn(aString);
  3674. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString}, smalltalk.String.klass)});},
  3675. args: ["aString"],
  3676. source: "fromString: aString\x0a\x09 <return new self.fn(aString)>",
  3677. messageSends: [],
  3678. referencedClasses: []
  3679. }),
  3680. smalltalk.String.klass);
  3681. smalltalk.addMethod(
  3682. "_lf",
  3683. smalltalk.method({
  3684. selector: "lf",
  3685. category: 'accessing',
  3686. fn: function () {
  3687. var self=this;
  3688. return smalltalk.withContext(function($ctx1) { return '\n';
  3689. return self}, function($ctx1) {$ctx1.fill(self,"lf",{}, smalltalk.String.klass)});},
  3690. args: [],
  3691. source: "lf\x0a\x09<return '\x5cn'>",
  3692. messageSends: [],
  3693. referencedClasses: []
  3694. }),
  3695. smalltalk.String.klass);
  3696. smalltalk.addMethod(
  3697. "_space",
  3698. smalltalk.method({
  3699. selector: "space",
  3700. category: 'accessing',
  3701. fn: function () {
  3702. var self=this;
  3703. return smalltalk.withContext(function($ctx1) { return ' ';
  3704. return self}, function($ctx1) {$ctx1.fill(self,"space",{}, smalltalk.String.klass)});},
  3705. args: [],
  3706. source: "space\x0a\x09<return ' '>",
  3707. messageSends: [],
  3708. referencedClasses: []
  3709. }),
  3710. smalltalk.String.klass);
  3711. smalltalk.addMethod(
  3712. "_streamClass",
  3713. smalltalk.method({
  3714. selector: "streamClass",
  3715. category: 'accessing',
  3716. fn: function () {
  3717. var self=this;
  3718. return smalltalk.withContext(function($ctx1) { var $1;
  3719. $1=(smalltalk.StringStream || StringStream);
  3720. return $1;
  3721. }, function($ctx1) {$ctx1.fill(self,"streamClass",{}, smalltalk.String.klass)});},
  3722. args: [],
  3723. source: "streamClass\x0a\x09 ^StringStream",
  3724. messageSends: [],
  3725. referencedClasses: ["StringStream"]
  3726. }),
  3727. smalltalk.String.klass);
  3728. smalltalk.addMethod(
  3729. "_streamContents_",
  3730. smalltalk.method({
  3731. selector: "streamContents:",
  3732. category: 'instance creation',
  3733. fn: function (blockWithArg) {
  3734. var self=this;
  3735. var stream;
  3736. return smalltalk.withContext(function($ctx1) { var $1;
  3737. stream=_st(_st(self)._streamClass())._on_(_st((smalltalk.String || String))._new());
  3738. _st(blockWithArg)._value_(stream);
  3739. $1=_st(stream)._contents();
  3740. return $1;
  3741. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{blockWithArg:blockWithArg,stream:stream}, smalltalk.String.klass)});},
  3742. args: ["blockWithArg"],
  3743. source: "streamContents: blockWithArg\x0a\x09|stream|\x0a\x09stream := (self streamClass on: String new).\x0a\x09blockWithArg value: stream.\x0a\x09^ stream contents",
  3744. messageSends: ["on:", "new", "streamClass", "value:", "contents"],
  3745. referencedClasses: ["String"]
  3746. }),
  3747. smalltalk.String.klass);
  3748. smalltalk.addMethod(
  3749. "_tab",
  3750. smalltalk.method({
  3751. selector: "tab",
  3752. category: 'accessing',
  3753. fn: function () {
  3754. var self=this;
  3755. return smalltalk.withContext(function($ctx1) { return '\t';
  3756. return self}, function($ctx1) {$ctx1.fill(self,"tab",{}, smalltalk.String.klass)});},
  3757. args: [],
  3758. source: "tab\x0a\x09<return '\x5ct'>",
  3759. messageSends: [],
  3760. referencedClasses: []
  3761. }),
  3762. smalltalk.String.klass);
  3763. smalltalk.addMethod(
  3764. "_value_",
  3765. smalltalk.method({
  3766. selector: "value:",
  3767. category: 'instance creation',
  3768. fn: function (aUTFCharCode) {
  3769. var self=this;
  3770. return smalltalk.withContext(function($ctx1) { return String.fromCharCode(aUTFCharCode);;
  3771. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode}, smalltalk.String.klass)});},
  3772. args: ["aUTFCharCode"],
  3773. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  3774. messageSends: [],
  3775. referencedClasses: []
  3776. }),
  3777. smalltalk.String.klass);
  3778. smalltalk.addClass('Symbol', smalltalk.CharacterArray, [], 'Kernel-Collections');
  3779. smalltalk.addMethod(
  3780. "__lt",
  3781. smalltalk.method({
  3782. selector: "<",
  3783. category: 'comparing',
  3784. fn: function (aSymbol) {
  3785. var self=this;
  3786. return smalltalk.withContext(function($ctx1) { var $1;
  3787. $1=_st(_st(self)._asString()).__lt(_st(aSymbol)._asString());
  3788. return $1;
  3789. }, function($ctx1) {$ctx1.fill(self,"<",{aSymbol:aSymbol}, smalltalk.Symbol)});},
  3790. args: ["aSymbol"],
  3791. source: "< aSymbol\x0a\x09^self asString < aSymbol asString",
  3792. messageSends: ["<", "asString"],
  3793. referencedClasses: []
  3794. }),
  3795. smalltalk.Symbol);
  3796. smalltalk.addMethod(
  3797. "__lt_eq",
  3798. smalltalk.method({
  3799. selector: "<=",
  3800. category: 'comparing',
  3801. fn: function (aSymbol) {
  3802. var self=this;
  3803. return smalltalk.withContext(function($ctx1) { var $1;
  3804. $1=_st(_st(self)._asString()).__lt_eq(_st(aSymbol)._asString());
  3805. return $1;
  3806. }, function($ctx1) {$ctx1.fill(self,"<=",{aSymbol:aSymbol}, smalltalk.Symbol)});},
  3807. args: ["aSymbol"],
  3808. source: "<= aSymbol\x0a\x09^self asString <= aSymbol asString",
  3809. messageSends: ["<=", "asString"],
  3810. referencedClasses: []
  3811. }),
  3812. smalltalk.Symbol);
  3813. smalltalk.addMethod(
  3814. "__eq",
  3815. smalltalk.method({
  3816. selector: "=",
  3817. category: 'comparing',
  3818. fn: function (aSymbol) {
  3819. var self=this;
  3820. return smalltalk.withContext(function($ctx1) { var $1,$2;
  3821. $1=_st(_st(aSymbol)._class()).__eq(_st(self)._class());
  3822. if(! smalltalk.assert($1)){
  3823. return false;
  3824. };
  3825. $2=_st(_st(self)._asString()).__eq(_st(aSymbol)._asString());
  3826. return $2;
  3827. }, function($ctx1) {$ctx1.fill(self,"=",{aSymbol:aSymbol}, smalltalk.Symbol)});},
  3828. args: ["aSymbol"],
  3829. source: "= aSymbol\x0a\x09aSymbol class = self class ifFalse: [^false].\x0a\x09^self asString = aSymbol asString",
  3830. messageSends: ["ifFalse:", "=", "class", "asString"],
  3831. referencedClasses: []
  3832. }),
  3833. smalltalk.Symbol);
  3834. smalltalk.addMethod(
  3835. "__gt",
  3836. smalltalk.method({
  3837. selector: ">",
  3838. category: 'comparing',
  3839. fn: function (aSymbol) {
  3840. var self=this;
  3841. return smalltalk.withContext(function($ctx1) { var $1;
  3842. $1=_st(_st(self)._asString()).__gt(_st(aSymbol)._asString());
  3843. return $1;
  3844. }, function($ctx1) {$ctx1.fill(self,">",{aSymbol:aSymbol}, smalltalk.Symbol)});},
  3845. args: ["aSymbol"],
  3846. source: "> aSymbol\x0a\x09^self asString > aSymbol asString",
  3847. messageSends: [">", "asString"],
  3848. referencedClasses: []
  3849. }),
  3850. smalltalk.Symbol);
  3851. smalltalk.addMethod(
  3852. "__gt_eq",
  3853. smalltalk.method({
  3854. selector: ">=",
  3855. category: 'comparing',
  3856. fn: function (aSymbol) {
  3857. var self=this;
  3858. return smalltalk.withContext(function($ctx1) { var $1;
  3859. $1=_st(_st(self)._asString()).__gt_eq(_st(aSymbol)._asString());
  3860. return $1;
  3861. }, function($ctx1) {$ctx1.fill(self,">=",{aSymbol:aSymbol}, smalltalk.Symbol)});},
  3862. args: ["aSymbol"],
  3863. source: ">= aSymbol\x0a\x09^self asString >= aSymbol asString",
  3864. messageSends: [">=", "asString"],
  3865. referencedClasses: []
  3866. }),
  3867. smalltalk.Symbol);
  3868. smalltalk.addMethod(
  3869. "_asJSON",
  3870. smalltalk.method({
  3871. selector: "asJSON",
  3872. category: 'converting',
  3873. fn: function () {
  3874. var self=this;
  3875. return smalltalk.withContext(function($ctx1) { var $1;
  3876. $1=_st(_st(self)._asString())._asJSON();
  3877. return $1;
  3878. }, function($ctx1) {$ctx1.fill(self,"asJSON",{}, smalltalk.Symbol)});},
  3879. args: [],
  3880. source: "asJSON\x0a\x09^self asString asJSON",
  3881. messageSends: ["asJSON", "asString"],
  3882. referencedClasses: []
  3883. }),
  3884. smalltalk.Symbol);
  3885. smalltalk.addMethod(
  3886. "_asJavascript",
  3887. smalltalk.method({
  3888. selector: "asJavascript",
  3889. category: 'converting',
  3890. fn: function (){
  3891. var self=this;
  3892. return smalltalk.withContext(function($ctx1) { var $1;
  3893. $1=_st(_st("smalltalk.symbolFor(").__comma(_st(_st(self)._asString())._asJavascript())).__comma(")");
  3894. return $1;
  3895. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{}, smalltalk.Symbol)})},
  3896. args: [],
  3897. source: "asJavascript\x0a\x09^'smalltalk.symbolFor(', self asString asJavascript, ')'",
  3898. messageSends: [",", "asJavascript", "asString"],
  3899. referencedClasses: []
  3900. }),
  3901. smalltalk.Symbol);
  3902. smalltalk.addMethod(
  3903. "_asSelector",
  3904. smalltalk.method({
  3905. selector: "asSelector",
  3906. category: 'converting',
  3907. fn: function () {
  3908. var self=this;
  3909. return smalltalk.withContext(function($ctx1) { var $1;
  3910. $1=_st(_st(self)._asString())._asSelector();
  3911. return $1;
  3912. }, function($ctx1) {$ctx1.fill(self,"asSelector",{}, smalltalk.Symbol)});},
  3913. args: [],
  3914. source: "asSelector\x0a\x09^self asString asSelector",
  3915. messageSends: ["asSelector", "asString"],
  3916. referencedClasses: []
  3917. }),
  3918. smalltalk.Symbol);
  3919. smalltalk.addMethod(
  3920. "_asString",
  3921. smalltalk.method({
  3922. selector: "asString",
  3923. category: 'converting',
  3924. fn: function () {
  3925. var self=this;
  3926. return smalltalk.withContext(function($ctx1) { return self.value;
  3927. return self}, function($ctx1) {$ctx1.fill(self,"asString",{}, smalltalk.Symbol)});},
  3928. args: [],
  3929. source: "asString\x0a\x09<return self.value>",
  3930. messageSends: [],
  3931. referencedClasses: []
  3932. }),
  3933. smalltalk.Symbol);
  3934. smalltalk.addMethod(
  3935. "_asSuperSelector",
  3936. smalltalk.method({
  3937. selector: "asSuperSelector",
  3938. category: 'converting',
  3939. fn: function () {
  3940. var self=this;
  3941. return smalltalk.withContext(function($ctx1) { var $1;
  3942. $1=_st(_st(self)._asString())._asSuperSelector();
  3943. return $1;
  3944. }, function($ctx1) {$ctx1.fill(self,"asSuperSelector",{}, smalltalk.Symbol)});},
  3945. args: [],
  3946. source: "asSuperSelector\x0a\x09^self asString asSuperSelector",
  3947. messageSends: ["asSuperSelector", "asString"],
  3948. referencedClasses: []
  3949. }),
  3950. smalltalk.Symbol);
  3951. smalltalk.addMethod(
  3952. "_asSymbol",
  3953. smalltalk.method({
  3954. selector: "asSymbol",
  3955. category: 'converting',
  3956. fn: function () {
  3957. var self=this;
  3958. return smalltalk.withContext(function($ctx1) { var $1;
  3959. $1=self;
  3960. return $1;
  3961. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{}, smalltalk.Symbol)});},
  3962. args: [],
  3963. source: "asSymbol\x0a\x09^self",
  3964. messageSends: [],
  3965. referencedClasses: []
  3966. }),
  3967. smalltalk.Symbol);
  3968. smalltalk.addMethod(
  3969. "_at_ifAbsent_",
  3970. smalltalk.method({
  3971. selector: "at:ifAbsent:",
  3972. category: 'accessing',
  3973. fn: function (anIndex, aBlock) {
  3974. var self=this;
  3975. return smalltalk.withContext(function($ctx1) { var $1;
  3976. $1=_st(_st(self)._asString())._at_ifAbsent_(anIndex,aBlock);
  3977. return $1;
  3978. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock}, smalltalk.Symbol)});},
  3979. args: ["anIndex", "aBlock"],
  3980. source: "at: anIndex ifAbsent: aBlock\x0a\x09^self asString at: anIndex ifAbsent: aBlock",
  3981. messageSends: ["at:ifAbsent:", "asString"],
  3982. referencedClasses: []
  3983. }),
  3984. smalltalk.Symbol);
  3985. smalltalk.addMethod(
  3986. "_collect_",
  3987. smalltalk.method({
  3988. selector: "collect:",
  3989. category: 'enumerating',
  3990. fn: function (aBlock) {
  3991. var self=this;
  3992. return smalltalk.withContext(function($ctx1) { var $1;
  3993. $1=_st(_st(_st(self)._asString())._collect_(aBlock))._asSymbol();
  3994. return $1;
  3995. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock}, smalltalk.Symbol)});},
  3996. args: ["aBlock"],
  3997. source: "collect: aBlock\x0a\x09^ (self asString collect: aBlock) asSymbol",
  3998. messageSends: ["asSymbol", "collect:", "asString"],
  3999. referencedClasses: []
  4000. }),
  4001. smalltalk.Symbol);
  4002. smalltalk.addMethod(
  4003. "_copyFrom_to_",
  4004. smalltalk.method({
  4005. selector: "copyFrom:to:",
  4006. category: 'copying',
  4007. fn: function (anIndex, anotherIndex) {
  4008. var self=this;
  4009. return smalltalk.withContext(function($ctx1) { var $1;
  4010. $1=_st(_st(self)._class())._fromString_(_st(_st(self)._asString())._copyFrom_to_(anIndex,anotherIndex));
  4011. return $1;
  4012. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex}, smalltalk.Symbol)});},
  4013. args: ["anIndex", "anotherIndex"],
  4014. source: "copyFrom: anIndex to: anotherIndex\x0a\x09^self class fromString: (self asString copyFrom: anIndex to: anotherIndex)",
  4015. messageSends: ["fromString:", "copyFrom:to:", "asString", "class"],
  4016. referencedClasses: []
  4017. }),
  4018. smalltalk.Symbol);
  4019. smalltalk.addMethod(
  4020. "_deepCopy",
  4021. smalltalk.method({
  4022. selector: "deepCopy",
  4023. category: 'copying',
  4024. fn: function () {
  4025. var self=this;
  4026. return smalltalk.withContext(function($ctx1) { var $1;
  4027. $1=self;
  4028. return $1;
  4029. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{}, smalltalk.Symbol)});},
  4030. args: [],
  4031. source: "deepCopy\x0a\x09^self",
  4032. messageSends: [],
  4033. referencedClasses: []
  4034. }),
  4035. smalltalk.Symbol);
  4036. smalltalk.addMethod(
  4037. "_detect_",
  4038. smalltalk.method({
  4039. selector: "detect:",
  4040. category: 'enumerating',
  4041. fn: function (aBlock) {
  4042. var self=this;
  4043. return smalltalk.withContext(function($ctx1) { var $1;
  4044. $1=_st(_st(self)._asString())._detect_(aBlock);
  4045. return $1;
  4046. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock}, smalltalk.Symbol)});},
  4047. args: ["aBlock"],
  4048. source: "detect: aBlock\x0a\x09^ self asString detect: aBlock",
  4049. messageSends: ["detect:", "asString"],
  4050. referencedClasses: []
  4051. }),
  4052. smalltalk.Symbol);
  4053. smalltalk.addMethod(
  4054. "_do_",
  4055. smalltalk.method({
  4056. selector: "do:",
  4057. category: 'enumerating',
  4058. fn: function (aBlock) {
  4059. var self=this;
  4060. return smalltalk.withContext(function($ctx1) { _st(_st(self)._asString())._do_(aBlock);
  4061. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.Symbol)});},
  4062. args: ["aBlock"],
  4063. source: "do: aBlock\x0a\x09self asString do: aBlock",
  4064. messageSends: ["do:", "asString"],
  4065. referencedClasses: []
  4066. }),
  4067. smalltalk.Symbol);
  4068. smalltalk.addMethod(
  4069. "_isSymbol",
  4070. smalltalk.method({
  4071. selector: "isSymbol",
  4072. category: 'printing',
  4073. fn: function () {
  4074. var self=this;
  4075. return smalltalk.withContext(function($ctx1) { return true;
  4076. }, function($ctx1) {$ctx1.fill(self,"isSymbol",{}, smalltalk.Symbol)});},
  4077. args: [],
  4078. source: "isSymbol\x0a\x09^true",
  4079. messageSends: [],
  4080. referencedClasses: []
  4081. }),
  4082. smalltalk.Symbol);
  4083. smalltalk.addMethod(
  4084. "_printString",
  4085. smalltalk.method({
  4086. selector: "printString",
  4087. category: 'printing',
  4088. fn: function () {
  4089. var self=this;
  4090. return smalltalk.withContext(function($ctx1) { var $1;
  4091. $1=_st("#").__comma(_st(self)._asString());
  4092. return $1;
  4093. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Symbol)});},
  4094. args: [],
  4095. source: "printString\x0a\x09^'#', self asString",
  4096. messageSends: [",", "asString"],
  4097. referencedClasses: []
  4098. }),
  4099. smalltalk.Symbol);
  4100. smalltalk.addMethod(
  4101. "_select_",
  4102. smalltalk.method({
  4103. selector: "select:",
  4104. category: 'enumerating',
  4105. fn: function (aBlock) {
  4106. var self=this;
  4107. return smalltalk.withContext(function($ctx1) { var $1;
  4108. $1=_st(_st(_st(self)._asString())._select_(aBlock))._asSymbol();
  4109. return $1;
  4110. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock}, smalltalk.Symbol)});},
  4111. args: ["aBlock"],
  4112. source: "select: aBlock\x0a\x09^ (self asString select: aBlock) asSymbol",
  4113. messageSends: ["asSymbol", "select:", "asString"],
  4114. referencedClasses: []
  4115. }),
  4116. smalltalk.Symbol);
  4117. smalltalk.addMethod(
  4118. "_shallowCopy",
  4119. smalltalk.method({
  4120. selector: "shallowCopy",
  4121. category: 'copying',
  4122. fn: function () {
  4123. var self=this;
  4124. return smalltalk.withContext(function($ctx1) { var $1;
  4125. $1=self;
  4126. return $1;
  4127. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{}, smalltalk.Symbol)});},
  4128. args: [],
  4129. source: "shallowCopy\x0a\x09^self",
  4130. messageSends: [],
  4131. referencedClasses: []
  4132. }),
  4133. smalltalk.Symbol);
  4134. smalltalk.addMethod(
  4135. "_size",
  4136. smalltalk.method({
  4137. selector: "size",
  4138. category: 'accessing',
  4139. fn: function () {
  4140. var self=this;
  4141. return smalltalk.withContext(function($ctx1) { var $1;
  4142. $1=_st(_st(self)._asString())._size();
  4143. return $1;
  4144. }, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Symbol)});},
  4145. args: [],
  4146. source: "size\x0a\x09^self asString size",
  4147. messageSends: ["size", "asString"],
  4148. referencedClasses: []
  4149. }),
  4150. smalltalk.Symbol);
  4151. smalltalk.addMethod(
  4152. "_value_",
  4153. smalltalk.method({
  4154. selector: "value:",
  4155. category: 'evaluating',
  4156. fn: function (anObject) {
  4157. var self=this;
  4158. return smalltalk.withContext(function($ctx1) { var $1;
  4159. $1=_st(anObject)._perform_(self);
  4160. return $1;
  4161. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject}, smalltalk.Symbol)});},
  4162. args: ["anObject"],
  4163. source: "value: anObject \x0a\x09^anObject perform: self",
  4164. messageSends: ["perform:"],
  4165. referencedClasses: []
  4166. }),
  4167. smalltalk.Symbol);
  4168. smalltalk.addMethod(
  4169. "_withIndexDo_",
  4170. smalltalk.method({
  4171. selector: "withIndexDo:",
  4172. category: 'enumerating',
  4173. fn: function (aBlock) {
  4174. var self=this;
  4175. return smalltalk.withContext(function($ctx1) { _st(_st(self)._asString())._withIndexDo_(aBlock);
  4176. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock}, smalltalk.Symbol)});},
  4177. args: ["aBlock"],
  4178. source: "withIndexDo: aBlock\x0a\x09self asString withIndexDo: aBlock",
  4179. messageSends: ["withIndexDo:", "asString"],
  4180. referencedClasses: []
  4181. }),
  4182. smalltalk.Symbol);
  4183. smalltalk.addMethod(
  4184. "_basicNew",
  4185. smalltalk.method({
  4186. selector: "basicNew",
  4187. category: 'instance creation',
  4188. fn: function () {
  4189. var self=this;
  4190. return smalltalk.withContext(function($ctx1) { _st(self)._shouldNotImplement();
  4191. return self}, function($ctx1) {$ctx1.fill(self,"basicNew",{}, smalltalk.Symbol.klass)});},
  4192. args: [],
  4193. source: "basicNew\x0a\x09self shouldNotImplement",
  4194. messageSends: ["shouldNotImplement"],
  4195. referencedClasses: []
  4196. }),
  4197. smalltalk.Symbol.klass);
  4198. smalltalk.addMethod(
  4199. "_fromString_",
  4200. smalltalk.method({
  4201. selector: "fromString:",
  4202. category: 'instance creation',
  4203. fn: function (aString) {
  4204. var self=this;
  4205. return smalltalk.withContext(function($ctx1) { var $1;
  4206. $1=_st(self)._lookup_(aString);
  4207. return $1;
  4208. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString}, smalltalk.Symbol.klass)});},
  4209. args: ["aString"],
  4210. source: "fromString: aString\x0a\x09^self lookup: aString",
  4211. messageSends: ["lookup:"],
  4212. referencedClasses: []
  4213. }),
  4214. smalltalk.Symbol.klass);
  4215. smalltalk.addMethod(
  4216. "_lookup_",
  4217. smalltalk.method({
  4218. selector: "lookup:",
  4219. category: 'instance creation',
  4220. fn: function (aString) {
  4221. var self=this;
  4222. return smalltalk.withContext(function($ctx1) { return smalltalk.symbolFor(aString);;
  4223. return self}, function($ctx1) {$ctx1.fill(self,"lookup:",{aString:aString}, smalltalk.Symbol.klass)});},
  4224. args: ["aString"],
  4225. source: "lookup: aString\x0a\x09<return smalltalk.symbolFor(aString);>",
  4226. messageSends: [],
  4227. referencedClasses: []
  4228. }),
  4229. smalltalk.Symbol.klass);
  4230. smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections');
  4231. smalltalk.addMethod(
  4232. "__eq",
  4233. smalltalk.method({
  4234. selector: "=",
  4235. category: 'comparing',
  4236. fn: function (aCollection) {
  4237. var self=this;
  4238. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  4239. var $early={};
  4240. try {
  4241. $1=_st(_st(self)._class()).__eq(_st(aCollection)._class());
  4242. if(! smalltalk.assert($1)){
  4243. return false;
  4244. };
  4245. $2=_st(_st(self)._size()).__eq(_st(aCollection)._size());
  4246. if(! smalltalk.assert($2)){
  4247. return false;
  4248. };
  4249. _st(self)._do_((function(each){
  4250. return smalltalk.withContext(function($ctx2) { $3=_st(aCollection)._includes_(each);
  4251. if(! smalltalk.assert($3)){
  4252. throw $early=[false];
  4253. };
  4254. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4255. return true;
  4256. }
  4257. catch(e) {if(e===$early)return e[0]; throw e}
  4258. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection}, smalltalk.Set)});},
  4259. args: ["aCollection"],
  4260. source: "= aCollection\x0a\x09self class = aCollection class ifFalse: [ ^ false ].\x0a self size = aCollection size ifFalse: [ ^ false ].\x0a\x09self do: [:each | (aCollection includes: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  4261. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"],
  4262. referencedClasses: []
  4263. }),
  4264. smalltalk.Set);
  4265. smalltalk.addMethod(
  4266. "_add_",
  4267. smalltalk.method({
  4268. selector: "add:",
  4269. category: 'adding/removing',
  4270. fn: function (anObject) {
  4271. var self=this;
  4272. return smalltalk.withContext(function($ctx1) {
  4273. var found;
  4274. for(var i=0; i < self['@elements'].length; i++) {
  4275. if(anObject == self['@elements'][i]) {
  4276. found = true;
  4277. break;
  4278. }
  4279. }
  4280. if(!found) {self['@elements'].push(anObject)}
  4281. ;
  4282. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject}, smalltalk.Set)});},
  4283. args: ["anObject"],
  4284. source: "add: anObject\x0a\x09<\x0a\x09\x09var found;\x0a\x09\x09for(var i=0; i < self['@elements'].length; i++) {\x0a\x09\x09\x09if(anObject == self['@elements'][i]) {\x0a\x09\x09\x09\x09found = true;\x0a\x09\x09\x09\x09break;\x0a\x09\x09\x09}\x0a\x09\x09}\x0a\x09\x09if(!found) {self['@elements'].push(anObject)}\x0a\x09>",
  4285. messageSends: [],
  4286. referencedClasses: []
  4287. }),
  4288. smalltalk.Set);
  4289. smalltalk.addMethod(
  4290. "_asArray",
  4291. smalltalk.method({
  4292. selector: "asArray",
  4293. category: 'converting',
  4294. fn: function () {
  4295. var self=this;
  4296. return smalltalk.withContext(function($ctx1) { var $1;
  4297. $1=_st(self["@elements"])._copy();
  4298. return $1;
  4299. }, function($ctx1) {$ctx1.fill(self,"asArray",{}, smalltalk.Set)});},
  4300. args: [],
  4301. source: "asArray\x0a\x09^elements copy",
  4302. messageSends: ["copy"],
  4303. referencedClasses: []
  4304. }),
  4305. smalltalk.Set);
  4306. smalltalk.addMethod(
  4307. "_collect_",
  4308. smalltalk.method({
  4309. selector: "collect:",
  4310. category: 'enumerating',
  4311. fn: function (aBlock) {
  4312. var self=this;
  4313. return smalltalk.withContext(function($ctx1) { var $1;
  4314. $1=_st(_st(self)._class())._withAll_(_st(self["@elements"])._collect_(aBlock));
  4315. return $1;
  4316. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock}, smalltalk.Set)});},
  4317. args: ["aBlock"],
  4318. source: "collect: aBlock\x0a\x09^self class withAll: (elements collect: aBlock)",
  4319. messageSends: ["withAll:", "collect:", "class"],
  4320. referencedClasses: []
  4321. }),
  4322. smalltalk.Set);
  4323. smalltalk.addMethod(
  4324. "_detect_ifNone_",
  4325. smalltalk.method({
  4326. selector: "detect:ifNone:",
  4327. category: 'enumerating',
  4328. fn: function (aBlock, anotherBlock) {
  4329. var self=this;
  4330. return smalltalk.withContext(function($ctx1) { var $1;
  4331. $1=_st(self["@elements"])._detect_ifNone_(aBlock,anotherBlock);
  4332. return $1;
  4333. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.Set)});},
  4334. args: ["aBlock", "anotherBlock"],
  4335. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^elements detect: aBlock ifNone: anotherBlock",
  4336. messageSends: ["detect:ifNone:"],
  4337. referencedClasses: []
  4338. }),
  4339. smalltalk.Set);
  4340. smalltalk.addMethod(
  4341. "_do_",
  4342. smalltalk.method({
  4343. selector: "do:",
  4344. category: 'enumerating',
  4345. fn: function (aBlock) {
  4346. var self=this;
  4347. return smalltalk.withContext(function($ctx1) { _st(self["@elements"])._do_(aBlock);
  4348. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.Set)});},
  4349. args: ["aBlock"],
  4350. source: "do: aBlock\x0a\x09elements do: aBlock",
  4351. messageSends: ["do:"],
  4352. referencedClasses: []
  4353. }),
  4354. smalltalk.Set);
  4355. smalltalk.addMethod(
  4356. "_includes_",
  4357. smalltalk.method({
  4358. selector: "includes:",
  4359. category: 'testing',
  4360. fn: function (anObject) {
  4361. var self=this;
  4362. return smalltalk.withContext(function($ctx1) { var $1;
  4363. $1=_st(self["@elements"])._includes_(anObject);
  4364. return $1;
  4365. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject}, smalltalk.Set)});},
  4366. args: ["anObject"],
  4367. source: "includes: anObject\x0a\x09^elements includes: anObject",
  4368. messageSends: ["includes:"],
  4369. referencedClasses: []
  4370. }),
  4371. smalltalk.Set);
  4372. smalltalk.addMethod(
  4373. "_initialize",
  4374. smalltalk.method({
  4375. selector: "initialize",
  4376. category: 'initialization',
  4377. fn: function () {
  4378. var self=this;
  4379. return smalltalk.withContext(function($ctx1) { smalltalk.Collection.fn.prototype._initialize.apply(_st(self), []);
  4380. self["@elements"]=[];
  4381. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.Set)});},
  4382. args: [],
  4383. source: "initialize\x0a\x09super initialize.\x0a\x09elements := #()",
  4384. messageSends: ["initialize"],
  4385. referencedClasses: []
  4386. }),
  4387. smalltalk.Set);
  4388. smalltalk.addMethod(
  4389. "_remove_",
  4390. smalltalk.method({
  4391. selector: "remove:",
  4392. category: 'adding/removing',
  4393. fn: function (anObject) {
  4394. var self=this;
  4395. return smalltalk.withContext(function($ctx1) { _st(self["@elements"])._remove_(anObject);
  4396. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject}, smalltalk.Set)});},
  4397. args: ["anObject"],
  4398. source: "remove: anObject\x0a\x09elements remove: anObject",
  4399. messageSends: ["remove:"],
  4400. referencedClasses: []
  4401. }),
  4402. smalltalk.Set);
  4403. smalltalk.addMethod(
  4404. "_select_",
  4405. smalltalk.method({
  4406. selector: "select:",
  4407. category: 'enumerating',
  4408. fn: function (aBlock) {
  4409. var self=this;
  4410. var collection;
  4411. return smalltalk.withContext(function($ctx1) { var $1,$3,$2,$4;
  4412. collection=_st(_st(self)._class())._new();
  4413. $1=self;
  4414. $2=(function(each){
  4415. return smalltalk.withContext(function($ctx2) { $3=_st(aBlock)._value_(each);
  4416. if(smalltalk.assert($3)){
  4417. return _st(collection)._add_(each);
  4418. };
  4419. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})});
  4420. _st($1)._do_($2);
  4421. $4=collection;
  4422. return $4;
  4423. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection}, smalltalk.Set)});},
  4424. args: ["aBlock"],
  4425. source: "select: aBlock\x0a\x09| collection |\x0a\x09collection := self class new. \x0a\x09self do: [:each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09\x09collection add: each]].\x0a\x09^collection",
  4426. messageSends: ["new", "class", "do:", "ifTrue:", "add:", "value:"],
  4427. referencedClasses: []
  4428. }),
  4429. smalltalk.Set);
  4430. smalltalk.addMethod(
  4431. "_size",
  4432. smalltalk.method({
  4433. selector: "size",
  4434. category: 'accessing',
  4435. fn: function () {
  4436. var self=this;
  4437. return smalltalk.withContext(function($ctx1) { var $1;
  4438. $1=_st(self["@elements"])._size();
  4439. return $1;
  4440. }, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Set)});},
  4441. args: [],
  4442. source: "size\x0a\x09^elements size",
  4443. messageSends: ["size"],
  4444. referencedClasses: []
  4445. }),
  4446. smalltalk.Set);
  4447. smalltalk.addClass('Queue', smalltalk.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  4448. smalltalk.Queue.comment="A Queue am a one-sided queue.\x0a\x0aA Queue uses two OrderedCollections inside,\x0a`read` is at the front, is not modified and only read using `readIndex`.\x0a`write` is at the back and is appended new items.\x0aWhen `read` is exhausted, `write` is promoted to `read` and new `write` is created.\x0a\x0aAs a consequence, no data moving is done by the Queue; write appending may do data moving\x0awhen growing `write`, but this is left to engine to implement as good as it chooses to."
  4449. smalltalk.addMethod(
  4450. "_back_",
  4451. smalltalk.method({
  4452. selector: "back:",
  4453. category: 'accessing',
  4454. fn: function (anObject) {
  4455. var self=this;
  4456. return smalltalk.withContext(function($ctx1) { _st(self["@write"])._add_(anObject);
  4457. return self}, function($ctx1) {$ctx1.fill(self,"back:",{anObject:anObject}, smalltalk.Queue)});},
  4458. args: ["anObject"],
  4459. source: "back: anObject\x0a\x09write add: anObject",
  4460. messageSends: ["add:"],
  4461. referencedClasses: []
  4462. }),
  4463. smalltalk.Queue);
  4464. smalltalk.addMethod(
  4465. "_front",
  4466. smalltalk.method({
  4467. selector: "front",
  4468. category: 'accessing',
  4469. fn: function () {
  4470. var self=this;
  4471. return smalltalk.withContext(function($ctx1) { var $1;
  4472. $1=_st(self)._frontIfAbsent_((function(){
  4473. return smalltalk.withContext(function($ctx2) { return _st(self)._error_("Cannot read from empty Queue.");
  4474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4475. return $1;
  4476. }, function($ctx1) {$ctx1.fill(self,"front",{}, smalltalk.Queue)});},
  4477. args: [],
  4478. source: "front\x0a ^self frontIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  4479. messageSends: ["frontIfAbsent:", "error:"],
  4480. referencedClasses: []
  4481. }),
  4482. smalltalk.Queue);
  4483. smalltalk.addMethod(
  4484. "_frontIfAbsent_",
  4485. smalltalk.method({
  4486. selector: "frontIfAbsent:",
  4487. category: 'accessing',
  4488. fn: function (aBlock) {
  4489. var self=this;
  4490. var result;
  4491. return smalltalk.withContext(function($ctx1) { var $1,$2,$4,$6,$7,$5,$3,$8;
  4492. var $early={};
  4493. try {
  4494. $1=self["@read"];
  4495. $2=self["@readIndex"];
  4496. $3=(function(){
  4497. return smalltalk.withContext(function($ctx2) { $4=_st(self["@write"])._isEmpty();
  4498. $5=(function(){
  4499. return smalltalk.withContext(function($ctx3) { $6=_st(self["@readIndex"]).__gt((1));
  4500. if(smalltalk.assert($6)){
  4501. self["@read"]=[];
  4502. self["@read"];
  4503. self["@readIndex"]=(1);
  4504. self["@readIndex"];
  4505. };
  4506. $7=_st(aBlock)._value();
  4507. throw $early=[$7];
  4508. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})});
  4509. _st($4)._ifTrue_($5);
  4510. self["@read"]=self["@write"];
  4511. self["@read"];
  4512. self["@readIndex"]=(1);
  4513. self["@readIndex"];
  4514. self["@write"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  4515. self["@write"];
  4516. return _st(self["@read"])._first();
  4517. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  4518. result=_st($1)._at_ifAbsent_($2,$3);
  4519. _st(self["@read"])._at_put_(self["@readIndex"],nil);
  4520. self["@readIndex"]=_st(self["@readIndex"]).__plus((1));
  4521. $8=result;
  4522. return $8;
  4523. }
  4524. catch(e) {if(e===$early)return e[0]; throw e}
  4525. }, function($ctx1) {$ctx1.fill(self,"frontIfAbsent:",{aBlock:aBlock,result:result}, smalltalk.Queue)});},
  4526. args: ["aBlock"],
  4527. source: "frontIfAbsent: aBlock\x0a\x09| result |\x0a\x09result := read at: readIndex ifAbsent: [\x0a\x09\x09write isEmpty ifTrue: [\x0a\x09\x09\x09readIndex > 1 ifTrue: [ read := #(). readIndex := 1 ].\x0a\x09\x09\x09^aBlock value ].\x0a \x09read := write.\x0a \x09readIndex := 1.\x0a \x09write := OrderedCollection new.\x0a \x09read first ].\x0a read at: readIndex put: nil.\x0a readIndex := readIndex + 1.\x0a ^result",
  4528. messageSends: ["at:ifAbsent:", "ifTrue:", ">", "value", "isEmpty", "new", "first", "at:put:", "+"],
  4529. referencedClasses: ["OrderedCollection"]
  4530. }),
  4531. smalltalk.Queue);
  4532. smalltalk.addMethod(
  4533. "_initialize",
  4534. smalltalk.method({
  4535. selector: "initialize",
  4536. category: 'initialization',
  4537. fn: function () {
  4538. var self=this;
  4539. return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  4540. self["@read"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  4541. self["@write"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  4542. self["@readIndex"]=(1);
  4543. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.Queue)});},
  4544. args: [],
  4545. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a write := OrderedCollection new.\x0a readIndex := 1",
  4546. messageSends: ["initialize", "new"],
  4547. referencedClasses: ["OrderedCollection"]
  4548. }),
  4549. smalltalk.Queue);
  4550. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
  4551. smalltalk.addMethod(
  4552. "_compile_",
  4553. smalltalk.method({
  4554. selector: "compile:",
  4555. category: 'evaluating',
  4556. fn: function (aString) {
  4557. var self=this;
  4558. return smalltalk.withContext(function($ctx1) { return self.compile(aString);
  4559. return self}, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString}, smalltalk.RegularExpression)});},
  4560. args: ["aString"],
  4561. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  4562. messageSends: [],
  4563. referencedClasses: []
  4564. }),
  4565. smalltalk.RegularExpression);
  4566. smalltalk.addMethod(
  4567. "_exec_",
  4568. smalltalk.method({
  4569. selector: "exec:",
  4570. category: 'evaluating',
  4571. fn: function (aString) {
  4572. var self=this;
  4573. return smalltalk.withContext(function($ctx1) { return self.exec(aString) || nil;
  4574. return self}, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString}, smalltalk.RegularExpression)});},
  4575. args: ["aString"],
  4576. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  4577. messageSends: [],
  4578. referencedClasses: []
  4579. }),
  4580. smalltalk.RegularExpression);
  4581. smalltalk.addMethod(
  4582. "_test_",
  4583. smalltalk.method({
  4584. selector: "test:",
  4585. category: 'evaluating',
  4586. fn: function (aString) {
  4587. var self=this;
  4588. return smalltalk.withContext(function($ctx1) { return self.test(aString);
  4589. return self}, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString}, smalltalk.RegularExpression)});},
  4590. args: ["aString"],
  4591. source: "test: aString\x0a\x09<return self.test(aString)>",
  4592. messageSends: [],
  4593. referencedClasses: []
  4594. }),
  4595. smalltalk.RegularExpression);
  4596. smalltalk.addMethod(
  4597. "_fromString_",
  4598. smalltalk.method({
  4599. selector: "fromString:",
  4600. category: 'instance creation',
  4601. fn: function (aString) {
  4602. var self=this;
  4603. return smalltalk.withContext(function($ctx1) { var $1;
  4604. $1=_st(self)._fromString_flag_(aString,"");
  4605. return $1;
  4606. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString}, smalltalk.RegularExpression.klass)});},
  4607. args: ["aString"],
  4608. source: "fromString: aString\x0a\x09 ^self fromString: aString flag: ''",
  4609. messageSends: ["fromString:flag:"],
  4610. referencedClasses: []
  4611. }),
  4612. smalltalk.RegularExpression.klass);
  4613. smalltalk.addMethod(
  4614. "_fromString_flag_",
  4615. smalltalk.method({
  4616. selector: "fromString:flag:",
  4617. category: 'instance creation',
  4618. fn: function (aString, anotherString) {
  4619. var self=this;
  4620. return smalltalk.withContext(function($ctx1) { return new RegExp(aString, anotherString);
  4621. return self}, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString}, smalltalk.RegularExpression.klass)});},
  4622. args: ["aString", "anotherString"],
  4623. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  4624. messageSends: [],
  4625. referencedClasses: []
  4626. }),
  4627. smalltalk.RegularExpression.klass);
  4628. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  4629. smalltalk.addMethod(
  4630. "_atEnd",
  4631. smalltalk.method({
  4632. selector: "atEnd",
  4633. category: 'testing',
  4634. fn: function () {
  4635. var self=this;
  4636. return smalltalk.withContext(function($ctx1) { var $1;
  4637. $1=_st(_st(self)._position()).__eq(_st(self)._size());
  4638. return $1;
  4639. }, function($ctx1) {$ctx1.fill(self,"atEnd",{}, smalltalk.Stream)});},
  4640. args: [],
  4641. source: "atEnd\x0a\x09^self position = self size",
  4642. messageSends: ["=", "size", "position"],
  4643. referencedClasses: []
  4644. }),
  4645. smalltalk.Stream);
  4646. smalltalk.addMethod(
  4647. "_atStart",
  4648. smalltalk.method({
  4649. selector: "atStart",
  4650. category: 'testing',
  4651. fn: function () {
  4652. var self=this;
  4653. return smalltalk.withContext(function($ctx1) { var $1;
  4654. $1=_st(_st(self)._position()).__eq((0));
  4655. return $1;
  4656. }, function($ctx1) {$ctx1.fill(self,"atStart",{}, smalltalk.Stream)});},
  4657. args: [],
  4658. source: "atStart\x0a\x09^self position = 0",
  4659. messageSends: ["=", "position"],
  4660. referencedClasses: []
  4661. }),
  4662. smalltalk.Stream);
  4663. smalltalk.addMethod(
  4664. "_close",
  4665. smalltalk.method({
  4666. selector: "close",
  4667. category: 'actions',
  4668. fn: function () {
  4669. var self=this;
  4670. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"close",{}, smalltalk.Stream)});},
  4671. args: [],
  4672. source: "close",
  4673. messageSends: [],
  4674. referencedClasses: []
  4675. }),
  4676. smalltalk.Stream);
  4677. smalltalk.addMethod(
  4678. "_collection",
  4679. smalltalk.method({
  4680. selector: "collection",
  4681. category: 'accessing',
  4682. fn: function () {
  4683. var self=this;
  4684. return smalltalk.withContext(function($ctx1) { var $1;
  4685. $1=self["@collection"];
  4686. return $1;
  4687. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.Stream)});},
  4688. args: [],
  4689. source: "collection\x0a\x09^collection",
  4690. messageSends: [],
  4691. referencedClasses: []
  4692. }),
  4693. smalltalk.Stream);
  4694. smalltalk.addMethod(
  4695. "_contents",
  4696. smalltalk.method({
  4697. selector: "contents",
  4698. category: 'accessing',
  4699. fn: function () {
  4700. var self=this;
  4701. return smalltalk.withContext(function($ctx1) { var $1;
  4702. $1=_st(_st(self)._collection())._copyFrom_to_((1),_st(self)._streamSize());
  4703. return $1;
  4704. }, function($ctx1) {$ctx1.fill(self,"contents",{}, smalltalk.Stream)});},
  4705. args: [],
  4706. source: "contents\x0a\x09^self collection\x0a\x09 copyFrom: 1 \x0a\x09 to: self streamSize",
  4707. messageSends: ["copyFrom:to:", "streamSize", "collection"],
  4708. referencedClasses: []
  4709. }),
  4710. smalltalk.Stream);
  4711. smalltalk.addMethod(
  4712. "_do_",
  4713. smalltalk.method({
  4714. selector: "do:",
  4715. category: 'enumerating',
  4716. fn: function (aBlock) {
  4717. var self=this;
  4718. return smalltalk.withContext(function($ctx1) { _st((function(){
  4719. return smalltalk.withContext(function($ctx2) { return _st(self)._atEnd();
  4720. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  4721. return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_(_st(self)._next());
  4722. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4723. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.Stream)});},
  4724. args: ["aBlock"],
  4725. source: "do: aBlock\x0a\x09[self atEnd] whileFalse: [aBlock value: self next]",
  4726. messageSends: ["whileFalse:", "value:", "next", "atEnd"],
  4727. referencedClasses: []
  4728. }),
  4729. smalltalk.Stream);
  4730. smalltalk.addMethod(
  4731. "_flush",
  4732. smalltalk.method({
  4733. selector: "flush",
  4734. category: 'actions',
  4735. fn: function () {
  4736. var self=this;
  4737. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"flush",{}, smalltalk.Stream)});},
  4738. args: [],
  4739. source: "flush",
  4740. messageSends: [],
  4741. referencedClasses: []
  4742. }),
  4743. smalltalk.Stream);
  4744. smalltalk.addMethod(
  4745. "_isEmpty",
  4746. smalltalk.method({
  4747. selector: "isEmpty",
  4748. category: 'testing',
  4749. fn: function () {
  4750. var self=this;
  4751. return smalltalk.withContext(function($ctx1) { var $1;
  4752. $1=_st(_st(self)._size()).__eq((0));
  4753. return $1;
  4754. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{}, smalltalk.Stream)});},
  4755. args: [],
  4756. source: "isEmpty\x0a\x09^self size = 0",
  4757. messageSends: ["=", "size"],
  4758. referencedClasses: []
  4759. }),
  4760. smalltalk.Stream);
  4761. smalltalk.addMethod(
  4762. "_next",
  4763. smalltalk.method({
  4764. selector: "next",
  4765. category: 'reading',
  4766. fn: function () {
  4767. var self=this;
  4768. return smalltalk.withContext(function($ctx1) { var $2,$1;
  4769. $2=_st(self)._atEnd();
  4770. if(smalltalk.assert($2)){
  4771. $1=nil;
  4772. } else {
  4773. _st(self)._position_(_st(_st(self)._position()).__plus((1)));
  4774. $1=_st(self["@collection"])._at_(_st(self)._position());
  4775. };
  4776. return $1;
  4777. }, function($ctx1) {$ctx1.fill(self,"next",{}, smalltalk.Stream)});},
  4778. args: [],
  4779. source: "next\x0a\x09^self atEnd \x0a\x09\x09ifTrue: [nil]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09self position: self position + 1. \x0a\x09\x09\x09collection at: self position]",
  4780. messageSends: ["ifTrue:ifFalse:", "position:", "+", "position", "at:", "atEnd"],
  4781. referencedClasses: []
  4782. }),
  4783. smalltalk.Stream);
  4784. smalltalk.addMethod(
  4785. "_next_",
  4786. smalltalk.method({
  4787. selector: "next:",
  4788. category: 'reading',
  4789. fn: function (anInteger) {
  4790. var self=this;
  4791. var tempCollection;
  4792. return smalltalk.withContext(function($ctx1) { var $1,$3,$2,$4;
  4793. tempCollection=_st(_st(_st(self)._collection())._class())._new();
  4794. $1=anInteger;
  4795. $2=(function(){
  4796. return smalltalk.withContext(function($ctx2) { $3=_st(self)._atEnd();
  4797. if(! smalltalk.assert($3)){
  4798. return _st(tempCollection)._add_(_st(self)._next());
  4799. };
  4800. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  4801. _st($1)._timesRepeat_($2);
  4802. $4=tempCollection;
  4803. return $4;
  4804. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection}, smalltalk.Stream)});},
  4805. args: ["anInteger"],
  4806. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09 self atEnd ifFalse: [\x0a\x09\x09tempCollection add: self next]].\x0a\x09^tempCollection",
  4807. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "add:", "next", "atEnd"],
  4808. referencedClasses: []
  4809. }),
  4810. smalltalk.Stream);
  4811. smalltalk.addMethod(
  4812. "_nextPut_",
  4813. smalltalk.method({
  4814. selector: "nextPut:",
  4815. category: 'writing',
  4816. fn: function (anObject) {
  4817. var self=this;
  4818. return smalltalk.withContext(function($ctx1) { _st(self)._position_(_st(_st(self)._position()).__plus((1)));
  4819. _st(_st(self)._collection())._at_put_(_st(self)._position(),anObject);
  4820. _st(self)._setStreamSize_(_st(_st(self)._streamSize())._max_(_st(self)._position()));
  4821. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject}, smalltalk.Stream)});},
  4822. args: ["anObject"],
  4823. source: "nextPut: anObject\x0a\x09self position: self position + 1.\x0a\x09self collection at: self position put: anObject.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  4824. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"],
  4825. referencedClasses: []
  4826. }),
  4827. smalltalk.Stream);
  4828. smalltalk.addMethod(
  4829. "_nextPutAll_",
  4830. smalltalk.method({
  4831. selector: "nextPutAll:",
  4832. category: 'writing',
  4833. fn: function (aCollection) {
  4834. var self=this;
  4835. return smalltalk.withContext(function($ctx1) { _st(aCollection)._do_((function(each){
  4836. return smalltalk.withContext(function($ctx2) { return _st(self)._nextPut_(each);
  4837. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4838. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection}, smalltalk.Stream)});},
  4839. args: ["aCollection"],
  4840. source: "nextPutAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09 self nextPut: each]",
  4841. messageSends: ["do:", "nextPut:"],
  4842. referencedClasses: []
  4843. }),
  4844. smalltalk.Stream);
  4845. smalltalk.addMethod(
  4846. "_peek",
  4847. smalltalk.method({
  4848. selector: "peek",
  4849. category: 'reading',
  4850. fn: function () {
  4851. var self=this;
  4852. return smalltalk.withContext(function($ctx1) { var $2,$1;
  4853. $2=_st(self)._atEnd();
  4854. if(! smalltalk.assert($2)){
  4855. $1=_st(_st(self)._collection())._at_(_st(_st(self)._position()).__plus((1)));
  4856. };
  4857. return $1;
  4858. }, function($ctx1) {$ctx1.fill(self,"peek",{}, smalltalk.Stream)});},
  4859. args: [],
  4860. source: "peek\x0a\x09^self atEnd ifFalse: [\x0a\x09 self collection at: self position + 1]",
  4861. messageSends: ["ifFalse:", "at:", "+", "position", "collection", "atEnd"],
  4862. referencedClasses: []
  4863. }),
  4864. smalltalk.Stream);
  4865. smalltalk.addMethod(
  4866. "_position",
  4867. smalltalk.method({
  4868. selector: "position",
  4869. category: 'accessing',
  4870. fn: function () {
  4871. var self=this;
  4872. return smalltalk.withContext(function($ctx1) { var $2,$1;
  4873. $2=self["@position"];
  4874. if(($receiver = $2) == nil || $receiver == undefined){
  4875. self["@position"]=(0);
  4876. $1=self["@position"];
  4877. } else {
  4878. $1=$2;
  4879. };
  4880. return $1;
  4881. }, function($ctx1) {$ctx1.fill(self,"position",{}, smalltalk.Stream)});},
  4882. args: [],
  4883. source: "position\x0a\x09^position ifNil: [position := 0]",
  4884. messageSends: ["ifNil:"],
  4885. referencedClasses: []
  4886. }),
  4887. smalltalk.Stream);
  4888. smalltalk.addMethod(
  4889. "_position_",
  4890. smalltalk.method({
  4891. selector: "position:",
  4892. category: 'accessing',
  4893. fn: function (anInteger) {
  4894. var self=this;
  4895. return smalltalk.withContext(function($ctx1) { self["@position"]=anInteger;
  4896. return self}, function($ctx1) {$ctx1.fill(self,"position:",{anInteger:anInteger}, smalltalk.Stream)});},
  4897. args: ["anInteger"],
  4898. source: "position: anInteger\x0a\x09position := anInteger",
  4899. messageSends: [],
  4900. referencedClasses: []
  4901. }),
  4902. smalltalk.Stream);
  4903. smalltalk.addMethod(
  4904. "_reset",
  4905. smalltalk.method({
  4906. selector: "reset",
  4907. category: 'actions',
  4908. fn: function () {
  4909. var self=this;
  4910. return smalltalk.withContext(function($ctx1) { _st(self)._position_((0));
  4911. return self}, function($ctx1) {$ctx1.fill(self,"reset",{}, smalltalk.Stream)});},
  4912. args: [],
  4913. source: "reset\x0a\x09self position: 0",
  4914. messageSends: ["position:"],
  4915. referencedClasses: []
  4916. }),
  4917. smalltalk.Stream);
  4918. smalltalk.addMethod(
  4919. "_resetContents",
  4920. smalltalk.method({
  4921. selector: "resetContents",
  4922. category: 'actions',
  4923. fn: function () {
  4924. var self=this;
  4925. return smalltalk.withContext(function($ctx1) { _st(self)._reset();
  4926. _st(self)._setStreamSize_((0));
  4927. return self}, function($ctx1) {$ctx1.fill(self,"resetContents",{}, smalltalk.Stream)});},
  4928. args: [],
  4929. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  4930. messageSends: ["reset", "setStreamSize:"],
  4931. referencedClasses: []
  4932. }),
  4933. smalltalk.Stream);
  4934. smalltalk.addMethod(
  4935. "_setCollection_",
  4936. smalltalk.method({
  4937. selector: "setCollection:",
  4938. category: 'accessing',
  4939. fn: function (aCollection) {
  4940. var self=this;
  4941. return smalltalk.withContext(function($ctx1) { self["@collection"]=aCollection;
  4942. return self}, function($ctx1) {$ctx1.fill(self,"setCollection:",{aCollection:aCollection}, smalltalk.Stream)});},
  4943. args: ["aCollection"],
  4944. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  4945. messageSends: [],
  4946. referencedClasses: []
  4947. }),
  4948. smalltalk.Stream);
  4949. smalltalk.addMethod(
  4950. "_setStreamSize_",
  4951. smalltalk.method({
  4952. selector: "setStreamSize:",
  4953. category: 'accessing',
  4954. fn: function (anInteger) {
  4955. var self=this;
  4956. return smalltalk.withContext(function($ctx1) { self["@streamSize"]=anInteger;
  4957. return self}, function($ctx1) {$ctx1.fill(self,"setStreamSize:",{anInteger:anInteger}, smalltalk.Stream)});},
  4958. args: ["anInteger"],
  4959. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  4960. messageSends: [],
  4961. referencedClasses: []
  4962. }),
  4963. smalltalk.Stream);
  4964. smalltalk.addMethod(
  4965. "_setToEnd",
  4966. smalltalk.method({
  4967. selector: "setToEnd",
  4968. category: 'positioning',
  4969. fn: function () {
  4970. var self=this;
  4971. return smalltalk.withContext(function($ctx1) { _st(self)._position_(_st(self)._size());
  4972. return self}, function($ctx1) {$ctx1.fill(self,"setToEnd",{}, smalltalk.Stream)});},
  4973. args: [],
  4974. source: "setToEnd\x0a\x09self position: self size",
  4975. messageSends: ["position:", "size"],
  4976. referencedClasses: []
  4977. }),
  4978. smalltalk.Stream);
  4979. smalltalk.addMethod(
  4980. "_size",
  4981. smalltalk.method({
  4982. selector: "size",
  4983. category: 'accessing',
  4984. fn: function () {
  4985. var self=this;
  4986. return smalltalk.withContext(function($ctx1) { var $1;
  4987. $1=_st(self)._streamSize();
  4988. return $1;
  4989. }, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Stream)});},
  4990. args: [],
  4991. source: "size\x0a\x09^self streamSize",
  4992. messageSends: ["streamSize"],
  4993. referencedClasses: []
  4994. }),
  4995. smalltalk.Stream);
  4996. smalltalk.addMethod(
  4997. "_skip_",
  4998. smalltalk.method({
  4999. selector: "skip:",
  5000. category: 'positioning',
  5001. fn: function (anInteger) {
  5002. var self=this;
  5003. return smalltalk.withContext(function($ctx1) { _st(self)._position_(_st(_st(_st(self)._position()).__plus(anInteger))._min_max_(_st(self)._size(),(0)));
  5004. return self}, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger}, smalltalk.Stream)});},
  5005. args: ["anInteger"],
  5006. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  5007. messageSends: ["position:", "min:max:", "size", "+", "position"],
  5008. referencedClasses: []
  5009. }),
  5010. smalltalk.Stream);
  5011. smalltalk.addMethod(
  5012. "_streamSize",
  5013. smalltalk.method({
  5014. selector: "streamSize",
  5015. category: 'accessing',
  5016. fn: function () {
  5017. var self=this;
  5018. return smalltalk.withContext(function($ctx1) { var $1;
  5019. $1=self["@streamSize"];
  5020. return $1;
  5021. }, function($ctx1) {$ctx1.fill(self,"streamSize",{}, smalltalk.Stream)});},
  5022. args: [],
  5023. source: "streamSize\x0a\x09^streamSize",
  5024. messageSends: [],
  5025. referencedClasses: []
  5026. }),
  5027. smalltalk.Stream);
  5028. smalltalk.addMethod(
  5029. "_on_",
  5030. smalltalk.method({
  5031. selector: "on:",
  5032. category: 'instance creation',
  5033. fn: function (aCollection) {
  5034. var self=this;
  5035. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  5036. $2=_st(self)._new();
  5037. _st($2)._setCollection_(aCollection);
  5038. _st($2)._setStreamSize_(_st(aCollection)._size());
  5039. $3=_st($2)._yourself();
  5040. $1=$3;
  5041. return $1;
  5042. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection}, smalltalk.Stream.klass)});},
  5043. args: ["aCollection"],
  5044. source: "on: aCollection\x0a\x09 ^self new \x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  5045. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"],
  5046. referencedClasses: []
  5047. }),
  5048. smalltalk.Stream.klass);
  5049. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections');
  5050. smalltalk.addMethod(
  5051. "_cr",
  5052. smalltalk.method({
  5053. selector: "cr",
  5054. category: 'writing',
  5055. fn: function () {
  5056. var self=this;
  5057. return smalltalk.withContext(function($ctx1) { var $1;
  5058. $1=_st(self)._nextPutAll_(_st((smalltalk.String || String))._cr());
  5059. return $1;
  5060. }, function($ctx1) {$ctx1.fill(self,"cr",{}, smalltalk.StringStream)});},
  5061. args: [],
  5062. source: "cr\x0a\x09^self nextPutAll: String cr",
  5063. messageSends: ["nextPutAll:", "cr"],
  5064. referencedClasses: ["String"]
  5065. }),
  5066. smalltalk.StringStream);
  5067. smalltalk.addMethod(
  5068. "_crlf",
  5069. smalltalk.method({
  5070. selector: "crlf",
  5071. category: 'writing',
  5072. fn: function () {
  5073. var self=this;
  5074. return smalltalk.withContext(function($ctx1) { var $1;
  5075. $1=_st(self)._nextPutAll_(_st((smalltalk.String || String))._crlf());
  5076. return $1;
  5077. }, function($ctx1) {$ctx1.fill(self,"crlf",{}, smalltalk.StringStream)});},
  5078. args: [],
  5079. source: "crlf\x0a\x09^self nextPutAll: String crlf",
  5080. messageSends: ["nextPutAll:", "crlf"],
  5081. referencedClasses: ["String"]
  5082. }),
  5083. smalltalk.StringStream);
  5084. smalltalk.addMethod(
  5085. "_lf",
  5086. smalltalk.method({
  5087. selector: "lf",
  5088. category: 'writing',
  5089. fn: function () {
  5090. var self=this;
  5091. return smalltalk.withContext(function($ctx1) { var $1;
  5092. $1=_st(self)._nextPutAll_(_st((smalltalk.String || String))._lf());
  5093. return $1;
  5094. }, function($ctx1) {$ctx1.fill(self,"lf",{}, smalltalk.StringStream)});},
  5095. args: [],
  5096. source: "lf\x0a\x09^self nextPutAll: String lf",
  5097. messageSends: ["nextPutAll:", "lf"],
  5098. referencedClasses: ["String"]
  5099. }),
  5100. smalltalk.StringStream);
  5101. smalltalk.addMethod(
  5102. "_next_",
  5103. smalltalk.method({
  5104. selector: "next:",
  5105. category: 'reading',
  5106. fn: function (anInteger) {
  5107. var self=this;
  5108. var tempCollection;
  5109. return smalltalk.withContext(function($ctx1) { var $1,$3,$2,$4;
  5110. tempCollection=_st(_st(_st(self)._collection())._class())._new();
  5111. $1=anInteger;
  5112. $2=(function(){
  5113. return smalltalk.withContext(function($ctx2) { $3=_st(self)._atEnd();
  5114. if(! smalltalk.assert($3)){
  5115. tempCollection=_st(tempCollection).__comma(_st(self)._next());
  5116. return tempCollection;
  5117. };
  5118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  5119. _st($1)._timesRepeat_($2);
  5120. $4=tempCollection;
  5121. return $4;
  5122. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection}, smalltalk.StringStream)});},
  5123. args: ["anInteger"],
  5124. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09 self atEnd ifFalse: [\x0a\x09\x09tempCollection := tempCollection, self next]].\x0a\x09^tempCollection",
  5125. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", ",", "next", "atEnd"],
  5126. referencedClasses: []
  5127. }),
  5128. smalltalk.StringStream);
  5129. smalltalk.addMethod(
  5130. "_nextPut_",
  5131. smalltalk.method({
  5132. selector: "nextPut:",
  5133. category: 'writing',
  5134. fn: function (aString) {
  5135. var self=this;
  5136. return smalltalk.withContext(function($ctx1) { _st(self)._nextPutAll_(aString);
  5137. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString}, smalltalk.StringStream)});},
  5138. args: ["aString"],
  5139. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  5140. messageSends: ["nextPutAll:"],
  5141. referencedClasses: []
  5142. }),
  5143. smalltalk.StringStream);
  5144. smalltalk.addMethod(
  5145. "_nextPutAll_",
  5146. smalltalk.method({
  5147. selector: "nextPutAll:",
  5148. category: 'writing',
  5149. fn: function (aString) {
  5150. var self=this;
  5151. return smalltalk.withContext(function($ctx1) { _st(self)._setCollection_(_st(_st(_st(_st(self)._collection())._copyFrom_to_((1),_st(self)._position())).__comma(aString)).__comma(_st(_st(self)._collection())._copyFrom_to_(_st(_st(_st(self)._position()).__plus((1))).__plus(_st(aString)._size()),_st(_st(self)._collection())._size())));
  5152. _st(self)._position_(_st(_st(self)._position()).__plus(_st(aString)._size()));
  5153. _st(self)._setStreamSize_(_st(_st(self)._streamSize())._max_(_st(self)._position()));
  5154. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString}, smalltalk.StringStream)});},
  5155. args: ["aString"],
  5156. source: "nextPutAll: aString\x0a\x09self setCollection: \x0a\x09 (self collection copyFrom: 1 to: self position),\x0a\x09 aString,\x0a\x09 (self collection copyFrom: (self position + 1 + aString size) to: self collection size).\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  5157. messageSends: ["setCollection:", ",", "copyFrom:to:", "+", "size", "position", "collection", "position:", "setStreamSize:", "max:", "streamSize"],
  5158. referencedClasses: []
  5159. }),
  5160. smalltalk.StringStream);
  5161. smalltalk.addMethod(
  5162. "_space",
  5163. smalltalk.method({
  5164. selector: "space",
  5165. category: 'writing',
  5166. fn: function () {
  5167. var self=this;
  5168. return smalltalk.withContext(function($ctx1) { _st(self)._nextPut_(" ");
  5169. return self}, function($ctx1) {$ctx1.fill(self,"space",{}, smalltalk.StringStream)});},
  5170. args: [],
  5171. source: "space\x0a\x09self nextPut: ' '",
  5172. messageSends: ["nextPut:"],
  5173. referencedClasses: []
  5174. }),
  5175. smalltalk.StringStream);