Kernel-Collections.js 337 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374
  1. define(["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  2. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  3. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  4. $core.addPackage("Kernel-Collections");
  5. ($core.packageDescriptors||$core.packages)["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  6. ($core.packageDescriptors||$core.packages)["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  8. //>>excludeStart("ide", pragmas.excludeIdeData);
  9. $globals.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`";
  10. //>>excludeEnd("ide");
  11. $core.addMethod(
  12. $core.method({
  13. selector: "=",
  14. protocol: "comparing",
  15. fn: function (anAssociation){
  16. var self=this,$self=this;
  17. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18. return $core.withContext(function($ctx1) {
  19. //>>excludeEnd("ctx");
  20. var $3,$2,$5,$4,$6,$1;
  21. $3=$self._class();
  22. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23. $ctx1.sendIdx["class"]=1;
  24. //>>excludeEnd("ctx");
  25. $2=$recv($3).__eq($recv(anAssociation)._class());
  26. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27. $ctx1.sendIdx["="]=1;
  28. //>>excludeEnd("ctx");
  29. $1=$recv($2)._and_((function(){
  30. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31. return $core.withContext(function($ctx2) {
  32. //>>excludeEnd("ctx");
  33. $5=$self._key();
  34. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35. $ctx2.sendIdx["key"]=1;
  36. //>>excludeEnd("ctx");
  37. $4=$recv($5).__eq($recv(anAssociation)._key());
  38. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39. $ctx2.sendIdx["="]=2;
  40. //>>excludeEnd("ctx");
  41. return $recv($4)._and_((function(){
  42. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43. return $core.withContext(function($ctx3) {
  44. //>>excludeEnd("ctx");
  45. $6=$self._value();
  46. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47. $ctx3.sendIdx["value"]=1;
  48. //>>excludeEnd("ctx");
  49. return $recv($6).__eq($recv(anAssociation)._value());
  50. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  51. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  52. //>>excludeEnd("ctx");
  53. }));
  54. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56. //>>excludeEnd("ctx");
  57. }));
  58. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59. $ctx1.sendIdx["and:"]=1;
  60. //>>excludeEnd("ctx");
  61. return $1;
  62. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  64. //>>excludeEnd("ctx");
  65. },
  66. //>>excludeStart("ide", pragmas.excludeIdeData);
  67. args: ["anAssociation"],
  68. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  69. referencedClasses: [],
  70. //>>excludeEnd("ide");
  71. messageSends: ["and:", "=", "class", "key", "value"]
  72. }),
  73. $globals.Association);
  74. $core.addMethod(
  75. $core.method({
  76. selector: "key",
  77. protocol: "accessing",
  78. fn: function (){
  79. var self=this,$self=this;
  80. return $self["@key"];
  81. },
  82. //>>excludeStart("ide", pragmas.excludeIdeData);
  83. args: [],
  84. source: "key\x0a\x09^ key",
  85. referencedClasses: [],
  86. //>>excludeEnd("ide");
  87. messageSends: []
  88. }),
  89. $globals.Association);
  90. $core.addMethod(
  91. $core.method({
  92. selector: "key:",
  93. protocol: "accessing",
  94. fn: function (aKey){
  95. var self=this,$self=this;
  96. $self["@key"]=aKey;
  97. return self;
  98. },
  99. //>>excludeStart("ide", pragmas.excludeIdeData);
  100. args: ["aKey"],
  101. source: "key: aKey\x0a\x09key := aKey",
  102. referencedClasses: [],
  103. //>>excludeEnd("ide");
  104. messageSends: []
  105. }),
  106. $globals.Association);
  107. $core.addMethod(
  108. $core.method({
  109. selector: "printOn:",
  110. protocol: "printing",
  111. fn: function (aStream){
  112. var self=this,$self=this;
  113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  114. return $core.withContext(function($ctx1) {
  115. //>>excludeEnd("ctx");
  116. $recv($self._key())._printOn_(aStream);
  117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  118. $ctx1.sendIdx["printOn:"]=1;
  119. //>>excludeEnd("ctx");
  120. $recv(aStream)._nextPutAll_(" -> ");
  121. $recv($self._value())._printOn_(aStream);
  122. return self;
  123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  124. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  125. //>>excludeEnd("ctx");
  126. },
  127. //>>excludeStart("ide", pragmas.excludeIdeData);
  128. args: ["aStream"],
  129. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  130. referencedClasses: [],
  131. //>>excludeEnd("ide");
  132. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  133. }),
  134. $globals.Association);
  135. $core.addMethod(
  136. $core.method({
  137. selector: "value",
  138. protocol: "accessing",
  139. fn: function (){
  140. var self=this,$self=this;
  141. return $self["@value"];
  142. },
  143. //>>excludeStart("ide", pragmas.excludeIdeData);
  144. args: [],
  145. source: "value\x0a\x09^ value",
  146. referencedClasses: [],
  147. //>>excludeEnd("ide");
  148. messageSends: []
  149. }),
  150. $globals.Association);
  151. $core.addMethod(
  152. $core.method({
  153. selector: "value:",
  154. protocol: "accessing",
  155. fn: function (aValue){
  156. var self=this,$self=this;
  157. $self["@value"]=aValue;
  158. return self;
  159. },
  160. //>>excludeStart("ide", pragmas.excludeIdeData);
  161. args: ["aValue"],
  162. source: "value: aValue\x0a\x09value := aValue",
  163. referencedClasses: [],
  164. //>>excludeEnd("ide");
  165. messageSends: []
  166. }),
  167. $globals.Association);
  168. $core.addMethod(
  169. $core.method({
  170. selector: "key:value:",
  171. protocol: "instance creation",
  172. fn: function (aKey,aValue){
  173. var self=this,$self=this;
  174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  175. return $core.withContext(function($ctx1) {
  176. //>>excludeEnd("ctx");
  177. var $1;
  178. $1=$self._new();
  179. $recv($1)._key_(aKey);
  180. $recv($1)._value_(aValue);
  181. return $recv($1)._yourself();
  182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  183. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.a$cls)});
  184. //>>excludeEnd("ctx");
  185. },
  186. //>>excludeStart("ide", pragmas.excludeIdeData);
  187. args: ["aKey", "aValue"],
  188. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  189. referencedClasses: [],
  190. //>>excludeEnd("ide");
  191. messageSends: ["key:", "new", "value:", "yourself"]
  192. }),
  193. $globals.Association.a$cls);
  194. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  195. //>>excludeStart("ide", pragmas.excludeIdeData);
  196. $globals.BucketStore.comment="I am an helper class for hash-based stores.\x0a\x0aI hold buckets which are selected by a hash, specified using `#hashBlock:`.\x0aThe hash can be any object, and\x0ait is used as a JS property (that is, in ES5\x0aits toString() value counts).\x0a\x0a## API\x0aI maintain a list of buckets. Client code can use this API:\x0a - `#bucketOfElement:` (to ask a bucket for element, I can return JS null if n/a)\x0a - `#do:` (to enumerate all elements of all buckets)\x0a - `#removeAll` (to remove all buckets)\x0a\x0aClient code itself should add/remove elements\x0ain a bucket. The `nil` object should not be put into any bucket.\x0a\x0aTypes of buckets are the responsibility of subclasses via `#newBucket`.";
  197. //>>excludeEnd("ide");
  198. $core.addMethod(
  199. $core.method({
  200. selector: "bucketOfElement:",
  201. protocol: "accessing",
  202. fn: function (anObject){
  203. var self=this,$self=this;
  204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  205. return $core.withContext(function($ctx1) {
  206. //>>excludeEnd("ctx");
  207. var hash = $self['@hashBlock'](anObject);
  208. if (!hash) return null;
  209. var buckets = $self['@buckets'],
  210. bucket = buckets[hash];
  211. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  212. return bucket;
  213. ;
  214. return self;
  215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  216. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  217. //>>excludeEnd("ctx");
  218. },
  219. //>>excludeStart("ide", pragmas.excludeIdeData);
  220. args: ["anObject"],
  221. source: "bucketOfElement: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var hash = $self[''@hashBlock''](anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = $self[''@buckets''],\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09'>",
  222. referencedClasses: [],
  223. //>>excludeEnd("ide");
  224. messageSends: []
  225. }),
  226. $globals.BucketStore);
  227. $core.addMethod(
  228. $core.method({
  229. selector: "do:",
  230. protocol: "enumerating",
  231. fn: function (aBlock){
  232. var self=this,$self=this;
  233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  234. return $core.withContext(function($ctx1) {
  235. //>>excludeEnd("ctx");
  236. var buckets = $self['@buckets'];
  237. var keys = Object.keys(buckets);
  238. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  239. ;
  240. return self;
  241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  242. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  243. //>>excludeEnd("ctx");
  244. },
  245. //>>excludeStart("ide", pragmas.excludeIdeData);
  246. args: ["aBlock"],
  247. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var buckets = $self[''@buckets''];\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09'>",
  248. referencedClasses: [],
  249. //>>excludeEnd("ide");
  250. messageSends: []
  251. }),
  252. $globals.BucketStore);
  253. $core.addMethod(
  254. $core.method({
  255. selector: "hashBlock:",
  256. protocol: "accessing",
  257. fn: function (aBlock){
  258. var self=this,$self=this;
  259. $self["@hashBlock"]=aBlock;
  260. return self;
  261. },
  262. //>>excludeStart("ide", pragmas.excludeIdeData);
  263. args: ["aBlock"],
  264. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  265. referencedClasses: [],
  266. //>>excludeEnd("ide");
  267. messageSends: []
  268. }),
  269. $globals.BucketStore);
  270. $core.addMethod(
  271. $core.method({
  272. selector: "initialize",
  273. protocol: "initialization",
  274. fn: function (){
  275. var self=this,$self=this;
  276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  277. return $core.withContext(function($ctx1) {
  278. //>>excludeEnd("ctx");
  279. (
  280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  281. $ctx1.supercall = true,
  282. //>>excludeEnd("ctx");
  283. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  285. $ctx1.supercall = false;
  286. //>>excludeEnd("ctx");;
  287. $self._removeAll();
  288. return self;
  289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  290. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  291. //>>excludeEnd("ctx");
  292. },
  293. //>>excludeStart("ide", pragmas.excludeIdeData);
  294. args: [],
  295. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  296. referencedClasses: [],
  297. //>>excludeEnd("ide");
  298. messageSends: ["initialize", "removeAll"]
  299. }),
  300. $globals.BucketStore);
  301. $core.addMethod(
  302. $core.method({
  303. selector: "newBucket",
  304. protocol: "private",
  305. fn: function (){
  306. var self=this,$self=this;
  307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  308. return $core.withContext(function($ctx1) {
  309. //>>excludeEnd("ctx");
  310. $self._subclassResponsibility();
  311. return self;
  312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  313. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  314. //>>excludeEnd("ctx");
  315. },
  316. //>>excludeStart("ide", pragmas.excludeIdeData);
  317. args: [],
  318. source: "newBucket\x0a\x09self subclassResponsibility",
  319. referencedClasses: [],
  320. //>>excludeEnd("ide");
  321. messageSends: ["subclassResponsibility"]
  322. }),
  323. $globals.BucketStore);
  324. $core.addMethod(
  325. $core.method({
  326. selector: "removeAll",
  327. protocol: "adding/removing",
  328. fn: function (){
  329. var self=this,$self=this;
  330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  331. return $core.withContext(function($ctx1) {
  332. //>>excludeEnd("ctx");
  333. $self['@buckets'] = Object.create(null);;
  334. return self;
  335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  336. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  337. //>>excludeEnd("ctx");
  338. },
  339. //>>excludeStart("ide", pragmas.excludeIdeData);
  340. args: [],
  341. source: "removeAll\x0a\x09<inlineJS: '$self[''@buckets''] = Object.create(null);'>",
  342. referencedClasses: [],
  343. //>>excludeEnd("ide");
  344. messageSends: []
  345. }),
  346. $globals.BucketStore);
  347. $core.addMethod(
  348. $core.method({
  349. selector: "hashBlock:",
  350. protocol: "instance creation",
  351. fn: function (aBlock){
  352. var self=this,$self=this;
  353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  354. return $core.withContext(function($ctx1) {
  355. //>>excludeEnd("ctx");
  356. var $1;
  357. $1=$self._new();
  358. $recv($1)._hashBlock_(aBlock);
  359. return $recv($1)._yourself();
  360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  361. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.a$cls)});
  362. //>>excludeEnd("ctx");
  363. },
  364. //>>excludeStart("ide", pragmas.excludeIdeData);
  365. args: ["aBlock"],
  366. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  367. referencedClasses: [],
  368. //>>excludeEnd("ide");
  369. messageSends: ["hashBlock:", "new", "yourself"]
  370. }),
  371. $globals.BucketStore.a$cls);
  372. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  373. //>>excludeStart("ide", pragmas.excludeIdeData);
  374. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  375. //>>excludeEnd("ide");
  376. $core.addMethod(
  377. $core.method({
  378. selector: "newBucket",
  379. protocol: "private",
  380. fn: function (){
  381. var self=this,$self=this;
  382. return [];
  383. },
  384. //>>excludeStart("ide", pragmas.excludeIdeData);
  385. args: [],
  386. source: "newBucket\x0a\x09^ #()",
  387. referencedClasses: [],
  388. //>>excludeEnd("ide");
  389. messageSends: []
  390. }),
  391. $globals.ArrayBucketStore);
  392. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  393. //>>excludeStart("ide", pragmas.excludeIdeData);
  394. $globals.Collection.comment="I am the abstract superclass of all classes that represent a group of elements.\x0a\x0aI provide a set of useful methods to the Collection hierarchy such as enumerating and converting methods.";
  395. //>>excludeEnd("ide");
  396. $core.addMethod(
  397. $core.method({
  398. selector: ",",
  399. protocol: "copying",
  400. fn: function (aCollection){
  401. var self=this,$self=this;
  402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  403. return $core.withContext(function($ctx1) {
  404. //>>excludeEnd("ctx");
  405. var $1;
  406. $1=$self._copy();
  407. $recv($1)._addAll_(aCollection);
  408. return $recv($1)._yourself();
  409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  410. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  411. //>>excludeEnd("ctx");
  412. },
  413. //>>excludeStart("ide", pragmas.excludeIdeData);
  414. args: ["aCollection"],
  415. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  416. referencedClasses: [],
  417. //>>excludeEnd("ide");
  418. messageSends: ["addAll:", "copy", "yourself"]
  419. }),
  420. $globals.Collection);
  421. $core.addMethod(
  422. $core.method({
  423. selector: "add:",
  424. protocol: "adding/removing",
  425. fn: function (anObject){
  426. var self=this,$self=this;
  427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  428. return $core.withContext(function($ctx1) {
  429. //>>excludeEnd("ctx");
  430. $self._subclassResponsibility();
  431. return self;
  432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  433. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  434. //>>excludeEnd("ctx");
  435. },
  436. //>>excludeStart("ide", pragmas.excludeIdeData);
  437. args: ["anObject"],
  438. source: "add: anObject\x0a\x09self subclassResponsibility",
  439. referencedClasses: [],
  440. //>>excludeEnd("ide");
  441. messageSends: ["subclassResponsibility"]
  442. }),
  443. $globals.Collection);
  444. $core.addMethod(
  445. $core.method({
  446. selector: "addAll:",
  447. protocol: "adding/removing",
  448. fn: function (aCollection){
  449. var self=this,$self=this;
  450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  451. return $core.withContext(function($ctx1) {
  452. //>>excludeEnd("ctx");
  453. $recv(aCollection)._do_((function(each){
  454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  455. return $core.withContext(function($ctx2) {
  456. //>>excludeEnd("ctx");
  457. return $self._add_(each);
  458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  459. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  460. //>>excludeEnd("ctx");
  461. }));
  462. return aCollection;
  463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  464. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  465. //>>excludeEnd("ctx");
  466. },
  467. //>>excludeStart("ide", pragmas.excludeIdeData);
  468. args: ["aCollection"],
  469. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  470. referencedClasses: [],
  471. //>>excludeEnd("ide");
  472. messageSends: ["do:", "add:"]
  473. }),
  474. $globals.Collection);
  475. $core.addMethod(
  476. $core.method({
  477. selector: "allSatisfy:",
  478. protocol: "enumerating",
  479. fn: function (aBlock){
  480. var self=this,$self=this;
  481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  482. return $core.withContext(function($ctx1) {
  483. //>>excludeEnd("ctx");
  484. var $1;
  485. var $early={};
  486. try {
  487. $self._do_((function(each){
  488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  489. return $core.withContext(function($ctx2) {
  490. //>>excludeEnd("ctx");
  491. $1=$recv(aBlock)._value_(each);
  492. if(!$core.assert($1)){
  493. throw $early=[false];
  494. }
  495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  496. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  497. //>>excludeEnd("ctx");
  498. }));
  499. return true;
  500. }
  501. catch(e) {if(e===$early)return e[0]; throw e}
  502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  503. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  504. //>>excludeEnd("ctx");
  505. },
  506. //>>excludeStart("ide", pragmas.excludeIdeData);
  507. args: ["aBlock"],
  508. source: "allSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for any element return false.\x0a\x09Otherwise return true.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  509. referencedClasses: [],
  510. //>>excludeEnd("ide");
  511. messageSends: ["do:", "ifFalse:", "value:"]
  512. }),
  513. $globals.Collection);
  514. $core.addMethod(
  515. $core.method({
  516. selector: "anyOne",
  517. protocol: "accessing",
  518. fn: function (){
  519. var self=this,$self=this;
  520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  521. return $core.withContext(function($ctx1) {
  522. //>>excludeEnd("ctx");
  523. var $early={};
  524. try {
  525. $self._ifEmpty_((function(){
  526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  527. return $core.withContext(function($ctx2) {
  528. //>>excludeEnd("ctx");
  529. return $self._error_("Collection is empty");
  530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  532. //>>excludeEnd("ctx");
  533. }));
  534. $self._do_((function(each){
  535. throw $early=[each];
  536. }));
  537. return self;
  538. }
  539. catch(e) {if(e===$early)return e[0]; throw e}
  540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  541. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  542. //>>excludeEnd("ctx");
  543. },
  544. //>>excludeStart("ide", pragmas.excludeIdeData);
  545. args: [],
  546. source: "anyOne\x0a\x09\x22Answer a representative sample of the receiver. This method can\x0a\x09be helpful when needing to preinfer the nature of the contents of \x0a\x09semi-homogeneous collections.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self do: [ :each | ^ each ]",
  547. referencedClasses: [],
  548. //>>excludeEnd("ide");
  549. messageSends: ["ifEmpty:", "error:", "do:"]
  550. }),
  551. $globals.Collection);
  552. $core.addMethod(
  553. $core.method({
  554. selector: "anySatisfy:",
  555. protocol: "enumerating",
  556. fn: function (aBlock){
  557. var self=this,$self=this;
  558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  559. return $core.withContext(function($ctx1) {
  560. //>>excludeEnd("ctx");
  561. var $1;
  562. var $early={};
  563. try {
  564. $self._do_((function(each){
  565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  566. return $core.withContext(function($ctx2) {
  567. //>>excludeEnd("ctx");
  568. $1=$recv(aBlock)._value_(each);
  569. if($core.assert($1)){
  570. throw $early=[true];
  571. }
  572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  573. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  574. //>>excludeEnd("ctx");
  575. }));
  576. return false;
  577. }
  578. catch(e) {if(e===$early)return e[0]; throw e}
  579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  580. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  581. //>>excludeEnd("ctx");
  582. },
  583. //>>excludeStart("ide", pragmas.excludeIdeData);
  584. args: ["aBlock"],
  585. source: "anySatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns true for any element return true.\x0a\x09Otherwise return false.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^ true ] ].\x0a\x09^ false",
  586. referencedClasses: [],
  587. //>>excludeEnd("ide");
  588. messageSends: ["do:", "ifTrue:", "value:"]
  589. }),
  590. $globals.Collection);
  591. $core.addMethod(
  592. $core.method({
  593. selector: "asArray",
  594. protocol: "converting",
  595. fn: function (){
  596. var self=this,$self=this;
  597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  598. return $core.withContext(function($ctx1) {
  599. //>>excludeEnd("ctx");
  600. return $recv($globals.Array)._withAll_(self);
  601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  602. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  603. //>>excludeEnd("ctx");
  604. },
  605. //>>excludeStart("ide", pragmas.excludeIdeData);
  606. args: [],
  607. source: "asArray\x0a\x09^ Array withAll: self",
  608. referencedClasses: ["Array"],
  609. //>>excludeEnd("ide");
  610. messageSends: ["withAll:"]
  611. }),
  612. $globals.Collection);
  613. $core.addMethod(
  614. $core.method({
  615. selector: "asJavaScriptObject",
  616. protocol: "converting",
  617. fn: function (){
  618. var self=this,$self=this;
  619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  620. return $core.withContext(function($ctx1) {
  621. //>>excludeEnd("ctx");
  622. return $recv($self._asArray())._collect_((function(each){
  623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  624. return $core.withContext(function($ctx2) {
  625. //>>excludeEnd("ctx");
  626. return $recv(each)._asJavaScriptObject();
  627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  628. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  629. //>>excludeEnd("ctx");
  630. }));
  631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  632. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.Collection)});
  633. //>>excludeEnd("ctx");
  634. },
  635. //>>excludeStart("ide", pragmas.excludeIdeData);
  636. args: [],
  637. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  638. referencedClasses: [],
  639. //>>excludeEnd("ide");
  640. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  641. }),
  642. $globals.Collection);
  643. $core.addMethod(
  644. $core.method({
  645. selector: "asOrderedCollection",
  646. protocol: "converting",
  647. fn: function (){
  648. var self=this,$self=this;
  649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  650. return $core.withContext(function($ctx1) {
  651. //>>excludeEnd("ctx");
  652. return $self._asArray();
  653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  654. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  655. //>>excludeEnd("ctx");
  656. },
  657. //>>excludeStart("ide", pragmas.excludeIdeData);
  658. args: [],
  659. source: "asOrderedCollection\x0a\x09^ self asArray",
  660. referencedClasses: [],
  661. //>>excludeEnd("ide");
  662. messageSends: ["asArray"]
  663. }),
  664. $globals.Collection);
  665. $core.addMethod(
  666. $core.method({
  667. selector: "asSet",
  668. protocol: "converting",
  669. fn: function (){
  670. var self=this,$self=this;
  671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  672. return $core.withContext(function($ctx1) {
  673. //>>excludeEnd("ctx");
  674. return $recv($globals.Set)._withAll_(self);
  675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  676. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  677. //>>excludeEnd("ctx");
  678. },
  679. //>>excludeStart("ide", pragmas.excludeIdeData);
  680. args: [],
  681. source: "asSet\x0a\x09^ Set withAll: self",
  682. referencedClasses: ["Set"],
  683. //>>excludeEnd("ide");
  684. messageSends: ["withAll:"]
  685. }),
  686. $globals.Collection);
  687. $core.addMethod(
  688. $core.method({
  689. selector: "collect:",
  690. protocol: "enumerating",
  691. fn: function (aBlock){
  692. var self=this,$self=this;
  693. var stream;
  694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  695. return $core.withContext(function($ctx1) {
  696. //>>excludeEnd("ctx");
  697. stream=$recv($recv($self._class())._new())._writeStream();
  698. $self._do_((function(each){
  699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  700. return $core.withContext(function($ctx2) {
  701. //>>excludeEnd("ctx");
  702. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  704. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  705. //>>excludeEnd("ctx");
  706. }));
  707. return $recv(stream)._contents();
  708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  709. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  710. //>>excludeEnd("ctx");
  711. },
  712. //>>excludeStart("ide", pragmas.excludeIdeData);
  713. args: ["aBlock"],
  714. 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",
  715. referencedClasses: [],
  716. //>>excludeEnd("ide");
  717. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  718. }),
  719. $globals.Collection);
  720. $core.addMethod(
  721. $core.method({
  722. selector: "copyWith:",
  723. protocol: "copying",
  724. fn: function (anObject){
  725. var self=this,$self=this;
  726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  727. return $core.withContext(function($ctx1) {
  728. //>>excludeEnd("ctx");
  729. var $1;
  730. $1=$self._copy();
  731. $recv($1)._add_(anObject);
  732. return $recv($1)._yourself();
  733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  734. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  735. //>>excludeEnd("ctx");
  736. },
  737. //>>excludeStart("ide", pragmas.excludeIdeData);
  738. args: ["anObject"],
  739. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  740. referencedClasses: [],
  741. //>>excludeEnd("ide");
  742. messageSends: ["add:", "copy", "yourself"]
  743. }),
  744. $globals.Collection);
  745. $core.addMethod(
  746. $core.method({
  747. selector: "copyWithAll:",
  748. protocol: "copying",
  749. fn: function (aCollection){
  750. var self=this,$self=this;
  751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  752. return $core.withContext(function($ctx1) {
  753. //>>excludeEnd("ctx");
  754. var $1;
  755. $1=$self._copy();
  756. $recv($1)._addAll_(aCollection);
  757. return $recv($1)._yourself();
  758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  759. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  760. //>>excludeEnd("ctx");
  761. },
  762. //>>excludeStart("ide", pragmas.excludeIdeData);
  763. args: ["aCollection"],
  764. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  765. referencedClasses: [],
  766. //>>excludeEnd("ide");
  767. messageSends: ["addAll:", "copy", "yourself"]
  768. }),
  769. $globals.Collection);
  770. $core.addMethod(
  771. $core.method({
  772. selector: "copyWithout:",
  773. protocol: "copying",
  774. fn: function (anObject){
  775. var self=this,$self=this;
  776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  777. return $core.withContext(function($ctx1) {
  778. //>>excludeEnd("ctx");
  779. return $self._reject_((function(each){
  780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  781. return $core.withContext(function($ctx2) {
  782. //>>excludeEnd("ctx");
  783. return $recv(each).__eq(anObject);
  784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  785. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  786. //>>excludeEnd("ctx");
  787. }));
  788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  789. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject},$globals.Collection)});
  790. //>>excludeEnd("ctx");
  791. },
  792. //>>excludeStart("ide", pragmas.excludeIdeData);
  793. args: ["anObject"],
  794. source: "copyWithout: anObject\x0a\x09\x22Answer a copy of the receiver that does not contain\x0a\x09any occurrences of anObject.\x22\x0a\x0a\x09^ self reject: [ :each | each = anObject ]",
  795. referencedClasses: [],
  796. //>>excludeEnd("ide");
  797. messageSends: ["reject:", "="]
  798. }),
  799. $globals.Collection);
  800. $core.addMethod(
  801. $core.method({
  802. selector: "copyWithoutAll:",
  803. protocol: "copying",
  804. fn: function (aCollection){
  805. var self=this,$self=this;
  806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  807. return $core.withContext(function($ctx1) {
  808. //>>excludeEnd("ctx");
  809. return $self._reject_((function(each){
  810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  811. return $core.withContext(function($ctx2) {
  812. //>>excludeEnd("ctx");
  813. return $recv(aCollection)._includes_(each);
  814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  815. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  816. //>>excludeEnd("ctx");
  817. }));
  818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  819. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  820. //>>excludeEnd("ctx");
  821. },
  822. //>>excludeStart("ide", pragmas.excludeIdeData);
  823. args: ["aCollection"],
  824. 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 ]",
  825. referencedClasses: [],
  826. //>>excludeEnd("ide");
  827. messageSends: ["reject:", "includes:"]
  828. }),
  829. $globals.Collection);
  830. $core.addMethod(
  831. $core.method({
  832. selector: "deepCopy",
  833. protocol: "copying",
  834. fn: function (){
  835. var self=this,$self=this;
  836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  837. return $core.withContext(function($ctx1) {
  838. //>>excludeEnd("ctx");
  839. return $self._collect_((function(each){
  840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  841. return $core.withContext(function($ctx2) {
  842. //>>excludeEnd("ctx");
  843. return $recv(each)._deepCopy();
  844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  845. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  846. //>>excludeEnd("ctx");
  847. }));
  848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  849. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  850. //>>excludeEnd("ctx");
  851. },
  852. //>>excludeStart("ide", pragmas.excludeIdeData);
  853. args: [],
  854. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  855. referencedClasses: [],
  856. //>>excludeEnd("ide");
  857. messageSends: ["collect:", "deepCopy"]
  858. }),
  859. $globals.Collection);
  860. $core.addMethod(
  861. $core.method({
  862. selector: "detect:",
  863. protocol: "enumerating",
  864. fn: function (aBlock){
  865. var self=this,$self=this;
  866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  867. return $core.withContext(function($ctx1) {
  868. //>>excludeEnd("ctx");
  869. return $self._detect_ifNone_(aBlock,(function(){
  870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  871. return $core.withContext(function($ctx2) {
  872. //>>excludeEnd("ctx");
  873. return $self._errorNotFound();
  874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  876. //>>excludeEnd("ctx");
  877. }));
  878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  879. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  880. //>>excludeEnd("ctx");
  881. },
  882. //>>excludeStart("ide", pragmas.excludeIdeData);
  883. args: ["aBlock"],
  884. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  885. referencedClasses: [],
  886. //>>excludeEnd("ide");
  887. messageSends: ["detect:ifNone:", "errorNotFound"]
  888. }),
  889. $globals.Collection);
  890. $core.addMethod(
  891. $core.method({
  892. selector: "detect:ifNone:",
  893. protocol: "enumerating",
  894. fn: function (aBlock,anotherBlock){
  895. var self=this,$self=this;
  896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  897. return $core.withContext(function($ctx1) {
  898. //>>excludeEnd("ctx");
  899. $self._subclassResponsibility();
  900. return self;
  901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  902. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  903. //>>excludeEnd("ctx");
  904. },
  905. //>>excludeStart("ide", pragmas.excludeIdeData);
  906. args: ["aBlock", "anotherBlock"],
  907. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  908. referencedClasses: [],
  909. //>>excludeEnd("ide");
  910. messageSends: ["subclassResponsibility"]
  911. }),
  912. $globals.Collection);
  913. $core.addMethod(
  914. $core.method({
  915. selector: "do:",
  916. protocol: "enumerating",
  917. fn: function (aBlock){
  918. var self=this,$self=this;
  919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  920. return $core.withContext(function($ctx1) {
  921. //>>excludeEnd("ctx");
  922. $self._subclassResponsibility();
  923. return self;
  924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  925. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  926. //>>excludeEnd("ctx");
  927. },
  928. //>>excludeStart("ide", pragmas.excludeIdeData);
  929. args: ["aBlock"],
  930. source: "do: aBlock\x0a\x09self subclassResponsibility",
  931. referencedClasses: [],
  932. //>>excludeEnd("ide");
  933. messageSends: ["subclassResponsibility"]
  934. }),
  935. $globals.Collection);
  936. $core.addMethod(
  937. $core.method({
  938. selector: "do:separatedBy:",
  939. protocol: "enumerating",
  940. fn: function (aBlock,anotherBlock){
  941. var self=this,$self=this;
  942. var actionBeforeElement;
  943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  944. return $core.withContext(function($ctx1) {
  945. //>>excludeEnd("ctx");
  946. actionBeforeElement=(function(){
  947. actionBeforeElement=anotherBlock;
  948. return actionBeforeElement;
  949. });
  950. $self._do_((function(each){
  951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  952. return $core.withContext(function($ctx2) {
  953. //>>excludeEnd("ctx");
  954. $recv(actionBeforeElement)._value();
  955. return $recv(aBlock)._value_(each);
  956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  957. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  958. //>>excludeEnd("ctx");
  959. }));
  960. return self;
  961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  962. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  963. //>>excludeEnd("ctx");
  964. },
  965. //>>excludeStart("ide", pragmas.excludeIdeData);
  966. args: ["aBlock", "anotherBlock"],
  967. source: "do: aBlock separatedBy: anotherBlock\x0a\x09| actionBeforeElement |\x0a\x09actionBeforeElement := [ actionBeforeElement := anotherBlock ].\x0a\x09self do: [ :each |\x0a\x09\x09actionBeforeElement value.\x0a\x09\x09aBlock value: each ]",
  968. referencedClasses: [],
  969. //>>excludeEnd("ide");
  970. messageSends: ["do:", "value", "value:"]
  971. }),
  972. $globals.Collection);
  973. $core.addMethod(
  974. $core.method({
  975. selector: "errorNotFound",
  976. protocol: "error handling",
  977. fn: function (){
  978. var self=this,$self=this;
  979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  980. return $core.withContext(function($ctx1) {
  981. //>>excludeEnd("ctx");
  982. $self._error_("Object is not in the collection");
  983. return self;
  984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  985. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  986. //>>excludeEnd("ctx");
  987. },
  988. //>>excludeStart("ide", pragmas.excludeIdeData);
  989. args: [],
  990. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  991. referencedClasses: [],
  992. //>>excludeEnd("ide");
  993. messageSends: ["error:"]
  994. }),
  995. $globals.Collection);
  996. $core.addMethod(
  997. $core.method({
  998. selector: "ifEmpty:",
  999. protocol: "testing",
  1000. fn: function (aBlock){
  1001. var self=this,$self=this;
  1002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1003. return $core.withContext(function($ctx1) {
  1004. //>>excludeEnd("ctx");
  1005. var $1;
  1006. $1=$self._isEmpty();
  1007. if($core.assert($1)){
  1008. return $recv(aBlock)._value();
  1009. } else {
  1010. return self;
  1011. }
  1012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1013. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  1014. //>>excludeEnd("ctx");
  1015. },
  1016. //>>excludeStart("ide", pragmas.excludeIdeData);
  1017. args: ["aBlock"],
  1018. 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. \x0a\x09Note 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: \x0a\x09\x09self classifyMethodAs:\x0a\x09\x09\x09(myProtocol ifEmpty: ['As yet unclassified'])\x22\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ self ]",
  1019. referencedClasses: [],
  1020. //>>excludeEnd("ide");
  1021. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  1022. }),
  1023. $globals.Collection);
  1024. $core.addMethod(
  1025. $core.method({
  1026. selector: "ifEmpty:ifNotEmpty:",
  1027. protocol: "testing",
  1028. fn: function (aBlock,anotherBlock){
  1029. var self=this,$self=this;
  1030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1031. return $core.withContext(function($ctx1) {
  1032. //>>excludeEnd("ctx");
  1033. var $1;
  1034. $1=$self._isEmpty();
  1035. if($core.assert($1)){
  1036. return $recv(aBlock)._value();
  1037. } else {
  1038. return $recv(anotherBlock)._value_(self);
  1039. }
  1040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1041. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  1042. //>>excludeEnd("ctx");
  1043. },
  1044. //>>excludeStart("ide", pragmas.excludeIdeData);
  1045. args: ["aBlock", "anotherBlock"],
  1046. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  1047. referencedClasses: [],
  1048. //>>excludeEnd("ide");
  1049. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  1050. }),
  1051. $globals.Collection);
  1052. $core.addMethod(
  1053. $core.method({
  1054. selector: "ifNotEmpty:",
  1055. protocol: "testing",
  1056. fn: function (aBlock){
  1057. var self=this,$self=this;
  1058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1059. return $core.withContext(function($ctx1) {
  1060. //>>excludeEnd("ctx");
  1061. var $1;
  1062. $1=$self._notEmpty();
  1063. if($core.assert($1)){
  1064. return $recv(aBlock)._value_(self);
  1065. } else {
  1066. return self;
  1067. }
  1068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1069. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  1070. //>>excludeEnd("ctx");
  1071. },
  1072. //>>excludeStart("ide", pragmas.excludeIdeData);
  1073. args: ["aBlock"],
  1074. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  1075. referencedClasses: [],
  1076. //>>excludeEnd("ide");
  1077. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1078. }),
  1079. $globals.Collection);
  1080. $core.addMethod(
  1081. $core.method({
  1082. selector: "ifNotEmpty:ifEmpty:",
  1083. protocol: "testing",
  1084. fn: function (aBlock,anotherBlock){
  1085. var self=this,$self=this;
  1086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1087. return $core.withContext(function($ctx1) {
  1088. //>>excludeEnd("ctx");
  1089. var $1;
  1090. $1=$self._notEmpty();
  1091. if($core.assert($1)){
  1092. return $recv(aBlock)._value_(self);
  1093. } else {
  1094. return $recv(anotherBlock)._value();
  1095. }
  1096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1097. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  1098. //>>excludeEnd("ctx");
  1099. },
  1100. //>>excludeStart("ide", pragmas.excludeIdeData);
  1101. args: ["aBlock", "anotherBlock"],
  1102. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  1103. referencedClasses: [],
  1104. //>>excludeEnd("ide");
  1105. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  1106. }),
  1107. $globals.Collection);
  1108. $core.addMethod(
  1109. $core.method({
  1110. selector: "includes:",
  1111. protocol: "testing",
  1112. fn: function (anObject){
  1113. var self=this,$self=this;
  1114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1115. return $core.withContext(function($ctx1) {
  1116. //>>excludeEnd("ctx");
  1117. return $self._anySatisfy_((function(each){
  1118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1119. return $core.withContext(function($ctx2) {
  1120. //>>excludeEnd("ctx");
  1121. return $recv(each).__eq(anObject);
  1122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1123. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1124. //>>excludeEnd("ctx");
  1125. }));
  1126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1127. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  1128. //>>excludeEnd("ctx");
  1129. },
  1130. //>>excludeStart("ide", pragmas.excludeIdeData);
  1131. args: ["anObject"],
  1132. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  1133. referencedClasses: [],
  1134. //>>excludeEnd("ide");
  1135. messageSends: ["anySatisfy:", "="]
  1136. }),
  1137. $globals.Collection);
  1138. $core.addMethod(
  1139. $core.method({
  1140. selector: "inject:into:",
  1141. protocol: "enumerating",
  1142. fn: function (anObject,aBlock){
  1143. var self=this,$self=this;
  1144. var result;
  1145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1146. return $core.withContext(function($ctx1) {
  1147. //>>excludeEnd("ctx");
  1148. result=anObject;
  1149. $self._do_((function(each){
  1150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1151. return $core.withContext(function($ctx2) {
  1152. //>>excludeEnd("ctx");
  1153. result=$recv(aBlock)._value_value_(result,each);
  1154. return result;
  1155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1156. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1157. //>>excludeEnd("ctx");
  1158. }));
  1159. return result;
  1160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1161. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  1162. //>>excludeEnd("ctx");
  1163. },
  1164. //>>excludeStart("ide", pragmas.excludeIdeData);
  1165. args: ["anObject", "aBlock"],
  1166. source: "inject: anObject into: aBlock\x0a\x09| result |\x0a\x09result := anObject.\x0a\x09self do: [ :each |\x0a\x09\x09result := aBlock value: result value: each ].\x0a\x09^ result",
  1167. referencedClasses: [],
  1168. //>>excludeEnd("ide");
  1169. messageSends: ["do:", "value:value:"]
  1170. }),
  1171. $globals.Collection);
  1172. $core.addMethod(
  1173. $core.method({
  1174. selector: "intersection:",
  1175. protocol: "enumerating",
  1176. fn: function (aCollection){
  1177. var self=this,$self=this;
  1178. var set,outputSet;
  1179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1180. return $core.withContext(function($ctx1) {
  1181. //>>excludeEnd("ctx");
  1182. var $2,$1;
  1183. set=$self._asSet();
  1184. outputSet=$recv($globals.Set)._new();
  1185. $recv(aCollection)._do_((function(each){
  1186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1187. return $core.withContext(function($ctx2) {
  1188. //>>excludeEnd("ctx");
  1189. $2=$recv(set)._includes_(each);
  1190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1191. $ctx2.sendIdx["includes:"]=1;
  1192. //>>excludeEnd("ctx");
  1193. $1=$recv($2)._and_((function(){
  1194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1195. return $core.withContext(function($ctx3) {
  1196. //>>excludeEnd("ctx");
  1197. return $recv($recv(outputSet)._includes_(each))._not();
  1198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1199. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1200. //>>excludeEnd("ctx");
  1201. }));
  1202. if($core.assert($1)){
  1203. return $recv(outputSet)._add_(each);
  1204. }
  1205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1206. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1207. //>>excludeEnd("ctx");
  1208. }));
  1209. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  1210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1211. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  1212. //>>excludeEnd("ctx");
  1213. },
  1214. //>>excludeStart("ide", pragmas.excludeIdeData);
  1215. args: ["aCollection"],
  1216. 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",
  1217. referencedClasses: ["Set"],
  1218. //>>excludeEnd("ide");
  1219. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  1220. }),
  1221. $globals.Collection);
  1222. $core.addMethod(
  1223. $core.method({
  1224. selector: "isEmpty",
  1225. protocol: "testing",
  1226. fn: function (){
  1227. var self=this,$self=this;
  1228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1229. return $core.withContext(function($ctx1) {
  1230. //>>excludeEnd("ctx");
  1231. return $recv($self._size()).__eq((0));
  1232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1233. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  1234. //>>excludeEnd("ctx");
  1235. },
  1236. //>>excludeStart("ide", pragmas.excludeIdeData);
  1237. args: [],
  1238. source: "isEmpty\x0a\x09^ self size = 0",
  1239. referencedClasses: [],
  1240. //>>excludeEnd("ide");
  1241. messageSends: ["=", "size"]
  1242. }),
  1243. $globals.Collection);
  1244. $core.addMethod(
  1245. $core.method({
  1246. selector: "noneSatisfy:",
  1247. protocol: "enumerating",
  1248. fn: function (aBlock){
  1249. var self=this,$self=this;
  1250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1251. return $core.withContext(function($ctx1) {
  1252. //>>excludeEnd("ctx");
  1253. var $1;
  1254. var $early={};
  1255. try {
  1256. $self._do_((function(item){
  1257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1258. return $core.withContext(function($ctx2) {
  1259. //>>excludeEnd("ctx");
  1260. $1=$recv(aBlock)._value_(item);
  1261. if($core.assert($1)){
  1262. throw $early=[false];
  1263. }
  1264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1265. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  1266. //>>excludeEnd("ctx");
  1267. }));
  1268. return true;
  1269. }
  1270. catch(e) {if(e===$early)return e[0]; throw e}
  1271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1272. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  1273. //>>excludeEnd("ctx");
  1274. },
  1275. //>>excludeStart("ide", pragmas.excludeIdeData);
  1276. args: ["aBlock"],
  1277. source: "noneSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for all elements return true.\x0a\x09Otherwise return false\x22\x0a\x0a\x09self do: [ :item | (aBlock value: item) ifTrue: [ ^ false ] ].\x0a\x09^ true",
  1278. referencedClasses: [],
  1279. //>>excludeEnd("ide");
  1280. messageSends: ["do:", "ifTrue:", "value:"]
  1281. }),
  1282. $globals.Collection);
  1283. $core.addMethod(
  1284. $core.method({
  1285. selector: "notEmpty",
  1286. protocol: "testing",
  1287. fn: function (){
  1288. var self=this,$self=this;
  1289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1290. return $core.withContext(function($ctx1) {
  1291. //>>excludeEnd("ctx");
  1292. return $recv($self._isEmpty())._not();
  1293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1294. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  1295. //>>excludeEnd("ctx");
  1296. },
  1297. //>>excludeStart("ide", pragmas.excludeIdeData);
  1298. args: [],
  1299. source: "notEmpty\x0a\x09^ self isEmpty not",
  1300. referencedClasses: [],
  1301. //>>excludeEnd("ide");
  1302. messageSends: ["not", "isEmpty"]
  1303. }),
  1304. $globals.Collection);
  1305. $core.addMethod(
  1306. $core.method({
  1307. selector: "occurrencesOf:",
  1308. protocol: "accessing",
  1309. fn: function (anObject){
  1310. var self=this,$self=this;
  1311. var tally;
  1312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1313. return $core.withContext(function($ctx1) {
  1314. //>>excludeEnd("ctx");
  1315. var $1;
  1316. tally=(0);
  1317. $self._do_((function(each){
  1318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1319. return $core.withContext(function($ctx2) {
  1320. //>>excludeEnd("ctx");
  1321. $1=$recv(anObject).__eq(each);
  1322. if($core.assert($1)){
  1323. tally=$recv(tally).__plus((1));
  1324. return tally;
  1325. }
  1326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1327. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1328. //>>excludeEnd("ctx");
  1329. }));
  1330. return tally;
  1331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1332. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  1333. //>>excludeEnd("ctx");
  1334. },
  1335. //>>excludeStart("ide", pragmas.excludeIdeData);
  1336. args: ["anObject"],
  1337. 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",
  1338. referencedClasses: [],
  1339. //>>excludeEnd("ide");
  1340. messageSends: ["do:", "ifTrue:", "=", "+"]
  1341. }),
  1342. $globals.Collection);
  1343. $core.addMethod(
  1344. $core.method({
  1345. selector: "putOn:",
  1346. protocol: "streaming",
  1347. fn: function (aStream){
  1348. var self=this,$self=this;
  1349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1350. return $core.withContext(function($ctx1) {
  1351. //>>excludeEnd("ctx");
  1352. $self._do_((function(each){
  1353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1354. return $core.withContext(function($ctx2) {
  1355. //>>excludeEnd("ctx");
  1356. return $recv(each)._putOn_(aStream);
  1357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1358. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1359. //>>excludeEnd("ctx");
  1360. }));
  1361. return self;
  1362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1363. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  1364. //>>excludeEnd("ctx");
  1365. },
  1366. //>>excludeStart("ide", pragmas.excludeIdeData);
  1367. args: ["aStream"],
  1368. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  1369. referencedClasses: [],
  1370. //>>excludeEnd("ide");
  1371. messageSends: ["do:", "putOn:"]
  1372. }),
  1373. $globals.Collection);
  1374. $core.addMethod(
  1375. $core.method({
  1376. selector: "reject:",
  1377. protocol: "enumerating",
  1378. fn: function (aBlock){
  1379. var self=this,$self=this;
  1380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1381. return $core.withContext(function($ctx1) {
  1382. //>>excludeEnd("ctx");
  1383. return $self._select_((function(each){
  1384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1385. return $core.withContext(function($ctx2) {
  1386. //>>excludeEnd("ctx");
  1387. return $recv($recv(aBlock)._value_(each)).__eq(false);
  1388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1389. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1390. //>>excludeEnd("ctx");
  1391. }));
  1392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1393. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  1394. //>>excludeEnd("ctx");
  1395. },
  1396. //>>excludeStart("ide", pragmas.excludeIdeData);
  1397. args: ["aBlock"],
  1398. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  1399. referencedClasses: [],
  1400. //>>excludeEnd("ide");
  1401. messageSends: ["select:", "=", "value:"]
  1402. }),
  1403. $globals.Collection);
  1404. $core.addMethod(
  1405. $core.method({
  1406. selector: "remove:",
  1407. protocol: "adding/removing",
  1408. fn: function (anObject){
  1409. var self=this,$self=this;
  1410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1411. return $core.withContext(function($ctx1) {
  1412. //>>excludeEnd("ctx");
  1413. return $self._remove_ifAbsent_(anObject,(function(){
  1414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1415. return $core.withContext(function($ctx2) {
  1416. //>>excludeEnd("ctx");
  1417. return $self._errorNotFound();
  1418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1420. //>>excludeEnd("ctx");
  1421. }));
  1422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1423. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  1424. //>>excludeEnd("ctx");
  1425. },
  1426. //>>excludeStart("ide", pragmas.excludeIdeData);
  1427. args: ["anObject"],
  1428. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  1429. referencedClasses: [],
  1430. //>>excludeEnd("ide");
  1431. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  1432. }),
  1433. $globals.Collection);
  1434. $core.addMethod(
  1435. $core.method({
  1436. selector: "remove:ifAbsent:",
  1437. protocol: "adding/removing",
  1438. fn: function (anObject,aBlock){
  1439. var self=this,$self=this;
  1440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1441. return $core.withContext(function($ctx1) {
  1442. //>>excludeEnd("ctx");
  1443. $self._subclassResponsibility();
  1444. return self;
  1445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1446. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  1447. //>>excludeEnd("ctx");
  1448. },
  1449. //>>excludeStart("ide", pragmas.excludeIdeData);
  1450. args: ["anObject", "aBlock"],
  1451. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1452. referencedClasses: [],
  1453. //>>excludeEnd("ide");
  1454. messageSends: ["subclassResponsibility"]
  1455. }),
  1456. $globals.Collection);
  1457. $core.addMethod(
  1458. $core.method({
  1459. selector: "removeAll",
  1460. protocol: "adding/removing",
  1461. fn: function (){
  1462. var self=this,$self=this;
  1463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1464. return $core.withContext(function($ctx1) {
  1465. //>>excludeEnd("ctx");
  1466. $self._subclassResponsibility();
  1467. return self;
  1468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1469. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  1470. //>>excludeEnd("ctx");
  1471. },
  1472. //>>excludeStart("ide", pragmas.excludeIdeData);
  1473. args: [],
  1474. source: "removeAll\x0a\x09self subclassResponsibility",
  1475. referencedClasses: [],
  1476. //>>excludeEnd("ide");
  1477. messageSends: ["subclassResponsibility"]
  1478. }),
  1479. $globals.Collection);
  1480. $core.addMethod(
  1481. $core.method({
  1482. selector: "select:",
  1483. protocol: "enumerating",
  1484. fn: function (aBlock){
  1485. var self=this,$self=this;
  1486. var stream;
  1487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1488. return $core.withContext(function($ctx1) {
  1489. //>>excludeEnd("ctx");
  1490. var $1;
  1491. stream=$recv($recv($self._class())._new())._writeStream();
  1492. $self._do_((function(each){
  1493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1494. return $core.withContext(function($ctx2) {
  1495. //>>excludeEnd("ctx");
  1496. $1=$recv(aBlock)._value_(each);
  1497. if($core.assert($1)){
  1498. return $recv(stream)._nextPut_(each);
  1499. }
  1500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1501. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1502. //>>excludeEnd("ctx");
  1503. }));
  1504. return $recv(stream)._contents();
  1505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1506. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  1507. //>>excludeEnd("ctx");
  1508. },
  1509. //>>excludeStart("ide", pragmas.excludeIdeData);
  1510. args: ["aBlock"],
  1511. source: "select: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: each ] ].\x0a\x09^ stream contents",
  1512. referencedClasses: [],
  1513. //>>excludeEnd("ide");
  1514. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1515. }),
  1516. $globals.Collection);
  1517. $core.addMethod(
  1518. $core.method({
  1519. selector: "select:thenCollect:",
  1520. protocol: "enumerating",
  1521. fn: function (selectBlock,collectBlock){
  1522. var self=this,$self=this;
  1523. var stream;
  1524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1525. return $core.withContext(function($ctx1) {
  1526. //>>excludeEnd("ctx");
  1527. var $1;
  1528. stream=$recv($recv($self._class())._new())._writeStream();
  1529. $self._do_((function(each){
  1530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1531. return $core.withContext(function($ctx2) {
  1532. //>>excludeEnd("ctx");
  1533. $1=$recv(selectBlock)._value_(each);
  1534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1535. $ctx2.sendIdx["value:"]=1;
  1536. //>>excludeEnd("ctx");
  1537. if($core.assert($1)){
  1538. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  1539. }
  1540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1541. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1542. //>>excludeEnd("ctx");
  1543. }));
  1544. return $recv(stream)._contents();
  1545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1546. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  1547. //>>excludeEnd("ctx");
  1548. },
  1549. //>>excludeStart("ide", pragmas.excludeIdeData);
  1550. args: ["selectBlock", "collectBlock"],
  1551. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(selectBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: (collectBlock value: each) ] ].\x0a\x09^ stream contents",
  1552. referencedClasses: [],
  1553. //>>excludeEnd("ide");
  1554. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1555. }),
  1556. $globals.Collection);
  1557. $core.addMethod(
  1558. $core.method({
  1559. selector: "shallowCopy",
  1560. protocol: "copying",
  1561. fn: function (){
  1562. var self=this,$self=this;
  1563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1564. return $core.withContext(function($ctx1) {
  1565. //>>excludeEnd("ctx");
  1566. return $self._collect_((function(each){
  1567. return each;
  1568. }));
  1569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1570. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  1571. //>>excludeEnd("ctx");
  1572. },
  1573. //>>excludeStart("ide", pragmas.excludeIdeData);
  1574. args: [],
  1575. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  1576. referencedClasses: [],
  1577. //>>excludeEnd("ide");
  1578. messageSends: ["collect:"]
  1579. }),
  1580. $globals.Collection);
  1581. $core.addMethod(
  1582. $core.method({
  1583. selector: "single",
  1584. protocol: "accessing",
  1585. fn: function (){
  1586. var self=this,$self=this;
  1587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1588. return $core.withContext(function($ctx1) {
  1589. //>>excludeEnd("ctx");
  1590. var $1;
  1591. $self._ifEmpty_((function(){
  1592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1593. return $core.withContext(function($ctx2) {
  1594. //>>excludeEnd("ctx");
  1595. return $self._error_("Collection is empty");
  1596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1597. $ctx2.sendIdx["error:"]=1;
  1598. //>>excludeEnd("ctx");
  1599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1600. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1601. //>>excludeEnd("ctx");
  1602. }));
  1603. $1=$recv($self._size()).__gt((1));
  1604. if($core.assert($1)){
  1605. $self._error_("Collection holds more than one element");
  1606. }
  1607. return $self._anyOne();
  1608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1609. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  1610. //>>excludeEnd("ctx");
  1611. },
  1612. //>>excludeStart("ide", pragmas.excludeIdeData);
  1613. args: [],
  1614. source: "single\x0a\x09\x22Answer a single element.\x0a\x09Raise an error if collection holds less or more than one element.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self size > 1 ifTrue: [ self error: 'Collection holds more than one element' ].\x0a\x09^ self anyOne",
  1615. referencedClasses: [],
  1616. //>>excludeEnd("ide");
  1617. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  1618. }),
  1619. $globals.Collection);
  1620. $core.addMethod(
  1621. $core.method({
  1622. selector: "size",
  1623. protocol: "accessing",
  1624. fn: function (){
  1625. var self=this,$self=this;
  1626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1627. return $core.withContext(function($ctx1) {
  1628. //>>excludeEnd("ctx");
  1629. $self._subclassResponsibility();
  1630. return self;
  1631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1632. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  1633. //>>excludeEnd("ctx");
  1634. },
  1635. //>>excludeStart("ide", pragmas.excludeIdeData);
  1636. args: [],
  1637. source: "size\x0a\x09self subclassResponsibility",
  1638. referencedClasses: [],
  1639. //>>excludeEnd("ide");
  1640. messageSends: ["subclassResponsibility"]
  1641. }),
  1642. $globals.Collection);
  1643. $core.addMethod(
  1644. $core.method({
  1645. selector: "classTag",
  1646. protocol: "accessing",
  1647. fn: function (){
  1648. var self=this,$self=this;
  1649. return "collection";
  1650. },
  1651. //>>excludeStart("ide", pragmas.excludeIdeData);
  1652. args: [],
  1653. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'collection'",
  1654. referencedClasses: [],
  1655. //>>excludeEnd("ide");
  1656. messageSends: []
  1657. }),
  1658. $globals.Collection.a$cls);
  1659. $core.addMethod(
  1660. $core.method({
  1661. selector: "new:",
  1662. protocol: "instance creation",
  1663. fn: function (anInteger){
  1664. var self=this,$self=this;
  1665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1666. return $core.withContext(function($ctx1) {
  1667. //>>excludeEnd("ctx");
  1668. return $self._new();
  1669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1670. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.a$cls)});
  1671. //>>excludeEnd("ctx");
  1672. },
  1673. //>>excludeStart("ide", pragmas.excludeIdeData);
  1674. args: ["anInteger"],
  1675. source: "new: anInteger\x0a\x09^ self new",
  1676. referencedClasses: [],
  1677. //>>excludeEnd("ide");
  1678. messageSends: ["new"]
  1679. }),
  1680. $globals.Collection.a$cls);
  1681. $core.addMethod(
  1682. $core.method({
  1683. selector: "with:",
  1684. protocol: "instance creation",
  1685. fn: function (anObject){
  1686. var self=this,$self=this;
  1687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1688. return $core.withContext(function($ctx1) {
  1689. //>>excludeEnd("ctx");
  1690. var $1;
  1691. $1=$self._new();
  1692. $recv($1)._add_(anObject);
  1693. return $recv($1)._yourself();
  1694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1695. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.a$cls)});
  1696. //>>excludeEnd("ctx");
  1697. },
  1698. //>>excludeStart("ide", pragmas.excludeIdeData);
  1699. args: ["anObject"],
  1700. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1701. referencedClasses: [],
  1702. //>>excludeEnd("ide");
  1703. messageSends: ["add:", "new", "yourself"]
  1704. }),
  1705. $globals.Collection.a$cls);
  1706. $core.addMethod(
  1707. $core.method({
  1708. selector: "with:with:",
  1709. protocol: "instance creation",
  1710. fn: function (anObject,anotherObject){
  1711. var self=this,$self=this;
  1712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1713. return $core.withContext(function($ctx1) {
  1714. //>>excludeEnd("ctx");
  1715. var $1;
  1716. $1=$self._new();
  1717. $recv($1)._add_(anObject);
  1718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1719. $ctx1.sendIdx["add:"]=1;
  1720. //>>excludeEnd("ctx");
  1721. $recv($1)._add_(anotherObject);
  1722. return $recv($1)._yourself();
  1723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1724. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.a$cls)});
  1725. //>>excludeEnd("ctx");
  1726. },
  1727. //>>excludeStart("ide", pragmas.excludeIdeData);
  1728. args: ["anObject", "anotherObject"],
  1729. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1730. referencedClasses: [],
  1731. //>>excludeEnd("ide");
  1732. messageSends: ["add:", "new", "yourself"]
  1733. }),
  1734. $globals.Collection.a$cls);
  1735. $core.addMethod(
  1736. $core.method({
  1737. selector: "with:with:with:",
  1738. protocol: "instance creation",
  1739. fn: function (firstObject,secondObject,thirdObject){
  1740. var self=this,$self=this;
  1741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1742. return $core.withContext(function($ctx1) {
  1743. //>>excludeEnd("ctx");
  1744. var $1;
  1745. $1=$self._new();
  1746. $recv($1)._add_(firstObject);
  1747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1748. $ctx1.sendIdx["add:"]=1;
  1749. //>>excludeEnd("ctx");
  1750. $recv($1)._add_(secondObject);
  1751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1752. $ctx1.sendIdx["add:"]=2;
  1753. //>>excludeEnd("ctx");
  1754. $recv($1)._add_(thirdObject);
  1755. return $recv($1)._yourself();
  1756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1757. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.a$cls)});
  1758. //>>excludeEnd("ctx");
  1759. },
  1760. //>>excludeStart("ide", pragmas.excludeIdeData);
  1761. args: ["firstObject", "secondObject", "thirdObject"],
  1762. source: "with: firstObject with: secondObject with: thirdObject\x0a\x09\x09^ self new\x0a\x09\x09add: firstObject;\x0a\x09\x09add: secondObject;\x0a\x09\x09add: thirdObject;\x0a\x09\x09yourself",
  1763. referencedClasses: [],
  1764. //>>excludeEnd("ide");
  1765. messageSends: ["add:", "new", "yourself"]
  1766. }),
  1767. $globals.Collection.a$cls);
  1768. $core.addMethod(
  1769. $core.method({
  1770. selector: "withAll:",
  1771. protocol: "instance creation",
  1772. fn: function (aCollection){
  1773. var self=this,$self=this;
  1774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1775. return $core.withContext(function($ctx1) {
  1776. //>>excludeEnd("ctx");
  1777. var $1;
  1778. $1=$self._new();
  1779. $recv($1)._addAll_(aCollection);
  1780. return $recv($1)._yourself();
  1781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1782. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.a$cls)});
  1783. //>>excludeEnd("ctx");
  1784. },
  1785. //>>excludeStart("ide", pragmas.excludeIdeData);
  1786. args: ["aCollection"],
  1787. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1788. referencedClasses: [],
  1789. //>>excludeEnd("ide");
  1790. messageSends: ["addAll:", "new", "yourself"]
  1791. }),
  1792. $globals.Collection.a$cls);
  1793. $core.addClass("IndexableCollection", $globals.Collection, [], "Kernel-Collections");
  1794. //>>excludeStart("ide", pragmas.excludeIdeData);
  1795. $globals.IndexableCollection.comment="I am a key-value store collection, that is,\x0aI store values under indexes.\x0a\x0aAs a rule of thumb, if a collection has `#at:` and `#at:put:`,\x0ait is an IndexableCollection.";
  1796. //>>excludeEnd("ide");
  1797. $core.addMethod(
  1798. $core.method({
  1799. selector: "at:",
  1800. protocol: "accessing",
  1801. fn: function (anIndex){
  1802. var self=this,$self=this;
  1803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1804. return $core.withContext(function($ctx1) {
  1805. //>>excludeEnd("ctx");
  1806. return $self._at_ifAbsent_(anIndex,(function(){
  1807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1808. return $core.withContext(function($ctx2) {
  1809. //>>excludeEnd("ctx");
  1810. return $self._errorNotFound();
  1811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1812. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1813. //>>excludeEnd("ctx");
  1814. }));
  1815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1816. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  1817. //>>excludeEnd("ctx");
  1818. },
  1819. //>>excludeStart("ide", pragmas.excludeIdeData);
  1820. args: ["anIndex"],
  1821. source: "at: anIndex\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, raise an error.\x22\x0a\x0a\x09^ self at: anIndex ifAbsent: [ self errorNotFound ]",
  1822. referencedClasses: [],
  1823. //>>excludeEnd("ide");
  1824. messageSends: ["at:ifAbsent:", "errorNotFound"]
  1825. }),
  1826. $globals.IndexableCollection);
  1827. $core.addMethod(
  1828. $core.method({
  1829. selector: "at:ifAbsent:",
  1830. protocol: "accessing",
  1831. fn: function (anIndex,aBlock){
  1832. var self=this,$self=this;
  1833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1834. return $core.withContext(function($ctx1) {
  1835. //>>excludeEnd("ctx");
  1836. $self._subclassResponsibility();
  1837. return self;
  1838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1839. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  1840. //>>excludeEnd("ctx");
  1841. },
  1842. //>>excludeStart("ide", pragmas.excludeIdeData);
  1843. args: ["anIndex", "aBlock"],
  1844. source: "at: anIndex ifAbsent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, answer the value of aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  1845. referencedClasses: [],
  1846. //>>excludeEnd("ide");
  1847. messageSends: ["subclassResponsibility"]
  1848. }),
  1849. $globals.IndexableCollection);
  1850. $core.addMethod(
  1851. $core.method({
  1852. selector: "at:ifAbsentPut:",
  1853. protocol: "accessing",
  1854. fn: function (aKey,aBlock){
  1855. var self=this,$self=this;
  1856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1857. return $core.withContext(function($ctx1) {
  1858. //>>excludeEnd("ctx");
  1859. return $self._at_ifAbsent_(aKey,(function(){
  1860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1861. return $core.withContext(function($ctx2) {
  1862. //>>excludeEnd("ctx");
  1863. return $self._at_put_(aKey,$recv(aBlock)._value());
  1864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1866. //>>excludeEnd("ctx");
  1867. }));
  1868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1869. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  1870. //>>excludeEnd("ctx");
  1871. },
  1872. //>>excludeStart("ide", pragmas.excludeIdeData);
  1873. args: ["aKey", "aBlock"],
  1874. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  1875. referencedClasses: [],
  1876. //>>excludeEnd("ide");
  1877. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  1878. }),
  1879. $globals.IndexableCollection);
  1880. $core.addMethod(
  1881. $core.method({
  1882. selector: "at:ifPresent:",
  1883. protocol: "accessing",
  1884. fn: function (anIndex,aBlock){
  1885. var self=this,$self=this;
  1886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1887. return $core.withContext(function($ctx1) {
  1888. //>>excludeEnd("ctx");
  1889. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  1890. return nil;
  1891. }));
  1892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1893. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  1894. //>>excludeEnd("ctx");
  1895. },
  1896. //>>excludeStart("ide", pragmas.excludeIdeData);
  1897. args: ["anIndex", "aBlock"],
  1898. source: "at: anIndex ifPresent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer nil.\x22\x0a\x0a\x09^ self at: anIndex ifPresent: aBlock ifAbsent: [ nil ]",
  1899. referencedClasses: [],
  1900. //>>excludeEnd("ide");
  1901. messageSends: ["at:ifPresent:ifAbsent:"]
  1902. }),
  1903. $globals.IndexableCollection);
  1904. $core.addMethod(
  1905. $core.method({
  1906. selector: "at:ifPresent:ifAbsent:",
  1907. protocol: "accessing",
  1908. fn: function (anIndex,aBlock,anotherBlock){
  1909. var self=this,$self=this;
  1910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1911. return $core.withContext(function($ctx1) {
  1912. //>>excludeEnd("ctx");
  1913. $self._subclassResponsibility();
  1914. return self;
  1915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1916. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  1917. //>>excludeEnd("ctx");
  1918. },
  1919. //>>excludeStart("ide", pragmas.excludeIdeData);
  1920. args: ["anIndex", "aBlock", "anotherBlock"],
  1921. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer the value of anotherBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  1922. referencedClasses: [],
  1923. //>>excludeEnd("ide");
  1924. messageSends: ["subclassResponsibility"]
  1925. }),
  1926. $globals.IndexableCollection);
  1927. $core.addMethod(
  1928. $core.method({
  1929. selector: "at:put:",
  1930. protocol: "accessing",
  1931. fn: function (anIndex,anObject){
  1932. var self=this,$self=this;
  1933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1934. return $core.withContext(function($ctx1) {
  1935. //>>excludeEnd("ctx");
  1936. $self._subclassResponsibility();
  1937. return self;
  1938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1939. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  1940. //>>excludeEnd("ctx");
  1941. },
  1942. //>>excludeStart("ide", pragmas.excludeIdeData);
  1943. args: ["anIndex", "anObject"],
  1944. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  1945. referencedClasses: [],
  1946. //>>excludeEnd("ide");
  1947. messageSends: ["subclassResponsibility"]
  1948. }),
  1949. $globals.IndexableCollection);
  1950. $core.addMethod(
  1951. $core.method({
  1952. selector: "indexOf:",
  1953. protocol: "accessing",
  1954. fn: function (anObject){
  1955. var self=this,$self=this;
  1956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1957. return $core.withContext(function($ctx1) {
  1958. //>>excludeEnd("ctx");
  1959. return $self._indexOf_ifAbsent_(anObject,(function(){
  1960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1961. return $core.withContext(function($ctx2) {
  1962. //>>excludeEnd("ctx");
  1963. return $self._errorNotFound();
  1964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1966. //>>excludeEnd("ctx");
  1967. }));
  1968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1969. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  1970. //>>excludeEnd("ctx");
  1971. },
  1972. //>>excludeStart("ide", pragmas.excludeIdeData);
  1973. args: ["anObject"],
  1974. source: "indexOf: anObject\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, raise an error.\x22\x0a\x0a\x09^ self indexOf: anObject ifAbsent: [ self errorNotFound ]",
  1975. referencedClasses: [],
  1976. //>>excludeEnd("ide");
  1977. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  1978. }),
  1979. $globals.IndexableCollection);
  1980. $core.addMethod(
  1981. $core.method({
  1982. selector: "indexOf:ifAbsent:",
  1983. protocol: "accessing",
  1984. fn: function (anObject,aBlock){
  1985. var self=this,$self=this;
  1986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1987. return $core.withContext(function($ctx1) {
  1988. //>>excludeEnd("ctx");
  1989. $self._subclassResponsibility();
  1990. return self;
  1991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1992. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  1993. //>>excludeEnd("ctx");
  1994. },
  1995. //>>excludeStart("ide", pragmas.excludeIdeData);
  1996. args: ["anObject", "aBlock"],
  1997. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, return value of executing aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  1998. referencedClasses: [],
  1999. //>>excludeEnd("ide");
  2000. messageSends: ["subclassResponsibility"]
  2001. }),
  2002. $globals.IndexableCollection);
  2003. $core.addMethod(
  2004. $core.method({
  2005. selector: "with:do:",
  2006. protocol: "enumerating",
  2007. fn: function (anotherCollection,aBlock){
  2008. var self=this,$self=this;
  2009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2010. return $core.withContext(function($ctx1) {
  2011. //>>excludeEnd("ctx");
  2012. $self._withIndexDo_((function(each,index){
  2013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2014. return $core.withContext(function($ctx2) {
  2015. //>>excludeEnd("ctx");
  2016. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  2017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2018. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  2019. //>>excludeEnd("ctx");
  2020. }));
  2021. return self;
  2022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2023. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  2024. //>>excludeEnd("ctx");
  2025. },
  2026. //>>excludeStart("ide", pragmas.excludeIdeData);
  2027. args: ["anotherCollection", "aBlock"],
  2028. source: "with: anotherCollection do: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with indetically-indexed value from anotherCollection\x22\x0a\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09aBlock value: each value: (anotherCollection at: index) ]",
  2029. referencedClasses: [],
  2030. //>>excludeEnd("ide");
  2031. messageSends: ["withIndexDo:", "value:value:", "at:"]
  2032. }),
  2033. $globals.IndexableCollection);
  2034. $core.addMethod(
  2035. $core.method({
  2036. selector: "withIndexDo:",
  2037. protocol: "enumerating",
  2038. fn: function (aBlock){
  2039. var self=this,$self=this;
  2040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2041. return $core.withContext(function($ctx1) {
  2042. //>>excludeEnd("ctx");
  2043. $self._subclassResponsibility();
  2044. return self;
  2045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2046. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  2047. //>>excludeEnd("ctx");
  2048. },
  2049. //>>excludeStart("ide", pragmas.excludeIdeData);
  2050. args: ["aBlock"],
  2051. source: "withIndexDo: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with its index as the second argument\x22\x0a\x0a\x09self subclassResponsibility",
  2052. referencedClasses: [],
  2053. //>>excludeEnd("ide");
  2054. messageSends: ["subclassResponsibility"]
  2055. }),
  2056. $globals.IndexableCollection);
  2057. $core.addClass("AssociativeCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  2058. //>>excludeStart("ide", pragmas.excludeIdeData);
  2059. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  2060. //>>excludeEnd("ide");
  2061. $core.addMethod(
  2062. $core.method({
  2063. selector: "=",
  2064. protocol: "comparing",
  2065. fn: function (anAssocitativeCollection){
  2066. var self=this,$self=this;
  2067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2068. return $core.withContext(function($ctx1) {
  2069. //>>excludeEnd("ctx");
  2070. var $2,$1,$4,$3,$5;
  2071. $2=$self._class();
  2072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2073. $ctx1.sendIdx["class"]=1;
  2074. //>>excludeEnd("ctx");
  2075. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  2076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2077. $ctx1.sendIdx["="]=1;
  2078. //>>excludeEnd("ctx");
  2079. if(!$core.assert($1)){
  2080. return false;
  2081. }
  2082. $4=$self._size();
  2083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2084. $ctx1.sendIdx["size"]=1;
  2085. //>>excludeEnd("ctx");
  2086. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  2087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2088. $ctx1.sendIdx["="]=2;
  2089. //>>excludeEnd("ctx");
  2090. if(!$core.assert($3)){
  2091. return false;
  2092. }
  2093. $5=$self._associations();
  2094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2095. $ctx1.sendIdx["associations"]=1;
  2096. //>>excludeEnd("ctx");
  2097. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  2098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2099. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  2100. //>>excludeEnd("ctx");
  2101. },
  2102. //>>excludeStart("ide", pragmas.excludeIdeData);
  2103. args: ["anAssocitativeCollection"],
  2104. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  2105. referencedClasses: [],
  2106. //>>excludeEnd("ide");
  2107. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  2108. }),
  2109. $globals.AssociativeCollection);
  2110. $core.addMethod(
  2111. $core.method({
  2112. selector: "add:",
  2113. protocol: "adding/removing",
  2114. fn: function (anAssociation){
  2115. var self=this,$self=this;
  2116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2117. return $core.withContext(function($ctx1) {
  2118. //>>excludeEnd("ctx");
  2119. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  2120. return self;
  2121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2122. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  2123. //>>excludeEnd("ctx");
  2124. },
  2125. //>>excludeStart("ide", pragmas.excludeIdeData);
  2126. args: ["anAssociation"],
  2127. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  2128. referencedClasses: [],
  2129. //>>excludeEnd("ide");
  2130. messageSends: ["at:put:", "key", "value"]
  2131. }),
  2132. $globals.AssociativeCollection);
  2133. $core.addMethod(
  2134. $core.method({
  2135. selector: "addAll:",
  2136. protocol: "adding/removing",
  2137. fn: function (anAssociativeCollection){
  2138. var self=this,$self=this;
  2139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2140. return $core.withContext(function($ctx1) {
  2141. //>>excludeEnd("ctx");
  2142. (
  2143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2144. $ctx1.supercall = true,
  2145. //>>excludeEnd("ctx");
  2146. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  2147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2148. $ctx1.supercall = false;
  2149. //>>excludeEnd("ctx");;
  2150. return anAssociativeCollection;
  2151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2152. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  2153. //>>excludeEnd("ctx");
  2154. },
  2155. //>>excludeStart("ide", pragmas.excludeIdeData);
  2156. args: ["anAssociativeCollection"],
  2157. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  2158. referencedClasses: [],
  2159. //>>excludeEnd("ide");
  2160. messageSends: ["addAll:", "associations"]
  2161. }),
  2162. $globals.AssociativeCollection);
  2163. $core.addMethod(
  2164. $core.method({
  2165. selector: "asDictionary",
  2166. protocol: "converting",
  2167. fn: function (){
  2168. var self=this,$self=this;
  2169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2170. return $core.withContext(function($ctx1) {
  2171. //>>excludeEnd("ctx");
  2172. return $recv($globals.Dictionary)._from_($self._associations());
  2173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2174. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  2175. //>>excludeEnd("ctx");
  2176. },
  2177. //>>excludeStart("ide", pragmas.excludeIdeData);
  2178. args: [],
  2179. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  2180. referencedClasses: ["Dictionary"],
  2181. //>>excludeEnd("ide");
  2182. messageSends: ["from:", "associations"]
  2183. }),
  2184. $globals.AssociativeCollection);
  2185. $core.addMethod(
  2186. $core.method({
  2187. selector: "asHashedCollection",
  2188. protocol: "converting",
  2189. fn: function (){
  2190. var self=this,$self=this;
  2191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2192. return $core.withContext(function($ctx1) {
  2193. //>>excludeEnd("ctx");
  2194. return $recv($globals.HashedCollection)._from_($self._associations());
  2195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2196. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  2197. //>>excludeEnd("ctx");
  2198. },
  2199. //>>excludeStart("ide", pragmas.excludeIdeData);
  2200. args: [],
  2201. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  2202. referencedClasses: ["HashedCollection"],
  2203. //>>excludeEnd("ide");
  2204. messageSends: ["from:", "associations"]
  2205. }),
  2206. $globals.AssociativeCollection);
  2207. $core.addMethod(
  2208. $core.method({
  2209. selector: "asJavaScriptObject",
  2210. protocol: "converting",
  2211. fn: function (){
  2212. var self=this,$self=this;
  2213. var hash;
  2214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2215. return $core.withContext(function($ctx1) {
  2216. //>>excludeEnd("ctx");
  2217. hash=$recv($globals.HashedCollection)._new();
  2218. $self._keysAndValuesDo_((function(key,value){
  2219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2220. return $core.withContext(function($ctx2) {
  2221. //>>excludeEnd("ctx");
  2222. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  2223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2224. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2225. //>>excludeEnd("ctx");
  2226. }));
  2227. return hash;
  2228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2229. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash},$globals.AssociativeCollection)});
  2230. //>>excludeEnd("ctx");
  2231. },
  2232. //>>excludeStart("ide", pragmas.excludeIdeData);
  2233. args: [],
  2234. source: "asJavaScriptObject\x0a\x09| hash |\x0a\x09hash := HashedCollection new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09hash at: key put: value asJavaScriptObject ].\x0a\x09^ hash",
  2235. referencedClasses: ["HashedCollection"],
  2236. //>>excludeEnd("ide");
  2237. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  2238. }),
  2239. $globals.AssociativeCollection);
  2240. $core.addMethod(
  2241. $core.method({
  2242. selector: "associations",
  2243. protocol: "accessing",
  2244. fn: function (){
  2245. var self=this,$self=this;
  2246. var associations;
  2247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2248. return $core.withContext(function($ctx1) {
  2249. //>>excludeEnd("ctx");
  2250. associations=[];
  2251. $self._associationsDo_((function(each){
  2252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2253. return $core.withContext(function($ctx2) {
  2254. //>>excludeEnd("ctx");
  2255. return $recv(associations)._add_(each);
  2256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2257. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2258. //>>excludeEnd("ctx");
  2259. }));
  2260. return associations;
  2261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2262. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  2263. //>>excludeEnd("ctx");
  2264. },
  2265. //>>excludeStart("ide", pragmas.excludeIdeData);
  2266. args: [],
  2267. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  2268. referencedClasses: [],
  2269. //>>excludeEnd("ide");
  2270. messageSends: ["associationsDo:", "add:"]
  2271. }),
  2272. $globals.AssociativeCollection);
  2273. $core.addMethod(
  2274. $core.method({
  2275. selector: "associationsDo:",
  2276. protocol: "enumerating",
  2277. fn: function (aBlock){
  2278. var self=this,$self=this;
  2279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2280. return $core.withContext(function($ctx1) {
  2281. //>>excludeEnd("ctx");
  2282. $self._keysAndValuesDo_((function(key,value){
  2283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2284. return $core.withContext(function($ctx2) {
  2285. //>>excludeEnd("ctx");
  2286. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  2287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2288. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2289. //>>excludeEnd("ctx");
  2290. }));
  2291. return self;
  2292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2293. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2294. //>>excludeEnd("ctx");
  2295. },
  2296. //>>excludeStart("ide", pragmas.excludeIdeData);
  2297. args: ["aBlock"],
  2298. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2299. referencedClasses: ["Association"],
  2300. //>>excludeEnd("ide");
  2301. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2302. }),
  2303. $globals.AssociativeCollection);
  2304. $core.addMethod(
  2305. $core.method({
  2306. selector: "at:ifPresent:ifAbsent:",
  2307. protocol: "accessing",
  2308. fn: function (aKey,aBlock,anotherBlock){
  2309. var self=this,$self=this;
  2310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2311. return $core.withContext(function($ctx1) {
  2312. //>>excludeEnd("ctx");
  2313. var $1;
  2314. $1=$self._includesKey_(aKey);
  2315. if($core.assert($1)){
  2316. return $recv(aBlock)._value_($self._at_(aKey));
  2317. } else {
  2318. return $recv(anotherBlock)._value();
  2319. }
  2320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2321. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  2322. //>>excludeEnd("ctx");
  2323. },
  2324. //>>excludeStart("ide", pragmas.excludeIdeData);
  2325. args: ["aKey", "aBlock", "anotherBlock"],
  2326. 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 \x0a\x09with the value associated with the key, otherwise answer the value \x0a\x09of absentBlock.\x22\x0a\x09\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: [ anotherBlock value ]",
  2327. referencedClasses: [],
  2328. //>>excludeEnd("ide");
  2329. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2330. }),
  2331. $globals.AssociativeCollection);
  2332. $core.addMethod(
  2333. $core.method({
  2334. selector: "collect:",
  2335. protocol: "enumerating",
  2336. fn: function (aBlock){
  2337. var self=this,$self=this;
  2338. var newDict;
  2339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2340. return $core.withContext(function($ctx1) {
  2341. //>>excludeEnd("ctx");
  2342. newDict=$recv($self._class())._new();
  2343. $self._keysAndValuesDo_((function(key,value){
  2344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2345. return $core.withContext(function($ctx2) {
  2346. //>>excludeEnd("ctx");
  2347. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  2348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2349. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2350. //>>excludeEnd("ctx");
  2351. }));
  2352. return newDict;
  2353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2354. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  2355. //>>excludeEnd("ctx");
  2356. },
  2357. //>>excludeStart("ide", pragmas.excludeIdeData);
  2358. args: ["aBlock"],
  2359. source: "collect: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09newDict at: key put: (aBlock value: value) ].\x0a\x09^ newDict",
  2360. referencedClasses: [],
  2361. //>>excludeEnd("ide");
  2362. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  2363. }),
  2364. $globals.AssociativeCollection);
  2365. $core.addMethod(
  2366. $core.method({
  2367. selector: "deepCopy",
  2368. protocol: "copying",
  2369. fn: function (){
  2370. var self=this,$self=this;
  2371. var copy;
  2372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2373. return $core.withContext(function($ctx1) {
  2374. //>>excludeEnd("ctx");
  2375. copy=$recv($self._class())._new();
  2376. $self._keysAndValuesDo_((function(key,value){
  2377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2378. return $core.withContext(function($ctx2) {
  2379. //>>excludeEnd("ctx");
  2380. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  2381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2382. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2383. //>>excludeEnd("ctx");
  2384. }));
  2385. return copy;
  2386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2387. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  2388. //>>excludeEnd("ctx");
  2389. },
  2390. //>>excludeStart("ide", pragmas.excludeIdeData);
  2391. args: [],
  2392. source: "deepCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09copy at: key put: value deepCopy ].\x0a\x09^ copy",
  2393. referencedClasses: [],
  2394. //>>excludeEnd("ide");
  2395. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  2396. }),
  2397. $globals.AssociativeCollection);
  2398. $core.addMethod(
  2399. $core.method({
  2400. selector: "detect:ifNone:",
  2401. protocol: "enumerating",
  2402. fn: function (aBlock,anotherBlock){
  2403. var self=this,$self=this;
  2404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2405. return $core.withContext(function($ctx1) {
  2406. //>>excludeEnd("ctx");
  2407. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  2408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2409. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  2410. //>>excludeEnd("ctx");
  2411. },
  2412. //>>excludeStart("ide", pragmas.excludeIdeData);
  2413. args: ["aBlock", "anotherBlock"],
  2414. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  2415. referencedClasses: [],
  2416. //>>excludeEnd("ide");
  2417. messageSends: ["detect:ifNone:", "values"]
  2418. }),
  2419. $globals.AssociativeCollection);
  2420. $core.addMethod(
  2421. $core.method({
  2422. selector: "do:",
  2423. protocol: "enumerating",
  2424. fn: function (aBlock){
  2425. var self=this,$self=this;
  2426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2427. return $core.withContext(function($ctx1) {
  2428. //>>excludeEnd("ctx");
  2429. $self._valuesDo_(aBlock);
  2430. return self;
  2431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2432. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2433. //>>excludeEnd("ctx");
  2434. },
  2435. //>>excludeStart("ide", pragmas.excludeIdeData);
  2436. args: ["aBlock"],
  2437. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  2438. referencedClasses: [],
  2439. //>>excludeEnd("ide");
  2440. messageSends: ["valuesDo:"]
  2441. }),
  2442. $globals.AssociativeCollection);
  2443. $core.addMethod(
  2444. $core.method({
  2445. selector: "includes:",
  2446. protocol: "enumerating",
  2447. fn: function (anObject){
  2448. var self=this,$self=this;
  2449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2450. return $core.withContext(function($ctx1) {
  2451. //>>excludeEnd("ctx");
  2452. return $recv($self._values())._includes_(anObject);
  2453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2454. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  2455. //>>excludeEnd("ctx");
  2456. },
  2457. //>>excludeStart("ide", pragmas.excludeIdeData);
  2458. args: ["anObject"],
  2459. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  2460. referencedClasses: [],
  2461. //>>excludeEnd("ide");
  2462. messageSends: ["includes:", "values"]
  2463. }),
  2464. $globals.AssociativeCollection);
  2465. $core.addMethod(
  2466. $core.method({
  2467. selector: "includesKey:",
  2468. protocol: "testing",
  2469. fn: function (aKey){
  2470. var self=this,$self=this;
  2471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2472. return $core.withContext(function($ctx1) {
  2473. //>>excludeEnd("ctx");
  2474. $self._subclassResponsibility();
  2475. return self;
  2476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2477. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  2478. //>>excludeEnd("ctx");
  2479. },
  2480. //>>excludeStart("ide", pragmas.excludeIdeData);
  2481. args: ["aKey"],
  2482. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  2483. referencedClasses: [],
  2484. //>>excludeEnd("ide");
  2485. messageSends: ["subclassResponsibility"]
  2486. }),
  2487. $globals.AssociativeCollection);
  2488. $core.addMethod(
  2489. $core.method({
  2490. selector: "indexOf:ifAbsent:",
  2491. protocol: "accessing",
  2492. fn: function (anObject,aBlock){
  2493. var self=this,$self=this;
  2494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2495. return $core.withContext(function($ctx1) {
  2496. //>>excludeEnd("ctx");
  2497. return $recv($self._keys())._detect_ifNone_((function(each){
  2498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2499. return $core.withContext(function($ctx2) {
  2500. //>>excludeEnd("ctx");
  2501. return $recv($self._at_(each)).__eq(anObject);
  2502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2503. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2504. //>>excludeEnd("ctx");
  2505. }),aBlock);
  2506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2507. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  2508. //>>excludeEnd("ctx");
  2509. },
  2510. //>>excludeStart("ide", pragmas.excludeIdeData);
  2511. args: ["anObject", "aBlock"],
  2512. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  2513. referencedClasses: [],
  2514. //>>excludeEnd("ide");
  2515. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  2516. }),
  2517. $globals.AssociativeCollection);
  2518. $core.addMethod(
  2519. $core.method({
  2520. selector: "keyAtValue:",
  2521. protocol: "accessing",
  2522. fn: function (anObject){
  2523. var self=this,$self=this;
  2524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2525. return $core.withContext(function($ctx1) {
  2526. //>>excludeEnd("ctx");
  2527. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  2528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2529. return $core.withContext(function($ctx2) {
  2530. //>>excludeEnd("ctx");
  2531. return $self._errorNotFound();
  2532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2533. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2534. //>>excludeEnd("ctx");
  2535. }));
  2536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2537. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  2538. //>>excludeEnd("ctx");
  2539. },
  2540. //>>excludeStart("ide", pragmas.excludeIdeData);
  2541. args: ["anObject"],
  2542. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  2543. referencedClasses: [],
  2544. //>>excludeEnd("ide");
  2545. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  2546. }),
  2547. $globals.AssociativeCollection);
  2548. $core.addMethod(
  2549. $core.method({
  2550. selector: "keyAtValue:ifAbsent:",
  2551. protocol: "accessing",
  2552. fn: function (anObject,aBlock){
  2553. var self=this,$self=this;
  2554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2555. return $core.withContext(function($ctx1) {
  2556. //>>excludeEnd("ctx");
  2557. return $self._indexOf_ifAbsent_(anObject,aBlock);
  2558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2559. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  2560. //>>excludeEnd("ctx");
  2561. },
  2562. //>>excludeStart("ide", pragmas.excludeIdeData);
  2563. args: ["anObject", "aBlock"],
  2564. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  2565. referencedClasses: [],
  2566. //>>excludeEnd("ide");
  2567. messageSends: ["indexOf:ifAbsent:"]
  2568. }),
  2569. $globals.AssociativeCollection);
  2570. $core.addMethod(
  2571. $core.method({
  2572. selector: "keys",
  2573. protocol: "accessing",
  2574. fn: function (){
  2575. var self=this,$self=this;
  2576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2577. return $core.withContext(function($ctx1) {
  2578. //>>excludeEnd("ctx");
  2579. $self._subclassResponsibility();
  2580. return self;
  2581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2582. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  2583. //>>excludeEnd("ctx");
  2584. },
  2585. //>>excludeStart("ide", pragmas.excludeIdeData);
  2586. args: [],
  2587. source: "keys\x0a\x09self subclassResponsibility",
  2588. referencedClasses: [],
  2589. //>>excludeEnd("ide");
  2590. messageSends: ["subclassResponsibility"]
  2591. }),
  2592. $globals.AssociativeCollection);
  2593. $core.addMethod(
  2594. $core.method({
  2595. selector: "keysAndValuesDo:",
  2596. protocol: "enumerating",
  2597. fn: function (aBlock){
  2598. var self=this,$self=this;
  2599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2600. return $core.withContext(function($ctx1) {
  2601. //>>excludeEnd("ctx");
  2602. $self._keysDo_((function(each){
  2603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2604. return $core.withContext(function($ctx2) {
  2605. //>>excludeEnd("ctx");
  2606. return $recv(aBlock)._value_value_(each,$self._at_(each));
  2607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2608. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2609. //>>excludeEnd("ctx");
  2610. }));
  2611. return self;
  2612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2613. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2614. //>>excludeEnd("ctx");
  2615. },
  2616. //>>excludeStart("ide", pragmas.excludeIdeData);
  2617. args: ["aBlock"],
  2618. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  2619. referencedClasses: [],
  2620. //>>excludeEnd("ide");
  2621. messageSends: ["keysDo:", "value:value:", "at:"]
  2622. }),
  2623. $globals.AssociativeCollection);
  2624. $core.addMethod(
  2625. $core.method({
  2626. selector: "keysDo:",
  2627. protocol: "enumerating",
  2628. fn: function (aBlock){
  2629. var self=this,$self=this;
  2630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2631. return $core.withContext(function($ctx1) {
  2632. //>>excludeEnd("ctx");
  2633. $self._subclassResponsibility();
  2634. return self;
  2635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2636. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2637. //>>excludeEnd("ctx");
  2638. },
  2639. //>>excludeStart("ide", pragmas.excludeIdeData);
  2640. args: ["aBlock"],
  2641. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  2642. referencedClasses: [],
  2643. //>>excludeEnd("ide");
  2644. messageSends: ["subclassResponsibility"]
  2645. }),
  2646. $globals.AssociativeCollection);
  2647. $core.addMethod(
  2648. $core.method({
  2649. selector: "printOn:",
  2650. protocol: "printing",
  2651. fn: function (aStream){
  2652. var self=this,$self=this;
  2653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2654. return $core.withContext(function($ctx1) {
  2655. //>>excludeEnd("ctx");
  2656. (
  2657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2658. $ctx1.supercall = true,
  2659. //>>excludeEnd("ctx");
  2660. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  2661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2662. $ctx1.supercall = false;
  2663. //>>excludeEnd("ctx");;
  2664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2665. $ctx1.sendIdx["printOn:"]=1;
  2666. //>>excludeEnd("ctx");
  2667. $recv(aStream)._nextPutAll_(" (");
  2668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2669. $ctx1.sendIdx["nextPutAll:"]=1;
  2670. //>>excludeEnd("ctx");
  2671. $recv($self._associations())._do_separatedBy_((function(each){
  2672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2673. return $core.withContext(function($ctx2) {
  2674. //>>excludeEnd("ctx");
  2675. return $recv(each)._printOn_(aStream);
  2676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2677. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2678. //>>excludeEnd("ctx");
  2679. }),(function(){
  2680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2681. return $core.withContext(function($ctx2) {
  2682. //>>excludeEnd("ctx");
  2683. return $recv(aStream)._nextPutAll_(" , ");
  2684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2685. $ctx2.sendIdx["nextPutAll:"]=2;
  2686. //>>excludeEnd("ctx");
  2687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2689. //>>excludeEnd("ctx");
  2690. }));
  2691. $recv(aStream)._nextPutAll_(")");
  2692. return self;
  2693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2694. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  2695. //>>excludeEnd("ctx");
  2696. },
  2697. //>>excludeStart("ide", pragmas.excludeIdeData);
  2698. args: ["aStream"],
  2699. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self associations\x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' , ' ].\x0a\x09aStream nextPutAll: ')'",
  2700. referencedClasses: [],
  2701. //>>excludeEnd("ide");
  2702. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  2703. }),
  2704. $globals.AssociativeCollection);
  2705. $core.addMethod(
  2706. $core.method({
  2707. selector: "remove:ifAbsent:",
  2708. protocol: "adding/removing",
  2709. fn: function (aKey,aBlock){
  2710. var self=this,$self=this;
  2711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2712. return $core.withContext(function($ctx1) {
  2713. //>>excludeEnd("ctx");
  2714. return $self._removeKey_ifAbsent_(aKey,aBlock);
  2715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2716. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  2717. //>>excludeEnd("ctx");
  2718. },
  2719. //>>excludeStart("ide", pragmas.excludeIdeData);
  2720. args: ["aKey", "aBlock"],
  2721. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  2722. referencedClasses: [],
  2723. //>>excludeEnd("ide");
  2724. messageSends: ["removeKey:ifAbsent:"]
  2725. }),
  2726. $globals.AssociativeCollection);
  2727. $core.addMethod(
  2728. $core.method({
  2729. selector: "removeAll",
  2730. protocol: "adding/removing",
  2731. fn: function (){
  2732. var self=this,$self=this;
  2733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2734. return $core.withContext(function($ctx1) {
  2735. //>>excludeEnd("ctx");
  2736. return $recv($self._keys())._do_((function(each){
  2737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2738. return $core.withContext(function($ctx2) {
  2739. //>>excludeEnd("ctx");
  2740. return $self._removeKey_(each);
  2741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2742. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2743. //>>excludeEnd("ctx");
  2744. }));
  2745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2746. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  2747. //>>excludeEnd("ctx");
  2748. },
  2749. //>>excludeStart("ide", pragmas.excludeIdeData);
  2750. args: [],
  2751. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  2752. referencedClasses: [],
  2753. //>>excludeEnd("ide");
  2754. messageSends: ["do:", "keys", "removeKey:"]
  2755. }),
  2756. $globals.AssociativeCollection);
  2757. $core.addMethod(
  2758. $core.method({
  2759. selector: "removeKey:",
  2760. protocol: "adding/removing",
  2761. fn: function (aKey){
  2762. var self=this,$self=this;
  2763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2764. return $core.withContext(function($ctx1) {
  2765. //>>excludeEnd("ctx");
  2766. return $self._remove_(aKey);
  2767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2768. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  2769. //>>excludeEnd("ctx");
  2770. },
  2771. //>>excludeStart("ide", pragmas.excludeIdeData);
  2772. args: ["aKey"],
  2773. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  2774. referencedClasses: [],
  2775. //>>excludeEnd("ide");
  2776. messageSends: ["remove:"]
  2777. }),
  2778. $globals.AssociativeCollection);
  2779. $core.addMethod(
  2780. $core.method({
  2781. selector: "removeKey:ifAbsent:",
  2782. protocol: "adding/removing",
  2783. fn: function (aKey,aBlock){
  2784. var self=this,$self=this;
  2785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2786. return $core.withContext(function($ctx1) {
  2787. //>>excludeEnd("ctx");
  2788. $self._subclassResponsibility();
  2789. return self;
  2790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2791. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  2792. //>>excludeEnd("ctx");
  2793. },
  2794. //>>excludeStart("ide", pragmas.excludeIdeData);
  2795. args: ["aKey", "aBlock"],
  2796. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2797. referencedClasses: [],
  2798. //>>excludeEnd("ide");
  2799. messageSends: ["subclassResponsibility"]
  2800. }),
  2801. $globals.AssociativeCollection);
  2802. $core.addMethod(
  2803. $core.method({
  2804. selector: "select:",
  2805. protocol: "enumerating",
  2806. fn: function (aBlock){
  2807. var self=this,$self=this;
  2808. var newDict;
  2809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2810. return $core.withContext(function($ctx1) {
  2811. //>>excludeEnd("ctx");
  2812. var $1;
  2813. newDict=$recv($self._class())._new();
  2814. $self._keysAndValuesDo_((function(key,value){
  2815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2816. return $core.withContext(function($ctx2) {
  2817. //>>excludeEnd("ctx");
  2818. $1=$recv(aBlock)._value_(value);
  2819. if($core.assert($1)){
  2820. return $recv(newDict)._at_put_(key,value);
  2821. }
  2822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2823. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2824. //>>excludeEnd("ctx");
  2825. }));
  2826. return newDict;
  2827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2828. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  2829. //>>excludeEnd("ctx");
  2830. },
  2831. //>>excludeStart("ide", pragmas.excludeIdeData);
  2832. args: ["aBlock"],
  2833. source: "select: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09(aBlock value: value) ifTrue: [ newDict at: key put: value ]].\x0a\x09^ newDict",
  2834. referencedClasses: [],
  2835. //>>excludeEnd("ide");
  2836. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2837. }),
  2838. $globals.AssociativeCollection);
  2839. $core.addMethod(
  2840. $core.method({
  2841. selector: "select:thenCollect:",
  2842. protocol: "enumerating",
  2843. fn: function (selectBlock,collectBlock){
  2844. var self=this,$self=this;
  2845. var newDict;
  2846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2847. return $core.withContext(function($ctx1) {
  2848. //>>excludeEnd("ctx");
  2849. var $1;
  2850. newDict=$recv($self._class())._new();
  2851. $self._keysAndValuesDo_((function(key,value){
  2852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2853. return $core.withContext(function($ctx2) {
  2854. //>>excludeEnd("ctx");
  2855. $1=$recv(selectBlock)._value_(value);
  2856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2857. $ctx2.sendIdx["value:"]=1;
  2858. //>>excludeEnd("ctx");
  2859. if($core.assert($1)){
  2860. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  2861. }
  2862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2863. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2864. //>>excludeEnd("ctx");
  2865. }));
  2866. return newDict;
  2867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2868. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict},$globals.AssociativeCollection)});
  2869. //>>excludeEnd("ctx");
  2870. },
  2871. //>>excludeStart("ide", pragmas.excludeIdeData);
  2872. args: ["selectBlock", "collectBlock"],
  2873. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09(selectBlock value: value) ifTrue: [ newDict at: key put: (collectBlock value: value) ]].\x0a\x09^ newDict",
  2874. referencedClasses: [],
  2875. //>>excludeEnd("ide");
  2876. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2877. }),
  2878. $globals.AssociativeCollection);
  2879. $core.addMethod(
  2880. $core.method({
  2881. selector: "shallowCopy",
  2882. protocol: "copying",
  2883. fn: function (){
  2884. var self=this,$self=this;
  2885. var copy;
  2886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2887. return $core.withContext(function($ctx1) {
  2888. //>>excludeEnd("ctx");
  2889. copy=$recv($self._class())._new();
  2890. $self._keysAndValuesDo_((function(key,value){
  2891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2892. return $core.withContext(function($ctx2) {
  2893. //>>excludeEnd("ctx");
  2894. return $recv(copy)._at_put_(key,value);
  2895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2896. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2897. //>>excludeEnd("ctx");
  2898. }));
  2899. return copy;
  2900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2901. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  2902. //>>excludeEnd("ctx");
  2903. },
  2904. //>>excludeStart("ide", pragmas.excludeIdeData);
  2905. args: [],
  2906. source: "shallowCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09copy at: key put: value ].\x0a\x09^ copy",
  2907. referencedClasses: [],
  2908. //>>excludeEnd("ide");
  2909. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2910. }),
  2911. $globals.AssociativeCollection);
  2912. $core.addMethod(
  2913. $core.method({
  2914. selector: "size",
  2915. protocol: "accessing",
  2916. fn: function (){
  2917. var self=this,$self=this;
  2918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2919. return $core.withContext(function($ctx1) {
  2920. //>>excludeEnd("ctx");
  2921. return $recv($self._keys())._size();
  2922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2923. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  2924. //>>excludeEnd("ctx");
  2925. },
  2926. //>>excludeStart("ide", pragmas.excludeIdeData);
  2927. args: [],
  2928. source: "size\x0a\x09^ self keys size",
  2929. referencedClasses: [],
  2930. //>>excludeEnd("ide");
  2931. messageSends: ["size", "keys"]
  2932. }),
  2933. $globals.AssociativeCollection);
  2934. $core.addMethod(
  2935. $core.method({
  2936. selector: "values",
  2937. protocol: "accessing",
  2938. fn: function (){
  2939. var self=this,$self=this;
  2940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2941. return $core.withContext(function($ctx1) {
  2942. //>>excludeEnd("ctx");
  2943. $self._subclassResponsibility();
  2944. return self;
  2945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2946. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  2947. //>>excludeEnd("ctx");
  2948. },
  2949. //>>excludeStart("ide", pragmas.excludeIdeData);
  2950. args: [],
  2951. source: "values\x0a\x09self subclassResponsibility",
  2952. referencedClasses: [],
  2953. //>>excludeEnd("ide");
  2954. messageSends: ["subclassResponsibility"]
  2955. }),
  2956. $globals.AssociativeCollection);
  2957. $core.addMethod(
  2958. $core.method({
  2959. selector: "valuesDo:",
  2960. protocol: "enumerating",
  2961. fn: function (aBlock){
  2962. var self=this,$self=this;
  2963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2964. return $core.withContext(function($ctx1) {
  2965. //>>excludeEnd("ctx");
  2966. $self._subclassResponsibility();
  2967. return self;
  2968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2969. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2970. //>>excludeEnd("ctx");
  2971. },
  2972. //>>excludeStart("ide", pragmas.excludeIdeData);
  2973. args: ["aBlock"],
  2974. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2975. referencedClasses: [],
  2976. //>>excludeEnd("ide");
  2977. messageSends: ["subclassResponsibility"]
  2978. }),
  2979. $globals.AssociativeCollection);
  2980. $core.addMethod(
  2981. $core.method({
  2982. selector: "withIndexDo:",
  2983. protocol: "enumerating",
  2984. fn: function (aBlock){
  2985. var self=this,$self=this;
  2986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2987. return $core.withContext(function($ctx1) {
  2988. //>>excludeEnd("ctx");
  2989. $self._keysAndValuesDo_((function(key,value){
  2990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2991. return $core.withContext(function($ctx2) {
  2992. //>>excludeEnd("ctx");
  2993. return $recv(aBlock)._value_value_(value,key);
  2994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2995. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2996. //>>excludeEnd("ctx");
  2997. }));
  2998. return self;
  2999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3000. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  3001. //>>excludeEnd("ctx");
  3002. },
  3003. //>>excludeStart("ide", pragmas.excludeIdeData);
  3004. args: ["aBlock"],
  3005. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  3006. referencedClasses: [],
  3007. //>>excludeEnd("ide");
  3008. messageSends: ["keysAndValuesDo:", "value:value:"]
  3009. }),
  3010. $globals.AssociativeCollection);
  3011. $core.addMethod(
  3012. $core.method({
  3013. selector: "from:",
  3014. protocol: "instance creation",
  3015. fn: function (aCollection){
  3016. var self=this,$self=this;
  3017. var newCollection;
  3018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3019. return $core.withContext(function($ctx1) {
  3020. //>>excludeEnd("ctx");
  3021. newCollection=$self._new();
  3022. $recv(aCollection)._do_((function(each){
  3023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3024. return $core.withContext(function($ctx2) {
  3025. //>>excludeEnd("ctx");
  3026. return $recv(newCollection)._add_(each);
  3027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3028. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3029. //>>excludeEnd("ctx");
  3030. }));
  3031. return newCollection;
  3032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3033. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  3034. //>>excludeEnd("ctx");
  3035. },
  3036. //>>excludeStart("ide", pragmas.excludeIdeData);
  3037. args: ["aCollection"],
  3038. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  3039. referencedClasses: [],
  3040. //>>excludeEnd("ide");
  3041. messageSends: ["new", "do:", "add:"]
  3042. }),
  3043. $globals.AssociativeCollection.a$cls);
  3044. $core.addMethod(
  3045. $core.method({
  3046. selector: "fromPairs:",
  3047. protocol: "instance creation",
  3048. fn: function (aCollection){
  3049. var self=this,$self=this;
  3050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3051. return $core.withContext(function($ctx1) {
  3052. //>>excludeEnd("ctx");
  3053. return $self._from_(aCollection);
  3054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3055. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.a$cls)});
  3056. //>>excludeEnd("ctx");
  3057. },
  3058. //>>excludeStart("ide", pragmas.excludeIdeData);
  3059. args: ["aCollection"],
  3060. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  3061. referencedClasses: [],
  3062. //>>excludeEnd("ide");
  3063. messageSends: ["from:"]
  3064. }),
  3065. $globals.AssociativeCollection.a$cls);
  3066. $core.addMethod(
  3067. $core.method({
  3068. selector: "newFromPairs:",
  3069. protocol: "instance creation",
  3070. fn: function (aCollection){
  3071. var self=this,$self=this;
  3072. var newCollection;
  3073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3074. return $core.withContext(function($ctx1) {
  3075. //>>excludeEnd("ctx");
  3076. var $2,$1,$3,$4;
  3077. $2=$recv(aCollection)._size();
  3078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3079. $ctx1.sendIdx["size"]=1;
  3080. //>>excludeEnd("ctx");
  3081. $1=$recv($2)._even();
  3082. if(!$core.assert($1)){
  3083. $self._error_("#newFromPairs only accepts arrays of an even length");
  3084. }
  3085. newCollection=$self._new();
  3086. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  3087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3088. return $core.withContext(function($ctx2) {
  3089. //>>excludeEnd("ctx");
  3090. $3=newCollection;
  3091. $4=$recv(aCollection)._at_(each);
  3092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3093. $ctx2.sendIdx["at:"]=1;
  3094. //>>excludeEnd("ctx");
  3095. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  3096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3097. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  3098. //>>excludeEnd("ctx");
  3099. }));
  3100. return newCollection;
  3101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3102. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  3103. //>>excludeEnd("ctx");
  3104. },
  3105. //>>excludeStart("ide", pragmas.excludeIdeData);
  3106. args: ["aCollection"],
  3107. source: "newFromPairs: aCollection\x0a\x09\x22Accept an array of elements where every two elements form an \x0a\x09association - the odd element being the key, and the even element the value.\x22\x0a\x09\x0a\x09| newCollection |\x0a\x09\x0a\x09aCollection size even ifFalse: [ \x0a\x09\x09self error: '#newFromPairs only accepts arrays of an even length' ].\x0a\x09\x09\x0a\x09newCollection := self new.\x0a\x09( 1 to: aCollection size by: 2 ) do: [ :each | \x0a\x09\x09newCollection at: (aCollection at: each) put: (aCollection at: each + 1) ].\x0a\x09\x09\x0a\x09^ newCollection",
  3108. referencedClasses: [],
  3109. //>>excludeEnd("ide");
  3110. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  3111. }),
  3112. $globals.AssociativeCollection.a$cls);
  3113. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  3114. //>>excludeStart("ide", pragmas.excludeIdeData);
  3115. $globals.Dictionary.comment="I represent a set of elements that can be viewed from one of two perspectives: a set of associations,\x0aor a container of values that are externally named where the name can be any object that responds to `=`.\x0a\x0aThe external name is referred to as the key.";
  3116. //>>excludeEnd("ide");
  3117. $core.addMethod(
  3118. $core.method({
  3119. selector: "at:ifAbsent:",
  3120. protocol: "accessing",
  3121. fn: function (aKey,aBlock){
  3122. var self=this,$self=this;
  3123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3124. return $core.withContext(function($ctx1) {
  3125. //>>excludeEnd("ctx");
  3126. var index = $self._positionOfKey_(aKey);
  3127. return index >=0 ? $self['@values'][index] : aBlock._value();
  3128. ;
  3129. return self;
  3130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3131. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  3132. //>>excludeEnd("ctx");
  3133. },
  3134. //>>excludeStart("ide", pragmas.excludeIdeData);
  3135. args: ["aKey", "aBlock"],
  3136. source: "at: aKey ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? $self[''@values''][index] : aBlock._value();\x0a\x09'>",
  3137. referencedClasses: [],
  3138. //>>excludeEnd("ide");
  3139. messageSends: []
  3140. }),
  3141. $globals.Dictionary);
  3142. $core.addMethod(
  3143. $core.method({
  3144. selector: "at:put:",
  3145. protocol: "accessing",
  3146. fn: function (aKey,aValue){
  3147. var self=this,$self=this;
  3148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3149. return $core.withContext(function($ctx1) {
  3150. //>>excludeEnd("ctx");
  3151. var index = $self._positionOfKey_(aKey);
  3152. if(index === -1) {
  3153. var keys = $self['@keys'];
  3154. index = keys.length;
  3155. keys.push(aKey);
  3156. }
  3157. return $self['@values'][index] = aValue;
  3158. ;
  3159. return self;
  3160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3161. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  3162. //>>excludeEnd("ctx");
  3163. },
  3164. //>>excludeStart("ide", pragmas.excludeIdeData);
  3165. args: ["aKey", "aValue"],
  3166. source: "at: aKey put: aValue\x0a\x09<inlineJS: '\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09var keys = $self[''@keys''];\x0a\x09\x09\x09index = keys.length;\x0a\x09\x09\x09keys.push(aKey);\x0a\x09\x09}\x0a\x0a\x09\x09return $self[''@values''][index] = aValue;\x0a\x09'>",
  3167. referencedClasses: [],
  3168. //>>excludeEnd("ide");
  3169. messageSends: []
  3170. }),
  3171. $globals.Dictionary);
  3172. $core.addMethod(
  3173. $core.method({
  3174. selector: "includesKey:",
  3175. protocol: "testing",
  3176. fn: function (aKey){
  3177. var self=this,$self=this;
  3178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3179. return $core.withContext(function($ctx1) {
  3180. //>>excludeEnd("ctx");
  3181. return $self._positionOfKey_(aKey) >= 0;;
  3182. return self;
  3183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3184. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  3185. //>>excludeEnd("ctx");
  3186. },
  3187. //>>excludeStart("ide", pragmas.excludeIdeData);
  3188. args: ["aKey"],
  3189. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  3190. referencedClasses: [],
  3191. //>>excludeEnd("ide");
  3192. messageSends: []
  3193. }),
  3194. $globals.Dictionary);
  3195. $core.addMethod(
  3196. $core.method({
  3197. selector: "indexOf:ifAbsent:",
  3198. protocol: "accessing",
  3199. fn: function (anObject,aBlock){
  3200. var self=this,$self=this;
  3201. var index;
  3202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3203. return $core.withContext(function($ctx1) {
  3204. //>>excludeEnd("ctx");
  3205. var $1;
  3206. index=$recv($self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  3207. return (0);
  3208. }));
  3209. $1=$recv(index).__eq((0));
  3210. if($core.assert($1)){
  3211. return $recv(aBlock)._value();
  3212. } else {
  3213. return $recv($self["@keys"])._at_(index);
  3214. }
  3215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3216. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  3217. //>>excludeEnd("ctx");
  3218. },
  3219. //>>excludeStart("ide", pragmas.excludeIdeData);
  3220. args: ["anObject", "aBlock"],
  3221. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := values \x0a\x09\x09indexOf: anObject \x0a\x09\x09ifAbsent: [ 0 ].\x0a\x09^ index = 0 \x0a\x09\x09ifTrue: [ aBlock value ] \x0a\x09\x09ifFalse: [ keys at: index ]",
  3222. referencedClasses: [],
  3223. //>>excludeEnd("ide");
  3224. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  3225. }),
  3226. $globals.Dictionary);
  3227. $core.addMethod(
  3228. $core.method({
  3229. selector: "initialize",
  3230. protocol: "initialization",
  3231. fn: function (){
  3232. var self=this,$self=this;
  3233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3234. return $core.withContext(function($ctx1) {
  3235. //>>excludeEnd("ctx");
  3236. (
  3237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3238. $ctx1.supercall = true,
  3239. //>>excludeEnd("ctx");
  3240. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  3241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3242. $ctx1.supercall = false;
  3243. //>>excludeEnd("ctx");;
  3244. $self["@keys"]=[];
  3245. $self["@values"]=[];
  3246. return self;
  3247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3248. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  3249. //>>excludeEnd("ctx");
  3250. },
  3251. //>>excludeStart("ide", pragmas.excludeIdeData);
  3252. args: [],
  3253. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  3254. referencedClasses: [],
  3255. //>>excludeEnd("ide");
  3256. messageSends: ["initialize"]
  3257. }),
  3258. $globals.Dictionary);
  3259. $core.addMethod(
  3260. $core.method({
  3261. selector: "keys",
  3262. protocol: "accessing",
  3263. fn: function (){
  3264. var self=this,$self=this;
  3265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3266. return $core.withContext(function($ctx1) {
  3267. //>>excludeEnd("ctx");
  3268. return $recv($self["@keys"])._copy();
  3269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3270. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  3271. //>>excludeEnd("ctx");
  3272. },
  3273. //>>excludeStart("ide", pragmas.excludeIdeData);
  3274. args: [],
  3275. source: "keys\x0a\x09^ keys copy",
  3276. referencedClasses: [],
  3277. //>>excludeEnd("ide");
  3278. messageSends: ["copy"]
  3279. }),
  3280. $globals.Dictionary);
  3281. $core.addMethod(
  3282. $core.method({
  3283. selector: "keysAndValuesDo:",
  3284. protocol: "enumerating",
  3285. fn: function (aBlock){
  3286. var self=this,$self=this;
  3287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3288. return $core.withContext(function($ctx1) {
  3289. //>>excludeEnd("ctx");
  3290. return $recv($self["@keys"])._with_do_($self["@values"],aBlock);
  3291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3292. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  3293. //>>excludeEnd("ctx");
  3294. },
  3295. //>>excludeStart("ide", pragmas.excludeIdeData);
  3296. args: ["aBlock"],
  3297. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3298. referencedClasses: [],
  3299. //>>excludeEnd("ide");
  3300. messageSends: ["with:do:"]
  3301. }),
  3302. $globals.Dictionary);
  3303. $core.addMethod(
  3304. $core.method({
  3305. selector: "keysDo:",
  3306. protocol: "enumerating",
  3307. fn: function (aBlock){
  3308. var self=this,$self=this;
  3309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3310. return $core.withContext(function($ctx1) {
  3311. //>>excludeEnd("ctx");
  3312. return $recv($self["@keys"])._do_(aBlock);
  3313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3314. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  3315. //>>excludeEnd("ctx");
  3316. },
  3317. //>>excludeStart("ide", pragmas.excludeIdeData);
  3318. args: ["aBlock"],
  3319. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3320. referencedClasses: [],
  3321. //>>excludeEnd("ide");
  3322. messageSends: ["do:"]
  3323. }),
  3324. $globals.Dictionary);
  3325. $core.addMethod(
  3326. $core.method({
  3327. selector: "positionOfKey:",
  3328. protocol: "private",
  3329. fn: function (anObject){
  3330. var self=this,$self=this;
  3331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3332. return $core.withContext(function($ctx1) {
  3333. //>>excludeEnd("ctx");
  3334. var keys = $self['@keys'];
  3335. for(var i=0;i<keys.length;i++){
  3336. if(keys[i].__eq(anObject)) { return i;}
  3337. }
  3338. return -1;
  3339. ;
  3340. return self;
  3341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3342. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  3343. //>>excludeEnd("ctx");
  3344. },
  3345. //>>excludeStart("ide", pragmas.excludeIdeData);
  3346. args: ["anObject"],
  3347. source: "positionOfKey: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var keys = $self[''@keys''];\x0a\x09\x09for(var i=0;i<keys.length;i++){\x0a\x09\x09\x09if(keys[i].__eq(anObject)) { return i;}\x0a\x09\x09}\x0a\x09\x09return -1;\x0a\x09'>",
  3348. referencedClasses: [],
  3349. //>>excludeEnd("ide");
  3350. messageSends: []
  3351. }),
  3352. $globals.Dictionary);
  3353. $core.addMethod(
  3354. $core.method({
  3355. selector: "removeAll",
  3356. protocol: "adding/removing",
  3357. fn: function (){
  3358. var self=this,$self=this;
  3359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3360. return $core.withContext(function($ctx1) {
  3361. //>>excludeEnd("ctx");
  3362. $recv($self["@keys"])._removeAll();
  3363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3364. $ctx1.sendIdx["removeAll"]=1;
  3365. //>>excludeEnd("ctx");
  3366. $recv($self["@values"])._removeAll();
  3367. return self;
  3368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3369. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  3370. //>>excludeEnd("ctx");
  3371. },
  3372. //>>excludeStart("ide", pragmas.excludeIdeData);
  3373. args: [],
  3374. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3375. referencedClasses: [],
  3376. //>>excludeEnd("ide");
  3377. messageSends: ["removeAll"]
  3378. }),
  3379. $globals.Dictionary);
  3380. $core.addMethod(
  3381. $core.method({
  3382. selector: "removeKey:ifAbsent:",
  3383. protocol: "adding/removing",
  3384. fn: function (aKey,aBlock){
  3385. var self=this,$self=this;
  3386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3387. return $core.withContext(function($ctx1) {
  3388. //>>excludeEnd("ctx");
  3389. var index = $self._positionOfKey_(aKey);
  3390. if(index === -1) {
  3391. return aBlock._value()
  3392. } else {
  3393. var keys = $self['@keys'], values = $self['@values'];
  3394. var value = values[index], l = keys.length;
  3395. keys[index] = keys[l-1];
  3396. keys.pop();
  3397. values[index] = values[l-1];
  3398. values.pop();
  3399. return value;
  3400. }
  3401. ;
  3402. return self;
  3403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3404. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  3405. //>>excludeEnd("ctx");
  3406. },
  3407. //>>excludeStart("ide", pragmas.excludeIdeData);
  3408. args: ["aKey", "aBlock"],
  3409. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09return aBlock._value()\x0a\x09\x09} else {\x0a\x09\x09\x09var keys = $self[''@keys''], values = $self[''@values''];\x0a\x09\x09\x09var value = values[index], l = keys.length;\x0a\x09\x09\x09keys[index] = keys[l-1];\x0a\x09\x09\x09keys.pop();\x0a\x09\x09\x09values[index] = values[l-1];\x0a\x09\x09\x09values.pop();\x0a\x09\x09\x09return value;\x0a\x09\x09}\x0a\x09'>",
  3410. referencedClasses: [],
  3411. //>>excludeEnd("ide");
  3412. messageSends: []
  3413. }),
  3414. $globals.Dictionary);
  3415. $core.addMethod(
  3416. $core.method({
  3417. selector: "values",
  3418. protocol: "accessing",
  3419. fn: function (){
  3420. var self=this,$self=this;
  3421. return $self["@values"];
  3422. },
  3423. //>>excludeStart("ide", pragmas.excludeIdeData);
  3424. args: [],
  3425. source: "values\x0a\x09^ values",
  3426. referencedClasses: [],
  3427. //>>excludeEnd("ide");
  3428. messageSends: []
  3429. }),
  3430. $globals.Dictionary);
  3431. $core.addMethod(
  3432. $core.method({
  3433. selector: "valuesDo:",
  3434. protocol: "enumerating",
  3435. fn: function (aBlock){
  3436. var self=this,$self=this;
  3437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3438. return $core.withContext(function($ctx1) {
  3439. //>>excludeEnd("ctx");
  3440. return $recv($self["@values"])._do_(aBlock);
  3441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3442. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  3443. //>>excludeEnd("ctx");
  3444. },
  3445. //>>excludeStart("ide", pragmas.excludeIdeData);
  3446. args: ["aBlock"],
  3447. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3448. referencedClasses: [],
  3449. //>>excludeEnd("ide");
  3450. messageSends: ["do:"]
  3451. }),
  3452. $globals.Dictionary);
  3453. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  3454. //>>excludeStart("ide", pragmas.excludeIdeData);
  3455. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3456. //>>excludeEnd("ide");
  3457. $core.addMethod(
  3458. $core.method({
  3459. selector: "at:ifAbsent:",
  3460. protocol: "accessing",
  3461. fn: function (aKey,aBlock){
  3462. var self=this,$self=this;
  3463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3464. return $core.withContext(function($ctx1) {
  3465. //>>excludeEnd("ctx");
  3466. var $1;
  3467. $1=$self._includesKey_(aKey);
  3468. if($core.assert($1)){
  3469. return $self._basicAt_(aKey);
  3470. } else {
  3471. return $recv(aBlock)._value();
  3472. }
  3473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3474. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  3475. //>>excludeEnd("ctx");
  3476. },
  3477. //>>excludeStart("ide", pragmas.excludeIdeData);
  3478. args: ["aKey", "aBlock"],
  3479. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3480. referencedClasses: [],
  3481. //>>excludeEnd("ide");
  3482. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3483. }),
  3484. $globals.HashedCollection);
  3485. $core.addMethod(
  3486. $core.method({
  3487. selector: "at:put:",
  3488. protocol: "accessing",
  3489. fn: function (aKey,aValue){
  3490. var self=this,$self=this;
  3491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3492. return $core.withContext(function($ctx1) {
  3493. //>>excludeEnd("ctx");
  3494. return $self._basicAt_put_(aKey,aValue);
  3495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3496. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  3497. //>>excludeEnd("ctx");
  3498. },
  3499. //>>excludeStart("ide", pragmas.excludeIdeData);
  3500. args: ["aKey", "aValue"],
  3501. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3502. referencedClasses: [],
  3503. //>>excludeEnd("ide");
  3504. messageSends: ["basicAt:put:"]
  3505. }),
  3506. $globals.HashedCollection);
  3507. $core.addMethod(
  3508. $core.method({
  3509. selector: "includesKey:",
  3510. protocol: "testing",
  3511. fn: function (aKey){
  3512. var self=this,$self=this;
  3513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3514. return $core.withContext(function($ctx1) {
  3515. //>>excludeEnd("ctx");
  3516. return self.hasOwnProperty(aKey);
  3517. return self;
  3518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3519. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  3520. //>>excludeEnd("ctx");
  3521. },
  3522. //>>excludeStart("ide", pragmas.excludeIdeData);
  3523. args: ["aKey"],
  3524. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  3525. referencedClasses: [],
  3526. //>>excludeEnd("ide");
  3527. messageSends: []
  3528. }),
  3529. $globals.HashedCollection);
  3530. $core.addMethod(
  3531. $core.method({
  3532. selector: "keys",
  3533. protocol: "accessing",
  3534. fn: function (){
  3535. var self=this,$self=this;
  3536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3537. return $core.withContext(function($ctx1) {
  3538. //>>excludeEnd("ctx");
  3539. return Object.keys(self);
  3540. return self;
  3541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3542. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  3543. //>>excludeEnd("ctx");
  3544. },
  3545. //>>excludeStart("ide", pragmas.excludeIdeData);
  3546. args: [],
  3547. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  3548. referencedClasses: [],
  3549. //>>excludeEnd("ide");
  3550. messageSends: []
  3551. }),
  3552. $globals.HashedCollection);
  3553. $core.addMethod(
  3554. $core.method({
  3555. selector: "keysDo:",
  3556. protocol: "enumerating",
  3557. fn: function (aBlock){
  3558. var self=this,$self=this;
  3559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3560. return $core.withContext(function($ctx1) {
  3561. //>>excludeEnd("ctx");
  3562. $recv($self._keys())._do_(aBlock);
  3563. return self;
  3564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3565. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  3566. //>>excludeEnd("ctx");
  3567. },
  3568. //>>excludeStart("ide", pragmas.excludeIdeData);
  3569. args: ["aBlock"],
  3570. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3571. referencedClasses: [],
  3572. //>>excludeEnd("ide");
  3573. messageSends: ["do:", "keys"]
  3574. }),
  3575. $globals.HashedCollection);
  3576. $core.addMethod(
  3577. $core.method({
  3578. selector: "removeKey:ifAbsent:",
  3579. protocol: "adding/removing",
  3580. fn: function (aKey,aBlock){
  3581. var self=this,$self=this;
  3582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3583. return $core.withContext(function($ctx1) {
  3584. //>>excludeEnd("ctx");
  3585. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3587. return $core.withContext(function($ctx2) {
  3588. //>>excludeEnd("ctx");
  3589. $self._basicDelete_(aKey);
  3590. return removed;
  3591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3592. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3593. //>>excludeEnd("ctx");
  3594. }),(function(){
  3595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3596. return $core.withContext(function($ctx2) {
  3597. //>>excludeEnd("ctx");
  3598. return $recv(aBlock)._value();
  3599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3600. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3601. //>>excludeEnd("ctx");
  3602. }));
  3603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3604. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  3605. //>>excludeEnd("ctx");
  3606. },
  3607. //>>excludeStart("ide", pragmas.excludeIdeData);
  3608. args: ["aKey", "aBlock"],
  3609. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^ self\x0a\x09\x09at: aKey\x0a\x09\x09ifPresent: [ :removed | self basicDelete: aKey. removed ]\x0a\x09\x09ifAbsent: [ aBlock value ]",
  3610. referencedClasses: [],
  3611. //>>excludeEnd("ide");
  3612. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3613. }),
  3614. $globals.HashedCollection);
  3615. $core.addMethod(
  3616. $core.method({
  3617. selector: "values",
  3618. protocol: "accessing",
  3619. fn: function (){
  3620. var self=this,$self=this;
  3621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3622. return $core.withContext(function($ctx1) {
  3623. //>>excludeEnd("ctx");
  3624. return $self._keys().map(function(key){
  3625. return $self._at_(key);
  3626. });
  3627. ;
  3628. return self;
  3629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3630. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  3631. //>>excludeEnd("ctx");
  3632. },
  3633. //>>excludeStart("ide", pragmas.excludeIdeData);
  3634. args: [],
  3635. source: "values\x0a\x09<inlineJS: '\x0a\x09\x09return $self._keys().map(function(key){\x0a\x09\x09\x09return $self._at_(key);\x0a\x09\x09});\x0a\x09'>",
  3636. referencedClasses: [],
  3637. //>>excludeEnd("ide");
  3638. messageSends: []
  3639. }),
  3640. $globals.HashedCollection);
  3641. $core.addMethod(
  3642. $core.method({
  3643. selector: "valuesDo:",
  3644. protocol: "enumerating",
  3645. fn: function (aBlock){
  3646. var self=this,$self=this;
  3647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3648. return $core.withContext(function($ctx1) {
  3649. //>>excludeEnd("ctx");
  3650. $recv($self._values())._do_(aBlock);
  3651. return self;
  3652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3653. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  3654. //>>excludeEnd("ctx");
  3655. },
  3656. //>>excludeStart("ide", pragmas.excludeIdeData);
  3657. args: ["aBlock"],
  3658. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3659. referencedClasses: [],
  3660. //>>excludeEnd("ide");
  3661. messageSends: ["do:", "values"]
  3662. }),
  3663. $globals.HashedCollection);
  3664. $core.addClass("SequenceableCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  3665. //>>excludeStart("ide", pragmas.excludeIdeData);
  3666. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3667. //>>excludeEnd("ide");
  3668. $core.addMethod(
  3669. $core.method({
  3670. selector: "=",
  3671. protocol: "comparing",
  3672. fn: function (aCollection){
  3673. var self=this,$self=this;
  3674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3675. return $core.withContext(function($ctx1) {
  3676. //>>excludeEnd("ctx");
  3677. var $3,$2,$4,$1,$5;
  3678. var $early={};
  3679. try {
  3680. $3=$self._class();
  3681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3682. $ctx1.sendIdx["class"]=1;
  3683. //>>excludeEnd("ctx");
  3684. $2=$recv($3).__eq($recv(aCollection)._class());
  3685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3686. $ctx1.sendIdx["="]=1;
  3687. //>>excludeEnd("ctx");
  3688. $1=$recv($2)._and_((function(){
  3689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3690. return $core.withContext(function($ctx2) {
  3691. //>>excludeEnd("ctx");
  3692. $4=$self._size();
  3693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3694. $ctx2.sendIdx["size"]=1;
  3695. //>>excludeEnd("ctx");
  3696. return $recv($4).__eq($recv(aCollection)._size());
  3697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3698. $ctx2.sendIdx["="]=2;
  3699. //>>excludeEnd("ctx");
  3700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3701. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3702. //>>excludeEnd("ctx");
  3703. }));
  3704. if(!$core.assert($1)){
  3705. return false;
  3706. }
  3707. $self._withIndexDo_((function(each,i){
  3708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3709. return $core.withContext(function($ctx2) {
  3710. //>>excludeEnd("ctx");
  3711. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  3712. if(!$core.assert($5)){
  3713. throw $early=[false];
  3714. }
  3715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3716. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3717. //>>excludeEnd("ctx");
  3718. }));
  3719. return true;
  3720. }
  3721. catch(e) {if(e===$early)return e[0]; throw e}
  3722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3723. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  3724. //>>excludeEnd("ctx");
  3725. },
  3726. //>>excludeStart("ide", pragmas.excludeIdeData);
  3727. args: ["aCollection"],
  3728. source: "= aCollection\x0a\x09(self class = aCollection class and: [\x0a\x09\x09self size = aCollection size ]) ifFalse: [ ^ false ].\x0a\x09self withIndexDo: [ :each :i |\x0a\x09\x09\x09\x09(aCollection at: i) = each ifFalse: [ ^ false ]].\x0a\x09^ true",
  3729. referencedClasses: [],
  3730. //>>excludeEnd("ide");
  3731. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3732. }),
  3733. $globals.SequenceableCollection);
  3734. $core.addMethod(
  3735. $core.method({
  3736. selector: "addLast:",
  3737. protocol: "adding/removing",
  3738. fn: function (anObject){
  3739. var self=this,$self=this;
  3740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3741. return $core.withContext(function($ctx1) {
  3742. //>>excludeEnd("ctx");
  3743. $self._add_(anObject);
  3744. return self;
  3745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3746. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  3747. //>>excludeEnd("ctx");
  3748. },
  3749. //>>excludeStart("ide", pragmas.excludeIdeData);
  3750. args: ["anObject"],
  3751. source: "addLast: anObject\x0a\x09self add: anObject",
  3752. referencedClasses: [],
  3753. //>>excludeEnd("ide");
  3754. messageSends: ["add:"]
  3755. }),
  3756. $globals.SequenceableCollection);
  3757. $core.addMethod(
  3758. $core.method({
  3759. selector: "allButFirst",
  3760. protocol: "accessing",
  3761. fn: function (){
  3762. var self=this,$self=this;
  3763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3764. return $core.withContext(function($ctx1) {
  3765. //>>excludeEnd("ctx");
  3766. return $self._copyFrom_to_((2),$self._size());
  3767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3768. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  3769. //>>excludeEnd("ctx");
  3770. },
  3771. //>>excludeStart("ide", pragmas.excludeIdeData);
  3772. args: [],
  3773. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3774. referencedClasses: [],
  3775. //>>excludeEnd("ide");
  3776. messageSends: ["copyFrom:to:", "size"]
  3777. }),
  3778. $globals.SequenceableCollection);
  3779. $core.addMethod(
  3780. $core.method({
  3781. selector: "allButLast",
  3782. protocol: "accessing",
  3783. fn: function (){
  3784. var self=this,$self=this;
  3785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3786. return $core.withContext(function($ctx1) {
  3787. //>>excludeEnd("ctx");
  3788. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  3789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3790. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  3791. //>>excludeEnd("ctx");
  3792. },
  3793. //>>excludeStart("ide", pragmas.excludeIdeData);
  3794. args: [],
  3795. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  3796. referencedClasses: [],
  3797. //>>excludeEnd("ide");
  3798. messageSends: ["copyFrom:to:", "-", "size"]
  3799. }),
  3800. $globals.SequenceableCollection);
  3801. $core.addMethod(
  3802. $core.method({
  3803. selector: "anyOne",
  3804. protocol: "accessing",
  3805. fn: function (){
  3806. var self=this,$self=this;
  3807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3808. return $core.withContext(function($ctx1) {
  3809. //>>excludeEnd("ctx");
  3810. return $self._at_((1));
  3811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3812. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  3813. //>>excludeEnd("ctx");
  3814. },
  3815. //>>excludeStart("ide", pragmas.excludeIdeData);
  3816. args: [],
  3817. source: "anyOne\x0a\x09^ self at: 1",
  3818. referencedClasses: [],
  3819. //>>excludeEnd("ide");
  3820. messageSends: ["at:"]
  3821. }),
  3822. $globals.SequenceableCollection);
  3823. $core.addMethod(
  3824. $core.method({
  3825. selector: "atRandom",
  3826. protocol: "accessing",
  3827. fn: function (){
  3828. var self=this,$self=this;
  3829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3830. return $core.withContext(function($ctx1) {
  3831. //>>excludeEnd("ctx");
  3832. return $self._at_($recv($self._size())._atRandom());
  3833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3834. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  3835. //>>excludeEnd("ctx");
  3836. },
  3837. //>>excludeStart("ide", pragmas.excludeIdeData);
  3838. args: [],
  3839. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3840. referencedClasses: [],
  3841. //>>excludeEnd("ide");
  3842. messageSends: ["at:", "atRandom", "size"]
  3843. }),
  3844. $globals.SequenceableCollection);
  3845. $core.addMethod(
  3846. $core.method({
  3847. selector: "beginsWith:",
  3848. protocol: "testing",
  3849. fn: function (prefix){
  3850. var self=this,$self=this;
  3851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3852. return $core.withContext(function($ctx1) {
  3853. //>>excludeEnd("ctx");
  3854. var $2,$3,$1;
  3855. $2=$self._size();
  3856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3857. $ctx1.sendIdx["size"]=1;
  3858. //>>excludeEnd("ctx");
  3859. $3=$recv(prefix)._size();
  3860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3861. $ctx1.sendIdx["size"]=2;
  3862. //>>excludeEnd("ctx");
  3863. $1=$recv($2).__lt($3);
  3864. if($core.assert($1)){
  3865. return false;
  3866. }
  3867. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  3868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3869. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  3870. //>>excludeEnd("ctx");
  3871. },
  3872. //>>excludeStart("ide", pragmas.excludeIdeData);
  3873. args: ["prefix"],
  3874. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3875. referencedClasses: [],
  3876. //>>excludeEnd("ide");
  3877. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3878. }),
  3879. $globals.SequenceableCollection);
  3880. $core.addMethod(
  3881. $core.method({
  3882. selector: "copyFrom:to:",
  3883. protocol: "copying",
  3884. fn: function (anIndex,anotherIndex){
  3885. var self=this,$self=this;
  3886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3887. return $core.withContext(function($ctx1) {
  3888. //>>excludeEnd("ctx");
  3889. $self._subclassResponsibility();
  3890. return self;
  3891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3892. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  3893. //>>excludeEnd("ctx");
  3894. },
  3895. //>>excludeStart("ide", pragmas.excludeIdeData);
  3896. args: ["anIndex", "anotherIndex"],
  3897. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  3898. referencedClasses: [],
  3899. //>>excludeEnd("ide");
  3900. messageSends: ["subclassResponsibility"]
  3901. }),
  3902. $globals.SequenceableCollection);
  3903. $core.addMethod(
  3904. $core.method({
  3905. selector: "detect:ifNone:",
  3906. protocol: "enumerating",
  3907. fn: function (aBlock,anotherBlock){
  3908. var self=this,$self=this;
  3909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3910. return $core.withContext(function($ctx1) {
  3911. //>>excludeEnd("ctx");
  3912. var nself = $self._numericallyIndexable();
  3913. for(var i = 0; i < nself.length; i++)
  3914. if(aBlock._value_(nself[i]))
  3915. return nself[i];
  3916. return anotherBlock._value();
  3917. ;
  3918. return self;
  3919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3920. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  3921. //>>excludeEnd("ctx");
  3922. },
  3923. //>>excludeStart("ide", pragmas.excludeIdeData);
  3924. args: ["aBlock", "anotherBlock"],
  3925. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i = 0; i < nself.length; i++)\x0a\x09\x09\x09if(aBlock._value_(nself[i]))\x0a\x09\x09\x09\x09return nself[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09'>",
  3926. referencedClasses: [],
  3927. //>>excludeEnd("ide");
  3928. messageSends: []
  3929. }),
  3930. $globals.SequenceableCollection);
  3931. $core.addMethod(
  3932. $core.method({
  3933. selector: "do:",
  3934. protocol: "enumerating",
  3935. fn: function (aBlock){
  3936. var self=this,$self=this;
  3937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3938. return $core.withContext(function($ctx1) {
  3939. //>>excludeEnd("ctx");
  3940. var nself = $self._numericallyIndexable();
  3941. for(var i=0; i < nself.length; i++) {
  3942. aBlock._value_(nself[i]);
  3943. }
  3944. ;
  3945. return self;
  3946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3947. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  3948. //>>excludeEnd("ctx");
  3949. },
  3950. //>>excludeStart("ide", pragmas.excludeIdeData);
  3951. args: ["aBlock"],
  3952. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < nself.length; i++) {\x0a\x09\x09\x09aBlock._value_(nself[i]);\x0a\x09\x09}\x0a\x09'>",
  3953. referencedClasses: [],
  3954. //>>excludeEnd("ide");
  3955. messageSends: []
  3956. }),
  3957. $globals.SequenceableCollection);
  3958. $core.addMethod(
  3959. $core.method({
  3960. selector: "endsWith:",
  3961. protocol: "testing",
  3962. fn: function (suffix){
  3963. var self=this,$self=this;
  3964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3965. return $core.withContext(function($ctx1) {
  3966. //>>excludeEnd("ctx");
  3967. var $2,$3,$1;
  3968. $2=$self._size();
  3969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3970. $ctx1.sendIdx["size"]=1;
  3971. //>>excludeEnd("ctx");
  3972. $3=$recv(suffix)._size();
  3973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3974. $ctx1.sendIdx["size"]=2;
  3975. //>>excludeEnd("ctx");
  3976. $1=$recv($2).__lt($3);
  3977. if($core.assert($1)){
  3978. return false;
  3979. }
  3980. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  3981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3982. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  3983. //>>excludeEnd("ctx");
  3984. },
  3985. //>>excludeStart("ide", pragmas.excludeIdeData);
  3986. args: ["suffix"],
  3987. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  3988. referencedClasses: [],
  3989. //>>excludeEnd("ide");
  3990. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  3991. }),
  3992. $globals.SequenceableCollection);
  3993. $core.addMethod(
  3994. $core.method({
  3995. selector: "first",
  3996. protocol: "accessing",
  3997. fn: function (){
  3998. var self=this,$self=this;
  3999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4000. return $core.withContext(function($ctx1) {
  4001. //>>excludeEnd("ctx");
  4002. return $self._at_((1));
  4003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4004. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  4005. //>>excludeEnd("ctx");
  4006. },
  4007. //>>excludeStart("ide", pragmas.excludeIdeData);
  4008. args: [],
  4009. source: "first\x0a\x09^ self at: 1",
  4010. referencedClasses: [],
  4011. //>>excludeEnd("ide");
  4012. messageSends: ["at:"]
  4013. }),
  4014. $globals.SequenceableCollection);
  4015. $core.addMethod(
  4016. $core.method({
  4017. selector: "first:",
  4018. protocol: "accessing",
  4019. fn: function (aNumber){
  4020. var self=this,$self=this;
  4021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4022. return $core.withContext(function($ctx1) {
  4023. //>>excludeEnd("ctx");
  4024. var $1;
  4025. $1=$recv($self._size()).__lt(aNumber);
  4026. if($core.assert($1)){
  4027. $self._error_("Invalid number of elements");
  4028. }
  4029. return $self._copyFrom_to_((1),aNumber);
  4030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4031. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  4032. //>>excludeEnd("ctx");
  4033. },
  4034. //>>excludeStart("ide", pragmas.excludeIdeData);
  4035. args: ["aNumber"],
  4036. source: "first: aNumber\x0a\x09\x22Answer the first `aNumber` elements of the receiver.\x0a\x09Raise an error if there are not enough elements in the receiver.\x22\x0a\x0a\x09self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].\x0a\x0a\x09^ self copyFrom: 1 to: aNumber",
  4037. referencedClasses: [],
  4038. //>>excludeEnd("ide");
  4039. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  4040. }),
  4041. $globals.SequenceableCollection);
  4042. $core.addMethod(
  4043. $core.method({
  4044. selector: "fourth",
  4045. protocol: "accessing",
  4046. fn: function (){
  4047. var self=this,$self=this;
  4048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4049. return $core.withContext(function($ctx1) {
  4050. //>>excludeEnd("ctx");
  4051. return $self._at_((4));
  4052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4053. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  4054. //>>excludeEnd("ctx");
  4055. },
  4056. //>>excludeStart("ide", pragmas.excludeIdeData);
  4057. args: [],
  4058. source: "fourth\x0a\x09^ self at: 4",
  4059. referencedClasses: [],
  4060. //>>excludeEnd("ide");
  4061. messageSends: ["at:"]
  4062. }),
  4063. $globals.SequenceableCollection);
  4064. $core.addMethod(
  4065. $core.method({
  4066. selector: "includes:",
  4067. protocol: "testing",
  4068. fn: function (anObject){
  4069. var self=this,$self=this;
  4070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4071. return $core.withContext(function($ctx1) {
  4072. //>>excludeEnd("ctx");
  4073. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  4074. return nil;
  4075. })))._notNil();
  4076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4077. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  4078. //>>excludeEnd("ctx");
  4079. },
  4080. //>>excludeStart("ide", pragmas.excludeIdeData);
  4081. args: ["anObject"],
  4082. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  4083. referencedClasses: [],
  4084. //>>excludeEnd("ide");
  4085. messageSends: ["notNil", "indexOf:ifAbsent:"]
  4086. }),
  4087. $globals.SequenceableCollection);
  4088. $core.addMethod(
  4089. $core.method({
  4090. selector: "indexOf:ifAbsent:",
  4091. protocol: "accessing",
  4092. fn: function (anObject,aBlock){
  4093. var self=this,$self=this;
  4094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4095. return $core.withContext(function($ctx1) {
  4096. //>>excludeEnd("ctx");
  4097. var nself = $self._numericallyIndexable();
  4098. for(var i=0; i < nself.length; i++) {
  4099. if($recv(nself[i]).__eq(anObject)) {return i+1}
  4100. };
  4101. return aBlock._value();
  4102. ;
  4103. return self;
  4104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4105. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  4106. //>>excludeEnd("ctx");
  4107. },
  4108. //>>excludeStart("ide", pragmas.excludeIdeData);
  4109. args: ["anObject", "aBlock"],
  4110. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < nself.length; i++) {\x0a\x09\x09\x09if($recv(nself[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  4111. referencedClasses: [],
  4112. //>>excludeEnd("ide");
  4113. messageSends: []
  4114. }),
  4115. $globals.SequenceableCollection);
  4116. $core.addMethod(
  4117. $core.method({
  4118. selector: "indexOf:startingAt:",
  4119. protocol: "accessing",
  4120. fn: function (anObject,start){
  4121. var self=this,$self=this;
  4122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4123. return $core.withContext(function($ctx1) {
  4124. //>>excludeEnd("ctx");
  4125. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  4126. return (0);
  4127. }));
  4128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4129. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  4130. //>>excludeEnd("ctx");
  4131. },
  4132. //>>excludeStart("ide", pragmas.excludeIdeData);
  4133. args: ["anObject", "start"],
  4134. 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 ]",
  4135. referencedClasses: [],
  4136. //>>excludeEnd("ide");
  4137. messageSends: ["indexOf:startingAt:ifAbsent:"]
  4138. }),
  4139. $globals.SequenceableCollection);
  4140. $core.addMethod(
  4141. $core.method({
  4142. selector: "indexOf:startingAt:ifAbsent:",
  4143. protocol: "accessing",
  4144. fn: function (anObject,start,aBlock){
  4145. var self=this,$self=this;
  4146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4147. return $core.withContext(function($ctx1) {
  4148. //>>excludeEnd("ctx");
  4149. var nself = $self._numericallyIndexable();
  4150. for(var i=start - 1; i < nself.length; i++){
  4151. if($recv(nself[i]).__eq(anObject)) {return i+1}
  4152. }
  4153. return aBlock._value();
  4154. ;
  4155. return self;
  4156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4157. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  4158. //>>excludeEnd("ctx");
  4159. },
  4160. //>>excludeStart("ide", pragmas.excludeIdeData);
  4161. args: ["anObject", "start", "aBlock"],
  4162. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i=start - 1; i < nself.length; i++){\x0a\x09\x09\x09if($recv(nself[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  4163. referencedClasses: [],
  4164. //>>excludeEnd("ide");
  4165. messageSends: []
  4166. }),
  4167. $globals.SequenceableCollection);
  4168. $core.addMethod(
  4169. $core.method({
  4170. selector: "last",
  4171. protocol: "accessing",
  4172. fn: function (){
  4173. var self=this,$self=this;
  4174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4175. return $core.withContext(function($ctx1) {
  4176. //>>excludeEnd("ctx");
  4177. return $self._at_($self._size());
  4178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4179. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  4180. //>>excludeEnd("ctx");
  4181. },
  4182. //>>excludeStart("ide", pragmas.excludeIdeData);
  4183. args: [],
  4184. source: "last\x0a\x09^ self at: self size",
  4185. referencedClasses: [],
  4186. //>>excludeEnd("ide");
  4187. messageSends: ["at:", "size"]
  4188. }),
  4189. $globals.SequenceableCollection);
  4190. $core.addMethod(
  4191. $core.method({
  4192. selector: "last:",
  4193. protocol: "accessing",
  4194. fn: function (aNumber){
  4195. var self=this,$self=this;
  4196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4197. return $core.withContext(function($ctx1) {
  4198. //>>excludeEnd("ctx");
  4199. var $2,$1,$5,$4,$3;
  4200. $2=$self._size();
  4201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4202. $ctx1.sendIdx["size"]=1;
  4203. //>>excludeEnd("ctx");
  4204. $1=$recv($2).__lt(aNumber);
  4205. if($core.assert($1)){
  4206. $self._error_("Invalid number of elements");
  4207. }
  4208. $5=$self._size();
  4209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4210. $ctx1.sendIdx["size"]=2;
  4211. //>>excludeEnd("ctx");
  4212. $4=$recv($5).__minus(aNumber);
  4213. $3=$recv($4).__plus((1));
  4214. return $self._copyFrom_to_($3,$self._size());
  4215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4216. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  4217. //>>excludeEnd("ctx");
  4218. },
  4219. //>>excludeStart("ide", pragmas.excludeIdeData);
  4220. args: ["aNumber"],
  4221. source: "last: aNumber\x0a\x09\x22Answer the last aNumber elements of the receiver.\x0a\x09Raise an error if there are not enough elements in the receiver.\x22\x0a\x0a\x09self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].\x0a\x0a\x09^ self copyFrom: self size - aNumber + 1 to: self size",
  4222. referencedClasses: [],
  4223. //>>excludeEnd("ide");
  4224. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  4225. }),
  4226. $globals.SequenceableCollection);
  4227. $core.addMethod(
  4228. $core.method({
  4229. selector: "newStream",
  4230. protocol: "streaming",
  4231. fn: function (){
  4232. var self=this,$self=this;
  4233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4234. return $core.withContext(function($ctx1) {
  4235. //>>excludeEnd("ctx");
  4236. return $recv($self._streamClass())._on_(self);
  4237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4238. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  4239. //>>excludeEnd("ctx");
  4240. },
  4241. //>>excludeStart("ide", pragmas.excludeIdeData);
  4242. args: [],
  4243. source: "newStream\x0a\x09^ self streamClass on: self",
  4244. referencedClasses: [],
  4245. //>>excludeEnd("ide");
  4246. messageSends: ["on:", "streamClass"]
  4247. }),
  4248. $globals.SequenceableCollection);
  4249. $core.addMethod(
  4250. $core.method({
  4251. selector: "numericallyIndexable",
  4252. protocol: "private",
  4253. fn: function (){
  4254. var self=this,$self=this;
  4255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4256. return $core.withContext(function($ctx1) {
  4257. //>>excludeEnd("ctx");
  4258. $self._subclassResponsibility();
  4259. return self;
  4260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4261. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  4262. //>>excludeEnd("ctx");
  4263. },
  4264. //>>excludeStart("ide", pragmas.excludeIdeData);
  4265. args: [],
  4266. source: "numericallyIndexable\x0a\x09\x22This is an internal converting message.\x0a\x09It answeres a representation of the receiver\x0a\x09that can use foo[i] in JavaScript code.\x0a\x09\x0a\x09It fixes IE8, where boxed String is unable\x0a\x09to numerically index its characters,\x0a\x09but primitive string can.\x22\x0a\x09\x0a\x09self subclassResponsibility",
  4267. referencedClasses: [],
  4268. //>>excludeEnd("ide");
  4269. messageSends: ["subclassResponsibility"]
  4270. }),
  4271. $globals.SequenceableCollection);
  4272. $core.addMethod(
  4273. $core.method({
  4274. selector: "readStream",
  4275. protocol: "streaming",
  4276. fn: function (){
  4277. var self=this,$self=this;
  4278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4279. return $core.withContext(function($ctx1) {
  4280. //>>excludeEnd("ctx");
  4281. return $self._stream();
  4282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4283. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  4284. //>>excludeEnd("ctx");
  4285. },
  4286. //>>excludeStart("ide", pragmas.excludeIdeData);
  4287. args: [],
  4288. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4289. referencedClasses: [],
  4290. //>>excludeEnd("ide");
  4291. messageSends: ["stream"]
  4292. }),
  4293. $globals.SequenceableCollection);
  4294. $core.addMethod(
  4295. $core.method({
  4296. selector: "removeLast",
  4297. protocol: "adding/removing",
  4298. fn: function (){
  4299. var self=this,$self=this;
  4300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4301. return $core.withContext(function($ctx1) {
  4302. //>>excludeEnd("ctx");
  4303. return $self._remove_($self._last());
  4304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4305. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  4306. //>>excludeEnd("ctx");
  4307. },
  4308. //>>excludeStart("ide", pragmas.excludeIdeData);
  4309. args: [],
  4310. source: "removeLast\x0a\x09^ self remove: self last",
  4311. referencedClasses: [],
  4312. //>>excludeEnd("ide");
  4313. messageSends: ["remove:", "last"]
  4314. }),
  4315. $globals.SequenceableCollection);
  4316. $core.addMethod(
  4317. $core.method({
  4318. selector: "reverseDo:",
  4319. protocol: "enumerating",
  4320. fn: function (aBlock){
  4321. var self=this,$self=this;
  4322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4323. return $core.withContext(function($ctx1) {
  4324. //>>excludeEnd("ctx");
  4325. $recv($self._reversed())._do_(aBlock);
  4326. return self;
  4327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4328. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  4329. //>>excludeEnd("ctx");
  4330. },
  4331. //>>excludeStart("ide", pragmas.excludeIdeData);
  4332. args: ["aBlock"],
  4333. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  4334. referencedClasses: [],
  4335. //>>excludeEnd("ide");
  4336. messageSends: ["do:", "reversed"]
  4337. }),
  4338. $globals.SequenceableCollection);
  4339. $core.addMethod(
  4340. $core.method({
  4341. selector: "reversed",
  4342. protocol: "converting",
  4343. fn: function (){
  4344. var self=this,$self=this;
  4345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4346. return $core.withContext(function($ctx1) {
  4347. //>>excludeEnd("ctx");
  4348. $self._subclassResponsibility();
  4349. return self;
  4350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4351. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  4352. //>>excludeEnd("ctx");
  4353. },
  4354. //>>excludeStart("ide", pragmas.excludeIdeData);
  4355. args: [],
  4356. source: "reversed\x0a\x09self subclassResponsibility",
  4357. referencedClasses: [],
  4358. //>>excludeEnd("ide");
  4359. messageSends: ["subclassResponsibility"]
  4360. }),
  4361. $globals.SequenceableCollection);
  4362. $core.addMethod(
  4363. $core.method({
  4364. selector: "second",
  4365. protocol: "accessing",
  4366. fn: function (){
  4367. var self=this,$self=this;
  4368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4369. return $core.withContext(function($ctx1) {
  4370. //>>excludeEnd("ctx");
  4371. return $self._at_((2));
  4372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4373. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  4374. //>>excludeEnd("ctx");
  4375. },
  4376. //>>excludeStart("ide", pragmas.excludeIdeData);
  4377. args: [],
  4378. source: "second\x0a\x09^ self at: 2",
  4379. referencedClasses: [],
  4380. //>>excludeEnd("ide");
  4381. messageSends: ["at:"]
  4382. }),
  4383. $globals.SequenceableCollection);
  4384. $core.addMethod(
  4385. $core.method({
  4386. selector: "single",
  4387. protocol: "accessing",
  4388. fn: function (){
  4389. var self=this,$self=this;
  4390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4391. return $core.withContext(function($ctx1) {
  4392. //>>excludeEnd("ctx");
  4393. if (self.length == 0) throw new Error("Collection is empty");
  4394. if (self.length > 1) throw new Error("Collection holds more than one element.");
  4395. return $self._numericallyIndexable()[0];;
  4396. return self;
  4397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4398. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.SequenceableCollection)});
  4399. //>>excludeEnd("ctx");
  4400. },
  4401. //>>excludeStart("ide", pragmas.excludeIdeData);
  4402. args: [],
  4403. source: "single\x0a<inlineJS: '\x0a\x09if (self.length == 0) throw new Error(\x22Collection is empty\x22);\x0a\x09if (self.length > 1) throw new Error(\x22Collection holds more than one element.\x22);\x0a\x09return $self._numericallyIndexable()[0];\x0a'>",
  4404. referencedClasses: [],
  4405. //>>excludeEnd("ide");
  4406. messageSends: []
  4407. }),
  4408. $globals.SequenceableCollection);
  4409. $core.addMethod(
  4410. $core.method({
  4411. selector: "stream",
  4412. protocol: "streaming",
  4413. fn: function (){
  4414. var self=this,$self=this;
  4415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4416. return $core.withContext(function($ctx1) {
  4417. //>>excludeEnd("ctx");
  4418. return $self._newStream();
  4419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4420. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  4421. //>>excludeEnd("ctx");
  4422. },
  4423. //>>excludeStart("ide", pragmas.excludeIdeData);
  4424. args: [],
  4425. source: "stream\x0a\x09^ self newStream",
  4426. referencedClasses: [],
  4427. //>>excludeEnd("ide");
  4428. messageSends: ["newStream"]
  4429. }),
  4430. $globals.SequenceableCollection);
  4431. $core.addMethod(
  4432. $core.method({
  4433. selector: "streamClass",
  4434. protocol: "streaming",
  4435. fn: function (){
  4436. var self=this,$self=this;
  4437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4438. return $core.withContext(function($ctx1) {
  4439. //>>excludeEnd("ctx");
  4440. return $recv($self._class())._streamClass();
  4441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4442. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  4443. //>>excludeEnd("ctx");
  4444. },
  4445. //>>excludeStart("ide", pragmas.excludeIdeData);
  4446. args: [],
  4447. source: "streamClass\x0a\x09^ self class streamClass",
  4448. referencedClasses: [],
  4449. //>>excludeEnd("ide");
  4450. messageSends: ["streamClass", "class"]
  4451. }),
  4452. $globals.SequenceableCollection);
  4453. $core.addMethod(
  4454. $core.method({
  4455. selector: "third",
  4456. protocol: "accessing",
  4457. fn: function (){
  4458. var self=this,$self=this;
  4459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4460. return $core.withContext(function($ctx1) {
  4461. //>>excludeEnd("ctx");
  4462. return $self._at_((3));
  4463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4464. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  4465. //>>excludeEnd("ctx");
  4466. },
  4467. //>>excludeStart("ide", pragmas.excludeIdeData);
  4468. args: [],
  4469. source: "third\x0a\x09^ self at: 3",
  4470. referencedClasses: [],
  4471. //>>excludeEnd("ide");
  4472. messageSends: ["at:"]
  4473. }),
  4474. $globals.SequenceableCollection);
  4475. $core.addMethod(
  4476. $core.method({
  4477. selector: "with:do:",
  4478. protocol: "enumerating",
  4479. fn: function (anotherCollection,aBlock){
  4480. var self=this,$self=this;
  4481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4482. return $core.withContext(function($ctx1) {
  4483. //>>excludeEnd("ctx");
  4484. var nself = $self._numericallyIndexable();
  4485. anotherCollection = anotherCollection._numericallyIndexable();
  4486. for(var i=0; i<nself.length; i++) {
  4487. aBlock._value_value_(nself[i], anotherCollection[i]);
  4488. }
  4489. ;
  4490. return self;
  4491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4492. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  4493. //>>excludeEnd("ctx");
  4494. },
  4495. //>>excludeStart("ide", pragmas.excludeIdeData);
  4496. args: ["anotherCollection", "aBlock"],
  4497. source: "with: anotherCollection do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09anotherCollection = anotherCollection._numericallyIndexable();\x0a\x09\x09for(var i=0; i<nself.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(nself[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09'>",
  4498. referencedClasses: [],
  4499. //>>excludeEnd("ide");
  4500. messageSends: []
  4501. }),
  4502. $globals.SequenceableCollection);
  4503. $core.addMethod(
  4504. $core.method({
  4505. selector: "withIndexDo:",
  4506. protocol: "enumerating",
  4507. fn: function (aBlock){
  4508. var self=this,$self=this;
  4509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4510. return $core.withContext(function($ctx1) {
  4511. //>>excludeEnd("ctx");
  4512. var nself = $self._numericallyIndexable();
  4513. for(var i=0; i < nself.length; i++) {
  4514. aBlock._value_value_(nself[i], i+1);
  4515. }
  4516. ;
  4517. return self;
  4518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4519. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  4520. //>>excludeEnd("ctx");
  4521. },
  4522. //>>excludeStart("ide", pragmas.excludeIdeData);
  4523. args: ["aBlock"],
  4524. source: "withIndexDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < nself.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(nself[i], i+1);\x0a\x09\x09}\x0a\x09'>",
  4525. referencedClasses: [],
  4526. //>>excludeEnd("ide");
  4527. messageSends: []
  4528. }),
  4529. $globals.SequenceableCollection);
  4530. $core.addMethod(
  4531. $core.method({
  4532. selector: "writeStream",
  4533. protocol: "streaming",
  4534. fn: function (){
  4535. var self=this,$self=this;
  4536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4537. return $core.withContext(function($ctx1) {
  4538. //>>excludeEnd("ctx");
  4539. return $self._stream();
  4540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4541. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  4542. //>>excludeEnd("ctx");
  4543. },
  4544. //>>excludeStart("ide", pragmas.excludeIdeData);
  4545. args: [],
  4546. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4547. referencedClasses: [],
  4548. //>>excludeEnd("ide");
  4549. messageSends: ["stream"]
  4550. }),
  4551. $globals.SequenceableCollection);
  4552. $core.addMethod(
  4553. $core.method({
  4554. selector: "streamClass",
  4555. protocol: "accessing",
  4556. fn: function (){
  4557. var self=this,$self=this;
  4558. return $globals.Stream;
  4559. },
  4560. //>>excludeStart("ide", pragmas.excludeIdeData);
  4561. args: [],
  4562. source: "streamClass\x0a\x09\x09^ Stream",
  4563. referencedClasses: ["Stream"],
  4564. //>>excludeEnd("ide");
  4565. messageSends: []
  4566. }),
  4567. $globals.SequenceableCollection.a$cls);
  4568. $core.addMethod(
  4569. $core.method({
  4570. selector: "streamContents:",
  4571. protocol: "streaming",
  4572. fn: function (aBlock){
  4573. var self=this,$self=this;
  4574. var stream;
  4575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4576. return $core.withContext(function($ctx1) {
  4577. //>>excludeEnd("ctx");
  4578. stream=$recv($self._streamClass())._on_($self._new());
  4579. $recv(aBlock)._value_(stream);
  4580. return $recv(stream)._contents();
  4581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4582. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.a$cls)});
  4583. //>>excludeEnd("ctx");
  4584. },
  4585. //>>excludeStart("ide", pragmas.excludeIdeData);
  4586. args: ["aBlock"],
  4587. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4588. referencedClasses: [],
  4589. //>>excludeEnd("ide");
  4590. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4591. }),
  4592. $globals.SequenceableCollection.a$cls);
  4593. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  4594. //>>excludeStart("ide", pragmas.excludeIdeData);
  4595. $globals.Array.comment="I represent a collection of objects ordered by the collector. The size of arrays is dynamic.\x0a\x0aI am directly mapped to JavaScript Number.\x0a\x0a*Note* In Amber, `OrderedCollection` is an alias for `Array`.";
  4596. //>>excludeEnd("ide");
  4597. $core.addMethod(
  4598. $core.method({
  4599. selector: "add:",
  4600. protocol: "adding/removing",
  4601. fn: function (anObject){
  4602. var self=this,$self=this;
  4603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4604. return $core.withContext(function($ctx1) {
  4605. //>>excludeEnd("ctx");
  4606. self.push(anObject); return anObject;;
  4607. return self;
  4608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4609. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  4610. //>>excludeEnd("ctx");
  4611. },
  4612. //>>excludeStart("ide", pragmas.excludeIdeData);
  4613. args: ["anObject"],
  4614. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  4615. referencedClasses: [],
  4616. //>>excludeEnd("ide");
  4617. messageSends: []
  4618. }),
  4619. $globals.Array);
  4620. $core.addMethod(
  4621. $core.method({
  4622. selector: "addAll:",
  4623. protocol: "adding/removing",
  4624. fn: function (aCollection){
  4625. var self=this,$self=this;
  4626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4627. return $core.withContext(function($ctx1) {
  4628. //>>excludeEnd("ctx");
  4629. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  4630. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  4631. return aCollection;;
  4632. return self;
  4633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4634. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  4635. //>>excludeEnd("ctx");
  4636. },
  4637. //>>excludeStart("ide", pragmas.excludeIdeData);
  4638. args: ["aCollection"],
  4639. source: "addAll: aCollection\x0a<inlineJS: '\x0a\x09if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);\x0a\x09else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);\x0a\x09return aCollection;\x0a'>",
  4640. referencedClasses: [],
  4641. //>>excludeEnd("ide");
  4642. messageSends: []
  4643. }),
  4644. $globals.Array);
  4645. $core.addMethod(
  4646. $core.method({
  4647. selector: "addFirst:",
  4648. protocol: "adding/removing",
  4649. fn: function (anObject){
  4650. var self=this,$self=this;
  4651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4652. return $core.withContext(function($ctx1) {
  4653. //>>excludeEnd("ctx");
  4654. self.unshift(anObject); return anObject;;
  4655. return self;
  4656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4657. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  4658. //>>excludeEnd("ctx");
  4659. },
  4660. //>>excludeStart("ide", pragmas.excludeIdeData);
  4661. args: ["anObject"],
  4662. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  4663. referencedClasses: [],
  4664. //>>excludeEnd("ide");
  4665. messageSends: []
  4666. }),
  4667. $globals.Array);
  4668. $core.addMethod(
  4669. $core.method({
  4670. selector: "asJavaScriptSource",
  4671. protocol: "converting",
  4672. fn: function (){
  4673. var self=this,$self=this;
  4674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4675. return $core.withContext(function($ctx1) {
  4676. //>>excludeEnd("ctx");
  4677. var $1;
  4678. $1=$recv("[".__comma($recv($self._collect_((function(each){
  4679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4680. return $core.withContext(function($ctx2) {
  4681. //>>excludeEnd("ctx");
  4682. return $recv(each)._asJavaScriptSource();
  4683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4684. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4685. //>>excludeEnd("ctx");
  4686. })))._join_(", "))).__comma("]");
  4687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4688. $ctx1.sendIdx[","]=1;
  4689. //>>excludeEnd("ctx");
  4690. return $1;
  4691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4692. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Array)});
  4693. //>>excludeEnd("ctx");
  4694. },
  4695. //>>excludeStart("ide", pragmas.excludeIdeData);
  4696. args: [],
  4697. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  4698. referencedClasses: [],
  4699. //>>excludeEnd("ide");
  4700. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  4701. }),
  4702. $globals.Array);
  4703. $core.addMethod(
  4704. $core.method({
  4705. selector: "at:ifAbsent:",
  4706. protocol: "accessing",
  4707. fn: function (anIndex,aBlock){
  4708. var self=this,$self=this;
  4709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4710. return $core.withContext(function($ctx1) {
  4711. //>>excludeEnd("ctx");
  4712. return anIndex >= 1 && anIndex <= self.length
  4713. ? self[anIndex - 1]
  4714. : aBlock._value()
  4715. ;
  4716. return self;
  4717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4718. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  4719. //>>excludeEnd("ctx");
  4720. },
  4721. //>>excludeStart("ide", pragmas.excludeIdeData);
  4722. args: ["anIndex", "aBlock"],
  4723. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09'>",
  4724. referencedClasses: [],
  4725. //>>excludeEnd("ide");
  4726. messageSends: []
  4727. }),
  4728. $globals.Array);
  4729. $core.addMethod(
  4730. $core.method({
  4731. selector: "at:ifPresent:ifAbsent:",
  4732. protocol: "accessing",
  4733. fn: function (anIndex,aBlock,anotherBlock){
  4734. var self=this,$self=this;
  4735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4736. return $core.withContext(function($ctx1) {
  4737. //>>excludeEnd("ctx");
  4738. return anIndex >= 1 && anIndex <= self.length
  4739. ? aBlock._value_(self[anIndex - 1])
  4740. : anotherBlock._value()
  4741. ;
  4742. return self;
  4743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4744. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  4745. //>>excludeEnd("ctx");
  4746. },
  4747. //>>excludeStart("ide", pragmas.excludeIdeData);
  4748. args: ["anIndex", "aBlock", "anotherBlock"],
  4749. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? aBlock._value_(self[anIndex - 1])\x0a\x09\x09\x09: anotherBlock._value()\x0a\x09'>",
  4750. referencedClasses: [],
  4751. //>>excludeEnd("ide");
  4752. messageSends: []
  4753. }),
  4754. $globals.Array);
  4755. $core.addMethod(
  4756. $core.method({
  4757. selector: "at:put:",
  4758. protocol: "accessing",
  4759. fn: function (anIndex,anObject){
  4760. var self=this,$self=this;
  4761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4762. return $core.withContext(function($ctx1) {
  4763. //>>excludeEnd("ctx");
  4764. return self[anIndex - 1] = anObject;
  4765. return self;
  4766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4767. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  4768. //>>excludeEnd("ctx");
  4769. },
  4770. //>>excludeStart("ide", pragmas.excludeIdeData);
  4771. args: ["anIndex", "anObject"],
  4772. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  4773. referencedClasses: [],
  4774. //>>excludeEnd("ide");
  4775. messageSends: []
  4776. }),
  4777. $globals.Array);
  4778. $core.addMethod(
  4779. $core.method({
  4780. selector: "collect:",
  4781. protocol: "enumerating",
  4782. fn: function (aBlock){
  4783. var self=this,$self=this;
  4784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4785. return $core.withContext(function($ctx1) {
  4786. //>>excludeEnd("ctx");
  4787. return self.map(function(each) {return aBlock._value_(each)});
  4788. return self;
  4789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4790. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  4791. //>>excludeEnd("ctx");
  4792. },
  4793. //>>excludeStart("ide", pragmas.excludeIdeData);
  4794. args: ["aBlock"],
  4795. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  4796. referencedClasses: [],
  4797. //>>excludeEnd("ide");
  4798. messageSends: []
  4799. }),
  4800. $globals.Array);
  4801. $core.addMethod(
  4802. $core.method({
  4803. selector: "copyFrom:to:",
  4804. protocol: "copying",
  4805. fn: function (anIndex,anotherIndex){
  4806. var self=this,$self=this;
  4807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4808. return $core.withContext(function($ctx1) {
  4809. //>>excludeEnd("ctx");
  4810. if (anIndex >= 1 && anotherIndex <= self.length) {
  4811. return self.slice(anIndex - 1, anotherIndex);
  4812. } else {
  4813. self._at_(anIndex);
  4814. self._at_(self.length + 1);
  4815. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4816. };
  4817. return self;
  4818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4819. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  4820. //>>excludeEnd("ctx");
  4821. },
  4822. //>>excludeStart("ide", pragmas.excludeIdeData);
  4823. args: ["anIndex", "anotherIndex"],
  4824. source: "copyFrom: anIndex to: anotherIndex\x0a<inlineJS: '\x0a\x09if (anIndex >= 1 && anotherIndex <= self.length) {\x0a\x09\x09return self.slice(anIndex - 1, anotherIndex);\x0a\x09} else {\x0a\x09\x09self._at_(anIndex);\x0a\x09\x09self._at_(self.length + 1);\x0a\x09\x09throw new Error(\x22Incorrect indexes in #copyFrom:to: not caught by #at:\x22);\x0a\x09}\x0a'>",
  4825. referencedClasses: [],
  4826. //>>excludeEnd("ide");
  4827. messageSends: []
  4828. }),
  4829. $globals.Array);
  4830. $core.addMethod(
  4831. $core.method({
  4832. selector: "join:",
  4833. protocol: "enumerating",
  4834. fn: function (aString){
  4835. var self=this,$self=this;
  4836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4837. return $core.withContext(function($ctx1) {
  4838. //>>excludeEnd("ctx");
  4839. return self.join(aString);
  4840. return self;
  4841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4842. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  4843. //>>excludeEnd("ctx");
  4844. },
  4845. //>>excludeStart("ide", pragmas.excludeIdeData);
  4846. args: ["aString"],
  4847. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  4848. referencedClasses: [],
  4849. //>>excludeEnd("ide");
  4850. messageSends: []
  4851. }),
  4852. $globals.Array);
  4853. $core.addMethod(
  4854. $core.method({
  4855. selector: "numericallyIndexable",
  4856. protocol: "private",
  4857. fn: function (){
  4858. var self=this,$self=this;
  4859. return self;
  4860. },
  4861. //>>excludeStart("ide", pragmas.excludeIdeData);
  4862. args: [],
  4863. source: "numericallyIndexable\x0a\x09^ self",
  4864. referencedClasses: [],
  4865. //>>excludeEnd("ide");
  4866. messageSends: []
  4867. }),
  4868. $globals.Array);
  4869. $core.addMethod(
  4870. $core.method({
  4871. selector: "printOn:",
  4872. protocol: "printing",
  4873. fn: function (aStream){
  4874. var self=this,$self=this;
  4875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4876. return $core.withContext(function($ctx1) {
  4877. //>>excludeEnd("ctx");
  4878. (
  4879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4880. $ctx1.supercall = true,
  4881. //>>excludeEnd("ctx");
  4882. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  4883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4884. $ctx1.supercall = false;
  4885. //>>excludeEnd("ctx");;
  4886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4887. $ctx1.sendIdx["printOn:"]=1;
  4888. //>>excludeEnd("ctx");
  4889. $recv(aStream)._nextPutAll_(" (");
  4890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4891. $ctx1.sendIdx["nextPutAll:"]=1;
  4892. //>>excludeEnd("ctx");
  4893. $self._do_separatedBy_((function(each){
  4894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4895. return $core.withContext(function($ctx2) {
  4896. //>>excludeEnd("ctx");
  4897. return $recv(each)._printOn_(aStream);
  4898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4899. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4900. //>>excludeEnd("ctx");
  4901. }),(function(){
  4902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4903. return $core.withContext(function($ctx2) {
  4904. //>>excludeEnd("ctx");
  4905. return $recv(aStream)._nextPutAll_(" ");
  4906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4907. $ctx2.sendIdx["nextPutAll:"]=2;
  4908. //>>excludeEnd("ctx");
  4909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4911. //>>excludeEnd("ctx");
  4912. }));
  4913. $recv(aStream)._nextPutAll_(")");
  4914. return self;
  4915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4916. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  4917. //>>excludeEnd("ctx");
  4918. },
  4919. //>>excludeStart("ide", pragmas.excludeIdeData);
  4920. args: ["aStream"],
  4921. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'",
  4922. referencedClasses: [],
  4923. //>>excludeEnd("ide");
  4924. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4925. }),
  4926. $globals.Array);
  4927. $core.addMethod(
  4928. $core.method({
  4929. selector: "remove:ifAbsent:",
  4930. protocol: "adding/removing",
  4931. fn: function (anObject,aBlock){
  4932. var self=this,$self=this;
  4933. var index;
  4934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4935. return $core.withContext(function($ctx1) {
  4936. //>>excludeEnd("ctx");
  4937. var $1;
  4938. index=$self._indexOf_ifAbsent_(anObject,(function(){
  4939. return (0);
  4940. }));
  4941. $1=$recv(index).__eq((0));
  4942. if($core.assert($1)){
  4943. return $recv(aBlock)._value();
  4944. } else {
  4945. $self._removeIndex_(index);
  4946. return anObject;
  4947. }
  4948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4949. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  4950. //>>excludeEnd("ctx");
  4951. },
  4952. //>>excludeStart("ide", pragmas.excludeIdeData);
  4953. args: ["anObject", "aBlock"],
  4954. source: "remove: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := self indexOf: anObject ifAbsent: [ 0 ].\x0a\x09^ index = 0\x0a\x09\x09ifFalse: [ self removeIndex: index. anObject ]\x0a\x09\x09ifTrue: [ aBlock value ]",
  4955. referencedClasses: [],
  4956. //>>excludeEnd("ide");
  4957. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4958. }),
  4959. $globals.Array);
  4960. $core.addMethod(
  4961. $core.method({
  4962. selector: "removeAll",
  4963. protocol: "adding/removing",
  4964. fn: function (){
  4965. var self=this,$self=this;
  4966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4967. return $core.withContext(function($ctx1) {
  4968. //>>excludeEnd("ctx");
  4969. self.length = 0;
  4970. return self;
  4971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4972. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  4973. //>>excludeEnd("ctx");
  4974. },
  4975. //>>excludeStart("ide", pragmas.excludeIdeData);
  4976. args: [],
  4977. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  4978. referencedClasses: [],
  4979. //>>excludeEnd("ide");
  4980. messageSends: []
  4981. }),
  4982. $globals.Array);
  4983. $core.addMethod(
  4984. $core.method({
  4985. selector: "removeFrom:to:",
  4986. protocol: "adding/removing",
  4987. fn: function (aNumber,anotherNumber){
  4988. var self=this,$self=this;
  4989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4990. return $core.withContext(function($ctx1) {
  4991. //>>excludeEnd("ctx");
  4992. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4993. return self;
  4994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4995. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  4996. //>>excludeEnd("ctx");
  4997. },
  4998. //>>excludeStart("ide", pragmas.excludeIdeData);
  4999. args: ["aNumber", "anotherNumber"],
  5000. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  5001. referencedClasses: [],
  5002. //>>excludeEnd("ide");
  5003. messageSends: []
  5004. }),
  5005. $globals.Array);
  5006. $core.addMethod(
  5007. $core.method({
  5008. selector: "removeIndex:",
  5009. protocol: "adding/removing",
  5010. fn: function (anInteger){
  5011. var self=this,$self=this;
  5012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5013. return $core.withContext(function($ctx1) {
  5014. //>>excludeEnd("ctx");
  5015. self.splice(anInteger - 1, 1);
  5016. return self;
  5017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5018. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  5019. //>>excludeEnd("ctx");
  5020. },
  5021. //>>excludeStart("ide", pragmas.excludeIdeData);
  5022. args: ["anInteger"],
  5023. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  5024. referencedClasses: [],
  5025. //>>excludeEnd("ide");
  5026. messageSends: []
  5027. }),
  5028. $globals.Array);
  5029. $core.addMethod(
  5030. $core.method({
  5031. selector: "removeLast",
  5032. protocol: "adding/removing",
  5033. fn: function (){
  5034. var self=this,$self=this;
  5035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5036. return $core.withContext(function($ctx1) {
  5037. //>>excludeEnd("ctx");
  5038. return self.pop();;
  5039. return self;
  5040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5041. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  5042. //>>excludeEnd("ctx");
  5043. },
  5044. //>>excludeStart("ide", pragmas.excludeIdeData);
  5045. args: [],
  5046. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  5047. referencedClasses: [],
  5048. //>>excludeEnd("ide");
  5049. messageSends: []
  5050. }),
  5051. $globals.Array);
  5052. $core.addMethod(
  5053. $core.method({
  5054. selector: "reversed",
  5055. protocol: "converting",
  5056. fn: function (){
  5057. var self=this,$self=this;
  5058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5059. return $core.withContext(function($ctx1) {
  5060. //>>excludeEnd("ctx");
  5061. return self.slice().reverse();
  5062. return self;
  5063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5064. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  5065. //>>excludeEnd("ctx");
  5066. },
  5067. //>>excludeStart("ide", pragmas.excludeIdeData);
  5068. args: [],
  5069. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  5070. referencedClasses: [],
  5071. //>>excludeEnd("ide");
  5072. messageSends: []
  5073. }),
  5074. $globals.Array);
  5075. $core.addMethod(
  5076. $core.method({
  5077. selector: "select:",
  5078. protocol: "enumerating",
  5079. fn: function (aBlock){
  5080. var self=this,$self=this;
  5081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5082. return $core.withContext(function($ctx1) {
  5083. //>>excludeEnd("ctx");
  5084. return self.filter(function(each) {return aBlock._value_(each)});
  5085. return self;
  5086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5087. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  5088. //>>excludeEnd("ctx");
  5089. },
  5090. //>>excludeStart("ide", pragmas.excludeIdeData);
  5091. args: ["aBlock"],
  5092. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  5093. referencedClasses: [],
  5094. //>>excludeEnd("ide");
  5095. messageSends: []
  5096. }),
  5097. $globals.Array);
  5098. $core.addMethod(
  5099. $core.method({
  5100. selector: "shallowCopy",
  5101. protocol: "copying",
  5102. fn: function (){
  5103. var self=this,$self=this;
  5104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5105. return $core.withContext(function($ctx1) {
  5106. //>>excludeEnd("ctx");
  5107. return self.slice();
  5108. return self;
  5109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5110. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  5111. //>>excludeEnd("ctx");
  5112. },
  5113. //>>excludeStart("ide", pragmas.excludeIdeData);
  5114. args: [],
  5115. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  5116. referencedClasses: [],
  5117. //>>excludeEnd("ide");
  5118. messageSends: []
  5119. }),
  5120. $globals.Array);
  5121. $core.addMethod(
  5122. $core.method({
  5123. selector: "size",
  5124. protocol: "accessing",
  5125. fn: function (){
  5126. var self=this,$self=this;
  5127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5128. return $core.withContext(function($ctx1) {
  5129. //>>excludeEnd("ctx");
  5130. return self.length;
  5131. return self;
  5132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5133. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  5134. //>>excludeEnd("ctx");
  5135. },
  5136. //>>excludeStart("ide", pragmas.excludeIdeData);
  5137. args: [],
  5138. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  5139. referencedClasses: [],
  5140. //>>excludeEnd("ide");
  5141. messageSends: []
  5142. }),
  5143. $globals.Array);
  5144. $core.addMethod(
  5145. $core.method({
  5146. selector: "sort",
  5147. protocol: "enumerating",
  5148. fn: function (){
  5149. var self=this,$self=this;
  5150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5151. return $core.withContext(function($ctx1) {
  5152. //>>excludeEnd("ctx");
  5153. return $self._sort_((function(a,b){
  5154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5155. return $core.withContext(function($ctx2) {
  5156. //>>excludeEnd("ctx");
  5157. return $recv(a).__lt(b);
  5158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5159. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  5160. //>>excludeEnd("ctx");
  5161. }));
  5162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5163. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  5164. //>>excludeEnd("ctx");
  5165. },
  5166. //>>excludeStart("ide", pragmas.excludeIdeData);
  5167. args: [],
  5168. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  5169. referencedClasses: [],
  5170. //>>excludeEnd("ide");
  5171. messageSends: ["sort:", "<"]
  5172. }),
  5173. $globals.Array);
  5174. $core.addMethod(
  5175. $core.method({
  5176. selector: "sort:",
  5177. protocol: "enumerating",
  5178. fn: function (aBlock){
  5179. var self=this,$self=this;
  5180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5181. return $core.withContext(function($ctx1) {
  5182. //>>excludeEnd("ctx");
  5183. return self.sort(function(a, b) {
  5184. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  5185. })
  5186. ;
  5187. return self;
  5188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5189. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  5190. //>>excludeEnd("ctx");
  5191. },
  5192. //>>excludeStart("ide", pragmas.excludeIdeData);
  5193. args: ["aBlock"],
  5194. source: "sort: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09return self.sort(function(a, b) {\x0a\x09\x09\x09if(aBlock._value_value_(a,b)) {return -1} else {return 1}\x0a\x09\x09})\x0a\x09'>",
  5195. referencedClasses: [],
  5196. //>>excludeEnd("ide");
  5197. messageSends: []
  5198. }),
  5199. $globals.Array);
  5200. $core.addMethod(
  5201. $core.method({
  5202. selector: "sorted",
  5203. protocol: "enumerating",
  5204. fn: function (){
  5205. var self=this,$self=this;
  5206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5207. return $core.withContext(function($ctx1) {
  5208. //>>excludeEnd("ctx");
  5209. return $recv($self._copy())._sort();
  5210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5211. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  5212. //>>excludeEnd("ctx");
  5213. },
  5214. //>>excludeStart("ide", pragmas.excludeIdeData);
  5215. args: [],
  5216. source: "sorted\x0a\x09^ self copy sort",
  5217. referencedClasses: [],
  5218. //>>excludeEnd("ide");
  5219. messageSends: ["sort", "copy"]
  5220. }),
  5221. $globals.Array);
  5222. $core.addMethod(
  5223. $core.method({
  5224. selector: "sorted:",
  5225. protocol: "enumerating",
  5226. fn: function (aBlock){
  5227. var self=this,$self=this;
  5228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5229. return $core.withContext(function($ctx1) {
  5230. //>>excludeEnd("ctx");
  5231. return $recv($self._copy())._sort_(aBlock);
  5232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5233. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  5234. //>>excludeEnd("ctx");
  5235. },
  5236. //>>excludeStart("ide", pragmas.excludeIdeData);
  5237. args: ["aBlock"],
  5238. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  5239. referencedClasses: [],
  5240. //>>excludeEnd("ide");
  5241. messageSends: ["sort:", "copy"]
  5242. }),
  5243. $globals.Array);
  5244. $core.addMethod(
  5245. $core.method({
  5246. selector: "new:",
  5247. protocol: "instance creation",
  5248. fn: function (anInteger){
  5249. var self=this,$self=this;
  5250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5251. return $core.withContext(function($ctx1) {
  5252. //>>excludeEnd("ctx");
  5253. return new Array(anInteger);
  5254. return self;
  5255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5256. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.a$cls)});
  5257. //>>excludeEnd("ctx");
  5258. },
  5259. //>>excludeStart("ide", pragmas.excludeIdeData);
  5260. args: ["anInteger"],
  5261. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  5262. referencedClasses: [],
  5263. //>>excludeEnd("ide");
  5264. messageSends: []
  5265. }),
  5266. $globals.Array.a$cls);
  5267. $core.addMethod(
  5268. $core.method({
  5269. selector: "with:",
  5270. protocol: "instance creation",
  5271. fn: function (anObject){
  5272. var self=this,$self=this;
  5273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5274. return $core.withContext(function($ctx1) {
  5275. //>>excludeEnd("ctx");
  5276. var $1;
  5277. $1=$self._new_((1));
  5278. $recv($1)._at_put_((1),anObject);
  5279. return $recv($1)._yourself();
  5280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5281. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.a$cls)});
  5282. //>>excludeEnd("ctx");
  5283. },
  5284. //>>excludeStart("ide", pragmas.excludeIdeData);
  5285. args: ["anObject"],
  5286. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  5287. referencedClasses: [],
  5288. //>>excludeEnd("ide");
  5289. messageSends: ["at:put:", "new:", "yourself"]
  5290. }),
  5291. $globals.Array.a$cls);
  5292. $core.addMethod(
  5293. $core.method({
  5294. selector: "with:with:",
  5295. protocol: "instance creation",
  5296. fn: function (anObject,anObject2){
  5297. var self=this,$self=this;
  5298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5299. return $core.withContext(function($ctx1) {
  5300. //>>excludeEnd("ctx");
  5301. var $1;
  5302. $1=$self._new_((2));
  5303. $recv($1)._at_put_((1),anObject);
  5304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5305. $ctx1.sendIdx["at:put:"]=1;
  5306. //>>excludeEnd("ctx");
  5307. $recv($1)._at_put_((2),anObject2);
  5308. return $recv($1)._yourself();
  5309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5310. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.a$cls)});
  5311. //>>excludeEnd("ctx");
  5312. },
  5313. //>>excludeStart("ide", pragmas.excludeIdeData);
  5314. args: ["anObject", "anObject2"],
  5315. source: "with: anObject with: anObject2\x0a\x09\x09^ (self new: 2)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09yourself",
  5316. referencedClasses: [],
  5317. //>>excludeEnd("ide");
  5318. messageSends: ["at:put:", "new:", "yourself"]
  5319. }),
  5320. $globals.Array.a$cls);
  5321. $core.addMethod(
  5322. $core.method({
  5323. selector: "with:with:with:",
  5324. protocol: "instance creation",
  5325. fn: function (anObject,anObject2,anObject3){
  5326. var self=this,$self=this;
  5327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5328. return $core.withContext(function($ctx1) {
  5329. //>>excludeEnd("ctx");
  5330. var $1;
  5331. $1=$self._new_((3));
  5332. $recv($1)._at_put_((1),anObject);
  5333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5334. $ctx1.sendIdx["at:put:"]=1;
  5335. //>>excludeEnd("ctx");
  5336. $recv($1)._at_put_((2),anObject2);
  5337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5338. $ctx1.sendIdx["at:put:"]=2;
  5339. //>>excludeEnd("ctx");
  5340. $recv($1)._at_put_((3),anObject3);
  5341. return $recv($1)._yourself();
  5342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5343. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.a$cls)});
  5344. //>>excludeEnd("ctx");
  5345. },
  5346. //>>excludeStart("ide", pragmas.excludeIdeData);
  5347. args: ["anObject", "anObject2", "anObject3"],
  5348. source: "with: anObject with: anObject2 with: anObject3\x0a\x09\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",
  5349. referencedClasses: [],
  5350. //>>excludeEnd("ide");
  5351. messageSends: ["at:put:", "new:", "yourself"]
  5352. }),
  5353. $globals.Array.a$cls);
  5354. $core.addMethod(
  5355. $core.method({
  5356. selector: "withAll:",
  5357. protocol: "instance creation",
  5358. fn: function (aCollection){
  5359. var self=this,$self=this;
  5360. var instance,index;
  5361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5362. return $core.withContext(function($ctx1) {
  5363. //>>excludeEnd("ctx");
  5364. index=(1);
  5365. instance=$self._new_($recv(aCollection)._size());
  5366. $recv(aCollection)._do_((function(each){
  5367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5368. return $core.withContext(function($ctx2) {
  5369. //>>excludeEnd("ctx");
  5370. $recv(instance)._at_put_(index,each);
  5371. index=$recv(index).__plus((1));
  5372. return index;
  5373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5374. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5375. //>>excludeEnd("ctx");
  5376. }));
  5377. return instance;
  5378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5379. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.a$cls)});
  5380. //>>excludeEnd("ctx");
  5381. },
  5382. //>>excludeStart("ide", pragmas.excludeIdeData);
  5383. args: ["aCollection"],
  5384. 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",
  5385. referencedClasses: [],
  5386. //>>excludeEnd("ide");
  5387. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  5388. }),
  5389. $globals.Array.a$cls);
  5390. $core.addClass("CharacterArray", $globals.SequenceableCollection, [], "Kernel-Collections");
  5391. //>>excludeStart("ide", pragmas.excludeIdeData);
  5392. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  5393. //>>excludeEnd("ide");
  5394. $core.addMethod(
  5395. $core.method({
  5396. selector: ",",
  5397. protocol: "copying",
  5398. fn: function (aString){
  5399. var self=this,$self=this;
  5400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5401. return $core.withContext(function($ctx1) {
  5402. //>>excludeEnd("ctx");
  5403. var $1;
  5404. $1=$self._asString();
  5405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5406. $ctx1.sendIdx["asString"]=1;
  5407. //>>excludeEnd("ctx");
  5408. return $recv($1).__comma($recv(aString)._asString());
  5409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5410. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  5411. //>>excludeEnd("ctx");
  5412. },
  5413. //>>excludeStart("ide", pragmas.excludeIdeData);
  5414. args: ["aString"],
  5415. source: ", aString\x0a\x09^ self asString, aString asString",
  5416. referencedClasses: [],
  5417. //>>excludeEnd("ide");
  5418. messageSends: [",", "asString"]
  5419. }),
  5420. $globals.CharacterArray);
  5421. $core.addMethod(
  5422. $core.method({
  5423. selector: "add:",
  5424. protocol: "adding/removing",
  5425. fn: function (anObject){
  5426. var self=this,$self=this;
  5427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5428. return $core.withContext(function($ctx1) {
  5429. //>>excludeEnd("ctx");
  5430. $self._errorReadOnly();
  5431. return self;
  5432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5433. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  5434. //>>excludeEnd("ctx");
  5435. },
  5436. //>>excludeStart("ide", pragmas.excludeIdeData);
  5437. args: ["anObject"],
  5438. source: "add: anObject\x0a\x09self errorReadOnly",
  5439. referencedClasses: [],
  5440. //>>excludeEnd("ide");
  5441. messageSends: ["errorReadOnly"]
  5442. }),
  5443. $globals.CharacterArray);
  5444. $core.addMethod(
  5445. $core.method({
  5446. selector: "asLowercase",
  5447. protocol: "converting",
  5448. fn: function (){
  5449. var self=this,$self=this;
  5450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5451. return $core.withContext(function($ctx1) {
  5452. //>>excludeEnd("ctx");
  5453. return $recv($self._class())._fromString_($recv($self._asString())._asLowercase());
  5454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5455. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  5456. //>>excludeEnd("ctx");
  5457. },
  5458. //>>excludeStart("ide", pragmas.excludeIdeData);
  5459. args: [],
  5460. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  5461. referencedClasses: [],
  5462. //>>excludeEnd("ide");
  5463. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  5464. }),
  5465. $globals.CharacterArray);
  5466. $core.addMethod(
  5467. $core.method({
  5468. selector: "asNumber",
  5469. protocol: "converting",
  5470. fn: function (){
  5471. var self=this,$self=this;
  5472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5473. return $core.withContext(function($ctx1) {
  5474. //>>excludeEnd("ctx");
  5475. return $recv($self._asString())._asNumber();
  5476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5477. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  5478. //>>excludeEnd("ctx");
  5479. },
  5480. //>>excludeStart("ide", pragmas.excludeIdeData);
  5481. args: [],
  5482. source: "asNumber\x0a\x09^ self asString asNumber",
  5483. referencedClasses: [],
  5484. //>>excludeEnd("ide");
  5485. messageSends: ["asNumber", "asString"]
  5486. }),
  5487. $globals.CharacterArray);
  5488. $core.addMethod(
  5489. $core.method({
  5490. selector: "asString",
  5491. protocol: "converting",
  5492. fn: function (){
  5493. var self=this,$self=this;
  5494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5495. return $core.withContext(function($ctx1) {
  5496. //>>excludeEnd("ctx");
  5497. return $self._subclassResponsibility();
  5498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5499. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  5500. //>>excludeEnd("ctx");
  5501. },
  5502. //>>excludeStart("ide", pragmas.excludeIdeData);
  5503. args: [],
  5504. source: "asString\x0a\x09^ self subclassResponsibility",
  5505. referencedClasses: [],
  5506. //>>excludeEnd("ide");
  5507. messageSends: ["subclassResponsibility"]
  5508. }),
  5509. $globals.CharacterArray);
  5510. $core.addMethod(
  5511. $core.method({
  5512. selector: "asSymbol",
  5513. protocol: "converting",
  5514. fn: function (){
  5515. var self=this,$self=this;
  5516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5517. return $core.withContext(function($ctx1) {
  5518. //>>excludeEnd("ctx");
  5519. return $self._asString();
  5520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5521. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  5522. //>>excludeEnd("ctx");
  5523. },
  5524. //>>excludeStart("ide", pragmas.excludeIdeData);
  5525. args: [],
  5526. source: "asSymbol\x0a\x09^ self asString",
  5527. referencedClasses: [],
  5528. //>>excludeEnd("ide");
  5529. messageSends: ["asString"]
  5530. }),
  5531. $globals.CharacterArray);
  5532. $core.addMethod(
  5533. $core.method({
  5534. selector: "asSymbolPrintOn:",
  5535. protocol: "printing",
  5536. fn: function (aStream){
  5537. var self=this,$self=this;
  5538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5539. return $core.withContext(function($ctx1) {
  5540. //>>excludeEnd("ctx");
  5541. var $1;
  5542. $recv(aStream)._nextPutAll_("#");
  5543. $1=$recv($self._asString())._isSelector();
  5544. if($core.assert($1)){
  5545. $recv(aStream)._nextPut_(self);
  5546. } else {
  5547. $self._printOn_(aStream);
  5548. }
  5549. return self;
  5550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5551. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.CharacterArray)});
  5552. //>>excludeEnd("ctx");
  5553. },
  5554. //>>excludeStart("ide", pragmas.excludeIdeData);
  5555. args: ["aStream"],
  5556. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  5557. referencedClasses: [],
  5558. //>>excludeEnd("ide");
  5559. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  5560. }),
  5561. $globals.CharacterArray);
  5562. $core.addMethod(
  5563. $core.method({
  5564. selector: "asUppercase",
  5565. protocol: "converting",
  5566. fn: function (){
  5567. var self=this,$self=this;
  5568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5569. return $core.withContext(function($ctx1) {
  5570. //>>excludeEnd("ctx");
  5571. return $recv($self._class())._fromString_($recv($self._asString())._asUppercase());
  5572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5573. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  5574. //>>excludeEnd("ctx");
  5575. },
  5576. //>>excludeStart("ide", pragmas.excludeIdeData);
  5577. args: [],
  5578. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  5579. referencedClasses: [],
  5580. //>>excludeEnd("ide");
  5581. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  5582. }),
  5583. $globals.CharacterArray);
  5584. $core.addMethod(
  5585. $core.method({
  5586. selector: "at:put:",
  5587. protocol: "accessing",
  5588. fn: function (anIndex,anObject){
  5589. var self=this,$self=this;
  5590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5591. return $core.withContext(function($ctx1) {
  5592. //>>excludeEnd("ctx");
  5593. $self._errorReadOnly();
  5594. return self;
  5595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5596. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  5597. //>>excludeEnd("ctx");
  5598. },
  5599. //>>excludeStart("ide", pragmas.excludeIdeData);
  5600. args: ["anIndex", "anObject"],
  5601. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5602. referencedClasses: [],
  5603. //>>excludeEnd("ide");
  5604. messageSends: ["errorReadOnly"]
  5605. }),
  5606. $globals.CharacterArray);
  5607. $core.addMethod(
  5608. $core.method({
  5609. selector: "errorReadOnly",
  5610. protocol: "error handling",
  5611. fn: function (){
  5612. var self=this,$self=this;
  5613. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5614. return $core.withContext(function($ctx1) {
  5615. //>>excludeEnd("ctx");
  5616. $self._error_("Object is read-only");
  5617. return self;
  5618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5619. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  5620. //>>excludeEnd("ctx");
  5621. },
  5622. //>>excludeStart("ide", pragmas.excludeIdeData);
  5623. args: [],
  5624. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5625. referencedClasses: [],
  5626. //>>excludeEnd("ide");
  5627. messageSends: ["error:"]
  5628. }),
  5629. $globals.CharacterArray);
  5630. $core.addMethod(
  5631. $core.method({
  5632. selector: "printOn:",
  5633. protocol: "printing",
  5634. fn: function (aStream){
  5635. var self=this,$self=this;
  5636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5637. return $core.withContext(function($ctx1) {
  5638. //>>excludeEnd("ctx");
  5639. $recv($self._asString())._printOn_(aStream);
  5640. return self;
  5641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5642. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  5643. //>>excludeEnd("ctx");
  5644. },
  5645. //>>excludeStart("ide", pragmas.excludeIdeData);
  5646. args: ["aStream"],
  5647. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  5648. referencedClasses: [],
  5649. //>>excludeEnd("ide");
  5650. messageSends: ["printOn:", "asString"]
  5651. }),
  5652. $globals.CharacterArray);
  5653. $core.addMethod(
  5654. $core.method({
  5655. selector: "putOn:",
  5656. protocol: "streaming",
  5657. fn: function (aStream){
  5658. var self=this,$self=this;
  5659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5660. return $core.withContext(function($ctx1) {
  5661. //>>excludeEnd("ctx");
  5662. $recv(aStream)._nextPutString_(self);
  5663. return self;
  5664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5665. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  5666. //>>excludeEnd("ctx");
  5667. },
  5668. //>>excludeStart("ide", pragmas.excludeIdeData);
  5669. args: ["aStream"],
  5670. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  5671. referencedClasses: [],
  5672. //>>excludeEnd("ide");
  5673. messageSends: ["nextPutString:"]
  5674. }),
  5675. $globals.CharacterArray);
  5676. $core.addMethod(
  5677. $core.method({
  5678. selector: "remove:",
  5679. protocol: "adding/removing",
  5680. fn: function (anObject){
  5681. var self=this,$self=this;
  5682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5683. return $core.withContext(function($ctx1) {
  5684. //>>excludeEnd("ctx");
  5685. $self._errorReadOnly();
  5686. return self;
  5687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5688. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  5689. //>>excludeEnd("ctx");
  5690. },
  5691. //>>excludeStart("ide", pragmas.excludeIdeData);
  5692. args: ["anObject"],
  5693. source: "remove: anObject\x0a\x09self errorReadOnly",
  5694. referencedClasses: [],
  5695. //>>excludeEnd("ide");
  5696. messageSends: ["errorReadOnly"]
  5697. }),
  5698. $globals.CharacterArray);
  5699. $core.addMethod(
  5700. $core.method({
  5701. selector: "remove:ifAbsent:",
  5702. protocol: "adding/removing",
  5703. fn: function (anObject,aBlock){
  5704. var self=this,$self=this;
  5705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5706. return $core.withContext(function($ctx1) {
  5707. //>>excludeEnd("ctx");
  5708. $self._errorReadOnly();
  5709. return self;
  5710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5711. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.CharacterArray)});
  5712. //>>excludeEnd("ctx");
  5713. },
  5714. //>>excludeStart("ide", pragmas.excludeIdeData);
  5715. args: ["anObject", "aBlock"],
  5716. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  5717. referencedClasses: [],
  5718. //>>excludeEnd("ide");
  5719. messageSends: ["errorReadOnly"]
  5720. }),
  5721. $globals.CharacterArray);
  5722. $core.addMethod(
  5723. $core.method({
  5724. selector: "symbolPrintString",
  5725. protocol: "printing",
  5726. fn: function (){
  5727. var self=this,$self=this;
  5728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5729. return $core.withContext(function($ctx1) {
  5730. //>>excludeEnd("ctx");
  5731. return $recv($globals.String)._streamContents_((function(str){
  5732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5733. return $core.withContext(function($ctx2) {
  5734. //>>excludeEnd("ctx");
  5735. return $self._asSymbolPrintOn_(str);
  5736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5737. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  5738. //>>excludeEnd("ctx");
  5739. }));
  5740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5741. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.CharacterArray)});
  5742. //>>excludeEnd("ctx");
  5743. },
  5744. //>>excludeStart("ide", pragmas.excludeIdeData);
  5745. args: [],
  5746. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  5747. referencedClasses: ["String"],
  5748. //>>excludeEnd("ide");
  5749. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  5750. }),
  5751. $globals.CharacterArray);
  5752. $core.addMethod(
  5753. $core.method({
  5754. selector: "fromString:",
  5755. protocol: "instance creation",
  5756. fn: function (aString){
  5757. var self=this,$self=this;
  5758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5759. return $core.withContext(function($ctx1) {
  5760. //>>excludeEnd("ctx");
  5761. $self._subclassResponsibility();
  5762. return self;
  5763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5764. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.a$cls)});
  5765. //>>excludeEnd("ctx");
  5766. },
  5767. //>>excludeStart("ide", pragmas.excludeIdeData);
  5768. args: ["aString"],
  5769. source: "fromString: aString\x0a\x09self subclassResponsibility",
  5770. referencedClasses: [],
  5771. //>>excludeEnd("ide");
  5772. messageSends: ["subclassResponsibility"]
  5773. }),
  5774. $globals.CharacterArray.a$cls);
  5775. $core.addClass("String", $globals.CharacterArray, [], "Kernel-Collections");
  5776. //>>excludeStart("ide", pragmas.excludeIdeData);
  5777. $globals.String.comment="I am an indexed collection of Characters. Unlike most Smalltalk dialects, Amber doesn't provide the Character class. Instead, elements of a String are single character strings.\x0a\x0aString inherits many useful methods from its hierarchy, such as\x0a\x09`Collection >> #,`";
  5778. //>>excludeEnd("ide");
  5779. $core.addMethod(
  5780. $core.method({
  5781. selector: ",",
  5782. protocol: "copying",
  5783. fn: function (aString){
  5784. var self=this,$self=this;
  5785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5786. return $core.withContext(function($ctx1) {
  5787. //>>excludeEnd("ctx");
  5788. return String(self) + aString;
  5789. return self;
  5790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5791. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  5792. //>>excludeEnd("ctx");
  5793. },
  5794. //>>excludeStart("ide", pragmas.excludeIdeData);
  5795. args: ["aString"],
  5796. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  5797. referencedClasses: [],
  5798. //>>excludeEnd("ide");
  5799. messageSends: []
  5800. }),
  5801. $globals.String);
  5802. $core.addMethod(
  5803. $core.method({
  5804. selector: "<",
  5805. protocol: "comparing",
  5806. fn: function (aString){
  5807. var self=this,$self=this;
  5808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5809. return $core.withContext(function($ctx1) {
  5810. //>>excludeEnd("ctx");
  5811. return String(self) < aString._asString();
  5812. return self;
  5813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5814. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  5815. //>>excludeEnd("ctx");
  5816. },
  5817. //>>excludeStart("ide", pragmas.excludeIdeData);
  5818. args: ["aString"],
  5819. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  5820. referencedClasses: [],
  5821. //>>excludeEnd("ide");
  5822. messageSends: []
  5823. }),
  5824. $globals.String);
  5825. $core.addMethod(
  5826. $core.method({
  5827. selector: "<=",
  5828. protocol: "comparing",
  5829. fn: function (aString){
  5830. var self=this,$self=this;
  5831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5832. return $core.withContext(function($ctx1) {
  5833. //>>excludeEnd("ctx");
  5834. return String(self) <= aString._asString();
  5835. return self;
  5836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5837. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  5838. //>>excludeEnd("ctx");
  5839. },
  5840. //>>excludeStart("ide", pragmas.excludeIdeData);
  5841. args: ["aString"],
  5842. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  5843. referencedClasses: [],
  5844. //>>excludeEnd("ide");
  5845. messageSends: []
  5846. }),
  5847. $globals.String);
  5848. $core.addMethod(
  5849. $core.method({
  5850. selector: "=",
  5851. protocol: "comparing",
  5852. fn: function (aString){
  5853. var self=this,$self=this;
  5854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5855. return $core.withContext(function($ctx1) {
  5856. //>>excludeEnd("ctx");
  5857. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  5858. return self;
  5859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5860. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  5861. //>>excludeEnd("ctx");
  5862. },
  5863. //>>excludeStart("ide", pragmas.excludeIdeData);
  5864. args: ["aString"],
  5865. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  5866. referencedClasses: [],
  5867. //>>excludeEnd("ide");
  5868. messageSends: []
  5869. }),
  5870. $globals.String);
  5871. $core.addMethod(
  5872. $core.method({
  5873. selector: "==",
  5874. protocol: "comparing",
  5875. fn: function (aString){
  5876. var self=this,$self=this;
  5877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5878. return $core.withContext(function($ctx1) {
  5879. //>>excludeEnd("ctx");
  5880. if (typeof aString === "string") return String(self) === aString;
  5881. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  5882. else return false;;
  5883. return self;
  5884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5885. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  5886. //>>excludeEnd("ctx");
  5887. },
  5888. //>>excludeStart("ide", pragmas.excludeIdeData);
  5889. args: ["aString"],
  5890. source: "== aString\x0a<inlineJS: '\x0a\x09if (typeof aString === \x22string\x22) return String(self) === aString;\x0a\x09else if (aString != null && typeof aString === \x22object\x22) return String(self) === aString.valueOf();\x0a\x09else return false;\x0a'>",
  5891. referencedClasses: [],
  5892. //>>excludeEnd("ide");
  5893. messageSends: []
  5894. }),
  5895. $globals.String);
  5896. $core.addMethod(
  5897. $core.method({
  5898. selector: ">",
  5899. protocol: "comparing",
  5900. fn: function (aString){
  5901. var self=this,$self=this;
  5902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5903. return $core.withContext(function($ctx1) {
  5904. //>>excludeEnd("ctx");
  5905. return String(self) > aString._asString();
  5906. return self;
  5907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5908. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  5909. //>>excludeEnd("ctx");
  5910. },
  5911. //>>excludeStart("ide", pragmas.excludeIdeData);
  5912. args: ["aString"],
  5913. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  5914. referencedClasses: [],
  5915. //>>excludeEnd("ide");
  5916. messageSends: []
  5917. }),
  5918. $globals.String);
  5919. $core.addMethod(
  5920. $core.method({
  5921. selector: ">=",
  5922. protocol: "comparing",
  5923. fn: function (aString){
  5924. var self=this,$self=this;
  5925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5926. return $core.withContext(function($ctx1) {
  5927. //>>excludeEnd("ctx");
  5928. return String(self) >= aString._asString();
  5929. return self;
  5930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5931. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  5932. //>>excludeEnd("ctx");
  5933. },
  5934. //>>excludeStart("ide", pragmas.excludeIdeData);
  5935. args: ["aString"],
  5936. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  5937. referencedClasses: [],
  5938. //>>excludeEnd("ide");
  5939. messageSends: []
  5940. }),
  5941. $globals.String);
  5942. $core.addMethod(
  5943. $core.method({
  5944. selector: "asJavaScriptMethodName",
  5945. protocol: "converting",
  5946. fn: function (){
  5947. var self=this,$self=this;
  5948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5949. return $core.withContext(function($ctx1) {
  5950. //>>excludeEnd("ctx");
  5951. return $core.st2js(self);
  5952. return self;
  5953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5954. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  5955. //>>excludeEnd("ctx");
  5956. },
  5957. //>>excludeStart("ide", pragmas.excludeIdeData);
  5958. args: [],
  5959. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  5960. referencedClasses: [],
  5961. //>>excludeEnd("ide");
  5962. messageSends: []
  5963. }),
  5964. $globals.String);
  5965. $core.addMethod(
  5966. $core.method({
  5967. selector: "asJavaScriptObject",
  5968. protocol: "converting",
  5969. fn: function (){
  5970. var self=this,$self=this;
  5971. return self;
  5972. },
  5973. //>>excludeStart("ide", pragmas.excludeIdeData);
  5974. args: [],
  5975. source: "asJavaScriptObject\x0a\x09^ self",
  5976. referencedClasses: [],
  5977. //>>excludeEnd("ide");
  5978. messageSends: []
  5979. }),
  5980. $globals.String);
  5981. $core.addMethod(
  5982. $core.method({
  5983. selector: "asJavaScriptSource",
  5984. protocol: "converting",
  5985. fn: function (){
  5986. var self=this,$self=this;
  5987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5988. return $core.withContext(function($ctx1) {
  5989. //>>excludeEnd("ctx");
  5990. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5991. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5992. else
  5993. return "\"" + self + "\"";
  5994. ;
  5995. return self;
  5996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5997. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  5998. //>>excludeEnd("ctx");
  5999. },
  6000. //>>excludeStart("ide", pragmas.excludeIdeData);
  6001. args: [],
  6002. source: "asJavaScriptSource\x0a\x09<inlineJS: '\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'>",
  6003. referencedClasses: [],
  6004. //>>excludeEnd("ide");
  6005. messageSends: []
  6006. }),
  6007. $globals.String);
  6008. $core.addMethod(
  6009. $core.method({
  6010. selector: "asLowercase",
  6011. protocol: "converting",
  6012. fn: function (){
  6013. var self=this,$self=this;
  6014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6015. return $core.withContext(function($ctx1) {
  6016. //>>excludeEnd("ctx");
  6017. return self.toLowerCase();
  6018. return self;
  6019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6020. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  6021. //>>excludeEnd("ctx");
  6022. },
  6023. //>>excludeStart("ide", pragmas.excludeIdeData);
  6024. args: [],
  6025. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  6026. referencedClasses: [],
  6027. //>>excludeEnd("ide");
  6028. messageSends: []
  6029. }),
  6030. $globals.String);
  6031. $core.addMethod(
  6032. $core.method({
  6033. selector: "asMutator",
  6034. protocol: "converting",
  6035. fn: function (){
  6036. var self=this,$self=this;
  6037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6038. return $core.withContext(function($ctx1) {
  6039. //>>excludeEnd("ctx");
  6040. var $1;
  6041. $1=$recv($self._last()).__eq(":");
  6042. if(!$core.assert($1)){
  6043. return $self.__comma(":");
  6044. }
  6045. return self;
  6046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6047. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  6048. //>>excludeEnd("ctx");
  6049. },
  6050. //>>excludeStart("ide", pragmas.excludeIdeData);
  6051. args: [],
  6052. source: "asMutator\x0a\x09\x22Answer a setter selector. For example,\x0a\x09#name asMutator returns #name:\x22\x0a\x0a\x09self last = ':' ifFalse: [ ^ self, ':' ].\x0a\x09^ self",
  6053. referencedClasses: [],
  6054. //>>excludeEnd("ide");
  6055. messageSends: ["ifFalse:", "=", "last", ","]
  6056. }),
  6057. $globals.String);
  6058. $core.addMethod(
  6059. $core.method({
  6060. selector: "asNumber",
  6061. protocol: "converting",
  6062. fn: function (){
  6063. var self=this,$self=this;
  6064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6065. return $core.withContext(function($ctx1) {
  6066. //>>excludeEnd("ctx");
  6067. return Number(self);
  6068. return self;
  6069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6070. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  6071. //>>excludeEnd("ctx");
  6072. },
  6073. //>>excludeStart("ide", pragmas.excludeIdeData);
  6074. args: [],
  6075. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  6076. referencedClasses: [],
  6077. //>>excludeEnd("ide");
  6078. messageSends: []
  6079. }),
  6080. $globals.String);
  6081. $core.addMethod(
  6082. $core.method({
  6083. selector: "asRegexp",
  6084. protocol: "converting",
  6085. fn: function (){
  6086. var self=this,$self=this;
  6087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6088. return $core.withContext(function($ctx1) {
  6089. //>>excludeEnd("ctx");
  6090. return $recv($globals.RegularExpression)._fromString_(self);
  6091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6092. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  6093. //>>excludeEnd("ctx");
  6094. },
  6095. //>>excludeStart("ide", pragmas.excludeIdeData);
  6096. args: [],
  6097. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  6098. referencedClasses: ["RegularExpression"],
  6099. //>>excludeEnd("ide");
  6100. messageSends: ["fromString:"]
  6101. }),
  6102. $globals.String);
  6103. $core.addMethod(
  6104. $core.method({
  6105. selector: "asString",
  6106. protocol: "converting",
  6107. fn: function (){
  6108. var self=this,$self=this;
  6109. return self;
  6110. },
  6111. //>>excludeStart("ide", pragmas.excludeIdeData);
  6112. args: [],
  6113. source: "asString\x0a\x09^ self",
  6114. referencedClasses: [],
  6115. //>>excludeEnd("ide");
  6116. messageSends: []
  6117. }),
  6118. $globals.String);
  6119. $core.addMethod(
  6120. $core.method({
  6121. selector: "asSymbol",
  6122. protocol: "converting",
  6123. fn: function (){
  6124. var self=this,$self=this;
  6125. return self;
  6126. },
  6127. //>>excludeStart("ide", pragmas.excludeIdeData);
  6128. args: [],
  6129. source: "asSymbol\x0a\x09^ self",
  6130. referencedClasses: [],
  6131. //>>excludeEnd("ide");
  6132. messageSends: []
  6133. }),
  6134. $globals.String);
  6135. $core.addMethod(
  6136. $core.method({
  6137. selector: "asUppercase",
  6138. protocol: "converting",
  6139. fn: function (){
  6140. var self=this,$self=this;
  6141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6142. return $core.withContext(function($ctx1) {
  6143. //>>excludeEnd("ctx");
  6144. return self.toUpperCase();
  6145. return self;
  6146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6147. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  6148. //>>excludeEnd("ctx");
  6149. },
  6150. //>>excludeStart("ide", pragmas.excludeIdeData);
  6151. args: [],
  6152. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  6153. referencedClasses: [],
  6154. //>>excludeEnd("ide");
  6155. messageSends: []
  6156. }),
  6157. $globals.String);
  6158. $core.addMethod(
  6159. $core.method({
  6160. selector: "asciiValue",
  6161. protocol: "accessing",
  6162. fn: function (){
  6163. var self=this,$self=this;
  6164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6165. return $core.withContext(function($ctx1) {
  6166. //>>excludeEnd("ctx");
  6167. return self.charCodeAt(0);;
  6168. return self;
  6169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6170. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  6171. //>>excludeEnd("ctx");
  6172. },
  6173. //>>excludeStart("ide", pragmas.excludeIdeData);
  6174. args: [],
  6175. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  6176. referencedClasses: [],
  6177. //>>excludeEnd("ide");
  6178. messageSends: []
  6179. }),
  6180. $globals.String);
  6181. $core.addMethod(
  6182. $core.method({
  6183. selector: "at:ifAbsent:",
  6184. protocol: "accessing",
  6185. fn: function (anIndex,aBlock){
  6186. var self=this,$self=this;
  6187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6188. return $core.withContext(function($ctx1) {
  6189. //>>excludeEnd("ctx");
  6190. return String(self)[anIndex - 1] || aBlock._value();
  6191. return self;
  6192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6193. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  6194. //>>excludeEnd("ctx");
  6195. },
  6196. //>>excludeStart("ide", pragmas.excludeIdeData);
  6197. args: ["anIndex", "aBlock"],
  6198. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  6199. referencedClasses: [],
  6200. //>>excludeEnd("ide");
  6201. messageSends: []
  6202. }),
  6203. $globals.String);
  6204. $core.addMethod(
  6205. $core.method({
  6206. selector: "at:ifPresent:ifAbsent:",
  6207. protocol: "accessing",
  6208. fn: function (anIndex,aBlock,anotherBlock){
  6209. var self=this,$self=this;
  6210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6211. return $core.withContext(function($ctx1) {
  6212. //>>excludeEnd("ctx");
  6213. var result = String(self)[anIndex - 1];
  6214. return result ? aBlock._value_(result) : anotherBlock._value();
  6215. ;
  6216. return self;
  6217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6218. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  6219. //>>excludeEnd("ctx");
  6220. },
  6221. //>>excludeStart("ide", pragmas.excludeIdeData);
  6222. args: ["anIndex", "aBlock", "anotherBlock"],
  6223. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09'>",
  6224. referencedClasses: [],
  6225. //>>excludeEnd("ide");
  6226. messageSends: []
  6227. }),
  6228. $globals.String);
  6229. $core.addMethod(
  6230. $core.method({
  6231. selector: "capitalized",
  6232. protocol: "converting",
  6233. fn: function (){
  6234. var self=this,$self=this;
  6235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6236. return $core.withContext(function($ctx1) {
  6237. //>>excludeEnd("ctx");
  6238. return $self._ifNotEmpty_((function(){
  6239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6240. return $core.withContext(function($ctx2) {
  6241. //>>excludeEnd("ctx");
  6242. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  6243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6244. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6245. //>>excludeEnd("ctx");
  6246. }));
  6247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6248. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  6249. //>>excludeEnd("ctx");
  6250. },
  6251. //>>excludeStart("ide", pragmas.excludeIdeData);
  6252. args: [],
  6253. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  6254. referencedClasses: [],
  6255. //>>excludeEnd("ide");
  6256. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  6257. }),
  6258. $globals.String);
  6259. $core.addMethod(
  6260. $core.method({
  6261. selector: "charCodeAt:",
  6262. protocol: "accessing",
  6263. fn: function (anInteger){
  6264. var self=this,$self=this;
  6265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6266. return $core.withContext(function($ctx1) {
  6267. //>>excludeEnd("ctx");
  6268. return self.charCodeAt(anInteger - 1);
  6269. return self;
  6270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6271. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  6272. //>>excludeEnd("ctx");
  6273. },
  6274. //>>excludeStart("ide", pragmas.excludeIdeData);
  6275. args: ["anInteger"],
  6276. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  6277. referencedClasses: [],
  6278. //>>excludeEnd("ide");
  6279. messageSends: []
  6280. }),
  6281. $globals.String);
  6282. $core.addMethod(
  6283. $core.method({
  6284. selector: "copyFrom:to:",
  6285. protocol: "copying",
  6286. fn: function (anIndex,anotherIndex){
  6287. var self=this,$self=this;
  6288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6289. return $core.withContext(function($ctx1) {
  6290. //>>excludeEnd("ctx");
  6291. return self.substring(anIndex - 1, anotherIndex);
  6292. return self;
  6293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6294. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  6295. //>>excludeEnd("ctx");
  6296. },
  6297. //>>excludeStart("ide", pragmas.excludeIdeData);
  6298. args: ["anIndex", "anotherIndex"],
  6299. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  6300. referencedClasses: [],
  6301. //>>excludeEnd("ide");
  6302. messageSends: []
  6303. }),
  6304. $globals.String);
  6305. $core.addMethod(
  6306. $core.method({
  6307. selector: "crlfSanitized",
  6308. protocol: "converting",
  6309. fn: function (){
  6310. var self=this,$self=this;
  6311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6312. return $core.withContext(function($ctx1) {
  6313. //>>excludeEnd("ctx");
  6314. return $recv($self._lines())._join_($recv($globals.String)._lf());
  6315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6316. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  6317. //>>excludeEnd("ctx");
  6318. },
  6319. //>>excludeStart("ide", pragmas.excludeIdeData);
  6320. args: [],
  6321. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  6322. referencedClasses: ["String"],
  6323. //>>excludeEnd("ide");
  6324. messageSends: ["join:", "lines", "lf"]
  6325. }),
  6326. $globals.String);
  6327. $core.addMethod(
  6328. $core.method({
  6329. selector: "deepCopy",
  6330. protocol: "copying",
  6331. fn: function (){
  6332. var self=this,$self=this;
  6333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6334. return $core.withContext(function($ctx1) {
  6335. //>>excludeEnd("ctx");
  6336. return $self._shallowCopy();
  6337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6338. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  6339. //>>excludeEnd("ctx");
  6340. },
  6341. //>>excludeStart("ide", pragmas.excludeIdeData);
  6342. args: [],
  6343. source: "deepCopy\x0a\x09^ self shallowCopy",
  6344. referencedClasses: [],
  6345. //>>excludeEnd("ide");
  6346. messageSends: ["shallowCopy"]
  6347. }),
  6348. $globals.String);
  6349. $core.addMethod(
  6350. $core.method({
  6351. selector: "escaped",
  6352. protocol: "converting",
  6353. fn: function (){
  6354. var self=this,$self=this;
  6355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6356. return $core.withContext(function($ctx1) {
  6357. //>>excludeEnd("ctx");
  6358. return escape(self);
  6359. return self;
  6360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6361. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  6362. //>>excludeEnd("ctx");
  6363. },
  6364. //>>excludeStart("ide", pragmas.excludeIdeData);
  6365. args: [],
  6366. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  6367. referencedClasses: [],
  6368. //>>excludeEnd("ide");
  6369. messageSends: []
  6370. }),
  6371. $globals.String);
  6372. $core.addMethod(
  6373. $core.method({
  6374. selector: "includesSubString:",
  6375. protocol: "testing",
  6376. fn: function (subString){
  6377. var self=this,$self=this;
  6378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6379. return $core.withContext(function($ctx1) {
  6380. //>>excludeEnd("ctx");
  6381. return self.indexOf(subString) != -1;
  6382. return self;
  6383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6384. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  6385. //>>excludeEnd("ctx");
  6386. },
  6387. //>>excludeStart("ide", pragmas.excludeIdeData);
  6388. args: ["subString"],
  6389. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  6390. referencedClasses: [],
  6391. //>>excludeEnd("ide");
  6392. messageSends: []
  6393. }),
  6394. $globals.String);
  6395. $core.addMethod(
  6396. $core.method({
  6397. selector: "isCapitalized",
  6398. protocol: "testing",
  6399. fn: function (){
  6400. var self=this,$self=this;
  6401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6402. return $core.withContext(function($ctx1) {
  6403. //>>excludeEnd("ctx");
  6404. var $2,$1;
  6405. $2=$self._first();
  6406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6407. $ctx1.sendIdx["first"]=1;
  6408. //>>excludeEnd("ctx");
  6409. $1=$recv($2)._asUppercase();
  6410. return $recv($1).__eq_eq($self._first());
  6411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6412. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  6413. //>>excludeEnd("ctx");
  6414. },
  6415. //>>excludeStart("ide", pragmas.excludeIdeData);
  6416. args: [],
  6417. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  6418. referencedClasses: [],
  6419. //>>excludeEnd("ide");
  6420. messageSends: ["==", "asUppercase", "first"]
  6421. }),
  6422. $globals.String);
  6423. $core.addMethod(
  6424. $core.method({
  6425. selector: "isImmutable",
  6426. protocol: "testing",
  6427. fn: function (){
  6428. var self=this,$self=this;
  6429. return true;
  6430. },
  6431. //>>excludeStart("ide", pragmas.excludeIdeData);
  6432. args: [],
  6433. source: "isImmutable\x0a\x09^ true",
  6434. referencedClasses: [],
  6435. //>>excludeEnd("ide");
  6436. messageSends: []
  6437. }),
  6438. $globals.String);
  6439. $core.addMethod(
  6440. $core.method({
  6441. selector: "isSelector",
  6442. protocol: "testing",
  6443. fn: function (){
  6444. var self=this,$self=this;
  6445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6446. return $core.withContext(function($ctx1) {
  6447. //>>excludeEnd("ctx");
  6448. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  6449. return self;
  6450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6451. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  6452. //>>excludeEnd("ctx");
  6453. },
  6454. //>>excludeStart("ide", pragmas.excludeIdeData);
  6455. args: [],
  6456. source: "isSelector\x0a<inlineJS:\x0a\x09'return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\x5c\x5c+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\x5c:)+)$/)'\x0a>",
  6457. referencedClasses: [],
  6458. //>>excludeEnd("ide");
  6459. messageSends: []
  6460. }),
  6461. $globals.String);
  6462. $core.addMethod(
  6463. $core.method({
  6464. selector: "isString",
  6465. protocol: "testing",
  6466. fn: function (){
  6467. var self=this,$self=this;
  6468. return true;
  6469. },
  6470. //>>excludeStart("ide", pragmas.excludeIdeData);
  6471. args: [],
  6472. source: "isString\x0a\x09^ true",
  6473. referencedClasses: [],
  6474. //>>excludeEnd("ide");
  6475. messageSends: []
  6476. }),
  6477. $globals.String);
  6478. $core.addMethod(
  6479. $core.method({
  6480. selector: "isVowel",
  6481. protocol: "testing",
  6482. fn: function (){
  6483. var self=this,$self=this;
  6484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6485. return $core.withContext(function($ctx1) {
  6486. //>>excludeEnd("ctx");
  6487. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  6488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6489. return $core.withContext(function($ctx2) {
  6490. //>>excludeEnd("ctx");
  6491. return "aeiou"._includes_($self._asLowercase());
  6492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6493. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6494. //>>excludeEnd("ctx");
  6495. }));
  6496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6497. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  6498. //>>excludeEnd("ctx");
  6499. },
  6500. //>>excludeStart("ide", pragmas.excludeIdeData);
  6501. args: [],
  6502. source: "isVowel\x0a\x09\x22Answer true if the receiver is a one character string containing a voyel\x22\x0a\x09\x0a\x09^ self size = 1 and: [ 'aeiou' includes: self asLowercase ]",
  6503. referencedClasses: [],
  6504. //>>excludeEnd("ide");
  6505. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  6506. }),
  6507. $globals.String);
  6508. $core.addMethod(
  6509. $core.method({
  6510. selector: "join:",
  6511. protocol: "split join",
  6512. fn: function (aCollection){
  6513. var self=this,$self=this;
  6514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6515. return $core.withContext(function($ctx1) {
  6516. //>>excludeEnd("ctx");
  6517. return $recv($globals.String)._streamContents_((function(stream){
  6518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6519. return $core.withContext(function($ctx2) {
  6520. //>>excludeEnd("ctx");
  6521. return $recv(aCollection)._do_separatedBy_((function(each){
  6522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6523. return $core.withContext(function($ctx3) {
  6524. //>>excludeEnd("ctx");
  6525. return $recv(stream)._nextPutAll_($recv(each)._asString());
  6526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6527. $ctx3.sendIdx["nextPutAll:"]=1;
  6528. //>>excludeEnd("ctx");
  6529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6530. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6531. //>>excludeEnd("ctx");
  6532. }),(function(){
  6533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6534. return $core.withContext(function($ctx3) {
  6535. //>>excludeEnd("ctx");
  6536. return $recv(stream)._nextPutAll_(self);
  6537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6538. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6539. //>>excludeEnd("ctx");
  6540. }));
  6541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6542. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6543. //>>excludeEnd("ctx");
  6544. }));
  6545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6546. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  6547. //>>excludeEnd("ctx");
  6548. },
  6549. //>>excludeStart("ide", pragmas.excludeIdeData);
  6550. args: ["aCollection"],
  6551. 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 ]]",
  6552. referencedClasses: ["String"],
  6553. //>>excludeEnd("ide");
  6554. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  6555. }),
  6556. $globals.String);
  6557. $core.addMethod(
  6558. $core.method({
  6559. selector: "lineIndicesDo:",
  6560. protocol: "split join",
  6561. fn: function (aBlock){
  6562. var self=this,$self=this;
  6563. var cr,lf,start,sz,nextLF,nextCR;
  6564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6565. return $core.withContext(function($ctx1) {
  6566. //>>excludeEnd("ctx");
  6567. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  6568. var $early={};
  6569. try {
  6570. start=(1);
  6571. sz=$self._size();
  6572. cr=$recv($globals.String)._cr();
  6573. nextCR=$self._indexOf_startingAt_(cr,(1));
  6574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6575. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  6576. //>>excludeEnd("ctx");
  6577. lf=$recv($globals.String)._lf();
  6578. nextLF=$self._indexOf_startingAt_(lf,(1));
  6579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6580. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  6581. //>>excludeEnd("ctx");
  6582. $recv((function(){
  6583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6584. return $core.withContext(function($ctx2) {
  6585. //>>excludeEnd("ctx");
  6586. return $recv(start).__lt_eq(sz);
  6587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6588. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6589. //>>excludeEnd("ctx");
  6590. }))._whileTrue_((function(){
  6591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6592. return $core.withContext(function($ctx2) {
  6593. //>>excludeEnd("ctx");
  6594. $2=$recv(nextLF).__eq((0));
  6595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6596. $ctx2.sendIdx["="]=1;
  6597. //>>excludeEnd("ctx");
  6598. $1=$recv($2)._and_((function(){
  6599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6600. return $core.withContext(function($ctx3) {
  6601. //>>excludeEnd("ctx");
  6602. return $recv(nextCR).__eq((0));
  6603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6604. $ctx3.sendIdx["="]=2;
  6605. //>>excludeEnd("ctx");
  6606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6607. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6608. //>>excludeEnd("ctx");
  6609. }));
  6610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6611. $ctx2.sendIdx["and:"]=1;
  6612. //>>excludeEnd("ctx");
  6613. if($core.assert($1)){
  6614. $recv(aBlock)._value_value_value_(start,sz,sz);
  6615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6616. $ctx2.sendIdx["value:value:value:"]=1;
  6617. //>>excludeEnd("ctx");
  6618. throw $early=[self];
  6619. }
  6620. $4=$recv(nextCR).__eq((0));
  6621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6622. $ctx2.sendIdx["="]=3;
  6623. //>>excludeEnd("ctx");
  6624. $3=$recv($4)._or_((function(){
  6625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6626. return $core.withContext(function($ctx3) {
  6627. //>>excludeEnd("ctx");
  6628. $5=(0).__lt(nextLF);
  6629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6630. $ctx3.sendIdx["<"]=1;
  6631. //>>excludeEnd("ctx");
  6632. return $recv($5)._and_((function(){
  6633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6634. return $core.withContext(function($ctx4) {
  6635. //>>excludeEnd("ctx");
  6636. return $recv(nextLF).__lt(nextCR);
  6637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6638. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  6639. //>>excludeEnd("ctx");
  6640. }));
  6641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6642. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  6643. //>>excludeEnd("ctx");
  6644. }));
  6645. if($core.assert($3)){
  6646. $6=start;
  6647. $7=$recv(nextLF).__minus((1));
  6648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6649. $ctx2.sendIdx["-"]=1;
  6650. //>>excludeEnd("ctx");
  6651. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  6652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6653. $ctx2.sendIdx["value:value:value:"]=2;
  6654. //>>excludeEnd("ctx");
  6655. start=(1).__plus(nextLF);
  6656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6657. $ctx2.sendIdx["+"]=1;
  6658. //>>excludeEnd("ctx");
  6659. nextLF=$self._indexOf_startingAt_(lf,start);
  6660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6661. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  6662. //>>excludeEnd("ctx");
  6663. return nextLF;
  6664. } else {
  6665. $9=(1).__plus(nextCR);
  6666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6667. $ctx2.sendIdx["+"]=2;
  6668. //>>excludeEnd("ctx");
  6669. $8=$recv($9).__eq(nextLF);
  6670. if($core.assert($8)){
  6671. $10=start;
  6672. $11=$recv(nextCR).__minus((1));
  6673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6674. $ctx2.sendIdx["-"]=2;
  6675. //>>excludeEnd("ctx");
  6676. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  6677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6678. $ctx2.sendIdx["value:value:value:"]=3;
  6679. //>>excludeEnd("ctx");
  6680. start=(1).__plus(nextLF);
  6681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6682. $ctx2.sendIdx["+"]=3;
  6683. //>>excludeEnd("ctx");
  6684. nextCR=$self._indexOf_startingAt_(cr,start);
  6685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6686. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  6687. //>>excludeEnd("ctx");
  6688. nextLF=$self._indexOf_startingAt_(lf,start);
  6689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6690. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  6691. //>>excludeEnd("ctx");
  6692. return nextLF;
  6693. } else {
  6694. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  6695. start=(1).__plus(nextCR);
  6696. nextCR=$self._indexOf_startingAt_(cr,start);
  6697. return nextCR;
  6698. }
  6699. }
  6700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6701. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6702. //>>excludeEnd("ctx");
  6703. }));
  6704. return self;
  6705. }
  6706. catch(e) {if(e===$early)return e[0]; throw e}
  6707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6708. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  6709. //>>excludeEnd("ctx");
  6710. },
  6711. //>>excludeStart("ide", pragmas.excludeIdeData);
  6712. args: ["aBlock"],
  6713. 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 ] ]]",
  6714. referencedClasses: ["String"],
  6715. //>>excludeEnd("ide");
  6716. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  6717. }),
  6718. $globals.String);
  6719. $core.addMethod(
  6720. $core.method({
  6721. selector: "lineNumber:",
  6722. protocol: "split join",
  6723. fn: function (anIndex){
  6724. var self=this,$self=this;
  6725. var lineCount;
  6726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6727. return $core.withContext(function($ctx1) {
  6728. //>>excludeEnd("ctx");
  6729. var $2,$1;
  6730. var $early={};
  6731. try {
  6732. lineCount=(0);
  6733. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  6734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6735. return $core.withContext(function($ctx2) {
  6736. //>>excludeEnd("ctx");
  6737. lineCount=$recv(lineCount).__plus((1));
  6738. $2=lineCount;
  6739. $1=$recv($2).__eq(anIndex);
  6740. if($core.assert($1)){
  6741. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  6742. }
  6743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6744. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  6745. //>>excludeEnd("ctx");
  6746. }));
  6747. return nil;
  6748. }
  6749. catch(e) {if(e===$early)return e[0]; throw e}
  6750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6751. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  6752. //>>excludeEnd("ctx");
  6753. },
  6754. //>>excludeStart("ide", pragmas.excludeIdeData);
  6755. args: ["anIndex"],
  6756. 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",
  6757. referencedClasses: [],
  6758. //>>excludeEnd("ide");
  6759. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  6760. }),
  6761. $globals.String);
  6762. $core.addMethod(
  6763. $core.method({
  6764. selector: "lines",
  6765. protocol: "split join",
  6766. fn: function (){
  6767. var self=this,$self=this;
  6768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6769. return $core.withContext(function($ctx1) {
  6770. //>>excludeEnd("ctx");
  6771. var result = self.split(/\r\n|\r|\n/);
  6772. if (!result[result.length-1]) result.pop();
  6773. return result;;
  6774. return self;
  6775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6776. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  6777. //>>excludeEnd("ctx");
  6778. },
  6779. //>>excludeStart("ide", pragmas.excludeIdeData);
  6780. args: [],
  6781. source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a<inlineJS: '\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;\x0a'>",
  6782. referencedClasses: [],
  6783. //>>excludeEnd("ide");
  6784. messageSends: []
  6785. }),
  6786. $globals.String);
  6787. $core.addMethod(
  6788. $core.method({
  6789. selector: "linesDo:",
  6790. protocol: "split join",
  6791. fn: function (aBlock){
  6792. var self=this,$self=this;
  6793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6794. return $core.withContext(function($ctx1) {
  6795. //>>excludeEnd("ctx");
  6796. $recv($self._lines())._do_(aBlock);
  6797. return self;
  6798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6799. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  6800. //>>excludeEnd("ctx");
  6801. },
  6802. //>>excludeStart("ide", pragmas.excludeIdeData);
  6803. args: ["aBlock"],
  6804. 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 lines do: aBlock",
  6805. referencedClasses: [],
  6806. //>>excludeEnd("ide");
  6807. messageSends: ["do:", "lines"]
  6808. }),
  6809. $globals.String);
  6810. $core.addMethod(
  6811. $core.method({
  6812. selector: "match:",
  6813. protocol: "regular expressions",
  6814. fn: function (aRegexp){
  6815. var self=this,$self=this;
  6816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6817. return $core.withContext(function($ctx1) {
  6818. //>>excludeEnd("ctx");
  6819. return self.search(aRegexp) != -1;
  6820. return self;
  6821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6822. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  6823. //>>excludeEnd("ctx");
  6824. },
  6825. //>>excludeStart("ide", pragmas.excludeIdeData);
  6826. args: ["aRegexp"],
  6827. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  6828. referencedClasses: [],
  6829. //>>excludeEnd("ide");
  6830. messageSends: []
  6831. }),
  6832. $globals.String);
  6833. $core.addMethod(
  6834. $core.method({
  6835. selector: "matchesOf:",
  6836. protocol: "regular expressions",
  6837. fn: function (aRegularExpression){
  6838. var self=this,$self=this;
  6839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6840. return $core.withContext(function($ctx1) {
  6841. //>>excludeEnd("ctx");
  6842. return self.match(aRegularExpression);
  6843. return self;
  6844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6845. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  6846. //>>excludeEnd("ctx");
  6847. },
  6848. //>>excludeStart("ide", pragmas.excludeIdeData);
  6849. args: ["aRegularExpression"],
  6850. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  6851. referencedClasses: [],
  6852. //>>excludeEnd("ide");
  6853. messageSends: []
  6854. }),
  6855. $globals.String);
  6856. $core.addMethod(
  6857. $core.method({
  6858. selector: "numericallyIndexable",
  6859. protocol: "private",
  6860. fn: function (){
  6861. var self=this,$self=this;
  6862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6863. return $core.withContext(function($ctx1) {
  6864. //>>excludeEnd("ctx");
  6865. return String(self);
  6866. return self;
  6867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6868. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  6869. //>>excludeEnd("ctx");
  6870. },
  6871. //>>excludeStart("ide", pragmas.excludeIdeData);
  6872. args: [],
  6873. source: "numericallyIndexable\x0a\x09<inlineJS: 'return String(self)'>",
  6874. referencedClasses: [],
  6875. //>>excludeEnd("ide");
  6876. messageSends: []
  6877. }),
  6878. $globals.String);
  6879. $core.addMethod(
  6880. $core.method({
  6881. selector: "printNl",
  6882. protocol: "printing",
  6883. fn: function (){
  6884. var self=this,$self=this;
  6885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6886. return $core.withContext(function($ctx1) {
  6887. //>>excludeEnd("ctx");
  6888. console.log(self);
  6889. return self;
  6890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6891. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  6892. //>>excludeEnd("ctx");
  6893. },
  6894. //>>excludeStart("ide", pragmas.excludeIdeData);
  6895. args: [],
  6896. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  6897. referencedClasses: [],
  6898. //>>excludeEnd("ide");
  6899. messageSends: []
  6900. }),
  6901. $globals.String);
  6902. $core.addMethod(
  6903. $core.method({
  6904. selector: "printOn:",
  6905. protocol: "printing",
  6906. fn: function (aStream){
  6907. var self=this,$self=this;
  6908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6909. return $core.withContext(function($ctx1) {
  6910. //>>excludeEnd("ctx");
  6911. $recv(aStream)._nextPutAll_("'");
  6912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6913. $ctx1.sendIdx["nextPutAll:"]=1;
  6914. //>>excludeEnd("ctx");
  6915. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  6916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6917. $ctx1.sendIdx["nextPutAll:"]=2;
  6918. //>>excludeEnd("ctx");
  6919. $recv(aStream)._nextPutAll_("'");
  6920. return self;
  6921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6922. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  6923. //>>excludeEnd("ctx");
  6924. },
  6925. //>>excludeStart("ide", pragmas.excludeIdeData);
  6926. args: ["aStream"],
  6927. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  6928. referencedClasses: [],
  6929. //>>excludeEnd("ide");
  6930. messageSends: ["nextPutAll:", "replace:with:"]
  6931. }),
  6932. $globals.String);
  6933. $core.addMethod(
  6934. $core.method({
  6935. selector: "replace:with:",
  6936. protocol: "regular expressions",
  6937. fn: function (aString,anotherString){
  6938. var self=this,$self=this;
  6939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6940. return $core.withContext(function($ctx1) {
  6941. //>>excludeEnd("ctx");
  6942. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6944. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  6945. //>>excludeEnd("ctx");
  6946. },
  6947. //>>excludeStart("ide", pragmas.excludeIdeData);
  6948. args: ["aString", "anotherString"],
  6949. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6950. referencedClasses: ["RegularExpression"],
  6951. //>>excludeEnd("ide");
  6952. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6953. }),
  6954. $globals.String);
  6955. $core.addMethod(
  6956. $core.method({
  6957. selector: "replaceRegexp:with:",
  6958. protocol: "regular expressions",
  6959. fn: function (aRegexp,aString){
  6960. var self=this,$self=this;
  6961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6962. return $core.withContext(function($ctx1) {
  6963. //>>excludeEnd("ctx");
  6964. return self.replace(aRegexp, aString);
  6965. return self;
  6966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6967. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  6968. //>>excludeEnd("ctx");
  6969. },
  6970. //>>excludeStart("ide", pragmas.excludeIdeData);
  6971. args: ["aRegexp", "aString"],
  6972. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  6973. referencedClasses: [],
  6974. //>>excludeEnd("ide");
  6975. messageSends: []
  6976. }),
  6977. $globals.String);
  6978. $core.addMethod(
  6979. $core.method({
  6980. selector: "reversed",
  6981. protocol: "converting",
  6982. fn: function (){
  6983. var self=this,$self=this;
  6984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6985. return $core.withContext(function($ctx1) {
  6986. //>>excludeEnd("ctx");
  6987. return self.split("").reverse().join("");
  6988. return self;
  6989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6990. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  6991. //>>excludeEnd("ctx");
  6992. },
  6993. //>>excludeStart("ide", pragmas.excludeIdeData);
  6994. args: [],
  6995. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  6996. referencedClasses: [],
  6997. //>>excludeEnd("ide");
  6998. messageSends: []
  6999. }),
  7000. $globals.String);
  7001. $core.addMethod(
  7002. $core.method({
  7003. selector: "shallowCopy",
  7004. protocol: "copying",
  7005. fn: function (){
  7006. var self=this,$self=this;
  7007. return self;
  7008. },
  7009. //>>excludeStart("ide", pragmas.excludeIdeData);
  7010. args: [],
  7011. source: "shallowCopy\x0a\x09^ self",
  7012. referencedClasses: [],
  7013. //>>excludeEnd("ide");
  7014. messageSends: []
  7015. }),
  7016. $globals.String);
  7017. $core.addMethod(
  7018. $core.method({
  7019. selector: "size",
  7020. protocol: "accessing",
  7021. fn: function (){
  7022. var self=this,$self=this;
  7023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7024. return $core.withContext(function($ctx1) {
  7025. //>>excludeEnd("ctx");
  7026. return self.length;
  7027. return self;
  7028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7029. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  7030. //>>excludeEnd("ctx");
  7031. },
  7032. //>>excludeStart("ide", pragmas.excludeIdeData);
  7033. args: [],
  7034. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  7035. referencedClasses: [],
  7036. //>>excludeEnd("ide");
  7037. messageSends: []
  7038. }),
  7039. $globals.String);
  7040. $core.addMethod(
  7041. $core.method({
  7042. selector: "subStrings:",
  7043. protocol: "split join",
  7044. fn: function (aString){
  7045. var self=this,$self=this;
  7046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7047. return $core.withContext(function($ctx1) {
  7048. //>>excludeEnd("ctx");
  7049. return $self._tokenize_(aString);
  7050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7051. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  7052. //>>excludeEnd("ctx");
  7053. },
  7054. //>>excludeStart("ide", pragmas.excludeIdeData);
  7055. args: ["aString"],
  7056. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  7057. referencedClasses: [],
  7058. //>>excludeEnd("ide");
  7059. messageSends: ["tokenize:"]
  7060. }),
  7061. $globals.String);
  7062. $core.addMethod(
  7063. $core.method({
  7064. selector: "tokenize:",
  7065. protocol: "split join",
  7066. fn: function (aString){
  7067. var self=this,$self=this;
  7068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7069. return $core.withContext(function($ctx1) {
  7070. //>>excludeEnd("ctx");
  7071. return self.split(aString);
  7072. return self;
  7073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7074. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  7075. //>>excludeEnd("ctx");
  7076. },
  7077. //>>excludeStart("ide", pragmas.excludeIdeData);
  7078. args: ["aString"],
  7079. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  7080. referencedClasses: [],
  7081. //>>excludeEnd("ide");
  7082. messageSends: []
  7083. }),
  7084. $globals.String);
  7085. $core.addMethod(
  7086. $core.method({
  7087. selector: "trimBoth",
  7088. protocol: "regular expressions",
  7089. fn: function (){
  7090. var self=this,$self=this;
  7091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7092. return $core.withContext(function($ctx1) {
  7093. //>>excludeEnd("ctx");
  7094. return $self._trimBoth_("\x5cs");
  7095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7096. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  7097. //>>excludeEnd("ctx");
  7098. },
  7099. //>>excludeStart("ide", pragmas.excludeIdeData);
  7100. args: [],
  7101. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  7102. referencedClasses: [],
  7103. //>>excludeEnd("ide");
  7104. messageSends: ["trimBoth:"]
  7105. }),
  7106. $globals.String);
  7107. $core.addMethod(
  7108. $core.method({
  7109. selector: "trimBoth:",
  7110. protocol: "regular expressions",
  7111. fn: function (separators){
  7112. var self=this,$self=this;
  7113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7114. return $core.withContext(function($ctx1) {
  7115. //>>excludeEnd("ctx");
  7116. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  7117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7118. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  7119. //>>excludeEnd("ctx");
  7120. },
  7121. //>>excludeStart("ide", pragmas.excludeIdeData);
  7122. args: ["separators"],
  7123. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  7124. referencedClasses: [],
  7125. //>>excludeEnd("ide");
  7126. messageSends: ["trimRight:", "trimLeft:"]
  7127. }),
  7128. $globals.String);
  7129. $core.addMethod(
  7130. $core.method({
  7131. selector: "trimLeft",
  7132. protocol: "regular expressions",
  7133. fn: function (){
  7134. var self=this,$self=this;
  7135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7136. return $core.withContext(function($ctx1) {
  7137. //>>excludeEnd("ctx");
  7138. return $self._trimLeft_("\x5cs");
  7139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7140. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  7141. //>>excludeEnd("ctx");
  7142. },
  7143. //>>excludeStart("ide", pragmas.excludeIdeData);
  7144. args: [],
  7145. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  7146. referencedClasses: [],
  7147. //>>excludeEnd("ide");
  7148. messageSends: ["trimLeft:"]
  7149. }),
  7150. $globals.String);
  7151. $core.addMethod(
  7152. $core.method({
  7153. selector: "trimLeft:",
  7154. protocol: "regular expressions",
  7155. fn: function (separators){
  7156. var self=this,$self=this;
  7157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7158. return $core.withContext(function($ctx1) {
  7159. //>>excludeEnd("ctx");
  7160. var $2,$1;
  7161. $2=$recv("^[".__comma(separators)).__comma("]+");
  7162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7163. $ctx1.sendIdx[","]=1;
  7164. //>>excludeEnd("ctx");
  7165. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  7166. return $self._replaceRegexp_with_($1,"");
  7167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7168. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  7169. //>>excludeEnd("ctx");
  7170. },
  7171. //>>excludeStart("ide", pragmas.excludeIdeData);
  7172. args: ["separators"],
  7173. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  7174. referencedClasses: ["RegularExpression"],
  7175. //>>excludeEnd("ide");
  7176. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  7177. }),
  7178. $globals.String);
  7179. $core.addMethod(
  7180. $core.method({
  7181. selector: "trimRight",
  7182. protocol: "regular expressions",
  7183. fn: function (){
  7184. var self=this,$self=this;
  7185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7186. return $core.withContext(function($ctx1) {
  7187. //>>excludeEnd("ctx");
  7188. return $self._trimRight_("\x5cs");
  7189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7190. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  7191. //>>excludeEnd("ctx");
  7192. },
  7193. //>>excludeStart("ide", pragmas.excludeIdeData);
  7194. args: [],
  7195. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  7196. referencedClasses: [],
  7197. //>>excludeEnd("ide");
  7198. messageSends: ["trimRight:"]
  7199. }),
  7200. $globals.String);
  7201. $core.addMethod(
  7202. $core.method({
  7203. selector: "trimRight:",
  7204. protocol: "regular expressions",
  7205. fn: function (separators){
  7206. var self=this,$self=this;
  7207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7208. return $core.withContext(function($ctx1) {
  7209. //>>excludeEnd("ctx");
  7210. var $2,$1;
  7211. $2=$recv("[".__comma(separators)).__comma("]+$");
  7212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7213. $ctx1.sendIdx[","]=1;
  7214. //>>excludeEnd("ctx");
  7215. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  7216. return $self._replaceRegexp_with_($1,"");
  7217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7218. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  7219. //>>excludeEnd("ctx");
  7220. },
  7221. //>>excludeStart("ide", pragmas.excludeIdeData);
  7222. args: ["separators"],
  7223. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  7224. referencedClasses: ["RegularExpression"],
  7225. //>>excludeEnd("ide");
  7226. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  7227. }),
  7228. $globals.String);
  7229. $core.addMethod(
  7230. $core.method({
  7231. selector: "unescaped",
  7232. protocol: "converting",
  7233. fn: function (){
  7234. var self=this,$self=this;
  7235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7236. return $core.withContext(function($ctx1) {
  7237. //>>excludeEnd("ctx");
  7238. return unescape(self);
  7239. return self;
  7240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7241. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  7242. //>>excludeEnd("ctx");
  7243. },
  7244. //>>excludeStart("ide", pragmas.excludeIdeData);
  7245. args: [],
  7246. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  7247. referencedClasses: [],
  7248. //>>excludeEnd("ide");
  7249. messageSends: []
  7250. }),
  7251. $globals.String);
  7252. $core.addMethod(
  7253. $core.method({
  7254. selector: "uriComponentDecoded",
  7255. protocol: "converting",
  7256. fn: function (){
  7257. var self=this,$self=this;
  7258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7259. return $core.withContext(function($ctx1) {
  7260. //>>excludeEnd("ctx");
  7261. return decodeURIComponent(self);
  7262. return self;
  7263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7264. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  7265. //>>excludeEnd("ctx");
  7266. },
  7267. //>>excludeStart("ide", pragmas.excludeIdeData);
  7268. args: [],
  7269. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  7270. referencedClasses: [],
  7271. //>>excludeEnd("ide");
  7272. messageSends: []
  7273. }),
  7274. $globals.String);
  7275. $core.addMethod(
  7276. $core.method({
  7277. selector: "uriComponentEncoded",
  7278. protocol: "converting",
  7279. fn: function (){
  7280. var self=this,$self=this;
  7281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7282. return $core.withContext(function($ctx1) {
  7283. //>>excludeEnd("ctx");
  7284. return encodeURIComponent(self);
  7285. return self;
  7286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7287. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  7288. //>>excludeEnd("ctx");
  7289. },
  7290. //>>excludeStart("ide", pragmas.excludeIdeData);
  7291. args: [],
  7292. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  7293. referencedClasses: [],
  7294. //>>excludeEnd("ide");
  7295. messageSends: []
  7296. }),
  7297. $globals.String);
  7298. $core.addMethod(
  7299. $core.method({
  7300. selector: "uriDecoded",
  7301. protocol: "converting",
  7302. fn: function (){
  7303. var self=this,$self=this;
  7304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7305. return $core.withContext(function($ctx1) {
  7306. //>>excludeEnd("ctx");
  7307. return decodeURI(self);
  7308. return self;
  7309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7310. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  7311. //>>excludeEnd("ctx");
  7312. },
  7313. //>>excludeStart("ide", pragmas.excludeIdeData);
  7314. args: [],
  7315. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  7316. referencedClasses: [],
  7317. //>>excludeEnd("ide");
  7318. messageSends: []
  7319. }),
  7320. $globals.String);
  7321. $core.addMethod(
  7322. $core.method({
  7323. selector: "uriEncoded",
  7324. protocol: "converting",
  7325. fn: function (){
  7326. var self=this,$self=this;
  7327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7328. return $core.withContext(function($ctx1) {
  7329. //>>excludeEnd("ctx");
  7330. return encodeURI(self);
  7331. return self;
  7332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7333. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  7334. //>>excludeEnd("ctx");
  7335. },
  7336. //>>excludeStart("ide", pragmas.excludeIdeData);
  7337. args: [],
  7338. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  7339. referencedClasses: [],
  7340. //>>excludeEnd("ide");
  7341. messageSends: []
  7342. }),
  7343. $globals.String);
  7344. $core.addMethod(
  7345. $core.method({
  7346. selector: "value:",
  7347. protocol: "evaluating",
  7348. fn: function (anObject){
  7349. var self=this,$self=this;
  7350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7351. return $core.withContext(function($ctx1) {
  7352. //>>excludeEnd("ctx");
  7353. return $recv(anObject)._perform_(self);
  7354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7355. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  7356. //>>excludeEnd("ctx");
  7357. },
  7358. //>>excludeStart("ide", pragmas.excludeIdeData);
  7359. args: ["anObject"],
  7360. source: "value: anObject \x0a\x09^ anObject perform: self",
  7361. referencedClasses: [],
  7362. //>>excludeEnd("ide");
  7363. messageSends: ["perform:"]
  7364. }),
  7365. $globals.String);
  7366. $core.addMethod(
  7367. $core.method({
  7368. selector: "cr",
  7369. protocol: "accessing",
  7370. fn: function (){
  7371. var self=this,$self=this;
  7372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7373. return $core.withContext(function($ctx1) {
  7374. //>>excludeEnd("ctx");
  7375. return "\r";
  7376. return self;
  7377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7378. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.a$cls)});
  7379. //>>excludeEnd("ctx");
  7380. },
  7381. //>>excludeStart("ide", pragmas.excludeIdeData);
  7382. args: [],
  7383. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  7384. referencedClasses: [],
  7385. //>>excludeEnd("ide");
  7386. messageSends: []
  7387. }),
  7388. $globals.String.a$cls);
  7389. $core.addMethod(
  7390. $core.method({
  7391. selector: "crlf",
  7392. protocol: "accessing",
  7393. fn: function (){
  7394. var self=this,$self=this;
  7395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7396. return $core.withContext(function($ctx1) {
  7397. //>>excludeEnd("ctx");
  7398. return "\r\n";
  7399. return self;
  7400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7401. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.a$cls)});
  7402. //>>excludeEnd("ctx");
  7403. },
  7404. //>>excludeStart("ide", pragmas.excludeIdeData);
  7405. args: [],
  7406. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  7407. referencedClasses: [],
  7408. //>>excludeEnd("ide");
  7409. messageSends: []
  7410. }),
  7411. $globals.String.a$cls);
  7412. $core.addMethod(
  7413. $core.method({
  7414. selector: "esc",
  7415. protocol: "accessing",
  7416. fn: function (){
  7417. var self=this,$self=this;
  7418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7419. return $core.withContext(function($ctx1) {
  7420. //>>excludeEnd("ctx");
  7421. return $self._fromCharCode_((27));
  7422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7423. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.a$cls)});
  7424. //>>excludeEnd("ctx");
  7425. },
  7426. //>>excludeStart("ide", pragmas.excludeIdeData);
  7427. args: [],
  7428. source: "esc\x0a\x09^ self fromCharCode: 27",
  7429. referencedClasses: [],
  7430. //>>excludeEnd("ide");
  7431. messageSends: ["fromCharCode:"]
  7432. }),
  7433. $globals.String.a$cls);
  7434. $core.addMethod(
  7435. $core.method({
  7436. selector: "fromCharCode:",
  7437. protocol: "instance creation",
  7438. fn: function (anInteger){
  7439. var self=this,$self=this;
  7440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7441. return $core.withContext(function($ctx1) {
  7442. //>>excludeEnd("ctx");
  7443. return String.fromCharCode(anInteger);
  7444. return self;
  7445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7446. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.a$cls)});
  7447. //>>excludeEnd("ctx");
  7448. },
  7449. //>>excludeStart("ide", pragmas.excludeIdeData);
  7450. args: ["anInteger"],
  7451. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  7452. referencedClasses: [],
  7453. //>>excludeEnd("ide");
  7454. messageSends: []
  7455. }),
  7456. $globals.String.a$cls);
  7457. $core.addMethod(
  7458. $core.method({
  7459. selector: "fromString:",
  7460. protocol: "instance creation",
  7461. fn: function (aString){
  7462. var self=this,$self=this;
  7463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7464. return $core.withContext(function($ctx1) {
  7465. //>>excludeEnd("ctx");
  7466. return String(aString);
  7467. return self;
  7468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7469. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.a$cls)});
  7470. //>>excludeEnd("ctx");
  7471. },
  7472. //>>excludeStart("ide", pragmas.excludeIdeData);
  7473. args: ["aString"],
  7474. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  7475. referencedClasses: [],
  7476. //>>excludeEnd("ide");
  7477. messageSends: []
  7478. }),
  7479. $globals.String.a$cls);
  7480. $core.addMethod(
  7481. $core.method({
  7482. selector: "lf",
  7483. protocol: "accessing",
  7484. fn: function (){
  7485. var self=this,$self=this;
  7486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7487. return $core.withContext(function($ctx1) {
  7488. //>>excludeEnd("ctx");
  7489. return "\n";
  7490. return self;
  7491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7492. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.a$cls)});
  7493. //>>excludeEnd("ctx");
  7494. },
  7495. //>>excludeStart("ide", pragmas.excludeIdeData);
  7496. args: [],
  7497. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  7498. referencedClasses: [],
  7499. //>>excludeEnd("ide");
  7500. messageSends: []
  7501. }),
  7502. $globals.String.a$cls);
  7503. $core.addMethod(
  7504. $core.method({
  7505. selector: "random",
  7506. protocol: "random",
  7507. fn: function (){
  7508. var self=this,$self=this;
  7509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7510. return $core.withContext(function($ctx1) {
  7511. //>>excludeEnd("ctx");
  7512. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  7513. return self;
  7514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7515. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.a$cls)});
  7516. //>>excludeEnd("ctx");
  7517. },
  7518. //>>excludeStart("ide", pragmas.excludeIdeData);
  7519. args: [],
  7520. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);'>",
  7521. referencedClasses: [],
  7522. //>>excludeEnd("ide");
  7523. messageSends: []
  7524. }),
  7525. $globals.String.a$cls);
  7526. $core.addMethod(
  7527. $core.method({
  7528. selector: "randomNotIn:",
  7529. protocol: "random",
  7530. fn: function (aString){
  7531. var self=this,$self=this;
  7532. var result;
  7533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7534. return $core.withContext(function($ctx1) {
  7535. //>>excludeEnd("ctx");
  7536. $recv((function(){
  7537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7538. return $core.withContext(function($ctx2) {
  7539. //>>excludeEnd("ctx");
  7540. result=$self._random();
  7541. return $recv(aString)._includesSubString_(result);
  7542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7543. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7544. //>>excludeEnd("ctx");
  7545. }))._whileTrue();
  7546. return result;
  7547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7548. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.a$cls)});
  7549. //>>excludeEnd("ctx");
  7550. },
  7551. //>>excludeStart("ide", pragmas.excludeIdeData);
  7552. args: ["aString"],
  7553. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  7554. referencedClasses: [],
  7555. //>>excludeEnd("ide");
  7556. messageSends: ["whileTrue", "random", "includesSubString:"]
  7557. }),
  7558. $globals.String.a$cls);
  7559. $core.addMethod(
  7560. $core.method({
  7561. selector: "space",
  7562. protocol: "accessing",
  7563. fn: function (){
  7564. var self=this,$self=this;
  7565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7566. return $core.withContext(function($ctx1) {
  7567. //>>excludeEnd("ctx");
  7568. return " ";
  7569. return self;
  7570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7571. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.a$cls)});
  7572. //>>excludeEnd("ctx");
  7573. },
  7574. //>>excludeStart("ide", pragmas.excludeIdeData);
  7575. args: [],
  7576. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  7577. referencedClasses: [],
  7578. //>>excludeEnd("ide");
  7579. messageSends: []
  7580. }),
  7581. $globals.String.a$cls);
  7582. $core.addMethod(
  7583. $core.method({
  7584. selector: "streamClass",
  7585. protocol: "accessing",
  7586. fn: function (){
  7587. var self=this,$self=this;
  7588. return $globals.StringStream;
  7589. },
  7590. //>>excludeStart("ide", pragmas.excludeIdeData);
  7591. args: [],
  7592. source: "streamClass\x0a\x09\x09^ StringStream",
  7593. referencedClasses: ["StringStream"],
  7594. //>>excludeEnd("ide");
  7595. messageSends: []
  7596. }),
  7597. $globals.String.a$cls);
  7598. $core.addMethod(
  7599. $core.method({
  7600. selector: "tab",
  7601. protocol: "accessing",
  7602. fn: function (){
  7603. var self=this,$self=this;
  7604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7605. return $core.withContext(function($ctx1) {
  7606. //>>excludeEnd("ctx");
  7607. return "\t";
  7608. return self;
  7609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7610. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.a$cls)});
  7611. //>>excludeEnd("ctx");
  7612. },
  7613. //>>excludeStart("ide", pragmas.excludeIdeData);
  7614. args: [],
  7615. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  7616. referencedClasses: [],
  7617. //>>excludeEnd("ide");
  7618. messageSends: []
  7619. }),
  7620. $globals.String.a$cls);
  7621. $core.addMethod(
  7622. $core.method({
  7623. selector: "value:",
  7624. protocol: "instance creation",
  7625. fn: function (aUTFCharCode){
  7626. var self=this,$self=this;
  7627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7628. return $core.withContext(function($ctx1) {
  7629. //>>excludeEnd("ctx");
  7630. return String.fromCharCode(aUTFCharCode);;
  7631. return self;
  7632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7633. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.a$cls)});
  7634. //>>excludeEnd("ctx");
  7635. },
  7636. //>>excludeStart("ide", pragmas.excludeIdeData);
  7637. args: ["aUTFCharCode"],
  7638. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  7639. referencedClasses: [],
  7640. //>>excludeEnd("ide");
  7641. messageSends: []
  7642. }),
  7643. $globals.String.a$cls);
  7644. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  7645. //>>excludeStart("ide", pragmas.excludeIdeData);
  7646. $globals.Set.comment="I represent an unordered set of objects without duplicates.\x0a\x0a## Implementation notes\x0a\x0aI put elements into different stores based on their type.\x0aThe goal is to store some elements into native JS object property names to be fast.\x0a\x0aIf an unboxed element has typeof 'string', 'boolean' or 'number', or an element is nil, null or undefined,\x0aI store it as a property name in an empty (== Object.create(null)) JS object, different for each type\x0a(for simplicity, nil/null/undefined is treated as one and included with the two booleans).\x0a\x0aIf element happen to be an object, I try to store them in `ArrayBucketStore`. I have two of them by default,\x0aone hashed using the Smalltalk class name, the other one using the JS constructor name. It is possible to have more or less\x0ainstances of `ArrayBucketStores`, see `#initializeSlowBucketStores`.\x0a\x0aAs a last resort, if none of the `ArrayBucketStore` instances can find a suitable bucket, the `defaultBucket` is used,\x0awhich is an `Array`.";
  7647. //>>excludeEnd("ide");
  7648. $core.addMethod(
  7649. $core.method({
  7650. selector: "=",
  7651. protocol: "comparing",
  7652. fn: function (aCollection){
  7653. var self=this,$self=this;
  7654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7655. return $core.withContext(function($ctx1) {
  7656. //>>excludeEnd("ctx");
  7657. var $2,$1,$4,$3,$5;
  7658. var $early={};
  7659. try {
  7660. $2=$self._class();
  7661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7662. $ctx1.sendIdx["class"]=1;
  7663. //>>excludeEnd("ctx");
  7664. $1=$recv($2).__eq($recv(aCollection)._class());
  7665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7666. $ctx1.sendIdx["="]=1;
  7667. //>>excludeEnd("ctx");
  7668. if(!$core.assert($1)){
  7669. return false;
  7670. }
  7671. $4=$self._size();
  7672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7673. $ctx1.sendIdx["size"]=1;
  7674. //>>excludeEnd("ctx");
  7675. $3=$recv($4).__eq($recv(aCollection)._size());
  7676. if(!$core.assert($3)){
  7677. return false;
  7678. }
  7679. $self._do_((function(each){
  7680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7681. return $core.withContext(function($ctx2) {
  7682. //>>excludeEnd("ctx");
  7683. $5=$recv(aCollection)._includes_(each);
  7684. if(!$core.assert($5)){
  7685. throw $early=[false];
  7686. }
  7687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7688. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7689. //>>excludeEnd("ctx");
  7690. }));
  7691. return true;
  7692. }
  7693. catch(e) {if(e===$early)return e[0]; throw e}
  7694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7695. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  7696. //>>excludeEnd("ctx");
  7697. },
  7698. //>>excludeStart("ide", pragmas.excludeIdeData);
  7699. args: ["aCollection"],
  7700. source: "= aCollection\x0a\x09self class = aCollection class ifFalse: [ ^ false ].\x0a\x09self size = aCollection size ifFalse: [ ^ false ].\x0a\x09self do: [ :each | (aCollection includes: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  7701. referencedClasses: [],
  7702. //>>excludeEnd("ide");
  7703. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  7704. }),
  7705. $globals.Set);
  7706. $core.addMethod(
  7707. $core.method({
  7708. selector: "add:",
  7709. protocol: "adding/removing",
  7710. fn: function (anObject){
  7711. var self=this,$self=this;
  7712. var bucket;
  7713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7714. return $core.withContext(function($ctx1) {
  7715. //>>excludeEnd("ctx");
  7716. var $1,$receiver;
  7717. bucket=$self._bucketsOfElement_(anObject);
  7718. $1=$recv(bucket)._second();
  7719. if(($receiver = $1) == null || $receiver.a$nil){
  7720. var object,slowBucket;
  7721. object=$recv(bucket)._first();
  7722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7723. $ctx1.sendIdx["first"]=1;
  7724. //>>excludeEnd("ctx");
  7725. slowBucket=$recv(bucket)._third();
  7726. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  7727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7728. return $core.withContext(function($ctx2) {
  7729. //>>excludeEnd("ctx");
  7730. $recv(slowBucket)._add_(object);
  7731. $self["@size"]=$recv($self["@size"]).__plus((1));
  7732. return $self["@size"];
  7733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7734. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7735. //>>excludeEnd("ctx");
  7736. }));
  7737. return object;
  7738. } else {
  7739. var primitiveBucket;
  7740. primitiveBucket=$receiver;
  7741. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  7742. }
  7743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7744. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7745. //>>excludeEnd("ctx");
  7746. },
  7747. //>>excludeStart("ide", pragmas.excludeIdeData);
  7748. args: ["anObject"],
  7749. source: "add: anObject\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [\x0a\x09\x09\x09| object slowBucket |\x0a\x09\x09\x09object := bucket first.\x0a\x09\x09\x09slowBucket := bucket third.\x0a\x09\x09\x09slowBucket \x0a\x09\x09\x09\x09indexOf: object \x0a\x09\x09\x09\x09ifAbsent: [ \x0a\x09\x09\x09\x09\x09slowBucket add: object. \x0a\x09\x09\x09\x09\x09size := size + 1 ].\x0a\x09\x09\x09object ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09add: bucket first \x0a\x09\x09\x09\x09in: primitiveBucket ]",
  7750. referencedClasses: [],
  7751. //>>excludeEnd("ide");
  7752. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  7753. }),
  7754. $globals.Set);
  7755. $core.addMethod(
  7756. $core.method({
  7757. selector: "add:in:",
  7758. protocol: "private",
  7759. fn: function (anObject,anotherObject){
  7760. var self=this,$self=this;
  7761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7762. return $core.withContext(function($ctx1) {
  7763. //>>excludeEnd("ctx");
  7764. if (anObject in anotherObject.store) { return false; }
  7765. $self['@size']++;
  7766. anotherObject.store[anObject] = true;
  7767. return anObject;
  7768. ;
  7769. return self;
  7770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7771. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7772. //>>excludeEnd("ctx");
  7773. },
  7774. //>>excludeStart("ide", pragmas.excludeIdeData);
  7775. args: ["anObject", "anotherObject"],
  7776. source: "add: anObject in: anotherObject\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09$self[''@size'']++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09'>",
  7777. referencedClasses: [],
  7778. //>>excludeEnd("ide");
  7779. messageSends: []
  7780. }),
  7781. $globals.Set);
  7782. $core.addMethod(
  7783. $core.method({
  7784. selector: "bucketsOfElement:",
  7785. protocol: "private",
  7786. fn: function (anObject){
  7787. var self=this,$self=this;
  7788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7789. return $core.withContext(function($ctx1) {
  7790. //>>excludeEnd("ctx");
  7791. // include nil to well-known objects under "boolean" fastBucket
  7792. if (anObject == null || anObject.a$nil) return [ null, $self['@fastBuckets'].boolean ];
  7793. var prim = anObject.valueOf();
  7794. if (typeof prim === "object" || typeof prim === "function" || !$self['@fastBuckets'][typeof prim]) {
  7795. var bucket = null;
  7796. $self['@slowBucketStores'].some(function (store) {
  7797. return bucket = store._bucketOfElement_(anObject);
  7798. });
  7799. return [ anObject, null, bucket || $self['@defaultBucket'] ];
  7800. }
  7801. return [ prim, $self['@fastBuckets'][typeof prim] ];
  7802. ;
  7803. return self;
  7804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7805. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  7806. //>>excludeEnd("ctx");
  7807. },
  7808. //>>excludeStart("ide", pragmas.excludeIdeData);
  7809. args: ["anObject"],
  7810. source: "bucketsOfElement: anObject\x0a\x09\x22Find the appropriate bucket for `anObject`.\x0a\x09For optimization purposes, directly answer an array with: \x0a\x09- the object to be store\x0a\x09- the primitive bucket\x0a\x09- the slow bucket\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09// include nil to well-known objects under \x22boolean\x22 fastBucket\x0a\x09\x09if (anObject == null || anObject.a$nil) return [ null, $self[''@fastBuckets''].boolean ];\x0a\x09\x09\x0a\x09\x09var prim = anObject.valueOf();\x0a\x09\x09if (typeof prim === \x22object\x22 || typeof prim === \x22function\x22 || !$self[''@fastBuckets''][typeof prim]) {\x0a\x09\x09\x09var bucket = null;\x0a\x09\x09\x09$self[''@slowBucketStores''].some(function (store) {\x0a\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09});\x0a\x09\x09\x09return [ anObject, null, bucket || $self[''@defaultBucket''] ];\x0a\x09\x09}\x0a\x09\x09return [ prim, $self[''@fastBuckets''][typeof prim] ];\x0a\x09'>",
  7811. referencedClasses: [],
  7812. //>>excludeEnd("ide");
  7813. messageSends: []
  7814. }),
  7815. $globals.Set);
  7816. $core.addMethod(
  7817. $core.method({
  7818. selector: "classNameOf:",
  7819. protocol: "private",
  7820. fn: function (anObject){
  7821. var self=this,$self=this;
  7822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7823. return $core.withContext(function($ctx1) {
  7824. //>>excludeEnd("ctx");
  7825. return anObject.a$cls != null && anObject.a$cls.name;
  7826. return self;
  7827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7828. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  7829. //>>excludeEnd("ctx");
  7830. },
  7831. //>>excludeStart("ide", pragmas.excludeIdeData);
  7832. args: ["anObject"],
  7833. source: "classNameOf: anObject\x0a\x09\x22Answer the class name of `anObject`, or `undefined` \x0a\x09if `anObject` is not an Smalltalk object\x22\x0a\x09\x0a\x09<inlineJS: 'return anObject.a$cls != null && anObject.a$cls.name'>",
  7834. referencedClasses: [],
  7835. //>>excludeEnd("ide");
  7836. messageSends: []
  7837. }),
  7838. $globals.Set);
  7839. $core.addMethod(
  7840. $core.method({
  7841. selector: "collect:",
  7842. protocol: "enumerating",
  7843. fn: function (aBlock){
  7844. var self=this,$self=this;
  7845. var collection;
  7846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7847. return $core.withContext(function($ctx1) {
  7848. //>>excludeEnd("ctx");
  7849. collection=$recv($self._class())._new();
  7850. $self._do_((function(each){
  7851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7852. return $core.withContext(function($ctx2) {
  7853. //>>excludeEnd("ctx");
  7854. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7856. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7857. //>>excludeEnd("ctx");
  7858. }));
  7859. return collection;
  7860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7861. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  7862. //>>excludeEnd("ctx");
  7863. },
  7864. //>>excludeStart("ide", pragmas.excludeIdeData);
  7865. args: ["aBlock"],
  7866. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7867. referencedClasses: [],
  7868. //>>excludeEnd("ide");
  7869. messageSends: ["new", "class", "do:", "add:", "value:"]
  7870. }),
  7871. $globals.Set);
  7872. $core.addMethod(
  7873. $core.method({
  7874. selector: "detect:ifNone:",
  7875. protocol: "enumerating",
  7876. fn: function (aBlock,anotherBlock){
  7877. var self=this,$self=this;
  7878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7879. return $core.withContext(function($ctx1) {
  7880. //>>excludeEnd("ctx");
  7881. var $1;
  7882. var $early={};
  7883. try {
  7884. $self._do_((function(each){
  7885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7886. return $core.withContext(function($ctx2) {
  7887. //>>excludeEnd("ctx");
  7888. $1=$recv(aBlock)._value_(each);
  7889. if($core.assert($1)){
  7890. throw $early=[each];
  7891. }
  7892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7893. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7894. //>>excludeEnd("ctx");
  7895. }));
  7896. return $recv(anotherBlock)._value();
  7897. }
  7898. catch(e) {if(e===$early)return e[0]; throw e}
  7899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7900. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  7901. //>>excludeEnd("ctx");
  7902. },
  7903. //>>excludeStart("ide", pragmas.excludeIdeData);
  7904. args: ["aBlock", "anotherBlock"],
  7905. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  7906. referencedClasses: [],
  7907. //>>excludeEnd("ide");
  7908. messageSends: ["do:", "ifTrue:", "value:", "value"]
  7909. }),
  7910. $globals.Set);
  7911. $core.addMethod(
  7912. $core.method({
  7913. selector: "do:",
  7914. protocol: "enumerating",
  7915. fn: function (aBlock){
  7916. var self=this,$self=this;
  7917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7918. return $core.withContext(function($ctx1) {
  7919. //>>excludeEnd("ctx");
  7920. var el, keys, i;
  7921. el = $self['@fastBuckets'];
  7922. keys = Object.keys(el);
  7923. for (i = 0; i < keys.length; ++i) {
  7924. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7925. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7926. else { store._do_(aBlock); }
  7927. }
  7928. el = $self['@slowBucketStores'];
  7929. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7930. $self['@defaultBucket']._do_(aBlock);
  7931. ;
  7932. return self;
  7933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7934. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  7935. //>>excludeEnd("ctx");
  7936. },
  7937. //>>excludeStart("ide", pragmas.excludeIdeData);
  7938. args: ["aBlock"],
  7939. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var el, keys, i;\x0a\x09\x09el = $self[''@fastBuckets''];\x0a\x09\x09keys = Object.keys(el);\x0a\x09\x09for (i = 0; i < keys.length; ++i) {\x0a\x09\x09\x09var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);\x0a\x09\x09\x09if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }\x0a\x09\x09\x09else { store._do_(aBlock); }\x0a\x09\x09}\x0a\x09\x09el = $self[''@slowBucketStores''];\x0a\x09\x09for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }\x0a\x09\x09$self[''@defaultBucket'']._do_(aBlock);\x0a\x09'>",
  7940. referencedClasses: [],
  7941. //>>excludeEnd("ide");
  7942. messageSends: []
  7943. }),
  7944. $globals.Set);
  7945. $core.addMethod(
  7946. $core.method({
  7947. selector: "includes:",
  7948. protocol: "testing",
  7949. fn: function (anObject){
  7950. var self=this,$self=this;
  7951. var bucket;
  7952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7953. return $core.withContext(function($ctx1) {
  7954. //>>excludeEnd("ctx");
  7955. var $1,$2,$3,$receiver;
  7956. bucket=$self._bucketsOfElement_(anObject);
  7957. $1=$recv(bucket)._second();
  7958. if(($receiver = $1) == null || $receiver.a$nil){
  7959. $2=$recv(bucket)._third();
  7960. $3=$recv(bucket)._first();
  7961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7962. $ctx1.sendIdx["first"]=1;
  7963. //>>excludeEnd("ctx");
  7964. return $recv($2)._includes_($3);
  7965. } else {
  7966. var primitiveBucket;
  7967. primitiveBucket=$receiver;
  7968. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7969. }
  7970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7971. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7972. //>>excludeEnd("ctx");
  7973. },
  7974. //>>excludeStart("ide", pragmas.excludeIdeData);
  7975. args: ["anObject"],
  7976. source: "includes: anObject\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third includes: bucket first ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self includes: bucket first in: primitiveBucket ]",
  7977. referencedClasses: [],
  7978. //>>excludeEnd("ide");
  7979. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7980. }),
  7981. $globals.Set);
  7982. $core.addMethod(
  7983. $core.method({
  7984. selector: "includes:in:",
  7985. protocol: "private",
  7986. fn: function (anObject,anotherObject){
  7987. var self=this,$self=this;
  7988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7989. return $core.withContext(function($ctx1) {
  7990. //>>excludeEnd("ctx");
  7991. return anObject in anotherObject.store;
  7992. return self;
  7993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7994. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7995. //>>excludeEnd("ctx");
  7996. },
  7997. //>>excludeStart("ide", pragmas.excludeIdeData);
  7998. args: ["anObject", "anotherObject"],
  7999. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  8000. referencedClasses: [],
  8001. //>>excludeEnd("ide");
  8002. messageSends: []
  8003. }),
  8004. $globals.Set);
  8005. $core.addMethod(
  8006. $core.method({
  8007. selector: "initialize",
  8008. protocol: "initialization",
  8009. fn: function (){
  8010. var self=this,$self=this;
  8011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8012. return $core.withContext(function($ctx1) {
  8013. //>>excludeEnd("ctx");
  8014. (
  8015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8016. $ctx1.supercall = true,
  8017. //>>excludeEnd("ctx");
  8018. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  8019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8020. $ctx1.supercall = false;
  8021. //>>excludeEnd("ctx");;
  8022. $self["@defaultBucket"]=[];
  8023. $self._initializeSlowBucketStores();
  8024. $self._removeAll();
  8025. return self;
  8026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8027. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  8028. //>>excludeEnd("ctx");
  8029. },
  8030. //>>excludeStart("ide", pragmas.excludeIdeData);
  8031. args: [],
  8032. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  8033. referencedClasses: [],
  8034. //>>excludeEnd("ide");
  8035. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  8036. }),
  8037. $globals.Set);
  8038. $core.addMethod(
  8039. $core.method({
  8040. selector: "initializeSlowBucketStores",
  8041. protocol: "initialization",
  8042. fn: function (){
  8043. var self=this,$self=this;
  8044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8045. return $core.withContext(function($ctx1) {
  8046. //>>excludeEnd("ctx");
  8047. var $1;
  8048. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  8049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8050. return $core.withContext(function($ctx2) {
  8051. //>>excludeEnd("ctx");
  8052. return $self._classNameOf_(x);
  8053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8054. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  8055. //>>excludeEnd("ctx");
  8056. }));
  8057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8058. $ctx1.sendIdx["hashBlock:"]=1;
  8059. //>>excludeEnd("ctx");
  8060. $self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  8061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8062. return $core.withContext(function($ctx2) {
  8063. //>>excludeEnd("ctx");
  8064. return $self._jsConstructorNameOf_(x);
  8065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8066. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  8067. //>>excludeEnd("ctx");
  8068. }))];
  8069. return self;
  8070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8071. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  8072. //>>excludeEnd("ctx");
  8073. },
  8074. //>>excludeStart("ide", pragmas.excludeIdeData);
  8075. args: [],
  8076. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  8077. referencedClasses: ["ArrayBucketStore"],
  8078. //>>excludeEnd("ide");
  8079. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  8080. }),
  8081. $globals.Set);
  8082. $core.addMethod(
  8083. $core.method({
  8084. selector: "jsConstructorNameOf:",
  8085. protocol: "private",
  8086. fn: function (anObject){
  8087. var self=this,$self=this;
  8088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8089. return $core.withContext(function($ctx1) {
  8090. //>>excludeEnd("ctx");
  8091. return anObject.constructor && anObject.constructor.name;
  8092. return self;
  8093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8094. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  8095. //>>excludeEnd("ctx");
  8096. },
  8097. //>>excludeStart("ide", pragmas.excludeIdeData);
  8098. args: ["anObject"],
  8099. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  8100. referencedClasses: [],
  8101. //>>excludeEnd("ide");
  8102. messageSends: []
  8103. }),
  8104. $globals.Set);
  8105. $core.addMethod(
  8106. $core.method({
  8107. selector: "printOn:",
  8108. protocol: "printing",
  8109. fn: function (aStream){
  8110. var self=this,$self=this;
  8111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8112. return $core.withContext(function($ctx1) {
  8113. //>>excludeEnd("ctx");
  8114. (
  8115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8116. $ctx1.supercall = true,
  8117. //>>excludeEnd("ctx");
  8118. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  8119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8120. $ctx1.supercall = false;
  8121. //>>excludeEnd("ctx");;
  8122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8123. $ctx1.sendIdx["printOn:"]=1;
  8124. //>>excludeEnd("ctx");
  8125. $recv(aStream)._nextPutAll_(" (");
  8126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8127. $ctx1.sendIdx["nextPutAll:"]=1;
  8128. //>>excludeEnd("ctx");
  8129. $self._do_separatedBy_((function(each){
  8130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8131. return $core.withContext(function($ctx2) {
  8132. //>>excludeEnd("ctx");
  8133. return $recv(each)._printOn_(aStream);
  8134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8135. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8136. //>>excludeEnd("ctx");
  8137. }),(function(){
  8138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8139. return $core.withContext(function($ctx2) {
  8140. //>>excludeEnd("ctx");
  8141. return $recv(aStream)._nextPutAll_(" ");
  8142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8143. $ctx2.sendIdx["nextPutAll:"]=2;
  8144. //>>excludeEnd("ctx");
  8145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8147. //>>excludeEnd("ctx");
  8148. }));
  8149. $recv(aStream)._nextPutAll_(")");
  8150. return self;
  8151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8152. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  8153. //>>excludeEnd("ctx");
  8154. },
  8155. //>>excludeStart("ide", pragmas.excludeIdeData);
  8156. args: ["aStream"],
  8157. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'",
  8158. referencedClasses: [],
  8159. //>>excludeEnd("ide");
  8160. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  8161. }),
  8162. $globals.Set);
  8163. $core.addMethod(
  8164. $core.method({
  8165. selector: "remove:ifAbsent:",
  8166. protocol: "adding/removing",
  8167. fn: function (anObject,aBlock){
  8168. var self=this,$self=this;
  8169. var bucket;
  8170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8171. return $core.withContext(function($ctx1) {
  8172. //>>excludeEnd("ctx");
  8173. var $1,$2,$3,$receiver;
  8174. var $early={};
  8175. try {
  8176. bucket=$self._bucketsOfElement_(anObject);
  8177. $1=$recv(bucket)._second();
  8178. if(($receiver = $1) == null || $receiver.a$nil){
  8179. $2=$recv(bucket)._third();
  8180. $3=$recv(bucket)._first();
  8181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8182. $ctx1.sendIdx["first"]=1;
  8183. //>>excludeEnd("ctx");
  8184. $recv($2)._remove_ifAbsent_($3,(function(){
  8185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8186. return $core.withContext(function($ctx2) {
  8187. //>>excludeEnd("ctx");
  8188. throw $early=[$recv(aBlock)._value()];
  8189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8190. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8191. //>>excludeEnd("ctx");
  8192. }));
  8193. $self["@size"]=$recv($self["@size"]).__minus((1));
  8194. return $self["@size"];
  8195. } else {
  8196. var primitiveBucket;
  8197. primitiveBucket=$receiver;
  8198. return $self._remove_in_($recv(bucket)._first(),primitiveBucket);
  8199. }
  8200. }
  8201. catch(e) {if(e===$early)return e[0]; throw e}
  8202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8203. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  8204. //>>excludeEnd("ctx");
  8205. },
  8206. //>>excludeStart("ide", pragmas.excludeIdeData);
  8207. args: ["anObject", "aBlock"],
  8208. source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third remove: bucket first ifAbsent: [ ^aBlock value ]. size := size - 1 ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ]",
  8209. referencedClasses: [],
  8210. //>>excludeEnd("ide");
  8211. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  8212. }),
  8213. $globals.Set);
  8214. $core.addMethod(
  8215. $core.method({
  8216. selector: "remove:in:",
  8217. protocol: "private",
  8218. fn: function (anObject,anotherObject){
  8219. var self=this,$self=this;
  8220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8221. return $core.withContext(function($ctx1) {
  8222. //>>excludeEnd("ctx");
  8223. if (anObject in anotherObject.store) { delete anotherObject.store[anObject]; $self['@size']--; };
  8224. return self;
  8225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8226. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  8227. //>>excludeEnd("ctx");
  8228. },
  8229. //>>excludeStart("ide", pragmas.excludeIdeData);
  8230. args: ["anObject", "anotherObject"],
  8231. source: "remove: anObject in: anotherObject\x0a\x09<inlineJS: 'if (anObject in anotherObject.store) { delete anotherObject.store[anObject]; $self[''@size'']--; }'>",
  8232. referencedClasses: [],
  8233. //>>excludeEnd("ide");
  8234. messageSends: []
  8235. }),
  8236. $globals.Set);
  8237. $core.addMethod(
  8238. $core.method({
  8239. selector: "removeAll",
  8240. protocol: "adding/removing",
  8241. fn: function (){
  8242. var self=this,$self=this;
  8243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8244. return $core.withContext(function($ctx1) {
  8245. //>>excludeEnd("ctx");
  8246. $self['@fastBuckets'] = {
  8247. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  8248. "number": { store: Object.create(null), fn: Number },
  8249. "string": { store: Object.create(null) }
  8250. };
  8251. $self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  8252. $self['@defaultBucket']._removeAll();
  8253. $self['@size'] = 0;
  8254. ;
  8255. return self;
  8256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8257. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  8258. //>>excludeEnd("ctx");
  8259. },
  8260. //>>excludeStart("ide", pragmas.excludeIdeData);
  8261. args: [],
  8262. source: "removeAll\x0a\x09<inlineJS: '\x0a\x09\x09$self[''@fastBuckets''] = {\x0a\x09\x09\x09\x22boolean\x22: { store: Object.create(null), fn: function (x) { return {\x22true\x22: true, \x22false\x22: false, \x22null\x22: null}[x]; } },\x0a\x09\x09\x09\x22number\x22: { store: Object.create(null), fn: Number },\x0a\x09\x09\x09\x22string\x22: { store: Object.create(null) }\x0a\x09\x09};\x0a\x09\x09$self[''@slowBucketStores''].forEach(function (x) { x._removeAll(); });\x0a\x09\x09$self[''@defaultBucket'']._removeAll();\x0a\x09\x09$self[''@size''] = 0;\x0a\x09'>",
  8263. referencedClasses: [],
  8264. //>>excludeEnd("ide");
  8265. messageSends: []
  8266. }),
  8267. $globals.Set);
  8268. $core.addMethod(
  8269. $core.method({
  8270. selector: "select:",
  8271. protocol: "enumerating",
  8272. fn: function (aBlock){
  8273. var self=this,$self=this;
  8274. var collection;
  8275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8276. return $core.withContext(function($ctx1) {
  8277. //>>excludeEnd("ctx");
  8278. var $1;
  8279. collection=$recv($self._class())._new();
  8280. $self._do_((function(each){
  8281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8282. return $core.withContext(function($ctx2) {
  8283. //>>excludeEnd("ctx");
  8284. $1=$recv(aBlock)._value_(each);
  8285. if($core.assert($1)){
  8286. return $recv(collection)._add_(each);
  8287. }
  8288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8289. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8290. //>>excludeEnd("ctx");
  8291. }));
  8292. return collection;
  8293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8294. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  8295. //>>excludeEnd("ctx");
  8296. },
  8297. //>>excludeStart("ide", pragmas.excludeIdeData);
  8298. args: ["aBlock"],
  8299. 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",
  8300. referencedClasses: [],
  8301. //>>excludeEnd("ide");
  8302. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  8303. }),
  8304. $globals.Set);
  8305. $core.addMethod(
  8306. $core.method({
  8307. selector: "select:thenCollect:",
  8308. protocol: "enumerating",
  8309. fn: function (selectBlock,collectBlock){
  8310. var self=this,$self=this;
  8311. var collection;
  8312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8313. return $core.withContext(function($ctx1) {
  8314. //>>excludeEnd("ctx");
  8315. var $1;
  8316. collection=$recv($self._class())._new();
  8317. $self._do_((function(each){
  8318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8319. return $core.withContext(function($ctx2) {
  8320. //>>excludeEnd("ctx");
  8321. $1=$recv(selectBlock)._value_(each);
  8322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8323. $ctx2.sendIdx["value:"]=1;
  8324. //>>excludeEnd("ctx");
  8325. if($core.assert($1)){
  8326. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  8327. }
  8328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8329. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8330. //>>excludeEnd("ctx");
  8331. }));
  8332. return collection;
  8333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8334. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  8335. //>>excludeEnd("ctx");
  8336. },
  8337. //>>excludeStart("ide", pragmas.excludeIdeData);
  8338. args: ["selectBlock", "collectBlock"],
  8339. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each |\x0a\x09\x09(selectBlock value: each) ifTrue: [\x0a\x09\x09\x09collection add: (collectBlock value: each) ] ].\x0a\x09^ collection",
  8340. referencedClasses: [],
  8341. //>>excludeEnd("ide");
  8342. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  8343. }),
  8344. $globals.Set);
  8345. $core.addMethod(
  8346. $core.method({
  8347. selector: "size",
  8348. protocol: "accessing",
  8349. fn: function (){
  8350. var self=this,$self=this;
  8351. return $self["@size"];
  8352. },
  8353. //>>excludeStart("ide", pragmas.excludeIdeData);
  8354. args: [],
  8355. source: "size\x0a\x09^ size",
  8356. referencedClasses: [],
  8357. //>>excludeEnd("ide");
  8358. messageSends: []
  8359. }),
  8360. $globals.Set);
  8361. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  8362. //>>excludeStart("ide", pragmas.excludeIdeData);
  8363. $globals.ProtoStream.comment="I am the abstract base for different accessor for a sequence of objects. This sequence is referred to as my \x22contents\x22.\x0aMy instances are read/write streams modifying the contents.";
  8364. //>>excludeEnd("ide");
  8365. $core.addMethod(
  8366. $core.method({
  8367. selector: "<<",
  8368. protocol: "writing",
  8369. fn: function (anObject){
  8370. var self=this,$self=this;
  8371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8372. return $core.withContext(function($ctx1) {
  8373. //>>excludeEnd("ctx");
  8374. $self._write_(anObject);
  8375. return self;
  8376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8377. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  8378. //>>excludeEnd("ctx");
  8379. },
  8380. //>>excludeStart("ide", pragmas.excludeIdeData);
  8381. args: ["anObject"],
  8382. source: "<< anObject\x0a\x09self write: anObject",
  8383. referencedClasses: [],
  8384. //>>excludeEnd("ide");
  8385. messageSends: ["write:"]
  8386. }),
  8387. $globals.ProtoStream);
  8388. $core.addMethod(
  8389. $core.method({
  8390. selector: "atEnd",
  8391. protocol: "testing",
  8392. fn: function (){
  8393. var self=this,$self=this;
  8394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8395. return $core.withContext(function($ctx1) {
  8396. //>>excludeEnd("ctx");
  8397. $self._subclassResponsibility();
  8398. return self;
  8399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8400. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  8401. //>>excludeEnd("ctx");
  8402. },
  8403. //>>excludeStart("ide", pragmas.excludeIdeData);
  8404. args: [],
  8405. source: "atEnd\x0a\x09self subclassResponsibility",
  8406. referencedClasses: [],
  8407. //>>excludeEnd("ide");
  8408. messageSends: ["subclassResponsibility"]
  8409. }),
  8410. $globals.ProtoStream);
  8411. $core.addMethod(
  8412. $core.method({
  8413. selector: "atStart",
  8414. protocol: "testing",
  8415. fn: function (){
  8416. var self=this,$self=this;
  8417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8418. return $core.withContext(function($ctx1) {
  8419. //>>excludeEnd("ctx");
  8420. $self._subclassResponsibility();
  8421. return self;
  8422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8423. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  8424. //>>excludeEnd("ctx");
  8425. },
  8426. //>>excludeStart("ide", pragmas.excludeIdeData);
  8427. args: [],
  8428. source: "atStart\x0a\x09self subclassResponsibility",
  8429. referencedClasses: [],
  8430. //>>excludeEnd("ide");
  8431. messageSends: ["subclassResponsibility"]
  8432. }),
  8433. $globals.ProtoStream);
  8434. $core.addMethod(
  8435. $core.method({
  8436. selector: "contents",
  8437. protocol: "accessing",
  8438. fn: function (){
  8439. var self=this,$self=this;
  8440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8441. return $core.withContext(function($ctx1) {
  8442. //>>excludeEnd("ctx");
  8443. $self._subclassResponsibility();
  8444. return self;
  8445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8446. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  8447. //>>excludeEnd("ctx");
  8448. },
  8449. //>>excludeStart("ide", pragmas.excludeIdeData);
  8450. args: [],
  8451. source: "contents\x0a\x09self subclassResponsibility",
  8452. referencedClasses: [],
  8453. //>>excludeEnd("ide");
  8454. messageSends: ["subclassResponsibility"]
  8455. }),
  8456. $globals.ProtoStream);
  8457. $core.addMethod(
  8458. $core.method({
  8459. selector: "do:",
  8460. protocol: "enumerating",
  8461. fn: function (aBlock){
  8462. var self=this,$self=this;
  8463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8464. return $core.withContext(function($ctx1) {
  8465. //>>excludeEnd("ctx");
  8466. $recv((function(){
  8467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8468. return $core.withContext(function($ctx2) {
  8469. //>>excludeEnd("ctx");
  8470. return $self._atEnd();
  8471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8473. //>>excludeEnd("ctx");
  8474. }))._whileFalse_((function(){
  8475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8476. return $core.withContext(function($ctx2) {
  8477. //>>excludeEnd("ctx");
  8478. return $recv(aBlock)._value_($self._next());
  8479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8481. //>>excludeEnd("ctx");
  8482. }));
  8483. return self;
  8484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8485. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  8486. //>>excludeEnd("ctx");
  8487. },
  8488. //>>excludeStart("ide", pragmas.excludeIdeData);
  8489. args: ["aBlock"],
  8490. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  8491. referencedClasses: [],
  8492. //>>excludeEnd("ide");
  8493. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  8494. }),
  8495. $globals.ProtoStream);
  8496. $core.addMethod(
  8497. $core.method({
  8498. selector: "isEmpty",
  8499. protocol: "testing",
  8500. fn: function (){
  8501. var self=this,$self=this;
  8502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8503. return $core.withContext(function($ctx1) {
  8504. //>>excludeEnd("ctx");
  8505. return $recv($self._atStart())._and_((function(){
  8506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8507. return $core.withContext(function($ctx2) {
  8508. //>>excludeEnd("ctx");
  8509. return $self._atEnd();
  8510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8511. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8512. //>>excludeEnd("ctx");
  8513. }));
  8514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8515. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  8516. //>>excludeEnd("ctx");
  8517. },
  8518. //>>excludeStart("ide", pragmas.excludeIdeData);
  8519. args: [],
  8520. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  8521. referencedClasses: [],
  8522. //>>excludeEnd("ide");
  8523. messageSends: ["and:", "atStart", "atEnd"]
  8524. }),
  8525. $globals.ProtoStream);
  8526. $core.addMethod(
  8527. $core.method({
  8528. selector: "next",
  8529. protocol: "reading",
  8530. fn: function (){
  8531. var self=this,$self=this;
  8532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8533. return $core.withContext(function($ctx1) {
  8534. //>>excludeEnd("ctx");
  8535. var $1;
  8536. $1=$self._atEnd();
  8537. if($core.assert($1)){
  8538. return nil;
  8539. } else {
  8540. return $self._subclassResponsibility();
  8541. }
  8542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8543. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  8544. //>>excludeEnd("ctx");
  8545. },
  8546. //>>excludeStart("ide", pragmas.excludeIdeData);
  8547. args: [],
  8548. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8549. referencedClasses: [],
  8550. //>>excludeEnd("ide");
  8551. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8552. }),
  8553. $globals.ProtoStream);
  8554. $core.addMethod(
  8555. $core.method({
  8556. selector: "nextPut:",
  8557. protocol: "writing",
  8558. fn: function (anObject){
  8559. var self=this,$self=this;
  8560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8561. return $core.withContext(function($ctx1) {
  8562. //>>excludeEnd("ctx");
  8563. $self._subclassResponsibility();
  8564. return self;
  8565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8566. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  8567. //>>excludeEnd("ctx");
  8568. },
  8569. //>>excludeStart("ide", pragmas.excludeIdeData);
  8570. args: ["anObject"],
  8571. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  8572. referencedClasses: [],
  8573. //>>excludeEnd("ide");
  8574. messageSends: ["subclassResponsibility"]
  8575. }),
  8576. $globals.ProtoStream);
  8577. $core.addMethod(
  8578. $core.method({
  8579. selector: "nextPutAll:",
  8580. protocol: "writing",
  8581. fn: function (aCollection){
  8582. var self=this,$self=this;
  8583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8584. return $core.withContext(function($ctx1) {
  8585. //>>excludeEnd("ctx");
  8586. $recv(aCollection)._do_((function(each){
  8587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8588. return $core.withContext(function($ctx2) {
  8589. //>>excludeEnd("ctx");
  8590. return $self._nextPut_(each);
  8591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8592. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8593. //>>excludeEnd("ctx");
  8594. }));
  8595. return self;
  8596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8597. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  8598. //>>excludeEnd("ctx");
  8599. },
  8600. //>>excludeStart("ide", pragmas.excludeIdeData);
  8601. args: ["aCollection"],
  8602. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  8603. referencedClasses: [],
  8604. //>>excludeEnd("ide");
  8605. messageSends: ["do:", "nextPut:"]
  8606. }),
  8607. $globals.ProtoStream);
  8608. $core.addMethod(
  8609. $core.method({
  8610. selector: "nextPutString:",
  8611. protocol: "writing",
  8612. fn: function (aString){
  8613. var self=this,$self=this;
  8614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8615. return $core.withContext(function($ctx1) {
  8616. //>>excludeEnd("ctx");
  8617. $self._nextPut_(aString);
  8618. return self;
  8619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8620. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  8621. //>>excludeEnd("ctx");
  8622. },
  8623. //>>excludeStart("ide", pragmas.excludeIdeData);
  8624. args: ["aString"],
  8625. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  8626. referencedClasses: [],
  8627. //>>excludeEnd("ide");
  8628. messageSends: ["nextPut:"]
  8629. }),
  8630. $globals.ProtoStream);
  8631. $core.addMethod(
  8632. $core.method({
  8633. selector: "peek",
  8634. protocol: "reading",
  8635. fn: function (){
  8636. var self=this,$self=this;
  8637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8638. return $core.withContext(function($ctx1) {
  8639. //>>excludeEnd("ctx");
  8640. var $1;
  8641. $1=$self._atEnd();
  8642. if($core.assert($1)){
  8643. return nil;
  8644. } else {
  8645. return $self._subclassResponsibility();
  8646. }
  8647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8648. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  8649. //>>excludeEnd("ctx");
  8650. },
  8651. //>>excludeStart("ide", pragmas.excludeIdeData);
  8652. args: [],
  8653. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8654. referencedClasses: [],
  8655. //>>excludeEnd("ide");
  8656. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8657. }),
  8658. $globals.ProtoStream);
  8659. $core.addMethod(
  8660. $core.method({
  8661. selector: "reset",
  8662. protocol: "actions",
  8663. fn: function (){
  8664. var self=this,$self=this;
  8665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8666. return $core.withContext(function($ctx1) {
  8667. //>>excludeEnd("ctx");
  8668. $self._subclassResponsibility();
  8669. return self;
  8670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8671. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  8672. //>>excludeEnd("ctx");
  8673. },
  8674. //>>excludeStart("ide", pragmas.excludeIdeData);
  8675. args: [],
  8676. source: "reset\x0a\x09self subclassResponsibility",
  8677. referencedClasses: [],
  8678. //>>excludeEnd("ide");
  8679. messageSends: ["subclassResponsibility"]
  8680. }),
  8681. $globals.ProtoStream);
  8682. $core.addMethod(
  8683. $core.method({
  8684. selector: "resetContents",
  8685. protocol: "actions",
  8686. fn: function (){
  8687. var self=this,$self=this;
  8688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8689. return $core.withContext(function($ctx1) {
  8690. //>>excludeEnd("ctx");
  8691. $self._subclassResponsibility();
  8692. return self;
  8693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8694. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  8695. //>>excludeEnd("ctx");
  8696. },
  8697. //>>excludeStart("ide", pragmas.excludeIdeData);
  8698. args: [],
  8699. source: "resetContents\x0a\x09self subclassResponsibility",
  8700. referencedClasses: [],
  8701. //>>excludeEnd("ide");
  8702. messageSends: ["subclassResponsibility"]
  8703. }),
  8704. $globals.ProtoStream);
  8705. $core.addMethod(
  8706. $core.method({
  8707. selector: "setToEnd",
  8708. protocol: "positioning",
  8709. fn: function (){
  8710. var self=this,$self=this;
  8711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8712. return $core.withContext(function($ctx1) {
  8713. //>>excludeEnd("ctx");
  8714. $self._subclassResponsibility();
  8715. return self;
  8716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8717. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  8718. //>>excludeEnd("ctx");
  8719. },
  8720. //>>excludeStart("ide", pragmas.excludeIdeData);
  8721. args: [],
  8722. source: "setToEnd\x0a\x09self subclassResponsibility",
  8723. referencedClasses: [],
  8724. //>>excludeEnd("ide");
  8725. messageSends: ["subclassResponsibility"]
  8726. }),
  8727. $globals.ProtoStream);
  8728. $core.addMethod(
  8729. $core.method({
  8730. selector: "setToStart",
  8731. protocol: "positioning",
  8732. fn: function (){
  8733. var self=this,$self=this;
  8734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8735. return $core.withContext(function($ctx1) {
  8736. //>>excludeEnd("ctx");
  8737. $self._reset();
  8738. return self;
  8739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8740. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  8741. //>>excludeEnd("ctx");
  8742. },
  8743. //>>excludeStart("ide", pragmas.excludeIdeData);
  8744. args: [],
  8745. source: "setToStart\x0a\x09self reset",
  8746. referencedClasses: [],
  8747. //>>excludeEnd("ide");
  8748. messageSends: ["reset"]
  8749. }),
  8750. $globals.ProtoStream);
  8751. $core.addMethod(
  8752. $core.method({
  8753. selector: "write:",
  8754. protocol: "writing",
  8755. fn: function (anObject){
  8756. var self=this,$self=this;
  8757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8758. return $core.withContext(function($ctx1) {
  8759. //>>excludeEnd("ctx");
  8760. $recv(anObject)._putOn_(self);
  8761. return self;
  8762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8763. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  8764. //>>excludeEnd("ctx");
  8765. },
  8766. //>>excludeStart("ide", pragmas.excludeIdeData);
  8767. args: ["anObject"],
  8768. source: "write: anObject\x0a\x09anObject putOn: self",
  8769. referencedClasses: [],
  8770. //>>excludeEnd("ide");
  8771. messageSends: ["putOn:"]
  8772. }),
  8773. $globals.ProtoStream);
  8774. $core.addMethod(
  8775. $core.method({
  8776. selector: "on:",
  8777. protocol: "instance creation",
  8778. fn: function (aCollection){
  8779. var self=this,$self=this;
  8780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8781. return $core.withContext(function($ctx1) {
  8782. //>>excludeEnd("ctx");
  8783. var $1;
  8784. $1=$self._new();
  8785. $recv($1)._setCollection_(aCollection);
  8786. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8787. return $recv($1)._yourself();
  8788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8789. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.a$cls)});
  8790. //>>excludeEnd("ctx");
  8791. },
  8792. //>>excludeStart("ide", pragmas.excludeIdeData);
  8793. args: ["aCollection"],
  8794. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8795. referencedClasses: [],
  8796. //>>excludeEnd("ide");
  8797. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8798. }),
  8799. $globals.ProtoStream.a$cls);
  8800. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  8801. //>>excludeStart("ide", pragmas.excludeIdeData);
  8802. $globals.Stream.comment="I represent an accessor for a sequence of objects. This sequence is referred to as my \x22contents\x22.\x0aMy instances are read/write streams to the contents sequence collection.";
  8803. //>>excludeEnd("ide");
  8804. $core.addMethod(
  8805. $core.method({
  8806. selector: "atEnd",
  8807. protocol: "testing",
  8808. fn: function (){
  8809. var self=this,$self=this;
  8810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8811. return $core.withContext(function($ctx1) {
  8812. //>>excludeEnd("ctx");
  8813. return $recv($self._position()).__eq($self._size());
  8814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8815. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  8816. //>>excludeEnd("ctx");
  8817. },
  8818. //>>excludeStart("ide", pragmas.excludeIdeData);
  8819. args: [],
  8820. source: "atEnd\x0a\x09^ self position = self size",
  8821. referencedClasses: [],
  8822. //>>excludeEnd("ide");
  8823. messageSends: ["=", "position", "size"]
  8824. }),
  8825. $globals.Stream);
  8826. $core.addMethod(
  8827. $core.method({
  8828. selector: "atStart",
  8829. protocol: "testing",
  8830. fn: function (){
  8831. var self=this,$self=this;
  8832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8833. return $core.withContext(function($ctx1) {
  8834. //>>excludeEnd("ctx");
  8835. return $recv($self._position()).__eq((0));
  8836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8837. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  8838. //>>excludeEnd("ctx");
  8839. },
  8840. //>>excludeStart("ide", pragmas.excludeIdeData);
  8841. args: [],
  8842. source: "atStart\x0a\x09^ self position = 0",
  8843. referencedClasses: [],
  8844. //>>excludeEnd("ide");
  8845. messageSends: ["=", "position"]
  8846. }),
  8847. $globals.Stream);
  8848. $core.addMethod(
  8849. $core.method({
  8850. selector: "close",
  8851. protocol: "actions",
  8852. fn: function (){
  8853. var self=this,$self=this;
  8854. return self;
  8855. },
  8856. //>>excludeStart("ide", pragmas.excludeIdeData);
  8857. args: [],
  8858. source: "close",
  8859. referencedClasses: [],
  8860. //>>excludeEnd("ide");
  8861. messageSends: []
  8862. }),
  8863. $globals.Stream);
  8864. $core.addMethod(
  8865. $core.method({
  8866. selector: "collection",
  8867. protocol: "accessing",
  8868. fn: function (){
  8869. var self=this,$self=this;
  8870. return $self["@collection"];
  8871. },
  8872. //>>excludeStart("ide", pragmas.excludeIdeData);
  8873. args: [],
  8874. source: "collection\x0a\x09^ collection",
  8875. referencedClasses: [],
  8876. //>>excludeEnd("ide");
  8877. messageSends: []
  8878. }),
  8879. $globals.Stream);
  8880. $core.addMethod(
  8881. $core.method({
  8882. selector: "contents",
  8883. protocol: "accessing",
  8884. fn: function (){
  8885. var self=this,$self=this;
  8886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8887. return $core.withContext(function($ctx1) {
  8888. //>>excludeEnd("ctx");
  8889. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  8890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8891. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  8892. //>>excludeEnd("ctx");
  8893. },
  8894. //>>excludeStart("ide", pragmas.excludeIdeData);
  8895. args: [],
  8896. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8897. referencedClasses: [],
  8898. //>>excludeEnd("ide");
  8899. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8900. }),
  8901. $globals.Stream);
  8902. $core.addMethod(
  8903. $core.method({
  8904. selector: "flush",
  8905. protocol: "actions",
  8906. fn: function (){
  8907. var self=this,$self=this;
  8908. return self;
  8909. },
  8910. //>>excludeStart("ide", pragmas.excludeIdeData);
  8911. args: [],
  8912. source: "flush",
  8913. referencedClasses: [],
  8914. //>>excludeEnd("ide");
  8915. messageSends: []
  8916. }),
  8917. $globals.Stream);
  8918. $core.addMethod(
  8919. $core.method({
  8920. selector: "isEmpty",
  8921. protocol: "testing",
  8922. fn: function (){
  8923. var self=this,$self=this;
  8924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8925. return $core.withContext(function($ctx1) {
  8926. //>>excludeEnd("ctx");
  8927. return $recv($self._size()).__eq((0));
  8928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8929. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  8930. //>>excludeEnd("ctx");
  8931. },
  8932. //>>excludeStart("ide", pragmas.excludeIdeData);
  8933. args: [],
  8934. source: "isEmpty\x0a\x09^ self size = 0",
  8935. referencedClasses: [],
  8936. //>>excludeEnd("ide");
  8937. messageSends: ["=", "size"]
  8938. }),
  8939. $globals.Stream);
  8940. $core.addMethod(
  8941. $core.method({
  8942. selector: "next",
  8943. protocol: "reading",
  8944. fn: function (){
  8945. var self=this,$self=this;
  8946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8947. return $core.withContext(function($ctx1) {
  8948. //>>excludeEnd("ctx");
  8949. var $1,$3,$2;
  8950. $1=$self._atEnd();
  8951. if($core.assert($1)){
  8952. return nil;
  8953. } else {
  8954. $3=$self._position();
  8955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8956. $ctx1.sendIdx["position"]=1;
  8957. //>>excludeEnd("ctx");
  8958. $2=$recv($3).__plus((1));
  8959. $self._position_($2);
  8960. return $recv($self["@collection"])._at_($self._position());
  8961. }
  8962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8963. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  8964. //>>excludeEnd("ctx");
  8965. },
  8966. //>>excludeStart("ide", pragmas.excludeIdeData);
  8967. args: [],
  8968. 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 ]",
  8969. referencedClasses: [],
  8970. //>>excludeEnd("ide");
  8971. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8972. }),
  8973. $globals.Stream);
  8974. $core.addMethod(
  8975. $core.method({
  8976. selector: "next:",
  8977. protocol: "reading",
  8978. fn: function (anInteger){
  8979. var self=this,$self=this;
  8980. var tempCollection;
  8981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8982. return $core.withContext(function($ctx1) {
  8983. //>>excludeEnd("ctx");
  8984. var $1;
  8985. tempCollection=$recv($recv($self._collection())._class())._new();
  8986. $recv(anInteger)._timesRepeat_((function(){
  8987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8988. return $core.withContext(function($ctx2) {
  8989. //>>excludeEnd("ctx");
  8990. $1=$self._atEnd();
  8991. if(!$core.assert($1)){
  8992. return $recv(tempCollection)._add_($self._next());
  8993. }
  8994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8996. //>>excludeEnd("ctx");
  8997. }));
  8998. return tempCollection;
  8999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9000. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  9001. //>>excludeEnd("ctx");
  9002. },
  9003. //>>excludeStart("ide", pragmas.excludeIdeData);
  9004. args: ["anInteger"],
  9005. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09\x09self atEnd ifFalse: [\x0a\x09\x09tempCollection add: self next ]].\x0a\x09^ tempCollection",
  9006. referencedClasses: [],
  9007. //>>excludeEnd("ide");
  9008. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  9009. }),
  9010. $globals.Stream);
  9011. $core.addMethod(
  9012. $core.method({
  9013. selector: "nextPut:",
  9014. protocol: "writing",
  9015. fn: function (anObject){
  9016. var self=this,$self=this;
  9017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9018. return $core.withContext(function($ctx1) {
  9019. //>>excludeEnd("ctx");
  9020. var $2,$1,$3,$4;
  9021. $2=$self._position();
  9022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9023. $ctx1.sendIdx["position"]=1;
  9024. //>>excludeEnd("ctx");
  9025. $1=$recv($2).__plus((1));
  9026. $self._position_($1);
  9027. $3=$self._collection();
  9028. $4=$self._position();
  9029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9030. $ctx1.sendIdx["position"]=2;
  9031. //>>excludeEnd("ctx");
  9032. $recv($3)._at_put_($4,anObject);
  9033. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  9034. return self;
  9035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9036. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  9037. //>>excludeEnd("ctx");
  9038. },
  9039. //>>excludeStart("ide", pragmas.excludeIdeData);
  9040. args: ["anObject"],
  9041. 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)",
  9042. referencedClasses: [],
  9043. //>>excludeEnd("ide");
  9044. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  9045. }),
  9046. $globals.Stream);
  9047. $core.addMethod(
  9048. $core.method({
  9049. selector: "peek",
  9050. protocol: "reading",
  9051. fn: function (){
  9052. var self=this,$self=this;
  9053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9054. return $core.withContext(function($ctx1) {
  9055. //>>excludeEnd("ctx");
  9056. var $1;
  9057. $1=$self._atEnd();
  9058. if(!$core.assert($1)){
  9059. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  9060. }
  9061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9062. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  9063. //>>excludeEnd("ctx");
  9064. },
  9065. //>>excludeStart("ide", pragmas.excludeIdeData);
  9066. args: [],
  9067. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  9068. referencedClasses: [],
  9069. //>>excludeEnd("ide");
  9070. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  9071. }),
  9072. $globals.Stream);
  9073. $core.addMethod(
  9074. $core.method({
  9075. selector: "position",
  9076. protocol: "accessing",
  9077. fn: function (){
  9078. var self=this,$self=this;
  9079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9080. return $core.withContext(function($ctx1) {
  9081. //>>excludeEnd("ctx");
  9082. var $1,$receiver;
  9083. $1=$self["@position"];
  9084. if(($receiver = $1) == null || $receiver.a$nil){
  9085. $self["@position"]=(0);
  9086. return $self["@position"];
  9087. } else {
  9088. return $1;
  9089. }
  9090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9091. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  9092. //>>excludeEnd("ctx");
  9093. },
  9094. //>>excludeStart("ide", pragmas.excludeIdeData);
  9095. args: [],
  9096. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  9097. referencedClasses: [],
  9098. //>>excludeEnd("ide");
  9099. messageSends: ["ifNil:"]
  9100. }),
  9101. $globals.Stream);
  9102. $core.addMethod(
  9103. $core.method({
  9104. selector: "position:",
  9105. protocol: "accessing",
  9106. fn: function (anInteger){
  9107. var self=this,$self=this;
  9108. $self["@position"]=anInteger;
  9109. return self;
  9110. },
  9111. //>>excludeStart("ide", pragmas.excludeIdeData);
  9112. args: ["anInteger"],
  9113. source: "position: anInteger\x0a\x09position := anInteger",
  9114. referencedClasses: [],
  9115. //>>excludeEnd("ide");
  9116. messageSends: []
  9117. }),
  9118. $globals.Stream);
  9119. $core.addMethod(
  9120. $core.method({
  9121. selector: "reset",
  9122. protocol: "actions",
  9123. fn: function (){
  9124. var self=this,$self=this;
  9125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9126. return $core.withContext(function($ctx1) {
  9127. //>>excludeEnd("ctx");
  9128. $self._position_((0));
  9129. return self;
  9130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9131. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  9132. //>>excludeEnd("ctx");
  9133. },
  9134. //>>excludeStart("ide", pragmas.excludeIdeData);
  9135. args: [],
  9136. source: "reset\x0a\x09self position: 0",
  9137. referencedClasses: [],
  9138. //>>excludeEnd("ide");
  9139. messageSends: ["position:"]
  9140. }),
  9141. $globals.Stream);
  9142. $core.addMethod(
  9143. $core.method({
  9144. selector: "resetContents",
  9145. protocol: "actions",
  9146. fn: function (){
  9147. var self=this,$self=this;
  9148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9149. return $core.withContext(function($ctx1) {
  9150. //>>excludeEnd("ctx");
  9151. $self._reset();
  9152. $self._setStreamSize_((0));
  9153. return self;
  9154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9155. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  9156. //>>excludeEnd("ctx");
  9157. },
  9158. //>>excludeStart("ide", pragmas.excludeIdeData);
  9159. args: [],
  9160. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  9161. referencedClasses: [],
  9162. //>>excludeEnd("ide");
  9163. messageSends: ["reset", "setStreamSize:"]
  9164. }),
  9165. $globals.Stream);
  9166. $core.addMethod(
  9167. $core.method({
  9168. selector: "setCollection:",
  9169. protocol: "accessing",
  9170. fn: function (aCollection){
  9171. var self=this,$self=this;
  9172. $self["@collection"]=aCollection;
  9173. return self;
  9174. },
  9175. //>>excludeStart("ide", pragmas.excludeIdeData);
  9176. args: ["aCollection"],
  9177. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  9178. referencedClasses: [],
  9179. //>>excludeEnd("ide");
  9180. messageSends: []
  9181. }),
  9182. $globals.Stream);
  9183. $core.addMethod(
  9184. $core.method({
  9185. selector: "setStreamSize:",
  9186. protocol: "accessing",
  9187. fn: function (anInteger){
  9188. var self=this,$self=this;
  9189. $self["@streamSize"]=anInteger;
  9190. return self;
  9191. },
  9192. //>>excludeStart("ide", pragmas.excludeIdeData);
  9193. args: ["anInteger"],
  9194. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  9195. referencedClasses: [],
  9196. //>>excludeEnd("ide");
  9197. messageSends: []
  9198. }),
  9199. $globals.Stream);
  9200. $core.addMethod(
  9201. $core.method({
  9202. selector: "setToEnd",
  9203. protocol: "positioning",
  9204. fn: function (){
  9205. var self=this,$self=this;
  9206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9207. return $core.withContext(function($ctx1) {
  9208. //>>excludeEnd("ctx");
  9209. $self._position_($self._size());
  9210. return self;
  9211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9212. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  9213. //>>excludeEnd("ctx");
  9214. },
  9215. //>>excludeStart("ide", pragmas.excludeIdeData);
  9216. args: [],
  9217. source: "setToEnd\x0a\x09self position: self size",
  9218. referencedClasses: [],
  9219. //>>excludeEnd("ide");
  9220. messageSends: ["position:", "size"]
  9221. }),
  9222. $globals.Stream);
  9223. $core.addMethod(
  9224. $core.method({
  9225. selector: "size",
  9226. protocol: "accessing",
  9227. fn: function (){
  9228. var self=this,$self=this;
  9229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9230. return $core.withContext(function($ctx1) {
  9231. //>>excludeEnd("ctx");
  9232. return $self._streamSize();
  9233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9234. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  9235. //>>excludeEnd("ctx");
  9236. },
  9237. //>>excludeStart("ide", pragmas.excludeIdeData);
  9238. args: [],
  9239. source: "size\x0a\x09^ self streamSize",
  9240. referencedClasses: [],
  9241. //>>excludeEnd("ide");
  9242. messageSends: ["streamSize"]
  9243. }),
  9244. $globals.Stream);
  9245. $core.addMethod(
  9246. $core.method({
  9247. selector: "skip:",
  9248. protocol: "positioning",
  9249. fn: function (anInteger){
  9250. var self=this,$self=this;
  9251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9252. return $core.withContext(function($ctx1) {
  9253. //>>excludeEnd("ctx");
  9254. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  9255. return self;
  9256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9257. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  9258. //>>excludeEnd("ctx");
  9259. },
  9260. //>>excludeStart("ide", pragmas.excludeIdeData);
  9261. args: ["anInteger"],
  9262. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  9263. referencedClasses: [],
  9264. //>>excludeEnd("ide");
  9265. messageSends: ["position:", "min:max:", "+", "position", "size"]
  9266. }),
  9267. $globals.Stream);
  9268. $core.addMethod(
  9269. $core.method({
  9270. selector: "streamSize",
  9271. protocol: "accessing",
  9272. fn: function (){
  9273. var self=this,$self=this;
  9274. return $self["@streamSize"];
  9275. },
  9276. //>>excludeStart("ide", pragmas.excludeIdeData);
  9277. args: [],
  9278. source: "streamSize\x0a\x09^ streamSize",
  9279. referencedClasses: [],
  9280. //>>excludeEnd("ide");
  9281. messageSends: []
  9282. }),
  9283. $globals.Stream);
  9284. $core.addMethod(
  9285. $core.method({
  9286. selector: "on:",
  9287. protocol: "instance creation",
  9288. fn: function (aCollection){
  9289. var self=this,$self=this;
  9290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9291. return $core.withContext(function($ctx1) {
  9292. //>>excludeEnd("ctx");
  9293. var $1;
  9294. $1=$self._new();
  9295. $recv($1)._setCollection_(aCollection);
  9296. $recv($1)._setStreamSize_($recv(aCollection)._size());
  9297. return $recv($1)._yourself();
  9298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9299. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.a$cls)});
  9300. //>>excludeEnd("ctx");
  9301. },
  9302. //>>excludeStart("ide", pragmas.excludeIdeData);
  9303. args: ["aCollection"],
  9304. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  9305. referencedClasses: [],
  9306. //>>excludeEnd("ide");
  9307. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  9308. }),
  9309. $globals.Stream.a$cls);
  9310. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  9311. //>>excludeStart("ide", pragmas.excludeIdeData);
  9312. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  9313. //>>excludeEnd("ide");
  9314. $core.addMethod(
  9315. $core.method({
  9316. selector: "cr",
  9317. protocol: "writing",
  9318. fn: function (){
  9319. var self=this,$self=this;
  9320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9321. return $core.withContext(function($ctx1) {
  9322. //>>excludeEnd("ctx");
  9323. return $self._nextPutAll_($recv($globals.String)._cr());
  9324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9325. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  9326. //>>excludeEnd("ctx");
  9327. },
  9328. //>>excludeStart("ide", pragmas.excludeIdeData);
  9329. args: [],
  9330. source: "cr\x0a\x09^ self nextPutAll: String cr",
  9331. referencedClasses: ["String"],
  9332. //>>excludeEnd("ide");
  9333. messageSends: ["nextPutAll:", "cr"]
  9334. }),
  9335. $globals.StringStream);
  9336. $core.addMethod(
  9337. $core.method({
  9338. selector: "crlf",
  9339. protocol: "writing",
  9340. fn: function (){
  9341. var self=this,$self=this;
  9342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9343. return $core.withContext(function($ctx1) {
  9344. //>>excludeEnd("ctx");
  9345. return $self._nextPutAll_($recv($globals.String)._crlf());
  9346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9347. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  9348. //>>excludeEnd("ctx");
  9349. },
  9350. //>>excludeStart("ide", pragmas.excludeIdeData);
  9351. args: [],
  9352. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  9353. referencedClasses: ["String"],
  9354. //>>excludeEnd("ide");
  9355. messageSends: ["nextPutAll:", "crlf"]
  9356. }),
  9357. $globals.StringStream);
  9358. $core.addMethod(
  9359. $core.method({
  9360. selector: "lf",
  9361. protocol: "writing",
  9362. fn: function (){
  9363. var self=this,$self=this;
  9364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9365. return $core.withContext(function($ctx1) {
  9366. //>>excludeEnd("ctx");
  9367. return $self._nextPutAll_($recv($globals.String)._lf());
  9368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9369. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  9370. //>>excludeEnd("ctx");
  9371. },
  9372. //>>excludeStart("ide", pragmas.excludeIdeData);
  9373. args: [],
  9374. source: "lf\x0a\x09^ self nextPutAll: String lf",
  9375. referencedClasses: ["String"],
  9376. //>>excludeEnd("ide");
  9377. messageSends: ["nextPutAll:", "lf"]
  9378. }),
  9379. $globals.StringStream);
  9380. $core.addMethod(
  9381. $core.method({
  9382. selector: "next:",
  9383. protocol: "reading",
  9384. fn: function (anInteger){
  9385. var self=this,$self=this;
  9386. var tempCollection;
  9387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9388. return $core.withContext(function($ctx1) {
  9389. //>>excludeEnd("ctx");
  9390. var $1;
  9391. tempCollection=$recv($recv($self._collection())._class())._new();
  9392. $recv(anInteger)._timesRepeat_((function(){
  9393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9394. return $core.withContext(function($ctx2) {
  9395. //>>excludeEnd("ctx");
  9396. $1=$self._atEnd();
  9397. if(!$core.assert($1)){
  9398. tempCollection=$recv(tempCollection).__comma($self._next());
  9399. return tempCollection;
  9400. }
  9401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9403. //>>excludeEnd("ctx");
  9404. }));
  9405. return tempCollection;
  9406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9407. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  9408. //>>excludeEnd("ctx");
  9409. },
  9410. //>>excludeStart("ide", pragmas.excludeIdeData);
  9411. args: ["anInteger"],
  9412. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09\x09self atEnd ifFalse: [\x0a\x09\x09tempCollection := tempCollection, self next ]].\x0a\x09^ tempCollection",
  9413. referencedClasses: [],
  9414. //>>excludeEnd("ide");
  9415. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  9416. }),
  9417. $globals.StringStream);
  9418. $core.addMethod(
  9419. $core.method({
  9420. selector: "nextPut:",
  9421. protocol: "writing",
  9422. fn: function (aString){
  9423. var self=this,$self=this;
  9424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9425. return $core.withContext(function($ctx1) {
  9426. //>>excludeEnd("ctx");
  9427. $self._nextPutAll_(aString);
  9428. return self;
  9429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9430. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  9431. //>>excludeEnd("ctx");
  9432. },
  9433. //>>excludeStart("ide", pragmas.excludeIdeData);
  9434. args: ["aString"],
  9435. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  9436. referencedClasses: [],
  9437. //>>excludeEnd("ide");
  9438. messageSends: ["nextPutAll:"]
  9439. }),
  9440. $globals.StringStream);
  9441. $core.addMethod(
  9442. $core.method({
  9443. selector: "nextPutAll:",
  9444. protocol: "writing",
  9445. fn: function (aString){
  9446. var self=this,$self=this;
  9447. var pre,post;
  9448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9449. return $core.withContext(function($ctx1) {
  9450. //>>excludeEnd("ctx");
  9451. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  9452. $1=$self._atEnd();
  9453. if($core.assert($1)){
  9454. $3=$self._collection();
  9455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9456. $ctx1.sendIdx["collection"]=1;
  9457. //>>excludeEnd("ctx");
  9458. $2=$recv($3).__comma(aString);
  9459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9460. $ctx1.sendIdx[","]=1;
  9461. //>>excludeEnd("ctx");
  9462. $self._setCollection_($2);
  9463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9464. $ctx1.sendIdx["setCollection:"]=1;
  9465. //>>excludeEnd("ctx");
  9466. } else {
  9467. $4=$self._collection();
  9468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9469. $ctx1.sendIdx["collection"]=2;
  9470. //>>excludeEnd("ctx");
  9471. $5=$self._position();
  9472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9473. $ctx1.sendIdx["position"]=1;
  9474. //>>excludeEnd("ctx");
  9475. pre=$recv($4)._copyFrom_to_((1),$5);
  9476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9477. $ctx1.sendIdx["copyFrom:to:"]=1;
  9478. //>>excludeEnd("ctx");
  9479. $6=$self._collection();
  9480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9481. $ctx1.sendIdx["collection"]=3;
  9482. //>>excludeEnd("ctx");
  9483. $9=$self._position();
  9484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9485. $ctx1.sendIdx["position"]=2;
  9486. //>>excludeEnd("ctx");
  9487. $8=$recv($9).__plus((1));
  9488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9489. $ctx1.sendIdx["+"]=2;
  9490. //>>excludeEnd("ctx");
  9491. $10=$recv(aString)._size();
  9492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9493. $ctx1.sendIdx["size"]=1;
  9494. //>>excludeEnd("ctx");
  9495. $7=$recv($8).__plus($10);
  9496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9497. $ctx1.sendIdx["+"]=1;
  9498. //>>excludeEnd("ctx");
  9499. $11=$recv($self._collection())._size();
  9500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9501. $ctx1.sendIdx["size"]=2;
  9502. //>>excludeEnd("ctx");
  9503. post=$recv($6)._copyFrom_to_($7,$11);
  9504. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  9505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9506. $ctx1.sendIdx[","]=2;
  9507. //>>excludeEnd("ctx");
  9508. $self._setCollection_($12);
  9509. }
  9510. $14=$self._position();
  9511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9512. $ctx1.sendIdx["position"]=3;
  9513. //>>excludeEnd("ctx");
  9514. $13=$recv($14).__plus($recv(aString)._size());
  9515. $self._position_($13);
  9516. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  9517. return self;
  9518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9519. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  9520. //>>excludeEnd("ctx");
  9521. },
  9522. //>>excludeStart("ide", pragmas.excludeIdeData);
  9523. args: ["aString"],
  9524. source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self atEnd ifTrue: [ self setCollection: self collection, aString ] ifFalse: [\x0a\x09\x09pre := self collection copyFrom: 1 to: self position.\x0a\x09\x09post := self collection copyFrom: (self position + 1 + aString size) to: self collection size.\x0a\x09\x09self setCollection: pre, aString, post\x0a\x09].\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  9525. referencedClasses: [],
  9526. //>>excludeEnd("ide");
  9527. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  9528. }),
  9529. $globals.StringStream);
  9530. $core.addMethod(
  9531. $core.method({
  9532. selector: "nextPutString:",
  9533. protocol: "writing",
  9534. fn: function (aString){
  9535. var self=this,$self=this;
  9536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9537. return $core.withContext(function($ctx1) {
  9538. //>>excludeEnd("ctx");
  9539. $self._nextPutAll_(aString);
  9540. return self;
  9541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9542. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  9543. //>>excludeEnd("ctx");
  9544. },
  9545. //>>excludeStart("ide", pragmas.excludeIdeData);
  9546. args: ["aString"],
  9547. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  9548. referencedClasses: [],
  9549. //>>excludeEnd("ide");
  9550. messageSends: ["nextPutAll:"]
  9551. }),
  9552. $globals.StringStream);
  9553. $core.addMethod(
  9554. $core.method({
  9555. selector: "print:",
  9556. protocol: "writing",
  9557. fn: function (anObject){
  9558. var self=this,$self=this;
  9559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9560. return $core.withContext(function($ctx1) {
  9561. //>>excludeEnd("ctx");
  9562. $recv(anObject)._printOn_(self);
  9563. return self;
  9564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9565. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  9566. //>>excludeEnd("ctx");
  9567. },
  9568. //>>excludeStart("ide", pragmas.excludeIdeData);
  9569. args: ["anObject"],
  9570. source: "print: anObject\x0a\x09anObject printOn: self",
  9571. referencedClasses: [],
  9572. //>>excludeEnd("ide");
  9573. messageSends: ["printOn:"]
  9574. }),
  9575. $globals.StringStream);
  9576. $core.addMethod(
  9577. $core.method({
  9578. selector: "printSymbol:",
  9579. protocol: "writing",
  9580. fn: function (anObject){
  9581. var self=this,$self=this;
  9582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9583. return $core.withContext(function($ctx1) {
  9584. //>>excludeEnd("ctx");
  9585. $recv(anObject)._asSymbolPrintOn_(self);
  9586. return self;
  9587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9588. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  9589. //>>excludeEnd("ctx");
  9590. },
  9591. //>>excludeStart("ide", pragmas.excludeIdeData);
  9592. args: ["anObject"],
  9593. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  9594. referencedClasses: [],
  9595. //>>excludeEnd("ide");
  9596. messageSends: ["asSymbolPrintOn:"]
  9597. }),
  9598. $globals.StringStream);
  9599. $core.addMethod(
  9600. $core.method({
  9601. selector: "space",
  9602. protocol: "writing",
  9603. fn: function (){
  9604. var self=this,$self=this;
  9605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9606. return $core.withContext(function($ctx1) {
  9607. //>>excludeEnd("ctx");
  9608. $self._nextPut_(" ");
  9609. return self;
  9610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9611. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  9612. //>>excludeEnd("ctx");
  9613. },
  9614. //>>excludeStart("ide", pragmas.excludeIdeData);
  9615. args: [],
  9616. source: "space\x0a\x09self nextPut: ' '",
  9617. referencedClasses: [],
  9618. //>>excludeEnd("ide");
  9619. messageSends: ["nextPut:"]
  9620. }),
  9621. $globals.StringStream);
  9622. $core.addMethod(
  9623. $core.method({
  9624. selector: "tab",
  9625. protocol: "writing",
  9626. fn: function (){
  9627. var self=this,$self=this;
  9628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9629. return $core.withContext(function($ctx1) {
  9630. //>>excludeEnd("ctx");
  9631. return $self._nextPutAll_($recv($globals.String)._tab());
  9632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9633. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  9634. //>>excludeEnd("ctx");
  9635. },
  9636. //>>excludeStart("ide", pragmas.excludeIdeData);
  9637. args: [],
  9638. source: "tab\x0a\x09^ self nextPutAll: String tab",
  9639. referencedClasses: ["String"],
  9640. //>>excludeEnd("ide");
  9641. messageSends: ["nextPutAll:", "tab"]
  9642. }),
  9643. $globals.StringStream);
  9644. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  9645. //>>excludeStart("ide", pragmas.excludeIdeData);
  9646. $globals.Queue.comment="I am a one-sided queue.\x0a\x0a## Usage\x0a\x0aUse `#nextPut:` to add items to the queue.\x0aUse `#next` or `#nextIfAbsent:` to get (and remove) the next item in the queue.\x0a\x0a## Implementation notes\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 me, write appending may do data moving\x0awhen growing `write`, but this is left to engine to implement as good as it chooses to.";
  9647. //>>excludeEnd("ide");
  9648. $core.addMethod(
  9649. $core.method({
  9650. selector: "initialize",
  9651. protocol: "initialization",
  9652. fn: function (){
  9653. var self=this,$self=this;
  9654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9655. return $core.withContext(function($ctx1) {
  9656. //>>excludeEnd("ctx");
  9657. (
  9658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9659. $ctx1.supercall = true,
  9660. //>>excludeEnd("ctx");
  9661. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  9662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9663. $ctx1.supercall = false;
  9664. //>>excludeEnd("ctx");;
  9665. $self["@read"]=$recv($globals.OrderedCollection)._new();
  9666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9667. $ctx1.sendIdx["new"]=1;
  9668. //>>excludeEnd("ctx");
  9669. $self["@write"]=$recv($globals.OrderedCollection)._new();
  9670. $self["@readIndex"]=(1);
  9671. return self;
  9672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9673. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  9674. //>>excludeEnd("ctx");
  9675. },
  9676. //>>excludeStart("ide", pragmas.excludeIdeData);
  9677. args: [],
  9678. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  9679. referencedClasses: ["OrderedCollection"],
  9680. //>>excludeEnd("ide");
  9681. messageSends: ["initialize", "new"]
  9682. }),
  9683. $globals.Queue);
  9684. $core.addMethod(
  9685. $core.method({
  9686. selector: "next",
  9687. protocol: "accessing",
  9688. fn: function (){
  9689. var self=this,$self=this;
  9690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9691. return $core.withContext(function($ctx1) {
  9692. //>>excludeEnd("ctx");
  9693. return $self._nextIfAbsent_((function(){
  9694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9695. return $core.withContext(function($ctx2) {
  9696. //>>excludeEnd("ctx");
  9697. return $self._error_("Cannot read from empty Queue.");
  9698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9700. //>>excludeEnd("ctx");
  9701. }));
  9702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9703. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  9704. //>>excludeEnd("ctx");
  9705. },
  9706. //>>excludeStart("ide", pragmas.excludeIdeData);
  9707. args: [],
  9708. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  9709. referencedClasses: [],
  9710. //>>excludeEnd("ide");
  9711. messageSends: ["nextIfAbsent:", "error:"]
  9712. }),
  9713. $globals.Queue);
  9714. $core.addMethod(
  9715. $core.method({
  9716. selector: "nextIfAbsent:",
  9717. protocol: "accessing",
  9718. fn: function (aBlock){
  9719. var self=this,$self=this;
  9720. var result;
  9721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9722. return $core.withContext(function($ctx1) {
  9723. //>>excludeEnd("ctx");
  9724. var $1;
  9725. var $early={};
  9726. try {
  9727. result=$recv($self["@read"])._at_ifAbsent_($self["@readIndex"],(function(){
  9728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9729. return $core.withContext(function($ctx2) {
  9730. //>>excludeEnd("ctx");
  9731. $recv($self["@write"])._ifEmpty_((function(){
  9732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9733. return $core.withContext(function($ctx3) {
  9734. //>>excludeEnd("ctx");
  9735. $1=$recv($self["@readIndex"]).__gt((1));
  9736. if($core.assert($1)){
  9737. $self["@read"]=[];
  9738. $self["@readIndex"]=(1);
  9739. $self["@readIndex"];
  9740. }
  9741. throw $early=[$recv(aBlock)._value()];
  9742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9743. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  9744. //>>excludeEnd("ctx");
  9745. }));
  9746. $self["@read"]=$self["@write"];
  9747. $self["@readIndex"]=(1);
  9748. $self["@write"]=$recv($globals.OrderedCollection)._new();
  9749. return $recv($self["@read"])._first();
  9750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9752. //>>excludeEnd("ctx");
  9753. }));
  9754. $recv($self["@read"])._at_put_($self["@readIndex"],nil);
  9755. $self["@readIndex"]=$recv($self["@readIndex"]).__plus((1));
  9756. return result;
  9757. }
  9758. catch(e) {if(e===$early)return e[0]; throw e}
  9759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9760. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  9761. //>>excludeEnd("ctx");
  9762. },
  9763. //>>excludeStart("ide", pragmas.excludeIdeData);
  9764. args: ["aBlock"],
  9765. source: "nextIfAbsent: aBlock\x0a\x09| result |\x0a\x09result := read at: readIndex ifAbsent: [\x0a\x09\x09write ifEmpty: [\x0a\x09\x09\x09readIndex > 1 ifTrue: [ read := #(). readIndex := 1 ].\x0a\x09\x09\x09^ aBlock value ].\x0a\x09\x09read := write.\x0a\x09\x09readIndex := 1.\x0a\x09\x09write := OrderedCollection new.\x0a\x09\x09read first ].\x0a\x09read at: readIndex put: nil.\x0a\x09readIndex := readIndex + 1.\x0a\x09^ result",
  9766. referencedClasses: ["OrderedCollection"],
  9767. //>>excludeEnd("ide");
  9768. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  9769. }),
  9770. $globals.Queue);
  9771. $core.addMethod(
  9772. $core.method({
  9773. selector: "nextPut:",
  9774. protocol: "accessing",
  9775. fn: function (anObject){
  9776. var self=this,$self=this;
  9777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9778. return $core.withContext(function($ctx1) {
  9779. //>>excludeEnd("ctx");
  9780. $recv($self["@write"])._add_(anObject);
  9781. return self;
  9782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9783. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  9784. //>>excludeEnd("ctx");
  9785. },
  9786. //>>excludeStart("ide", pragmas.excludeIdeData);
  9787. args: ["anObject"],
  9788. source: "nextPut: anObject\x0a\x09write add: anObject",
  9789. referencedClasses: [],
  9790. //>>excludeEnd("ide");
  9791. messageSends: ["add:"]
  9792. }),
  9793. $globals.Queue);
  9794. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  9795. //>>excludeStart("ide", pragmas.excludeIdeData);
  9796. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9797. //>>excludeEnd("ide");
  9798. $core.addMethod(
  9799. $core.method({
  9800. selector: "compile:",
  9801. protocol: "evaluating",
  9802. fn: function (aString){
  9803. var self=this,$self=this;
  9804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9805. return $core.withContext(function($ctx1) {
  9806. //>>excludeEnd("ctx");
  9807. return self.compile(aString);
  9808. return self;
  9809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9810. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  9811. //>>excludeEnd("ctx");
  9812. },
  9813. //>>excludeStart("ide", pragmas.excludeIdeData);
  9814. args: ["aString"],
  9815. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  9816. referencedClasses: [],
  9817. //>>excludeEnd("ide");
  9818. messageSends: []
  9819. }),
  9820. $globals.RegularExpression);
  9821. $core.addMethod(
  9822. $core.method({
  9823. selector: "exec:",
  9824. protocol: "evaluating",
  9825. fn: function (aString){
  9826. var self=this,$self=this;
  9827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9828. return $core.withContext(function($ctx1) {
  9829. //>>excludeEnd("ctx");
  9830. return self.exec(aString) || nil;
  9831. return self;
  9832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9833. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  9834. //>>excludeEnd("ctx");
  9835. },
  9836. //>>excludeStart("ide", pragmas.excludeIdeData);
  9837. args: ["aString"],
  9838. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  9839. referencedClasses: [],
  9840. //>>excludeEnd("ide");
  9841. messageSends: []
  9842. }),
  9843. $globals.RegularExpression);
  9844. $core.addMethod(
  9845. $core.method({
  9846. selector: "test:",
  9847. protocol: "evaluating",
  9848. fn: function (aString){
  9849. var self=this,$self=this;
  9850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9851. return $core.withContext(function($ctx1) {
  9852. //>>excludeEnd("ctx");
  9853. return self.test(aString);
  9854. return self;
  9855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9856. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  9857. //>>excludeEnd("ctx");
  9858. },
  9859. //>>excludeStart("ide", pragmas.excludeIdeData);
  9860. args: ["aString"],
  9861. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  9862. referencedClasses: [],
  9863. //>>excludeEnd("ide");
  9864. messageSends: []
  9865. }),
  9866. $globals.RegularExpression);
  9867. $core.addMethod(
  9868. $core.method({
  9869. selector: "fromString:",
  9870. protocol: "instance creation",
  9871. fn: function (aString){
  9872. var self=this,$self=this;
  9873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9874. return $core.withContext(function($ctx1) {
  9875. //>>excludeEnd("ctx");
  9876. return $self._fromString_flag_(aString,"");
  9877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9878. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.a$cls)});
  9879. //>>excludeEnd("ctx");
  9880. },
  9881. //>>excludeStart("ide", pragmas.excludeIdeData);
  9882. args: ["aString"],
  9883. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9884. referencedClasses: [],
  9885. //>>excludeEnd("ide");
  9886. messageSends: ["fromString:flag:"]
  9887. }),
  9888. $globals.RegularExpression.a$cls);
  9889. $core.addMethod(
  9890. $core.method({
  9891. selector: "fromString:flag:",
  9892. protocol: "instance creation",
  9893. fn: function (aString,anotherString){
  9894. var self=this,$self=this;
  9895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9896. return $core.withContext(function($ctx1) {
  9897. //>>excludeEnd("ctx");
  9898. return new RegExp(aString, anotherString);
  9899. return self;
  9900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9901. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.a$cls)});
  9902. //>>excludeEnd("ctx");
  9903. },
  9904. //>>excludeStart("ide", pragmas.excludeIdeData);
  9905. args: ["aString", "anotherString"],
  9906. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  9907. referencedClasses: [],
  9908. //>>excludeEnd("ide");
  9909. messageSends: []
  9910. }),
  9911. $globals.RegularExpression.a$cls);
  9912. });