Kernel-Collections.js 328 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089
  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. var $pkg = $core.addPackage("Kernel-Collections");
  5. $pkg.innerEval = function (expr) { return eval(expr); };
  6. $pkg.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. $self._deprecatedAPI_("Use #, instead.");
  755. return $self.__comma(aCollection);
  756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  757. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  758. //>>excludeEnd("ctx");
  759. },
  760. //>>excludeStart("ide", pragmas.excludeIdeData);
  761. args: ["aCollection"],
  762. source: "copyWithAll: aCollection\x0a\x09self deprecatedAPI: 'Use #, instead.'.\x0a\x09^ self, aCollection",
  763. referencedClasses: [],
  764. //>>excludeEnd("ide");
  765. messageSends: ["deprecatedAPI:", ","]
  766. }),
  767. $globals.Collection);
  768. $core.addMethod(
  769. $core.method({
  770. selector: "copyWithout:",
  771. protocol: "copying",
  772. fn: function (anObject){
  773. var self=this,$self=this;
  774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  775. return $core.withContext(function($ctx1) {
  776. //>>excludeEnd("ctx");
  777. return $self._reject_((function(each){
  778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  779. return $core.withContext(function($ctx2) {
  780. //>>excludeEnd("ctx");
  781. return $recv(each).__eq(anObject);
  782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  783. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  784. //>>excludeEnd("ctx");
  785. }));
  786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  787. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject},$globals.Collection)});
  788. //>>excludeEnd("ctx");
  789. },
  790. //>>excludeStart("ide", pragmas.excludeIdeData);
  791. args: ["anObject"],
  792. 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 ]",
  793. referencedClasses: [],
  794. //>>excludeEnd("ide");
  795. messageSends: ["reject:", "="]
  796. }),
  797. $globals.Collection);
  798. $core.addMethod(
  799. $core.method({
  800. selector: "copyWithoutAll:",
  801. protocol: "copying",
  802. fn: function (aCollection){
  803. var self=this,$self=this;
  804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  805. return $core.withContext(function($ctx1) {
  806. //>>excludeEnd("ctx");
  807. return $self._reject_((function(each){
  808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  809. return $core.withContext(function($ctx2) {
  810. //>>excludeEnd("ctx");
  811. return $recv(aCollection)._includes_(each);
  812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  813. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  814. //>>excludeEnd("ctx");
  815. }));
  816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  817. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  818. //>>excludeEnd("ctx");
  819. },
  820. //>>excludeStart("ide", pragmas.excludeIdeData);
  821. args: ["aCollection"],
  822. 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 ]",
  823. referencedClasses: [],
  824. //>>excludeEnd("ide");
  825. messageSends: ["reject:", "includes:"]
  826. }),
  827. $globals.Collection);
  828. $core.addMethod(
  829. $core.method({
  830. selector: "deepCopy",
  831. protocol: "copying",
  832. fn: function (){
  833. var self=this,$self=this;
  834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  835. return $core.withContext(function($ctx1) {
  836. //>>excludeEnd("ctx");
  837. return $self._collect_((function(each){
  838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  839. return $core.withContext(function($ctx2) {
  840. //>>excludeEnd("ctx");
  841. return $recv(each)._deepCopy();
  842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  843. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  844. //>>excludeEnd("ctx");
  845. }));
  846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  847. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  848. //>>excludeEnd("ctx");
  849. },
  850. //>>excludeStart("ide", pragmas.excludeIdeData);
  851. args: [],
  852. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  853. referencedClasses: [],
  854. //>>excludeEnd("ide");
  855. messageSends: ["collect:", "deepCopy"]
  856. }),
  857. $globals.Collection);
  858. $core.addMethod(
  859. $core.method({
  860. selector: "detect:",
  861. protocol: "enumerating",
  862. fn: function (aBlock){
  863. var self=this,$self=this;
  864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  865. return $core.withContext(function($ctx1) {
  866. //>>excludeEnd("ctx");
  867. return $self._detect_ifNone_(aBlock,(function(){
  868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  869. return $core.withContext(function($ctx2) {
  870. //>>excludeEnd("ctx");
  871. return $self._errorNotFound();
  872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  873. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  874. //>>excludeEnd("ctx");
  875. }));
  876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  877. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  878. //>>excludeEnd("ctx");
  879. },
  880. //>>excludeStart("ide", pragmas.excludeIdeData);
  881. args: ["aBlock"],
  882. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  883. referencedClasses: [],
  884. //>>excludeEnd("ide");
  885. messageSends: ["detect:ifNone:", "errorNotFound"]
  886. }),
  887. $globals.Collection);
  888. $core.addMethod(
  889. $core.method({
  890. selector: "detect:ifNone:",
  891. protocol: "enumerating",
  892. fn: function (aBlock,anotherBlock){
  893. var self=this,$self=this;
  894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  895. return $core.withContext(function($ctx1) {
  896. //>>excludeEnd("ctx");
  897. var $1;
  898. var $early={};
  899. try {
  900. $self._do_((function(each){
  901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  902. return $core.withContext(function($ctx2) {
  903. //>>excludeEnd("ctx");
  904. $1=$recv(aBlock)._value_(each);
  905. if($core.assert($1)){
  906. throw $early=[each];
  907. }
  908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  909. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  910. //>>excludeEnd("ctx");
  911. }));
  912. return $recv(anotherBlock)._value();
  913. }
  914. catch(e) {if(e===$early)return e[0]; throw e}
  915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  916. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  917. //>>excludeEnd("ctx");
  918. },
  919. //>>excludeStart("ide", pragmas.excludeIdeData);
  920. args: ["aBlock", "anotherBlock"],
  921. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  922. referencedClasses: [],
  923. //>>excludeEnd("ide");
  924. messageSends: ["do:", "ifTrue:", "value:", "value"]
  925. }),
  926. $globals.Collection);
  927. $core.addMethod(
  928. $core.method({
  929. selector: "do:",
  930. protocol: "enumerating",
  931. fn: function (aBlock){
  932. var self=this,$self=this;
  933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  934. return $core.withContext(function($ctx1) {
  935. //>>excludeEnd("ctx");
  936. $self._subclassResponsibility();
  937. return self;
  938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  939. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  940. //>>excludeEnd("ctx");
  941. },
  942. //>>excludeStart("ide", pragmas.excludeIdeData);
  943. args: ["aBlock"],
  944. source: "do: aBlock\x0a\x09self subclassResponsibility",
  945. referencedClasses: [],
  946. //>>excludeEnd("ide");
  947. messageSends: ["subclassResponsibility"]
  948. }),
  949. $globals.Collection);
  950. $core.addMethod(
  951. $core.method({
  952. selector: "do:separatedBy:",
  953. protocol: "enumerating",
  954. fn: function (aBlock,anotherBlock){
  955. var self=this,$self=this;
  956. var actionBeforeElement;
  957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  958. return $core.withContext(function($ctx1) {
  959. //>>excludeEnd("ctx");
  960. actionBeforeElement=(function(){
  961. actionBeforeElement=anotherBlock;
  962. return actionBeforeElement;
  963. });
  964. $self._do_((function(each){
  965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  966. return $core.withContext(function($ctx2) {
  967. //>>excludeEnd("ctx");
  968. $recv(actionBeforeElement)._value();
  969. return $recv(aBlock)._value_(each);
  970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  971. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  972. //>>excludeEnd("ctx");
  973. }));
  974. return self;
  975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  976. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  977. //>>excludeEnd("ctx");
  978. },
  979. //>>excludeStart("ide", pragmas.excludeIdeData);
  980. args: ["aBlock", "anotherBlock"],
  981. 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 ]",
  982. referencedClasses: [],
  983. //>>excludeEnd("ide");
  984. messageSends: ["do:", "value", "value:"]
  985. }),
  986. $globals.Collection);
  987. $core.addMethod(
  988. $core.method({
  989. selector: "errorNotFound",
  990. protocol: "error handling",
  991. fn: function (){
  992. var self=this,$self=this;
  993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  994. return $core.withContext(function($ctx1) {
  995. //>>excludeEnd("ctx");
  996. $self._error_("Object is not in the collection");
  997. return self;
  998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  999. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  1000. //>>excludeEnd("ctx");
  1001. },
  1002. //>>excludeStart("ide", pragmas.excludeIdeData);
  1003. args: [],
  1004. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  1005. referencedClasses: [],
  1006. //>>excludeEnd("ide");
  1007. messageSends: ["error:"]
  1008. }),
  1009. $globals.Collection);
  1010. $core.addMethod(
  1011. $core.method({
  1012. selector: "ifEmpty:",
  1013. protocol: "testing",
  1014. fn: function (aBlock){
  1015. var self=this,$self=this;
  1016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1017. return $core.withContext(function($ctx1) {
  1018. //>>excludeEnd("ctx");
  1019. var $1;
  1020. $1=$self._isEmpty();
  1021. if($core.assert($1)){
  1022. return $recv(aBlock)._value();
  1023. } else {
  1024. return self;
  1025. }
  1026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1027. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  1028. //>>excludeEnd("ctx");
  1029. },
  1030. //>>excludeStart("ide", pragmas.excludeIdeData);
  1031. args: ["aBlock"],
  1032. 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 ]",
  1033. referencedClasses: [],
  1034. //>>excludeEnd("ide");
  1035. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  1036. }),
  1037. $globals.Collection);
  1038. $core.addMethod(
  1039. $core.method({
  1040. selector: "ifEmpty:ifNotEmpty:",
  1041. protocol: "testing",
  1042. fn: function (aBlock,anotherBlock){
  1043. var self=this,$self=this;
  1044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1045. return $core.withContext(function($ctx1) {
  1046. //>>excludeEnd("ctx");
  1047. var $1;
  1048. $1=$self._isEmpty();
  1049. if($core.assert($1)){
  1050. return $recv(aBlock)._value();
  1051. } else {
  1052. return $recv(anotherBlock)._value_(self);
  1053. }
  1054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1055. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  1056. //>>excludeEnd("ctx");
  1057. },
  1058. //>>excludeStart("ide", pragmas.excludeIdeData);
  1059. args: ["aBlock", "anotherBlock"],
  1060. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  1061. referencedClasses: [],
  1062. //>>excludeEnd("ide");
  1063. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  1064. }),
  1065. $globals.Collection);
  1066. $core.addMethod(
  1067. $core.method({
  1068. selector: "ifNotEmpty:",
  1069. protocol: "testing",
  1070. fn: function (aBlock){
  1071. var self=this,$self=this;
  1072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1073. return $core.withContext(function($ctx1) {
  1074. //>>excludeEnd("ctx");
  1075. var $1;
  1076. $1=$self._notEmpty();
  1077. if($core.assert($1)){
  1078. return $recv(aBlock)._value_(self);
  1079. } else {
  1080. return self;
  1081. }
  1082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1083. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  1084. //>>excludeEnd("ctx");
  1085. },
  1086. //>>excludeStart("ide", pragmas.excludeIdeData);
  1087. args: ["aBlock"],
  1088. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  1089. referencedClasses: [],
  1090. //>>excludeEnd("ide");
  1091. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1092. }),
  1093. $globals.Collection);
  1094. $core.addMethod(
  1095. $core.method({
  1096. selector: "ifNotEmpty:ifEmpty:",
  1097. protocol: "testing",
  1098. fn: function (aBlock,anotherBlock){
  1099. var self=this,$self=this;
  1100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1101. return $core.withContext(function($ctx1) {
  1102. //>>excludeEnd("ctx");
  1103. var $1;
  1104. $1=$self._notEmpty();
  1105. if($core.assert($1)){
  1106. return $recv(aBlock)._value_(self);
  1107. } else {
  1108. return $recv(anotherBlock)._value();
  1109. }
  1110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1111. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  1112. //>>excludeEnd("ctx");
  1113. },
  1114. //>>excludeStart("ide", pragmas.excludeIdeData);
  1115. args: ["aBlock", "anotherBlock"],
  1116. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  1117. referencedClasses: [],
  1118. //>>excludeEnd("ide");
  1119. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  1120. }),
  1121. $globals.Collection);
  1122. $core.addMethod(
  1123. $core.method({
  1124. selector: "includes:",
  1125. protocol: "testing",
  1126. fn: function (anObject){
  1127. var self=this,$self=this;
  1128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1129. return $core.withContext(function($ctx1) {
  1130. //>>excludeEnd("ctx");
  1131. return $self._anySatisfy_((function(each){
  1132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1133. return $core.withContext(function($ctx2) {
  1134. //>>excludeEnd("ctx");
  1135. return $recv(each).__eq(anObject);
  1136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1137. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1138. //>>excludeEnd("ctx");
  1139. }));
  1140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1141. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  1142. //>>excludeEnd("ctx");
  1143. },
  1144. //>>excludeStart("ide", pragmas.excludeIdeData);
  1145. args: ["anObject"],
  1146. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  1147. referencedClasses: [],
  1148. //>>excludeEnd("ide");
  1149. messageSends: ["anySatisfy:", "="]
  1150. }),
  1151. $globals.Collection);
  1152. $core.addMethod(
  1153. $core.method({
  1154. selector: "inject:into:",
  1155. protocol: "enumerating",
  1156. fn: function (anObject,aBlock){
  1157. var self=this,$self=this;
  1158. var result;
  1159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1160. return $core.withContext(function($ctx1) {
  1161. //>>excludeEnd("ctx");
  1162. result=anObject;
  1163. $self._do_((function(each){
  1164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1165. return $core.withContext(function($ctx2) {
  1166. //>>excludeEnd("ctx");
  1167. result=$recv(aBlock)._value_value_(result,each);
  1168. return result;
  1169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1170. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1171. //>>excludeEnd("ctx");
  1172. }));
  1173. return result;
  1174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1175. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  1176. //>>excludeEnd("ctx");
  1177. },
  1178. //>>excludeStart("ide", pragmas.excludeIdeData);
  1179. args: ["anObject", "aBlock"],
  1180. 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",
  1181. referencedClasses: [],
  1182. //>>excludeEnd("ide");
  1183. messageSends: ["do:", "value:value:"]
  1184. }),
  1185. $globals.Collection);
  1186. $core.addMethod(
  1187. $core.method({
  1188. selector: "intersection:",
  1189. protocol: "enumerating",
  1190. fn: function (aCollection){
  1191. var self=this,$self=this;
  1192. var set,outputSet;
  1193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1194. return $core.withContext(function($ctx1) {
  1195. //>>excludeEnd("ctx");
  1196. var $2,$1;
  1197. set=$self._asSet();
  1198. outputSet=$recv($globals.Set)._new();
  1199. $recv(aCollection)._do_((function(each){
  1200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1201. return $core.withContext(function($ctx2) {
  1202. //>>excludeEnd("ctx");
  1203. $2=$recv(set)._includes_(each);
  1204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1205. $ctx2.sendIdx["includes:"]=1;
  1206. //>>excludeEnd("ctx");
  1207. $1=$recv($2)._and_((function(){
  1208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1209. return $core.withContext(function($ctx3) {
  1210. //>>excludeEnd("ctx");
  1211. return $recv($recv(outputSet)._includes_(each))._not();
  1212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1213. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1214. //>>excludeEnd("ctx");
  1215. }));
  1216. if($core.assert($1)){
  1217. return $recv(outputSet)._add_(each);
  1218. }
  1219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1220. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1221. //>>excludeEnd("ctx");
  1222. }));
  1223. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  1224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1225. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  1226. //>>excludeEnd("ctx");
  1227. },
  1228. //>>excludeStart("ide", pragmas.excludeIdeData);
  1229. args: ["aCollection"],
  1230. 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",
  1231. referencedClasses: ["Set"],
  1232. //>>excludeEnd("ide");
  1233. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  1234. }),
  1235. $globals.Collection);
  1236. $core.addMethod(
  1237. $core.method({
  1238. selector: "isEmpty",
  1239. protocol: "testing",
  1240. fn: function (){
  1241. var self=this,$self=this;
  1242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1243. return $core.withContext(function($ctx1) {
  1244. //>>excludeEnd("ctx");
  1245. return $recv($self._size()).__eq((0));
  1246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1247. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  1248. //>>excludeEnd("ctx");
  1249. },
  1250. //>>excludeStart("ide", pragmas.excludeIdeData);
  1251. args: [],
  1252. source: "isEmpty\x0a\x09^ self size = 0",
  1253. referencedClasses: [],
  1254. //>>excludeEnd("ide");
  1255. messageSends: ["=", "size"]
  1256. }),
  1257. $globals.Collection);
  1258. $core.addMethod(
  1259. $core.method({
  1260. selector: "noneSatisfy:",
  1261. protocol: "enumerating",
  1262. fn: function (aBlock){
  1263. var self=this,$self=this;
  1264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1265. return $core.withContext(function($ctx1) {
  1266. //>>excludeEnd("ctx");
  1267. var $1;
  1268. var $early={};
  1269. try {
  1270. $self._do_((function(item){
  1271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1272. return $core.withContext(function($ctx2) {
  1273. //>>excludeEnd("ctx");
  1274. $1=$recv(aBlock)._value_(item);
  1275. if($core.assert($1)){
  1276. throw $early=[false];
  1277. }
  1278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1279. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  1280. //>>excludeEnd("ctx");
  1281. }));
  1282. return true;
  1283. }
  1284. catch(e) {if(e===$early)return e[0]; throw e}
  1285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1286. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  1287. //>>excludeEnd("ctx");
  1288. },
  1289. //>>excludeStart("ide", pragmas.excludeIdeData);
  1290. args: ["aBlock"],
  1291. 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",
  1292. referencedClasses: [],
  1293. //>>excludeEnd("ide");
  1294. messageSends: ["do:", "ifTrue:", "value:"]
  1295. }),
  1296. $globals.Collection);
  1297. $core.addMethod(
  1298. $core.method({
  1299. selector: "notEmpty",
  1300. protocol: "testing",
  1301. fn: function (){
  1302. var self=this,$self=this;
  1303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1304. return $core.withContext(function($ctx1) {
  1305. //>>excludeEnd("ctx");
  1306. return $recv($self._isEmpty())._not();
  1307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1308. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  1309. //>>excludeEnd("ctx");
  1310. },
  1311. //>>excludeStart("ide", pragmas.excludeIdeData);
  1312. args: [],
  1313. source: "notEmpty\x0a\x09^ self isEmpty not",
  1314. referencedClasses: [],
  1315. //>>excludeEnd("ide");
  1316. messageSends: ["not", "isEmpty"]
  1317. }),
  1318. $globals.Collection);
  1319. $core.addMethod(
  1320. $core.method({
  1321. selector: "occurrencesOf:",
  1322. protocol: "accessing",
  1323. fn: function (anObject){
  1324. var self=this,$self=this;
  1325. var tally;
  1326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1327. return $core.withContext(function($ctx1) {
  1328. //>>excludeEnd("ctx");
  1329. var $1;
  1330. tally=(0);
  1331. $self._do_((function(each){
  1332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1333. return $core.withContext(function($ctx2) {
  1334. //>>excludeEnd("ctx");
  1335. $1=$recv(anObject).__eq(each);
  1336. if($core.assert($1)){
  1337. tally=$recv(tally).__plus((1));
  1338. return tally;
  1339. }
  1340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1341. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1342. //>>excludeEnd("ctx");
  1343. }));
  1344. return tally;
  1345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1346. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  1347. //>>excludeEnd("ctx");
  1348. },
  1349. //>>excludeStart("ide", pragmas.excludeIdeData);
  1350. args: ["anObject"],
  1351. 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",
  1352. referencedClasses: [],
  1353. //>>excludeEnd("ide");
  1354. messageSends: ["do:", "ifTrue:", "=", "+"]
  1355. }),
  1356. $globals.Collection);
  1357. $core.addMethod(
  1358. $core.method({
  1359. selector: "putOn:",
  1360. protocol: "streaming",
  1361. fn: function (aStream){
  1362. var self=this,$self=this;
  1363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1364. return $core.withContext(function($ctx1) {
  1365. //>>excludeEnd("ctx");
  1366. $self._do_((function(each){
  1367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1368. return $core.withContext(function($ctx2) {
  1369. //>>excludeEnd("ctx");
  1370. return $recv(each)._putOn_(aStream);
  1371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1372. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1373. //>>excludeEnd("ctx");
  1374. }));
  1375. return self;
  1376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1377. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  1378. //>>excludeEnd("ctx");
  1379. },
  1380. //>>excludeStart("ide", pragmas.excludeIdeData);
  1381. args: ["aStream"],
  1382. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  1383. referencedClasses: [],
  1384. //>>excludeEnd("ide");
  1385. messageSends: ["do:", "putOn:"]
  1386. }),
  1387. $globals.Collection);
  1388. $core.addMethod(
  1389. $core.method({
  1390. selector: "reject:",
  1391. protocol: "enumerating",
  1392. fn: function (aBlock){
  1393. var self=this,$self=this;
  1394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1395. return $core.withContext(function($ctx1) {
  1396. //>>excludeEnd("ctx");
  1397. return $self._select_((function(each){
  1398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1399. return $core.withContext(function($ctx2) {
  1400. //>>excludeEnd("ctx");
  1401. return $recv($recv(aBlock)._value_(each)).__eq(false);
  1402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1403. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1404. //>>excludeEnd("ctx");
  1405. }));
  1406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1407. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  1408. //>>excludeEnd("ctx");
  1409. },
  1410. //>>excludeStart("ide", pragmas.excludeIdeData);
  1411. args: ["aBlock"],
  1412. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  1413. referencedClasses: [],
  1414. //>>excludeEnd("ide");
  1415. messageSends: ["select:", "=", "value:"]
  1416. }),
  1417. $globals.Collection);
  1418. $core.addMethod(
  1419. $core.method({
  1420. selector: "remove:",
  1421. protocol: "adding/removing",
  1422. fn: function (anObject){
  1423. var self=this,$self=this;
  1424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1425. return $core.withContext(function($ctx1) {
  1426. //>>excludeEnd("ctx");
  1427. return $self._remove_ifAbsent_(anObject,(function(){
  1428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1429. return $core.withContext(function($ctx2) {
  1430. //>>excludeEnd("ctx");
  1431. return $self._errorNotFound();
  1432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1433. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1434. //>>excludeEnd("ctx");
  1435. }));
  1436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1437. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  1438. //>>excludeEnd("ctx");
  1439. },
  1440. //>>excludeStart("ide", pragmas.excludeIdeData);
  1441. args: ["anObject"],
  1442. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  1443. referencedClasses: [],
  1444. //>>excludeEnd("ide");
  1445. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  1446. }),
  1447. $globals.Collection);
  1448. $core.addMethod(
  1449. $core.method({
  1450. selector: "remove:ifAbsent:",
  1451. protocol: "adding/removing",
  1452. fn: function (anObject,aBlock){
  1453. var self=this,$self=this;
  1454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1455. return $core.withContext(function($ctx1) {
  1456. //>>excludeEnd("ctx");
  1457. $self._subclassResponsibility();
  1458. return self;
  1459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1460. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  1461. //>>excludeEnd("ctx");
  1462. },
  1463. //>>excludeStart("ide", pragmas.excludeIdeData);
  1464. args: ["anObject", "aBlock"],
  1465. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1466. referencedClasses: [],
  1467. //>>excludeEnd("ide");
  1468. messageSends: ["subclassResponsibility"]
  1469. }),
  1470. $globals.Collection);
  1471. $core.addMethod(
  1472. $core.method({
  1473. selector: "removeAll",
  1474. protocol: "adding/removing",
  1475. fn: function (){
  1476. var self=this,$self=this;
  1477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1478. return $core.withContext(function($ctx1) {
  1479. //>>excludeEnd("ctx");
  1480. $self._subclassResponsibility();
  1481. return self;
  1482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1483. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  1484. //>>excludeEnd("ctx");
  1485. },
  1486. //>>excludeStart("ide", pragmas.excludeIdeData);
  1487. args: [],
  1488. source: "removeAll\x0a\x09self subclassResponsibility",
  1489. referencedClasses: [],
  1490. //>>excludeEnd("ide");
  1491. messageSends: ["subclassResponsibility"]
  1492. }),
  1493. $globals.Collection);
  1494. $core.addMethod(
  1495. $core.method({
  1496. selector: "select:",
  1497. protocol: "enumerating",
  1498. fn: function (aBlock){
  1499. var self=this,$self=this;
  1500. var stream;
  1501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1502. return $core.withContext(function($ctx1) {
  1503. //>>excludeEnd("ctx");
  1504. var $1;
  1505. stream=$recv($recv($self._class())._new())._writeStream();
  1506. $self._do_((function(each){
  1507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1508. return $core.withContext(function($ctx2) {
  1509. //>>excludeEnd("ctx");
  1510. $1=$recv(aBlock)._value_(each);
  1511. if($core.assert($1)){
  1512. return $recv(stream)._nextPut_(each);
  1513. }
  1514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1515. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1516. //>>excludeEnd("ctx");
  1517. }));
  1518. return $recv(stream)._contents();
  1519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1520. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  1521. //>>excludeEnd("ctx");
  1522. },
  1523. //>>excludeStart("ide", pragmas.excludeIdeData);
  1524. args: ["aBlock"],
  1525. 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",
  1526. referencedClasses: [],
  1527. //>>excludeEnd("ide");
  1528. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1529. }),
  1530. $globals.Collection);
  1531. $core.addMethod(
  1532. $core.method({
  1533. selector: "select:thenCollect:",
  1534. protocol: "enumerating",
  1535. fn: function (selectBlock,collectBlock){
  1536. var self=this,$self=this;
  1537. var stream;
  1538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1539. return $core.withContext(function($ctx1) {
  1540. //>>excludeEnd("ctx");
  1541. var $1;
  1542. stream=$recv($recv($self._class())._new())._writeStream();
  1543. $self._do_((function(each){
  1544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1545. return $core.withContext(function($ctx2) {
  1546. //>>excludeEnd("ctx");
  1547. $1=$recv(selectBlock)._value_(each);
  1548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1549. $ctx2.sendIdx["value:"]=1;
  1550. //>>excludeEnd("ctx");
  1551. if($core.assert($1)){
  1552. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  1553. }
  1554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1555. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1556. //>>excludeEnd("ctx");
  1557. }));
  1558. return $recv(stream)._contents();
  1559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1560. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  1561. //>>excludeEnd("ctx");
  1562. },
  1563. //>>excludeStart("ide", pragmas.excludeIdeData);
  1564. args: ["selectBlock", "collectBlock"],
  1565. 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",
  1566. referencedClasses: [],
  1567. //>>excludeEnd("ide");
  1568. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1569. }),
  1570. $globals.Collection);
  1571. $core.addMethod(
  1572. $core.method({
  1573. selector: "shallowCopy",
  1574. protocol: "copying",
  1575. fn: function (){
  1576. var self=this,$self=this;
  1577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1578. return $core.withContext(function($ctx1) {
  1579. //>>excludeEnd("ctx");
  1580. return $self._collect_((function(each){
  1581. return each;
  1582. }));
  1583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1584. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  1585. //>>excludeEnd("ctx");
  1586. },
  1587. //>>excludeStart("ide", pragmas.excludeIdeData);
  1588. args: [],
  1589. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  1590. referencedClasses: [],
  1591. //>>excludeEnd("ide");
  1592. messageSends: ["collect:"]
  1593. }),
  1594. $globals.Collection);
  1595. $core.addMethod(
  1596. $core.method({
  1597. selector: "single",
  1598. protocol: "accessing",
  1599. fn: function (){
  1600. var self=this,$self=this;
  1601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1602. return $core.withContext(function($ctx1) {
  1603. //>>excludeEnd("ctx");
  1604. var $1;
  1605. $self._ifEmpty_((function(){
  1606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1607. return $core.withContext(function($ctx2) {
  1608. //>>excludeEnd("ctx");
  1609. return $self._error_("Collection is empty");
  1610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1611. $ctx2.sendIdx["error:"]=1;
  1612. //>>excludeEnd("ctx");
  1613. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1614. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1615. //>>excludeEnd("ctx");
  1616. }));
  1617. $1=$recv($self._size()).__gt((1));
  1618. if($core.assert($1)){
  1619. $self._error_("Collection holds more than one element");
  1620. }
  1621. return $self._anyOne();
  1622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1623. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  1624. //>>excludeEnd("ctx");
  1625. },
  1626. //>>excludeStart("ide", pragmas.excludeIdeData);
  1627. args: [],
  1628. 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",
  1629. referencedClasses: [],
  1630. //>>excludeEnd("ide");
  1631. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  1632. }),
  1633. $globals.Collection);
  1634. $core.addMethod(
  1635. $core.method({
  1636. selector: "size",
  1637. protocol: "accessing",
  1638. fn: function (){
  1639. var self=this,$self=this;
  1640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1641. return $core.withContext(function($ctx1) {
  1642. //>>excludeEnd("ctx");
  1643. $self._subclassResponsibility();
  1644. return self;
  1645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1646. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  1647. //>>excludeEnd("ctx");
  1648. },
  1649. //>>excludeStart("ide", pragmas.excludeIdeData);
  1650. args: [],
  1651. source: "size\x0a\x09self subclassResponsibility",
  1652. referencedClasses: [],
  1653. //>>excludeEnd("ide");
  1654. messageSends: ["subclassResponsibility"]
  1655. }),
  1656. $globals.Collection);
  1657. $core.addMethod(
  1658. $core.method({
  1659. selector: "classTag",
  1660. protocol: "accessing",
  1661. fn: function (){
  1662. var self=this,$self=this;
  1663. return "collection";
  1664. },
  1665. //>>excludeStart("ide", pragmas.excludeIdeData);
  1666. args: [],
  1667. 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'",
  1668. referencedClasses: [],
  1669. //>>excludeEnd("ide");
  1670. messageSends: []
  1671. }),
  1672. $globals.Collection.a$cls);
  1673. $core.addMethod(
  1674. $core.method({
  1675. selector: "new:",
  1676. protocol: "instance creation",
  1677. fn: function (anInteger){
  1678. var self=this,$self=this;
  1679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1680. return $core.withContext(function($ctx1) {
  1681. //>>excludeEnd("ctx");
  1682. return $self._new();
  1683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1684. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.a$cls)});
  1685. //>>excludeEnd("ctx");
  1686. },
  1687. //>>excludeStart("ide", pragmas.excludeIdeData);
  1688. args: ["anInteger"],
  1689. source: "new: anInteger\x0a\x09^ self new",
  1690. referencedClasses: [],
  1691. //>>excludeEnd("ide");
  1692. messageSends: ["new"]
  1693. }),
  1694. $globals.Collection.a$cls);
  1695. $core.addMethod(
  1696. $core.method({
  1697. selector: "with:",
  1698. protocol: "instance creation",
  1699. fn: function (anObject){
  1700. var self=this,$self=this;
  1701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1702. return $core.withContext(function($ctx1) {
  1703. //>>excludeEnd("ctx");
  1704. var $1;
  1705. $1=$self._new();
  1706. $recv($1)._add_(anObject);
  1707. return $recv($1)._yourself();
  1708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1709. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.a$cls)});
  1710. //>>excludeEnd("ctx");
  1711. },
  1712. //>>excludeStart("ide", pragmas.excludeIdeData);
  1713. args: ["anObject"],
  1714. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1715. referencedClasses: [],
  1716. //>>excludeEnd("ide");
  1717. messageSends: ["add:", "new", "yourself"]
  1718. }),
  1719. $globals.Collection.a$cls);
  1720. $core.addMethod(
  1721. $core.method({
  1722. selector: "with:with:",
  1723. protocol: "instance creation",
  1724. fn: function (anObject,anotherObject){
  1725. var self=this,$self=this;
  1726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1727. return $core.withContext(function($ctx1) {
  1728. //>>excludeEnd("ctx");
  1729. var $1;
  1730. $1=$self._new();
  1731. $recv($1)._add_(anObject);
  1732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1733. $ctx1.sendIdx["add:"]=1;
  1734. //>>excludeEnd("ctx");
  1735. $recv($1)._add_(anotherObject);
  1736. return $recv($1)._yourself();
  1737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1738. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.a$cls)});
  1739. //>>excludeEnd("ctx");
  1740. },
  1741. //>>excludeStart("ide", pragmas.excludeIdeData);
  1742. args: ["anObject", "anotherObject"],
  1743. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1744. referencedClasses: [],
  1745. //>>excludeEnd("ide");
  1746. messageSends: ["add:", "new", "yourself"]
  1747. }),
  1748. $globals.Collection.a$cls);
  1749. $core.addMethod(
  1750. $core.method({
  1751. selector: "with:with:with:",
  1752. protocol: "instance creation",
  1753. fn: function (firstObject,secondObject,thirdObject){
  1754. var self=this,$self=this;
  1755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1756. return $core.withContext(function($ctx1) {
  1757. //>>excludeEnd("ctx");
  1758. var $1;
  1759. $1=$self._new();
  1760. $recv($1)._add_(firstObject);
  1761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1762. $ctx1.sendIdx["add:"]=1;
  1763. //>>excludeEnd("ctx");
  1764. $recv($1)._add_(secondObject);
  1765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1766. $ctx1.sendIdx["add:"]=2;
  1767. //>>excludeEnd("ctx");
  1768. $recv($1)._add_(thirdObject);
  1769. return $recv($1)._yourself();
  1770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1771. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.a$cls)});
  1772. //>>excludeEnd("ctx");
  1773. },
  1774. //>>excludeStart("ide", pragmas.excludeIdeData);
  1775. args: ["firstObject", "secondObject", "thirdObject"],
  1776. 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",
  1777. referencedClasses: [],
  1778. //>>excludeEnd("ide");
  1779. messageSends: ["add:", "new", "yourself"]
  1780. }),
  1781. $globals.Collection.a$cls);
  1782. $core.addMethod(
  1783. $core.method({
  1784. selector: "withAll:",
  1785. protocol: "instance creation",
  1786. fn: function (aCollection){
  1787. var self=this,$self=this;
  1788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1789. return $core.withContext(function($ctx1) {
  1790. //>>excludeEnd("ctx");
  1791. var $1;
  1792. $1=$self._new();
  1793. $recv($1)._addAll_(aCollection);
  1794. return $recv($1)._yourself();
  1795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1796. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.a$cls)});
  1797. //>>excludeEnd("ctx");
  1798. },
  1799. //>>excludeStart("ide", pragmas.excludeIdeData);
  1800. args: ["aCollection"],
  1801. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1802. referencedClasses: [],
  1803. //>>excludeEnd("ide");
  1804. messageSends: ["addAll:", "new", "yourself"]
  1805. }),
  1806. $globals.Collection.a$cls);
  1807. $core.addClass("AssociativeCollection", $globals.Collection, [], "Kernel-Collections");
  1808. //>>excludeStart("ide", pragmas.excludeIdeData);
  1809. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  1810. //>>excludeEnd("ide");
  1811. $core.addMethod(
  1812. $core.method({
  1813. selector: "=",
  1814. protocol: "comparing",
  1815. fn: function (anAssocitativeCollection){
  1816. var self=this,$self=this;
  1817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1818. return $core.withContext(function($ctx1) {
  1819. //>>excludeEnd("ctx");
  1820. var $2,$1,$4,$3,$5;
  1821. $2=$self._class();
  1822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1823. $ctx1.sendIdx["class"]=1;
  1824. //>>excludeEnd("ctx");
  1825. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  1826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1827. $ctx1.sendIdx["="]=1;
  1828. //>>excludeEnd("ctx");
  1829. if(!$core.assert($1)){
  1830. return false;
  1831. }
  1832. $4=$self._size();
  1833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1834. $ctx1.sendIdx["size"]=1;
  1835. //>>excludeEnd("ctx");
  1836. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  1837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1838. $ctx1.sendIdx["="]=2;
  1839. //>>excludeEnd("ctx");
  1840. if(!$core.assert($3)){
  1841. return false;
  1842. }
  1843. $5=$self._associations();
  1844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1845. $ctx1.sendIdx["associations"]=1;
  1846. //>>excludeEnd("ctx");
  1847. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  1848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1849. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  1850. //>>excludeEnd("ctx");
  1851. },
  1852. //>>excludeStart("ide", pragmas.excludeIdeData);
  1853. args: ["anAssocitativeCollection"],
  1854. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  1855. referencedClasses: [],
  1856. //>>excludeEnd("ide");
  1857. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  1858. }),
  1859. $globals.AssociativeCollection);
  1860. $core.addMethod(
  1861. $core.method({
  1862. selector: "add:",
  1863. protocol: "adding/removing",
  1864. fn: function (anAssociation){
  1865. var self=this,$self=this;
  1866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1867. return $core.withContext(function($ctx1) {
  1868. //>>excludeEnd("ctx");
  1869. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  1870. return self;
  1871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1872. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  1873. //>>excludeEnd("ctx");
  1874. },
  1875. //>>excludeStart("ide", pragmas.excludeIdeData);
  1876. args: ["anAssociation"],
  1877. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  1878. referencedClasses: [],
  1879. //>>excludeEnd("ide");
  1880. messageSends: ["at:put:", "key", "value"]
  1881. }),
  1882. $globals.AssociativeCollection);
  1883. $core.addMethod(
  1884. $core.method({
  1885. selector: "addAll:",
  1886. protocol: "adding/removing",
  1887. fn: function (anAssociativeCollection){
  1888. var self=this,$self=this;
  1889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1890. return $core.withContext(function($ctx1) {
  1891. //>>excludeEnd("ctx");
  1892. (
  1893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1894. $ctx1.supercall = true,
  1895. //>>excludeEnd("ctx");
  1896. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  1897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1898. $ctx1.supercall = false;
  1899. //>>excludeEnd("ctx");;
  1900. return anAssociativeCollection;
  1901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1902. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  1903. //>>excludeEnd("ctx");
  1904. },
  1905. //>>excludeStart("ide", pragmas.excludeIdeData);
  1906. args: ["anAssociativeCollection"],
  1907. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  1908. referencedClasses: [],
  1909. //>>excludeEnd("ide");
  1910. messageSends: ["addAll:", "associations"]
  1911. }),
  1912. $globals.AssociativeCollection);
  1913. $core.addMethod(
  1914. $core.method({
  1915. selector: "asDictionary",
  1916. protocol: "converting",
  1917. fn: function (){
  1918. var self=this,$self=this;
  1919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1920. return $core.withContext(function($ctx1) {
  1921. //>>excludeEnd("ctx");
  1922. return $recv($globals.Dictionary)._from_($self._associations());
  1923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1924. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  1925. //>>excludeEnd("ctx");
  1926. },
  1927. //>>excludeStart("ide", pragmas.excludeIdeData);
  1928. args: [],
  1929. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  1930. referencedClasses: ["Dictionary"],
  1931. //>>excludeEnd("ide");
  1932. messageSends: ["from:", "associations"]
  1933. }),
  1934. $globals.AssociativeCollection);
  1935. $core.addMethod(
  1936. $core.method({
  1937. selector: "asHashedCollection",
  1938. protocol: "converting",
  1939. fn: function (){
  1940. var self=this,$self=this;
  1941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1942. return $core.withContext(function($ctx1) {
  1943. //>>excludeEnd("ctx");
  1944. return $recv($globals.HashedCollection)._from_($self._associations());
  1945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1946. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  1947. //>>excludeEnd("ctx");
  1948. },
  1949. //>>excludeStart("ide", pragmas.excludeIdeData);
  1950. args: [],
  1951. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  1952. referencedClasses: ["HashedCollection"],
  1953. //>>excludeEnd("ide");
  1954. messageSends: ["from:", "associations"]
  1955. }),
  1956. $globals.AssociativeCollection);
  1957. $core.addMethod(
  1958. $core.method({
  1959. selector: "asJavaScriptObject",
  1960. protocol: "converting",
  1961. fn: function (){
  1962. var self=this,$self=this;
  1963. var hash;
  1964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1965. return $core.withContext(function($ctx1) {
  1966. //>>excludeEnd("ctx");
  1967. hash=$recv($globals.HashedCollection)._new();
  1968. $self._keysAndValuesDo_((function(key,value){
  1969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1970. return $core.withContext(function($ctx2) {
  1971. //>>excludeEnd("ctx");
  1972. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  1973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1974. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  1975. //>>excludeEnd("ctx");
  1976. }));
  1977. return hash;
  1978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1979. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash},$globals.AssociativeCollection)});
  1980. //>>excludeEnd("ctx");
  1981. },
  1982. //>>excludeStart("ide", pragmas.excludeIdeData);
  1983. args: [],
  1984. 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",
  1985. referencedClasses: ["HashedCollection"],
  1986. //>>excludeEnd("ide");
  1987. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  1988. }),
  1989. $globals.AssociativeCollection);
  1990. $core.addMethod(
  1991. $core.method({
  1992. selector: "associations",
  1993. protocol: "accessing",
  1994. fn: function (){
  1995. var self=this,$self=this;
  1996. var associations;
  1997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1998. return $core.withContext(function($ctx1) {
  1999. //>>excludeEnd("ctx");
  2000. associations=[];
  2001. $self._associationsDo_((function(each){
  2002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2003. return $core.withContext(function($ctx2) {
  2004. //>>excludeEnd("ctx");
  2005. return $recv(associations)._add_(each);
  2006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2007. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2008. //>>excludeEnd("ctx");
  2009. }));
  2010. return associations;
  2011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2012. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  2013. //>>excludeEnd("ctx");
  2014. },
  2015. //>>excludeStart("ide", pragmas.excludeIdeData);
  2016. args: [],
  2017. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  2018. referencedClasses: [],
  2019. //>>excludeEnd("ide");
  2020. messageSends: ["associationsDo:", "add:"]
  2021. }),
  2022. $globals.AssociativeCollection);
  2023. $core.addMethod(
  2024. $core.method({
  2025. selector: "associationsDo:",
  2026. protocol: "enumerating",
  2027. fn: function (aBlock){
  2028. var self=this,$self=this;
  2029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2030. return $core.withContext(function($ctx1) {
  2031. //>>excludeEnd("ctx");
  2032. $self._keysAndValuesDo_((function(key,value){
  2033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2034. return $core.withContext(function($ctx2) {
  2035. //>>excludeEnd("ctx");
  2036. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  2037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2038. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2039. //>>excludeEnd("ctx");
  2040. }));
  2041. return self;
  2042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2043. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2044. //>>excludeEnd("ctx");
  2045. },
  2046. //>>excludeStart("ide", pragmas.excludeIdeData);
  2047. args: ["aBlock"],
  2048. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2049. referencedClasses: ["Association"],
  2050. //>>excludeEnd("ide");
  2051. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2052. }),
  2053. $globals.AssociativeCollection);
  2054. $core.addMethod(
  2055. $core.method({
  2056. selector: "at:ifPresent:ifAbsent:",
  2057. protocol: "accessing",
  2058. fn: function (aKey,aBlock,anotherBlock){
  2059. var self=this,$self=this;
  2060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2061. return $core.withContext(function($ctx1) {
  2062. //>>excludeEnd("ctx");
  2063. var $1;
  2064. $1=$self._includesKey_(aKey);
  2065. if($core.assert($1)){
  2066. return $recv(aBlock)._value_($self._at_(aKey));
  2067. } else {
  2068. return $recv(anotherBlock)._value();
  2069. }
  2070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2071. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  2072. //>>excludeEnd("ctx");
  2073. },
  2074. //>>excludeStart("ide", pragmas.excludeIdeData);
  2075. args: ["aKey", "aBlock", "anotherBlock"],
  2076. 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 ]",
  2077. referencedClasses: [],
  2078. //>>excludeEnd("ide");
  2079. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2080. }),
  2081. $globals.AssociativeCollection);
  2082. $core.addMethod(
  2083. $core.method({
  2084. selector: "collect:",
  2085. protocol: "enumerating",
  2086. fn: function (aBlock){
  2087. var self=this,$self=this;
  2088. var newDict;
  2089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2090. return $core.withContext(function($ctx1) {
  2091. //>>excludeEnd("ctx");
  2092. newDict=$recv($self._class())._new();
  2093. $self._keysAndValuesDo_((function(key,value){
  2094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2095. return $core.withContext(function($ctx2) {
  2096. //>>excludeEnd("ctx");
  2097. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  2098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2099. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2100. //>>excludeEnd("ctx");
  2101. }));
  2102. return newDict;
  2103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2104. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  2105. //>>excludeEnd("ctx");
  2106. },
  2107. //>>excludeStart("ide", pragmas.excludeIdeData);
  2108. args: ["aBlock"],
  2109. 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",
  2110. referencedClasses: [],
  2111. //>>excludeEnd("ide");
  2112. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  2113. }),
  2114. $globals.AssociativeCollection);
  2115. $core.addMethod(
  2116. $core.method({
  2117. selector: "deepCopy",
  2118. protocol: "copying",
  2119. fn: function (){
  2120. var self=this,$self=this;
  2121. var copy;
  2122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2123. return $core.withContext(function($ctx1) {
  2124. //>>excludeEnd("ctx");
  2125. copy=$recv($self._class())._new();
  2126. $self._keysAndValuesDo_((function(key,value){
  2127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2128. return $core.withContext(function($ctx2) {
  2129. //>>excludeEnd("ctx");
  2130. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  2131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2132. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2133. //>>excludeEnd("ctx");
  2134. }));
  2135. return copy;
  2136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2137. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  2138. //>>excludeEnd("ctx");
  2139. },
  2140. //>>excludeStart("ide", pragmas.excludeIdeData);
  2141. args: [],
  2142. 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",
  2143. referencedClasses: [],
  2144. //>>excludeEnd("ide");
  2145. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  2146. }),
  2147. $globals.AssociativeCollection);
  2148. $core.addMethod(
  2149. $core.method({
  2150. selector: "detect:ifNone:",
  2151. protocol: "enumerating",
  2152. fn: function (aBlock,anotherBlock){
  2153. var self=this,$self=this;
  2154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2155. return $core.withContext(function($ctx1) {
  2156. //>>excludeEnd("ctx");
  2157. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  2158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2159. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  2160. //>>excludeEnd("ctx");
  2161. },
  2162. //>>excludeStart("ide", pragmas.excludeIdeData);
  2163. args: ["aBlock", "anotherBlock"],
  2164. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  2165. referencedClasses: [],
  2166. //>>excludeEnd("ide");
  2167. messageSends: ["detect:ifNone:", "values"]
  2168. }),
  2169. $globals.AssociativeCollection);
  2170. $core.addMethod(
  2171. $core.method({
  2172. selector: "do:",
  2173. protocol: "enumerating",
  2174. fn: function (aBlock){
  2175. var self=this,$self=this;
  2176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2177. return $core.withContext(function($ctx1) {
  2178. //>>excludeEnd("ctx");
  2179. $self._valuesDo_(aBlock);
  2180. return self;
  2181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2182. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2183. //>>excludeEnd("ctx");
  2184. },
  2185. //>>excludeStart("ide", pragmas.excludeIdeData);
  2186. args: ["aBlock"],
  2187. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  2188. referencedClasses: [],
  2189. //>>excludeEnd("ide");
  2190. messageSends: ["valuesDo:"]
  2191. }),
  2192. $globals.AssociativeCollection);
  2193. $core.addMethod(
  2194. $core.method({
  2195. selector: "includes:",
  2196. protocol: "enumerating",
  2197. fn: function (anObject){
  2198. var self=this,$self=this;
  2199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2200. return $core.withContext(function($ctx1) {
  2201. //>>excludeEnd("ctx");
  2202. return $recv($self._values())._includes_(anObject);
  2203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2204. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  2205. //>>excludeEnd("ctx");
  2206. },
  2207. //>>excludeStart("ide", pragmas.excludeIdeData);
  2208. args: ["anObject"],
  2209. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  2210. referencedClasses: [],
  2211. //>>excludeEnd("ide");
  2212. messageSends: ["includes:", "values"]
  2213. }),
  2214. $globals.AssociativeCollection);
  2215. $core.addMethod(
  2216. $core.method({
  2217. selector: "includesKey:",
  2218. protocol: "testing",
  2219. fn: function (aKey){
  2220. var self=this,$self=this;
  2221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2222. return $core.withContext(function($ctx1) {
  2223. //>>excludeEnd("ctx");
  2224. $self._subclassResponsibility();
  2225. return self;
  2226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2227. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  2228. //>>excludeEnd("ctx");
  2229. },
  2230. //>>excludeStart("ide", pragmas.excludeIdeData);
  2231. args: ["aKey"],
  2232. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  2233. referencedClasses: [],
  2234. //>>excludeEnd("ide");
  2235. messageSends: ["subclassResponsibility"]
  2236. }),
  2237. $globals.AssociativeCollection);
  2238. $core.addMethod(
  2239. $core.method({
  2240. selector: "indexOf:ifAbsent:",
  2241. protocol: "accessing",
  2242. fn: function (anObject,aBlock){
  2243. var self=this,$self=this;
  2244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2245. return $core.withContext(function($ctx1) {
  2246. //>>excludeEnd("ctx");
  2247. return $recv($self._keys())._detect_ifNone_((function(each){
  2248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2249. return $core.withContext(function($ctx2) {
  2250. //>>excludeEnd("ctx");
  2251. return $recv($self._at_(each)).__eq(anObject);
  2252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2253. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2254. //>>excludeEnd("ctx");
  2255. }),aBlock);
  2256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2257. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  2258. //>>excludeEnd("ctx");
  2259. },
  2260. //>>excludeStart("ide", pragmas.excludeIdeData);
  2261. args: ["anObject", "aBlock"],
  2262. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  2263. referencedClasses: [],
  2264. //>>excludeEnd("ide");
  2265. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  2266. }),
  2267. $globals.AssociativeCollection);
  2268. $core.addMethod(
  2269. $core.method({
  2270. selector: "keyAtValue:",
  2271. protocol: "accessing",
  2272. fn: function (anObject){
  2273. var self=this,$self=this;
  2274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2275. return $core.withContext(function($ctx1) {
  2276. //>>excludeEnd("ctx");
  2277. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  2278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2279. return $core.withContext(function($ctx2) {
  2280. //>>excludeEnd("ctx");
  2281. return $self._errorNotFound();
  2282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2283. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2284. //>>excludeEnd("ctx");
  2285. }));
  2286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2287. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  2288. //>>excludeEnd("ctx");
  2289. },
  2290. //>>excludeStart("ide", pragmas.excludeIdeData);
  2291. args: ["anObject"],
  2292. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  2293. referencedClasses: [],
  2294. //>>excludeEnd("ide");
  2295. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  2296. }),
  2297. $globals.AssociativeCollection);
  2298. $core.addMethod(
  2299. $core.method({
  2300. selector: "keyAtValue:ifAbsent:",
  2301. protocol: "accessing",
  2302. fn: function (anObject,aBlock){
  2303. var self=this,$self=this;
  2304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2305. return $core.withContext(function($ctx1) {
  2306. //>>excludeEnd("ctx");
  2307. return $self._indexOf_ifAbsent_(anObject,aBlock);
  2308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2309. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  2310. //>>excludeEnd("ctx");
  2311. },
  2312. //>>excludeStart("ide", pragmas.excludeIdeData);
  2313. args: ["anObject", "aBlock"],
  2314. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  2315. referencedClasses: [],
  2316. //>>excludeEnd("ide");
  2317. messageSends: ["indexOf:ifAbsent:"]
  2318. }),
  2319. $globals.AssociativeCollection);
  2320. $core.addMethod(
  2321. $core.method({
  2322. selector: "keys",
  2323. protocol: "accessing",
  2324. fn: function (){
  2325. var self=this,$self=this;
  2326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2327. return $core.withContext(function($ctx1) {
  2328. //>>excludeEnd("ctx");
  2329. $self._subclassResponsibility();
  2330. return self;
  2331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2332. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  2333. //>>excludeEnd("ctx");
  2334. },
  2335. //>>excludeStart("ide", pragmas.excludeIdeData);
  2336. args: [],
  2337. source: "keys\x0a\x09self subclassResponsibility",
  2338. referencedClasses: [],
  2339. //>>excludeEnd("ide");
  2340. messageSends: ["subclassResponsibility"]
  2341. }),
  2342. $globals.AssociativeCollection);
  2343. $core.addMethod(
  2344. $core.method({
  2345. selector: "keysAndValuesDo:",
  2346. protocol: "enumerating",
  2347. fn: function (aBlock){
  2348. var self=this,$self=this;
  2349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2350. return $core.withContext(function($ctx1) {
  2351. //>>excludeEnd("ctx");
  2352. $self._keysDo_((function(each){
  2353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2354. return $core.withContext(function($ctx2) {
  2355. //>>excludeEnd("ctx");
  2356. return $recv(aBlock)._value_value_(each,$self._at_(each));
  2357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2358. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2359. //>>excludeEnd("ctx");
  2360. }));
  2361. return self;
  2362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2363. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2364. //>>excludeEnd("ctx");
  2365. },
  2366. //>>excludeStart("ide", pragmas.excludeIdeData);
  2367. args: ["aBlock"],
  2368. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  2369. referencedClasses: [],
  2370. //>>excludeEnd("ide");
  2371. messageSends: ["keysDo:", "value:value:", "at:"]
  2372. }),
  2373. $globals.AssociativeCollection);
  2374. $core.addMethod(
  2375. $core.method({
  2376. selector: "keysDo:",
  2377. protocol: "enumerating",
  2378. fn: function (aBlock){
  2379. var self=this,$self=this;
  2380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2381. return $core.withContext(function($ctx1) {
  2382. //>>excludeEnd("ctx");
  2383. $self._subclassResponsibility();
  2384. return self;
  2385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2386. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2387. //>>excludeEnd("ctx");
  2388. },
  2389. //>>excludeStart("ide", pragmas.excludeIdeData);
  2390. args: ["aBlock"],
  2391. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  2392. referencedClasses: [],
  2393. //>>excludeEnd("ide");
  2394. messageSends: ["subclassResponsibility"]
  2395. }),
  2396. $globals.AssociativeCollection);
  2397. $core.addMethod(
  2398. $core.method({
  2399. selector: "printOn:",
  2400. protocol: "printing",
  2401. fn: function (aStream){
  2402. var self=this,$self=this;
  2403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2404. return $core.withContext(function($ctx1) {
  2405. //>>excludeEnd("ctx");
  2406. (
  2407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2408. $ctx1.supercall = true,
  2409. //>>excludeEnd("ctx");
  2410. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  2411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2412. $ctx1.supercall = false;
  2413. //>>excludeEnd("ctx");;
  2414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2415. $ctx1.sendIdx["printOn:"]=1;
  2416. //>>excludeEnd("ctx");
  2417. $recv(aStream)._nextPutAll_(" (");
  2418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2419. $ctx1.sendIdx["nextPutAll:"]=1;
  2420. //>>excludeEnd("ctx");
  2421. $recv($self._associations())._do_separatedBy_((function(each){
  2422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2423. return $core.withContext(function($ctx2) {
  2424. //>>excludeEnd("ctx");
  2425. return $recv(each)._printOn_(aStream);
  2426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2427. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2428. //>>excludeEnd("ctx");
  2429. }),(function(){
  2430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2431. return $core.withContext(function($ctx2) {
  2432. //>>excludeEnd("ctx");
  2433. return $recv(aStream)._nextPutAll_(" , ");
  2434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2435. $ctx2.sendIdx["nextPutAll:"]=2;
  2436. //>>excludeEnd("ctx");
  2437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2438. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2439. //>>excludeEnd("ctx");
  2440. }));
  2441. $recv(aStream)._nextPutAll_(")");
  2442. return self;
  2443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2444. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  2445. //>>excludeEnd("ctx");
  2446. },
  2447. //>>excludeStart("ide", pragmas.excludeIdeData);
  2448. args: ["aStream"],
  2449. 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: ')'",
  2450. referencedClasses: [],
  2451. //>>excludeEnd("ide");
  2452. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  2453. }),
  2454. $globals.AssociativeCollection);
  2455. $core.addMethod(
  2456. $core.method({
  2457. selector: "remove:ifAbsent:",
  2458. protocol: "adding/removing",
  2459. fn: function (aKey,aBlock){
  2460. var self=this,$self=this;
  2461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2462. return $core.withContext(function($ctx1) {
  2463. //>>excludeEnd("ctx");
  2464. return $self._removeKey_ifAbsent_(aKey,aBlock);
  2465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2466. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  2467. //>>excludeEnd("ctx");
  2468. },
  2469. //>>excludeStart("ide", pragmas.excludeIdeData);
  2470. args: ["aKey", "aBlock"],
  2471. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  2472. referencedClasses: [],
  2473. //>>excludeEnd("ide");
  2474. messageSends: ["removeKey:ifAbsent:"]
  2475. }),
  2476. $globals.AssociativeCollection);
  2477. $core.addMethod(
  2478. $core.method({
  2479. selector: "removeAll",
  2480. protocol: "adding/removing",
  2481. fn: function (){
  2482. var self=this,$self=this;
  2483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2484. return $core.withContext(function($ctx1) {
  2485. //>>excludeEnd("ctx");
  2486. return $recv($self._keys())._do_((function(each){
  2487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2488. return $core.withContext(function($ctx2) {
  2489. //>>excludeEnd("ctx");
  2490. return $self._removeKey_(each);
  2491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2492. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2493. //>>excludeEnd("ctx");
  2494. }));
  2495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2496. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  2497. //>>excludeEnd("ctx");
  2498. },
  2499. //>>excludeStart("ide", pragmas.excludeIdeData);
  2500. args: [],
  2501. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  2502. referencedClasses: [],
  2503. //>>excludeEnd("ide");
  2504. messageSends: ["do:", "keys", "removeKey:"]
  2505. }),
  2506. $globals.AssociativeCollection);
  2507. $core.addMethod(
  2508. $core.method({
  2509. selector: "removeKey:",
  2510. protocol: "adding/removing",
  2511. fn: function (aKey){
  2512. var self=this,$self=this;
  2513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2514. return $core.withContext(function($ctx1) {
  2515. //>>excludeEnd("ctx");
  2516. return $self._remove_(aKey);
  2517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2518. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  2519. //>>excludeEnd("ctx");
  2520. },
  2521. //>>excludeStart("ide", pragmas.excludeIdeData);
  2522. args: ["aKey"],
  2523. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  2524. referencedClasses: [],
  2525. //>>excludeEnd("ide");
  2526. messageSends: ["remove:"]
  2527. }),
  2528. $globals.AssociativeCollection);
  2529. $core.addMethod(
  2530. $core.method({
  2531. selector: "removeKey:ifAbsent:",
  2532. protocol: "adding/removing",
  2533. fn: function (aKey,aBlock){
  2534. var self=this,$self=this;
  2535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2536. return $core.withContext(function($ctx1) {
  2537. //>>excludeEnd("ctx");
  2538. $self._subclassResponsibility();
  2539. return self;
  2540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2541. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  2542. //>>excludeEnd("ctx");
  2543. },
  2544. //>>excludeStart("ide", pragmas.excludeIdeData);
  2545. args: ["aKey", "aBlock"],
  2546. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2547. referencedClasses: [],
  2548. //>>excludeEnd("ide");
  2549. messageSends: ["subclassResponsibility"]
  2550. }),
  2551. $globals.AssociativeCollection);
  2552. $core.addMethod(
  2553. $core.method({
  2554. selector: "select:",
  2555. protocol: "enumerating",
  2556. fn: function (aBlock){
  2557. var self=this,$self=this;
  2558. var newDict;
  2559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2560. return $core.withContext(function($ctx1) {
  2561. //>>excludeEnd("ctx");
  2562. var $1;
  2563. newDict=$recv($self._class())._new();
  2564. $self._keysAndValuesDo_((function(key,value){
  2565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2566. return $core.withContext(function($ctx2) {
  2567. //>>excludeEnd("ctx");
  2568. $1=$recv(aBlock)._value_(value);
  2569. if($core.assert($1)){
  2570. return $recv(newDict)._at_put_(key,value);
  2571. }
  2572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2573. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2574. //>>excludeEnd("ctx");
  2575. }));
  2576. return newDict;
  2577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2578. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  2579. //>>excludeEnd("ctx");
  2580. },
  2581. //>>excludeStart("ide", pragmas.excludeIdeData);
  2582. args: ["aBlock"],
  2583. 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",
  2584. referencedClasses: [],
  2585. //>>excludeEnd("ide");
  2586. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2587. }),
  2588. $globals.AssociativeCollection);
  2589. $core.addMethod(
  2590. $core.method({
  2591. selector: "select:thenCollect:",
  2592. protocol: "enumerating",
  2593. fn: function (selectBlock,collectBlock){
  2594. var self=this,$self=this;
  2595. var newDict;
  2596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2597. return $core.withContext(function($ctx1) {
  2598. //>>excludeEnd("ctx");
  2599. var $1;
  2600. newDict=$recv($self._class())._new();
  2601. $self._keysAndValuesDo_((function(key,value){
  2602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2603. return $core.withContext(function($ctx2) {
  2604. //>>excludeEnd("ctx");
  2605. $1=$recv(selectBlock)._value_(value);
  2606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2607. $ctx2.sendIdx["value:"]=1;
  2608. //>>excludeEnd("ctx");
  2609. if($core.assert($1)){
  2610. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  2611. }
  2612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2613. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2614. //>>excludeEnd("ctx");
  2615. }));
  2616. return newDict;
  2617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2618. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict},$globals.AssociativeCollection)});
  2619. //>>excludeEnd("ctx");
  2620. },
  2621. //>>excludeStart("ide", pragmas.excludeIdeData);
  2622. args: ["selectBlock", "collectBlock"],
  2623. 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",
  2624. referencedClasses: [],
  2625. //>>excludeEnd("ide");
  2626. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2627. }),
  2628. $globals.AssociativeCollection);
  2629. $core.addMethod(
  2630. $core.method({
  2631. selector: "shallowCopy",
  2632. protocol: "copying",
  2633. fn: function (){
  2634. var self=this,$self=this;
  2635. var copy;
  2636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2637. return $core.withContext(function($ctx1) {
  2638. //>>excludeEnd("ctx");
  2639. copy=$recv($self._class())._new();
  2640. $self._keysAndValuesDo_((function(key,value){
  2641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2642. return $core.withContext(function($ctx2) {
  2643. //>>excludeEnd("ctx");
  2644. return $recv(copy)._at_put_(key,value);
  2645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2646. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2647. //>>excludeEnd("ctx");
  2648. }));
  2649. return copy;
  2650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2651. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  2652. //>>excludeEnd("ctx");
  2653. },
  2654. //>>excludeStart("ide", pragmas.excludeIdeData);
  2655. args: [],
  2656. 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",
  2657. referencedClasses: [],
  2658. //>>excludeEnd("ide");
  2659. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2660. }),
  2661. $globals.AssociativeCollection);
  2662. $core.addMethod(
  2663. $core.method({
  2664. selector: "size",
  2665. protocol: "accessing",
  2666. fn: function (){
  2667. var self=this,$self=this;
  2668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2669. return $core.withContext(function($ctx1) {
  2670. //>>excludeEnd("ctx");
  2671. return $recv($self._keys())._size();
  2672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2673. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  2674. //>>excludeEnd("ctx");
  2675. },
  2676. //>>excludeStart("ide", pragmas.excludeIdeData);
  2677. args: [],
  2678. source: "size\x0a\x09^ self keys size",
  2679. referencedClasses: [],
  2680. //>>excludeEnd("ide");
  2681. messageSends: ["size", "keys"]
  2682. }),
  2683. $globals.AssociativeCollection);
  2684. $core.addMethod(
  2685. $core.method({
  2686. selector: "values",
  2687. protocol: "accessing",
  2688. fn: function (){
  2689. var self=this,$self=this;
  2690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2691. return $core.withContext(function($ctx1) {
  2692. //>>excludeEnd("ctx");
  2693. $self._subclassResponsibility();
  2694. return self;
  2695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2696. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  2697. //>>excludeEnd("ctx");
  2698. },
  2699. //>>excludeStart("ide", pragmas.excludeIdeData);
  2700. args: [],
  2701. source: "values\x0a\x09self subclassResponsibility",
  2702. referencedClasses: [],
  2703. //>>excludeEnd("ide");
  2704. messageSends: ["subclassResponsibility"]
  2705. }),
  2706. $globals.AssociativeCollection);
  2707. $core.addMethod(
  2708. $core.method({
  2709. selector: "valuesDo:",
  2710. protocol: "enumerating",
  2711. fn: function (aBlock){
  2712. var self=this,$self=this;
  2713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2714. return $core.withContext(function($ctx1) {
  2715. //>>excludeEnd("ctx");
  2716. $self._subclassResponsibility();
  2717. return self;
  2718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2719. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2720. //>>excludeEnd("ctx");
  2721. },
  2722. //>>excludeStart("ide", pragmas.excludeIdeData);
  2723. args: ["aBlock"],
  2724. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2725. referencedClasses: [],
  2726. //>>excludeEnd("ide");
  2727. messageSends: ["subclassResponsibility"]
  2728. }),
  2729. $globals.AssociativeCollection);
  2730. $core.addMethod(
  2731. $core.method({
  2732. selector: "withIndexDo:",
  2733. protocol: "enumerating",
  2734. fn: function (aBlock){
  2735. var self=this,$self=this;
  2736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2737. return $core.withContext(function($ctx1) {
  2738. //>>excludeEnd("ctx");
  2739. $self._keysAndValuesDo_((function(key,value){
  2740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2741. return $core.withContext(function($ctx2) {
  2742. //>>excludeEnd("ctx");
  2743. return $recv(aBlock)._value_value_(value,key);
  2744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2745. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2746. //>>excludeEnd("ctx");
  2747. }));
  2748. return self;
  2749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2750. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2751. //>>excludeEnd("ctx");
  2752. },
  2753. //>>excludeStart("ide", pragmas.excludeIdeData);
  2754. args: ["aBlock"],
  2755. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  2756. referencedClasses: [],
  2757. //>>excludeEnd("ide");
  2758. messageSends: ["keysAndValuesDo:", "value:value:"]
  2759. }),
  2760. $globals.AssociativeCollection);
  2761. $core.addMethod(
  2762. $core.method({
  2763. selector: "from:",
  2764. protocol: "instance creation",
  2765. fn: function (aCollection){
  2766. var self=this,$self=this;
  2767. var newCollection;
  2768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2769. return $core.withContext(function($ctx1) {
  2770. //>>excludeEnd("ctx");
  2771. newCollection=$self._new();
  2772. $recv(aCollection)._do_((function(each){
  2773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2774. return $core.withContext(function($ctx2) {
  2775. //>>excludeEnd("ctx");
  2776. return $recv(newCollection)._add_(each);
  2777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2778. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2779. //>>excludeEnd("ctx");
  2780. }));
  2781. return newCollection;
  2782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2783. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  2784. //>>excludeEnd("ctx");
  2785. },
  2786. //>>excludeStart("ide", pragmas.excludeIdeData);
  2787. args: ["aCollection"],
  2788. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  2789. referencedClasses: [],
  2790. //>>excludeEnd("ide");
  2791. messageSends: ["new", "do:", "add:"]
  2792. }),
  2793. $globals.AssociativeCollection.a$cls);
  2794. $core.addMethod(
  2795. $core.method({
  2796. selector: "fromPairs:",
  2797. protocol: "instance creation",
  2798. fn: function (aCollection){
  2799. var self=this,$self=this;
  2800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2801. return $core.withContext(function($ctx1) {
  2802. //>>excludeEnd("ctx");
  2803. return $self._from_(aCollection);
  2804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2805. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.a$cls)});
  2806. //>>excludeEnd("ctx");
  2807. },
  2808. //>>excludeStart("ide", pragmas.excludeIdeData);
  2809. args: ["aCollection"],
  2810. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  2811. referencedClasses: [],
  2812. //>>excludeEnd("ide");
  2813. messageSends: ["from:"]
  2814. }),
  2815. $globals.AssociativeCollection.a$cls);
  2816. $core.addMethod(
  2817. $core.method({
  2818. selector: "newFromPairs:",
  2819. protocol: "instance creation",
  2820. fn: function (aCollection){
  2821. var self=this,$self=this;
  2822. var newCollection;
  2823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2824. return $core.withContext(function($ctx1) {
  2825. //>>excludeEnd("ctx");
  2826. var $2,$1,$3,$4;
  2827. $2=$recv(aCollection)._size();
  2828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2829. $ctx1.sendIdx["size"]=1;
  2830. //>>excludeEnd("ctx");
  2831. $1=$recv($2)._even();
  2832. if(!$core.assert($1)){
  2833. $self._error_("#newFromPairs only accepts arrays of an even length");
  2834. }
  2835. newCollection=$self._new();
  2836. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  2837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2838. return $core.withContext(function($ctx2) {
  2839. //>>excludeEnd("ctx");
  2840. $3=newCollection;
  2841. $4=$recv(aCollection)._at_(each);
  2842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2843. $ctx2.sendIdx["at:"]=1;
  2844. //>>excludeEnd("ctx");
  2845. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  2846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2847. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2848. //>>excludeEnd("ctx");
  2849. }));
  2850. return newCollection;
  2851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2852. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  2853. //>>excludeEnd("ctx");
  2854. },
  2855. //>>excludeStart("ide", pragmas.excludeIdeData);
  2856. args: ["aCollection"],
  2857. 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",
  2858. referencedClasses: [],
  2859. //>>excludeEnd("ide");
  2860. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  2861. }),
  2862. $globals.AssociativeCollection.a$cls);
  2863. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  2864. //>>excludeStart("ide", pragmas.excludeIdeData);
  2865. $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.";
  2866. //>>excludeEnd("ide");
  2867. $core.addMethod(
  2868. $core.method({
  2869. selector: "at:ifAbsent:",
  2870. protocol: "accessing",
  2871. fn: function (aKey,aBlock){
  2872. var self=this,$self=this;
  2873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2874. return $core.withContext(function($ctx1) {
  2875. //>>excludeEnd("ctx");
  2876. var index = $self._positionOfKey_(aKey);
  2877. return index >=0 ? $self['@values'][index] : aBlock._value();
  2878. ;
  2879. return self;
  2880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2881. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  2882. //>>excludeEnd("ctx");
  2883. },
  2884. //>>excludeStart("ide", pragmas.excludeIdeData);
  2885. args: ["aKey", "aBlock"],
  2886. 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'>",
  2887. referencedClasses: [],
  2888. //>>excludeEnd("ide");
  2889. messageSends: []
  2890. }),
  2891. $globals.Dictionary);
  2892. $core.addMethod(
  2893. $core.method({
  2894. selector: "at:put:",
  2895. protocol: "accessing",
  2896. fn: function (aKey,aValue){
  2897. var self=this,$self=this;
  2898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2899. return $core.withContext(function($ctx1) {
  2900. //>>excludeEnd("ctx");
  2901. var index = $self._positionOfKey_(aKey);
  2902. if(index === -1) {
  2903. var keys = $self['@keys'];
  2904. index = keys.length;
  2905. keys.push(aKey);
  2906. }
  2907. return $self['@values'][index] = aValue;
  2908. ;
  2909. return self;
  2910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2911. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  2912. //>>excludeEnd("ctx");
  2913. },
  2914. //>>excludeStart("ide", pragmas.excludeIdeData);
  2915. args: ["aKey", "aValue"],
  2916. 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'>",
  2917. referencedClasses: [],
  2918. //>>excludeEnd("ide");
  2919. messageSends: []
  2920. }),
  2921. $globals.Dictionary);
  2922. $core.addMethod(
  2923. $core.method({
  2924. selector: "includesKey:",
  2925. protocol: "testing",
  2926. fn: function (aKey){
  2927. var self=this,$self=this;
  2928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2929. return $core.withContext(function($ctx1) {
  2930. //>>excludeEnd("ctx");
  2931. return $self._positionOfKey_(aKey) >= 0;;
  2932. return self;
  2933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2934. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  2935. //>>excludeEnd("ctx");
  2936. },
  2937. //>>excludeStart("ide", pragmas.excludeIdeData);
  2938. args: ["aKey"],
  2939. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  2940. referencedClasses: [],
  2941. //>>excludeEnd("ide");
  2942. messageSends: []
  2943. }),
  2944. $globals.Dictionary);
  2945. $core.addMethod(
  2946. $core.method({
  2947. selector: "indexOf:ifAbsent:",
  2948. protocol: "accessing",
  2949. fn: function (anObject,aBlock){
  2950. var self=this,$self=this;
  2951. var index;
  2952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2953. return $core.withContext(function($ctx1) {
  2954. //>>excludeEnd("ctx");
  2955. var $1;
  2956. index=$recv($self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  2957. return (0);
  2958. }));
  2959. $1=$recv(index).__eq((0));
  2960. if($core.assert($1)){
  2961. return $recv(aBlock)._value();
  2962. } else {
  2963. return $recv($self["@keys"])._at_(index);
  2964. }
  2965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2966. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  2967. //>>excludeEnd("ctx");
  2968. },
  2969. //>>excludeStart("ide", pragmas.excludeIdeData);
  2970. args: ["anObject", "aBlock"],
  2971. 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 ]",
  2972. referencedClasses: [],
  2973. //>>excludeEnd("ide");
  2974. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  2975. }),
  2976. $globals.Dictionary);
  2977. $core.addMethod(
  2978. $core.method({
  2979. selector: "initialize",
  2980. protocol: "initialization",
  2981. fn: function (){
  2982. var self=this,$self=this;
  2983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2984. return $core.withContext(function($ctx1) {
  2985. //>>excludeEnd("ctx");
  2986. (
  2987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2988. $ctx1.supercall = true,
  2989. //>>excludeEnd("ctx");
  2990. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  2991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2992. $ctx1.supercall = false;
  2993. //>>excludeEnd("ctx");;
  2994. $self["@keys"]=[];
  2995. $self["@values"]=[];
  2996. return self;
  2997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2998. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  2999. //>>excludeEnd("ctx");
  3000. },
  3001. //>>excludeStart("ide", pragmas.excludeIdeData);
  3002. args: [],
  3003. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  3004. referencedClasses: [],
  3005. //>>excludeEnd("ide");
  3006. messageSends: ["initialize"]
  3007. }),
  3008. $globals.Dictionary);
  3009. $core.addMethod(
  3010. $core.method({
  3011. selector: "keys",
  3012. protocol: "accessing",
  3013. fn: function (){
  3014. var self=this,$self=this;
  3015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3016. return $core.withContext(function($ctx1) {
  3017. //>>excludeEnd("ctx");
  3018. return $recv($self["@keys"])._copy();
  3019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3020. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  3021. //>>excludeEnd("ctx");
  3022. },
  3023. //>>excludeStart("ide", pragmas.excludeIdeData);
  3024. args: [],
  3025. source: "keys\x0a\x09^ keys copy",
  3026. referencedClasses: [],
  3027. //>>excludeEnd("ide");
  3028. messageSends: ["copy"]
  3029. }),
  3030. $globals.Dictionary);
  3031. $core.addMethod(
  3032. $core.method({
  3033. selector: "keysAndValuesDo:",
  3034. protocol: "enumerating",
  3035. fn: function (aBlock){
  3036. var self=this,$self=this;
  3037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3038. return $core.withContext(function($ctx1) {
  3039. //>>excludeEnd("ctx");
  3040. return $recv($self["@keys"])._with_do_($self["@values"],aBlock);
  3041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3042. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  3043. //>>excludeEnd("ctx");
  3044. },
  3045. //>>excludeStart("ide", pragmas.excludeIdeData);
  3046. args: ["aBlock"],
  3047. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3048. referencedClasses: [],
  3049. //>>excludeEnd("ide");
  3050. messageSends: ["with:do:"]
  3051. }),
  3052. $globals.Dictionary);
  3053. $core.addMethod(
  3054. $core.method({
  3055. selector: "keysDo:",
  3056. protocol: "enumerating",
  3057. fn: function (aBlock){
  3058. var self=this,$self=this;
  3059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3060. return $core.withContext(function($ctx1) {
  3061. //>>excludeEnd("ctx");
  3062. return $recv($self["@keys"])._do_(aBlock);
  3063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3064. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  3065. //>>excludeEnd("ctx");
  3066. },
  3067. //>>excludeStart("ide", pragmas.excludeIdeData);
  3068. args: ["aBlock"],
  3069. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3070. referencedClasses: [],
  3071. //>>excludeEnd("ide");
  3072. messageSends: ["do:"]
  3073. }),
  3074. $globals.Dictionary);
  3075. $core.addMethod(
  3076. $core.method({
  3077. selector: "positionOfKey:",
  3078. protocol: "private",
  3079. fn: function (anObject){
  3080. var self=this,$self=this;
  3081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3082. return $core.withContext(function($ctx1) {
  3083. //>>excludeEnd("ctx");
  3084. var keys = $self['@keys'];
  3085. for(var i=0;i<keys.length;i++){
  3086. if(keys[i].__eq(anObject)) { return i;}
  3087. }
  3088. return -1;
  3089. ;
  3090. return self;
  3091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3092. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  3093. //>>excludeEnd("ctx");
  3094. },
  3095. //>>excludeStart("ide", pragmas.excludeIdeData);
  3096. args: ["anObject"],
  3097. 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'>",
  3098. referencedClasses: [],
  3099. //>>excludeEnd("ide");
  3100. messageSends: []
  3101. }),
  3102. $globals.Dictionary);
  3103. $core.addMethod(
  3104. $core.method({
  3105. selector: "removeAll",
  3106. protocol: "adding/removing",
  3107. fn: function (){
  3108. var self=this,$self=this;
  3109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3110. return $core.withContext(function($ctx1) {
  3111. //>>excludeEnd("ctx");
  3112. $recv($self["@keys"])._removeAll();
  3113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3114. $ctx1.sendIdx["removeAll"]=1;
  3115. //>>excludeEnd("ctx");
  3116. $recv($self["@values"])._removeAll();
  3117. return self;
  3118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3119. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  3120. //>>excludeEnd("ctx");
  3121. },
  3122. //>>excludeStart("ide", pragmas.excludeIdeData);
  3123. args: [],
  3124. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3125. referencedClasses: [],
  3126. //>>excludeEnd("ide");
  3127. messageSends: ["removeAll"]
  3128. }),
  3129. $globals.Dictionary);
  3130. $core.addMethod(
  3131. $core.method({
  3132. selector: "removeKey:ifAbsent:",
  3133. protocol: "adding/removing",
  3134. fn: function (aKey,aBlock){
  3135. var self=this,$self=this;
  3136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3137. return $core.withContext(function($ctx1) {
  3138. //>>excludeEnd("ctx");
  3139. var index = $self._positionOfKey_(aKey);
  3140. if(index === -1) {
  3141. return aBlock._value()
  3142. } else {
  3143. var keys = $self['@keys'], values = $self['@values'];
  3144. var value = values[index], l = keys.length;
  3145. keys[index] = keys[l-1];
  3146. keys.pop();
  3147. values[index] = values[l-1];
  3148. values.pop();
  3149. return value;
  3150. }
  3151. ;
  3152. return self;
  3153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3154. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  3155. //>>excludeEnd("ctx");
  3156. },
  3157. //>>excludeStart("ide", pragmas.excludeIdeData);
  3158. args: ["aKey", "aBlock"],
  3159. 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'>",
  3160. referencedClasses: [],
  3161. //>>excludeEnd("ide");
  3162. messageSends: []
  3163. }),
  3164. $globals.Dictionary);
  3165. $core.addMethod(
  3166. $core.method({
  3167. selector: "values",
  3168. protocol: "accessing",
  3169. fn: function (){
  3170. var self=this,$self=this;
  3171. return $self["@values"];
  3172. },
  3173. //>>excludeStart("ide", pragmas.excludeIdeData);
  3174. args: [],
  3175. source: "values\x0a\x09^ values",
  3176. referencedClasses: [],
  3177. //>>excludeEnd("ide");
  3178. messageSends: []
  3179. }),
  3180. $globals.Dictionary);
  3181. $core.addMethod(
  3182. $core.method({
  3183. selector: "valuesDo:",
  3184. protocol: "enumerating",
  3185. fn: function (aBlock){
  3186. var self=this,$self=this;
  3187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3188. return $core.withContext(function($ctx1) {
  3189. //>>excludeEnd("ctx");
  3190. return $recv($self["@values"])._do_(aBlock);
  3191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3192. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  3193. //>>excludeEnd("ctx");
  3194. },
  3195. //>>excludeStart("ide", pragmas.excludeIdeData);
  3196. args: ["aBlock"],
  3197. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3198. referencedClasses: [],
  3199. //>>excludeEnd("ide");
  3200. messageSends: ["do:"]
  3201. }),
  3202. $globals.Dictionary);
  3203. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  3204. //>>excludeStart("ide", pragmas.excludeIdeData);
  3205. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3206. //>>excludeEnd("ide");
  3207. $core.addMethod(
  3208. $core.method({
  3209. selector: "at:ifAbsent:",
  3210. protocol: "accessing",
  3211. fn: function (aKey,aBlock){
  3212. var self=this,$self=this;
  3213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3214. return $core.withContext(function($ctx1) {
  3215. //>>excludeEnd("ctx");
  3216. var $1;
  3217. $1=$self._includesKey_(aKey);
  3218. if($core.assert($1)){
  3219. return $self._basicAt_(aKey);
  3220. } else {
  3221. return $recv(aBlock)._value();
  3222. }
  3223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3224. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  3225. //>>excludeEnd("ctx");
  3226. },
  3227. //>>excludeStart("ide", pragmas.excludeIdeData);
  3228. args: ["aKey", "aBlock"],
  3229. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3230. referencedClasses: [],
  3231. //>>excludeEnd("ide");
  3232. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3233. }),
  3234. $globals.HashedCollection);
  3235. $core.addMethod(
  3236. $core.method({
  3237. selector: "at:put:",
  3238. protocol: "accessing",
  3239. fn: function (aKey,aValue){
  3240. var self=this,$self=this;
  3241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3242. return $core.withContext(function($ctx1) {
  3243. //>>excludeEnd("ctx");
  3244. return $self._basicAt_put_(aKey,aValue);
  3245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3246. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  3247. //>>excludeEnd("ctx");
  3248. },
  3249. //>>excludeStart("ide", pragmas.excludeIdeData);
  3250. args: ["aKey", "aValue"],
  3251. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3252. referencedClasses: [],
  3253. //>>excludeEnd("ide");
  3254. messageSends: ["basicAt:put:"]
  3255. }),
  3256. $globals.HashedCollection);
  3257. $core.addMethod(
  3258. $core.method({
  3259. selector: "includesKey:",
  3260. protocol: "testing",
  3261. fn: function (aKey){
  3262. var self=this,$self=this;
  3263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3264. return $core.withContext(function($ctx1) {
  3265. //>>excludeEnd("ctx");
  3266. return self.hasOwnProperty(aKey);
  3267. return self;
  3268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3269. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  3270. //>>excludeEnd("ctx");
  3271. },
  3272. //>>excludeStart("ide", pragmas.excludeIdeData);
  3273. args: ["aKey"],
  3274. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  3275. referencedClasses: [],
  3276. //>>excludeEnd("ide");
  3277. messageSends: []
  3278. }),
  3279. $globals.HashedCollection);
  3280. $core.addMethod(
  3281. $core.method({
  3282. selector: "keys",
  3283. protocol: "accessing",
  3284. fn: function (){
  3285. var self=this,$self=this;
  3286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3287. return $core.withContext(function($ctx1) {
  3288. //>>excludeEnd("ctx");
  3289. return Object.keys(self);
  3290. return self;
  3291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3292. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  3293. //>>excludeEnd("ctx");
  3294. },
  3295. //>>excludeStart("ide", pragmas.excludeIdeData);
  3296. args: [],
  3297. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  3298. referencedClasses: [],
  3299. //>>excludeEnd("ide");
  3300. messageSends: []
  3301. }),
  3302. $globals.HashedCollection);
  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. $recv($self._keys())._do_(aBlock);
  3313. return self;
  3314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3315. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  3316. //>>excludeEnd("ctx");
  3317. },
  3318. //>>excludeStart("ide", pragmas.excludeIdeData);
  3319. args: ["aBlock"],
  3320. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3321. referencedClasses: [],
  3322. //>>excludeEnd("ide");
  3323. messageSends: ["do:", "keys"]
  3324. }),
  3325. $globals.HashedCollection);
  3326. $core.addMethod(
  3327. $core.method({
  3328. selector: "removeKey:ifAbsent:",
  3329. protocol: "adding/removing",
  3330. fn: function (aKey,aBlock){
  3331. var self=this,$self=this;
  3332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3333. return $core.withContext(function($ctx1) {
  3334. //>>excludeEnd("ctx");
  3335. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3337. return $core.withContext(function($ctx2) {
  3338. //>>excludeEnd("ctx");
  3339. $self._basicDelete_(aKey);
  3340. return removed;
  3341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3342. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3343. //>>excludeEnd("ctx");
  3344. }),(function(){
  3345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3346. return $core.withContext(function($ctx2) {
  3347. //>>excludeEnd("ctx");
  3348. return $recv(aBlock)._value();
  3349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3350. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3351. //>>excludeEnd("ctx");
  3352. }));
  3353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3354. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  3355. //>>excludeEnd("ctx");
  3356. },
  3357. //>>excludeStart("ide", pragmas.excludeIdeData);
  3358. args: ["aKey", "aBlock"],
  3359. 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 ]",
  3360. referencedClasses: [],
  3361. //>>excludeEnd("ide");
  3362. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3363. }),
  3364. $globals.HashedCollection);
  3365. $core.addMethod(
  3366. $core.method({
  3367. selector: "values",
  3368. protocol: "accessing",
  3369. fn: function (){
  3370. var self=this,$self=this;
  3371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3372. return $core.withContext(function($ctx1) {
  3373. //>>excludeEnd("ctx");
  3374. return $self._keys().map(function(key){
  3375. return $self._at_(key);
  3376. });
  3377. ;
  3378. return self;
  3379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3380. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  3381. //>>excludeEnd("ctx");
  3382. },
  3383. //>>excludeStart("ide", pragmas.excludeIdeData);
  3384. args: [],
  3385. 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'>",
  3386. referencedClasses: [],
  3387. //>>excludeEnd("ide");
  3388. messageSends: []
  3389. }),
  3390. $globals.HashedCollection);
  3391. $core.addMethod(
  3392. $core.method({
  3393. selector: "valuesDo:",
  3394. protocol: "enumerating",
  3395. fn: function (aBlock){
  3396. var self=this,$self=this;
  3397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3398. return $core.withContext(function($ctx1) {
  3399. //>>excludeEnd("ctx");
  3400. $recv($self._values())._do_(aBlock);
  3401. return self;
  3402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3403. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  3404. //>>excludeEnd("ctx");
  3405. },
  3406. //>>excludeStart("ide", pragmas.excludeIdeData);
  3407. args: ["aBlock"],
  3408. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3409. referencedClasses: [],
  3410. //>>excludeEnd("ide");
  3411. messageSends: ["do:", "values"]
  3412. }),
  3413. $globals.HashedCollection);
  3414. $core.addClass("SequenceableCollection", $globals.Collection, [], "Kernel-Collections");
  3415. //>>excludeStart("ide", pragmas.excludeIdeData);
  3416. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3417. //>>excludeEnd("ide");
  3418. $core.addMethod(
  3419. $core.method({
  3420. selector: "=",
  3421. protocol: "comparing",
  3422. fn: function (aCollection){
  3423. var self=this,$self=this;
  3424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3425. return $core.withContext(function($ctx1) {
  3426. //>>excludeEnd("ctx");
  3427. var $3,$2,$4,$1,$5;
  3428. var $early={};
  3429. try {
  3430. $3=$self._class();
  3431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3432. $ctx1.sendIdx["class"]=1;
  3433. //>>excludeEnd("ctx");
  3434. $2=$recv($3).__eq($recv(aCollection)._class());
  3435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3436. $ctx1.sendIdx["="]=1;
  3437. //>>excludeEnd("ctx");
  3438. $1=$recv($2)._and_((function(){
  3439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3440. return $core.withContext(function($ctx2) {
  3441. //>>excludeEnd("ctx");
  3442. $4=$self._size();
  3443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3444. $ctx2.sendIdx["size"]=1;
  3445. //>>excludeEnd("ctx");
  3446. return $recv($4).__eq($recv(aCollection)._size());
  3447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3448. $ctx2.sendIdx["="]=2;
  3449. //>>excludeEnd("ctx");
  3450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3451. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3452. //>>excludeEnd("ctx");
  3453. }));
  3454. if(!$core.assert($1)){
  3455. return false;
  3456. }
  3457. $self._withIndexDo_((function(each,i){
  3458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3459. return $core.withContext(function($ctx2) {
  3460. //>>excludeEnd("ctx");
  3461. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  3462. if(!$core.assert($5)){
  3463. throw $early=[false];
  3464. }
  3465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3466. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3467. //>>excludeEnd("ctx");
  3468. }));
  3469. return true;
  3470. }
  3471. catch(e) {if(e===$early)return e[0]; throw e}
  3472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3473. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  3474. //>>excludeEnd("ctx");
  3475. },
  3476. //>>excludeStart("ide", pragmas.excludeIdeData);
  3477. args: ["aCollection"],
  3478. 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",
  3479. referencedClasses: [],
  3480. //>>excludeEnd("ide");
  3481. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3482. }),
  3483. $globals.SequenceableCollection);
  3484. $core.addMethod(
  3485. $core.method({
  3486. selector: "addLast:",
  3487. protocol: "adding/removing",
  3488. fn: function (anObject){
  3489. var self=this,$self=this;
  3490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3491. return $core.withContext(function($ctx1) {
  3492. //>>excludeEnd("ctx");
  3493. $self._add_(anObject);
  3494. return self;
  3495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3496. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  3497. //>>excludeEnd("ctx");
  3498. },
  3499. //>>excludeStart("ide", pragmas.excludeIdeData);
  3500. args: ["anObject"],
  3501. source: "addLast: anObject\x0a\x09self add: anObject",
  3502. referencedClasses: [],
  3503. //>>excludeEnd("ide");
  3504. messageSends: ["add:"]
  3505. }),
  3506. $globals.SequenceableCollection);
  3507. $core.addMethod(
  3508. $core.method({
  3509. selector: "allButFirst",
  3510. protocol: "accessing",
  3511. fn: function (){
  3512. var self=this,$self=this;
  3513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3514. return $core.withContext(function($ctx1) {
  3515. //>>excludeEnd("ctx");
  3516. return $self._copyFrom_to_((2),$self._size());
  3517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3518. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  3519. //>>excludeEnd("ctx");
  3520. },
  3521. //>>excludeStart("ide", pragmas.excludeIdeData);
  3522. args: [],
  3523. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3524. referencedClasses: [],
  3525. //>>excludeEnd("ide");
  3526. messageSends: ["copyFrom:to:", "size"]
  3527. }),
  3528. $globals.SequenceableCollection);
  3529. $core.addMethod(
  3530. $core.method({
  3531. selector: "allButLast",
  3532. protocol: "accessing",
  3533. fn: function (){
  3534. var self=this,$self=this;
  3535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3536. return $core.withContext(function($ctx1) {
  3537. //>>excludeEnd("ctx");
  3538. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  3539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3540. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  3541. //>>excludeEnd("ctx");
  3542. },
  3543. //>>excludeStart("ide", pragmas.excludeIdeData);
  3544. args: [],
  3545. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  3546. referencedClasses: [],
  3547. //>>excludeEnd("ide");
  3548. messageSends: ["copyFrom:to:", "-", "size"]
  3549. }),
  3550. $globals.SequenceableCollection);
  3551. $core.addMethod(
  3552. $core.method({
  3553. selector: "anyOne",
  3554. protocol: "accessing",
  3555. fn: function (){
  3556. var self=this,$self=this;
  3557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3558. return $core.withContext(function($ctx1) {
  3559. //>>excludeEnd("ctx");
  3560. return $self._at_((1));
  3561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3562. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  3563. //>>excludeEnd("ctx");
  3564. },
  3565. //>>excludeStart("ide", pragmas.excludeIdeData);
  3566. args: [],
  3567. source: "anyOne\x0a\x09^ self at: 1",
  3568. referencedClasses: [],
  3569. //>>excludeEnd("ide");
  3570. messageSends: ["at:"]
  3571. }),
  3572. $globals.SequenceableCollection);
  3573. $core.addMethod(
  3574. $core.method({
  3575. selector: "atRandom",
  3576. protocol: "accessing",
  3577. fn: function (){
  3578. var self=this,$self=this;
  3579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3580. return $core.withContext(function($ctx1) {
  3581. //>>excludeEnd("ctx");
  3582. return $self._at_($recv($self._size())._atRandom());
  3583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3584. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  3585. //>>excludeEnd("ctx");
  3586. },
  3587. //>>excludeStart("ide", pragmas.excludeIdeData);
  3588. args: [],
  3589. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3590. referencedClasses: [],
  3591. //>>excludeEnd("ide");
  3592. messageSends: ["at:", "atRandom", "size"]
  3593. }),
  3594. $globals.SequenceableCollection);
  3595. $core.addMethod(
  3596. $core.method({
  3597. selector: "beginsWith:",
  3598. protocol: "testing",
  3599. fn: function (prefix){
  3600. var self=this,$self=this;
  3601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3602. return $core.withContext(function($ctx1) {
  3603. //>>excludeEnd("ctx");
  3604. var $2,$3,$1;
  3605. $2=$self._size();
  3606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3607. $ctx1.sendIdx["size"]=1;
  3608. //>>excludeEnd("ctx");
  3609. $3=$recv(prefix)._size();
  3610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3611. $ctx1.sendIdx["size"]=2;
  3612. //>>excludeEnd("ctx");
  3613. $1=$recv($2).__lt($3);
  3614. if($core.assert($1)){
  3615. return false;
  3616. }
  3617. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  3618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3619. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  3620. //>>excludeEnd("ctx");
  3621. },
  3622. //>>excludeStart("ide", pragmas.excludeIdeData);
  3623. args: ["prefix"],
  3624. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3625. referencedClasses: [],
  3626. //>>excludeEnd("ide");
  3627. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3628. }),
  3629. $globals.SequenceableCollection);
  3630. $core.addMethod(
  3631. $core.method({
  3632. selector: "copyFrom:to:",
  3633. protocol: "copying",
  3634. fn: function (anIndex,anotherIndex){
  3635. var self=this,$self=this;
  3636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3637. return $core.withContext(function($ctx1) {
  3638. //>>excludeEnd("ctx");
  3639. $self._subclassResponsibility();
  3640. return self;
  3641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3642. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  3643. //>>excludeEnd("ctx");
  3644. },
  3645. //>>excludeStart("ide", pragmas.excludeIdeData);
  3646. args: ["anIndex", "anotherIndex"],
  3647. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  3648. referencedClasses: [],
  3649. //>>excludeEnd("ide");
  3650. messageSends: ["subclassResponsibility"]
  3651. }),
  3652. $globals.SequenceableCollection);
  3653. $core.addMethod(
  3654. $core.method({
  3655. selector: "endsWith:",
  3656. protocol: "testing",
  3657. fn: function (suffix){
  3658. var self=this,$self=this;
  3659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3660. return $core.withContext(function($ctx1) {
  3661. //>>excludeEnd("ctx");
  3662. var $2,$3,$1;
  3663. $2=$self._size();
  3664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3665. $ctx1.sendIdx["size"]=1;
  3666. //>>excludeEnd("ctx");
  3667. $3=$recv(suffix)._size();
  3668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3669. $ctx1.sendIdx["size"]=2;
  3670. //>>excludeEnd("ctx");
  3671. $1=$recv($2).__lt($3);
  3672. if($core.assert($1)){
  3673. return false;
  3674. }
  3675. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  3676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3677. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  3678. //>>excludeEnd("ctx");
  3679. },
  3680. //>>excludeStart("ide", pragmas.excludeIdeData);
  3681. args: ["suffix"],
  3682. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  3683. referencedClasses: [],
  3684. //>>excludeEnd("ide");
  3685. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  3686. }),
  3687. $globals.SequenceableCollection);
  3688. $core.addMethod(
  3689. $core.method({
  3690. selector: "first",
  3691. protocol: "accessing",
  3692. fn: function (){
  3693. var self=this,$self=this;
  3694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3695. return $core.withContext(function($ctx1) {
  3696. //>>excludeEnd("ctx");
  3697. return $self._at_((1));
  3698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3699. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  3700. //>>excludeEnd("ctx");
  3701. },
  3702. //>>excludeStart("ide", pragmas.excludeIdeData);
  3703. args: [],
  3704. source: "first\x0a\x09^ self at: 1",
  3705. referencedClasses: [],
  3706. //>>excludeEnd("ide");
  3707. messageSends: ["at:"]
  3708. }),
  3709. $globals.SequenceableCollection);
  3710. $core.addMethod(
  3711. $core.method({
  3712. selector: "first:",
  3713. protocol: "accessing",
  3714. fn: function (aNumber){
  3715. var self=this,$self=this;
  3716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3717. return $core.withContext(function($ctx1) {
  3718. //>>excludeEnd("ctx");
  3719. var $1;
  3720. $1=$recv($self._size()).__lt(aNumber);
  3721. if($core.assert($1)){
  3722. $self._error_("Invalid number of elements");
  3723. }
  3724. return $self._copyFrom_to_((1),aNumber);
  3725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3726. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  3727. //>>excludeEnd("ctx");
  3728. },
  3729. //>>excludeStart("ide", pragmas.excludeIdeData);
  3730. args: ["aNumber"],
  3731. 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",
  3732. referencedClasses: [],
  3733. //>>excludeEnd("ide");
  3734. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  3735. }),
  3736. $globals.SequenceableCollection);
  3737. $core.addMethod(
  3738. $core.method({
  3739. selector: "fourth",
  3740. protocol: "accessing",
  3741. fn: function (){
  3742. var self=this,$self=this;
  3743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3744. return $core.withContext(function($ctx1) {
  3745. //>>excludeEnd("ctx");
  3746. return $self._at_((4));
  3747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3748. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  3749. //>>excludeEnd("ctx");
  3750. },
  3751. //>>excludeStart("ide", pragmas.excludeIdeData);
  3752. args: [],
  3753. source: "fourth\x0a\x09^ self at: 4",
  3754. referencedClasses: [],
  3755. //>>excludeEnd("ide");
  3756. messageSends: ["at:"]
  3757. }),
  3758. $globals.SequenceableCollection);
  3759. $core.addMethod(
  3760. $core.method({
  3761. selector: "includes:",
  3762. protocol: "testing",
  3763. fn: function (anObject){
  3764. var self=this,$self=this;
  3765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3766. return $core.withContext(function($ctx1) {
  3767. //>>excludeEnd("ctx");
  3768. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  3769. return nil;
  3770. })))._notNil();
  3771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3772. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  3773. //>>excludeEnd("ctx");
  3774. },
  3775. //>>excludeStart("ide", pragmas.excludeIdeData);
  3776. args: ["anObject"],
  3777. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  3778. referencedClasses: [],
  3779. //>>excludeEnd("ide");
  3780. messageSends: ["notNil", "indexOf:ifAbsent:"]
  3781. }),
  3782. $globals.SequenceableCollection);
  3783. $core.addMethod(
  3784. $core.method({
  3785. selector: "indexOf:startingAt:",
  3786. protocol: "accessing",
  3787. fn: function (anObject,start){
  3788. var self=this,$self=this;
  3789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3790. return $core.withContext(function($ctx1) {
  3791. //>>excludeEnd("ctx");
  3792. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  3793. return (0);
  3794. }));
  3795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3796. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  3797. //>>excludeEnd("ctx");
  3798. },
  3799. //>>excludeStart("ide", pragmas.excludeIdeData);
  3800. args: ["anObject", "start"],
  3801. 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 ]",
  3802. referencedClasses: [],
  3803. //>>excludeEnd("ide");
  3804. messageSends: ["indexOf:startingAt:ifAbsent:"]
  3805. }),
  3806. $globals.SequenceableCollection);
  3807. $core.addMethod(
  3808. $core.method({
  3809. selector: "indexOf:startingAt:ifAbsent:",
  3810. protocol: "accessing",
  3811. fn: function (anObject,start,aBlock){
  3812. var self=this,$self=this;
  3813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3814. return $core.withContext(function($ctx1) {
  3815. //>>excludeEnd("ctx");
  3816. $self._subclassResponsibility();
  3817. return self;
  3818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3819. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  3820. //>>excludeEnd("ctx");
  3821. },
  3822. //>>excludeStart("ide", pragmas.excludeIdeData);
  3823. args: ["anObject", "start", "aBlock"],
  3824. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  3825. referencedClasses: [],
  3826. //>>excludeEnd("ide");
  3827. messageSends: ["subclassResponsibility"]
  3828. }),
  3829. $globals.SequenceableCollection);
  3830. $core.addMethod(
  3831. $core.method({
  3832. selector: "last",
  3833. protocol: "accessing",
  3834. fn: function (){
  3835. var self=this,$self=this;
  3836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3837. return $core.withContext(function($ctx1) {
  3838. //>>excludeEnd("ctx");
  3839. return $self._at_($self._size());
  3840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3841. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  3842. //>>excludeEnd("ctx");
  3843. },
  3844. //>>excludeStart("ide", pragmas.excludeIdeData);
  3845. args: [],
  3846. source: "last\x0a\x09^ self at: self size",
  3847. referencedClasses: [],
  3848. //>>excludeEnd("ide");
  3849. messageSends: ["at:", "size"]
  3850. }),
  3851. $globals.SequenceableCollection);
  3852. $core.addMethod(
  3853. $core.method({
  3854. selector: "last:",
  3855. protocol: "accessing",
  3856. fn: function (aNumber){
  3857. var self=this,$self=this;
  3858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3859. return $core.withContext(function($ctx1) {
  3860. //>>excludeEnd("ctx");
  3861. var $2,$1,$5,$4,$3;
  3862. $2=$self._size();
  3863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3864. $ctx1.sendIdx["size"]=1;
  3865. //>>excludeEnd("ctx");
  3866. $1=$recv($2).__lt(aNumber);
  3867. if($core.assert($1)){
  3868. $self._error_("Invalid number of elements");
  3869. }
  3870. $5=$self._size();
  3871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3872. $ctx1.sendIdx["size"]=2;
  3873. //>>excludeEnd("ctx");
  3874. $4=$recv($5).__minus(aNumber);
  3875. $3=$recv($4).__plus((1));
  3876. return $self._copyFrom_to_($3,$self._size());
  3877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3878. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  3879. //>>excludeEnd("ctx");
  3880. },
  3881. //>>excludeStart("ide", pragmas.excludeIdeData);
  3882. args: ["aNumber"],
  3883. 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",
  3884. referencedClasses: [],
  3885. //>>excludeEnd("ide");
  3886. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  3887. }),
  3888. $globals.SequenceableCollection);
  3889. $core.addMethod(
  3890. $core.method({
  3891. selector: "newStream",
  3892. protocol: "streaming",
  3893. fn: function (){
  3894. var self=this,$self=this;
  3895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3896. return $core.withContext(function($ctx1) {
  3897. //>>excludeEnd("ctx");
  3898. return $recv($self._streamClass())._on_(self);
  3899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3900. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  3901. //>>excludeEnd("ctx");
  3902. },
  3903. //>>excludeStart("ide", pragmas.excludeIdeData);
  3904. args: [],
  3905. source: "newStream\x0a\x09^ self streamClass on: self",
  3906. referencedClasses: [],
  3907. //>>excludeEnd("ide");
  3908. messageSends: ["on:", "streamClass"]
  3909. }),
  3910. $globals.SequenceableCollection);
  3911. $core.addMethod(
  3912. $core.method({
  3913. selector: "readStream",
  3914. protocol: "streaming",
  3915. fn: function (){
  3916. var self=this,$self=this;
  3917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3918. return $core.withContext(function($ctx1) {
  3919. //>>excludeEnd("ctx");
  3920. return $self._stream();
  3921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3922. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  3923. //>>excludeEnd("ctx");
  3924. },
  3925. //>>excludeStart("ide", pragmas.excludeIdeData);
  3926. args: [],
  3927. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  3928. referencedClasses: [],
  3929. //>>excludeEnd("ide");
  3930. messageSends: ["stream"]
  3931. }),
  3932. $globals.SequenceableCollection);
  3933. $core.addMethod(
  3934. $core.method({
  3935. selector: "removeLast",
  3936. protocol: "adding/removing",
  3937. fn: function (){
  3938. var self=this,$self=this;
  3939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3940. return $core.withContext(function($ctx1) {
  3941. //>>excludeEnd("ctx");
  3942. return $self._remove_($self._last());
  3943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3944. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  3945. //>>excludeEnd("ctx");
  3946. },
  3947. //>>excludeStart("ide", pragmas.excludeIdeData);
  3948. args: [],
  3949. source: "removeLast\x0a\x09^ self remove: self last",
  3950. referencedClasses: [],
  3951. //>>excludeEnd("ide");
  3952. messageSends: ["remove:", "last"]
  3953. }),
  3954. $globals.SequenceableCollection);
  3955. $core.addMethod(
  3956. $core.method({
  3957. selector: "reverseDo:",
  3958. protocol: "enumerating",
  3959. fn: function (aBlock){
  3960. var self=this,$self=this;
  3961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3962. return $core.withContext(function($ctx1) {
  3963. //>>excludeEnd("ctx");
  3964. $recv($self._reversed())._do_(aBlock);
  3965. return self;
  3966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3967. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  3968. //>>excludeEnd("ctx");
  3969. },
  3970. //>>excludeStart("ide", pragmas.excludeIdeData);
  3971. args: ["aBlock"],
  3972. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  3973. referencedClasses: [],
  3974. //>>excludeEnd("ide");
  3975. messageSends: ["do:", "reversed"]
  3976. }),
  3977. $globals.SequenceableCollection);
  3978. $core.addMethod(
  3979. $core.method({
  3980. selector: "reversed",
  3981. protocol: "converting",
  3982. fn: function (){
  3983. var self=this,$self=this;
  3984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3985. return $core.withContext(function($ctx1) {
  3986. //>>excludeEnd("ctx");
  3987. $self._subclassResponsibility();
  3988. return self;
  3989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3990. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  3991. //>>excludeEnd("ctx");
  3992. },
  3993. //>>excludeStart("ide", pragmas.excludeIdeData);
  3994. args: [],
  3995. source: "reversed\x0a\x09self subclassResponsibility",
  3996. referencedClasses: [],
  3997. //>>excludeEnd("ide");
  3998. messageSends: ["subclassResponsibility"]
  3999. }),
  4000. $globals.SequenceableCollection);
  4001. $core.addMethod(
  4002. $core.method({
  4003. selector: "second",
  4004. protocol: "accessing",
  4005. fn: function (){
  4006. var self=this,$self=this;
  4007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4008. return $core.withContext(function($ctx1) {
  4009. //>>excludeEnd("ctx");
  4010. return $self._at_((2));
  4011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4012. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  4013. //>>excludeEnd("ctx");
  4014. },
  4015. //>>excludeStart("ide", pragmas.excludeIdeData);
  4016. args: [],
  4017. source: "second\x0a\x09^ self at: 2",
  4018. referencedClasses: [],
  4019. //>>excludeEnd("ide");
  4020. messageSends: ["at:"]
  4021. }),
  4022. $globals.SequenceableCollection);
  4023. $core.addMethod(
  4024. $core.method({
  4025. selector: "stream",
  4026. protocol: "streaming",
  4027. fn: function (){
  4028. var self=this,$self=this;
  4029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4030. return $core.withContext(function($ctx1) {
  4031. //>>excludeEnd("ctx");
  4032. return $self._newStream();
  4033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4034. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  4035. //>>excludeEnd("ctx");
  4036. },
  4037. //>>excludeStart("ide", pragmas.excludeIdeData);
  4038. args: [],
  4039. source: "stream\x0a\x09^ self newStream",
  4040. referencedClasses: [],
  4041. //>>excludeEnd("ide");
  4042. messageSends: ["newStream"]
  4043. }),
  4044. $globals.SequenceableCollection);
  4045. $core.addMethod(
  4046. $core.method({
  4047. selector: "streamClass",
  4048. protocol: "streaming",
  4049. fn: function (){
  4050. var self=this,$self=this;
  4051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4052. return $core.withContext(function($ctx1) {
  4053. //>>excludeEnd("ctx");
  4054. return $recv($self._class())._streamClass();
  4055. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4056. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  4057. //>>excludeEnd("ctx");
  4058. },
  4059. //>>excludeStart("ide", pragmas.excludeIdeData);
  4060. args: [],
  4061. source: "streamClass\x0a\x09^ self class streamClass",
  4062. referencedClasses: [],
  4063. //>>excludeEnd("ide");
  4064. messageSends: ["streamClass", "class"]
  4065. }),
  4066. $globals.SequenceableCollection);
  4067. $core.addMethod(
  4068. $core.method({
  4069. selector: "third",
  4070. protocol: "accessing",
  4071. fn: function (){
  4072. var self=this,$self=this;
  4073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4074. return $core.withContext(function($ctx1) {
  4075. //>>excludeEnd("ctx");
  4076. return $self._at_((3));
  4077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4078. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  4079. //>>excludeEnd("ctx");
  4080. },
  4081. //>>excludeStart("ide", pragmas.excludeIdeData);
  4082. args: [],
  4083. source: "third\x0a\x09^ self at: 3",
  4084. referencedClasses: [],
  4085. //>>excludeEnd("ide");
  4086. messageSends: ["at:"]
  4087. }),
  4088. $globals.SequenceableCollection);
  4089. $core.addMethod(
  4090. $core.method({
  4091. selector: "writeStream",
  4092. protocol: "streaming",
  4093. fn: function (){
  4094. var self=this,$self=this;
  4095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4096. return $core.withContext(function($ctx1) {
  4097. //>>excludeEnd("ctx");
  4098. return $self._stream();
  4099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4100. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  4101. //>>excludeEnd("ctx");
  4102. },
  4103. //>>excludeStart("ide", pragmas.excludeIdeData);
  4104. args: [],
  4105. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4106. referencedClasses: [],
  4107. //>>excludeEnd("ide");
  4108. messageSends: ["stream"]
  4109. }),
  4110. $globals.SequenceableCollection);
  4111. $core.addMethod(
  4112. $core.method({
  4113. selector: "streamClass",
  4114. protocol: "accessing",
  4115. fn: function (){
  4116. var self=this,$self=this;
  4117. return $globals.Stream;
  4118. },
  4119. //>>excludeStart("ide", pragmas.excludeIdeData);
  4120. args: [],
  4121. source: "streamClass\x0a\x09\x09^ Stream",
  4122. referencedClasses: ["Stream"],
  4123. //>>excludeEnd("ide");
  4124. messageSends: []
  4125. }),
  4126. $globals.SequenceableCollection.a$cls);
  4127. $core.addMethod(
  4128. $core.method({
  4129. selector: "streamContents:",
  4130. protocol: "streaming",
  4131. fn: function (aBlock){
  4132. var self=this,$self=this;
  4133. var stream;
  4134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4135. return $core.withContext(function($ctx1) {
  4136. //>>excludeEnd("ctx");
  4137. stream=$recv($self._streamClass())._on_($self._new());
  4138. $recv(aBlock)._value_(stream);
  4139. return $recv(stream)._contents();
  4140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4141. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.a$cls)});
  4142. //>>excludeEnd("ctx");
  4143. },
  4144. //>>excludeStart("ide", pragmas.excludeIdeData);
  4145. args: ["aBlock"],
  4146. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4147. referencedClasses: [],
  4148. //>>excludeEnd("ide");
  4149. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4150. }),
  4151. $globals.SequenceableCollection.a$cls);
  4152. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  4153. //>>excludeStart("ide", pragmas.excludeIdeData);
  4154. $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`.";
  4155. //>>excludeEnd("ide");
  4156. $core.addMethod(
  4157. $core.method({
  4158. selector: "add:",
  4159. protocol: "adding/removing",
  4160. fn: function (anObject){
  4161. var self=this,$self=this;
  4162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4163. return $core.withContext(function($ctx1) {
  4164. //>>excludeEnd("ctx");
  4165. self.push(anObject); return anObject;;
  4166. return self;
  4167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4168. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  4169. //>>excludeEnd("ctx");
  4170. },
  4171. //>>excludeStart("ide", pragmas.excludeIdeData);
  4172. args: ["anObject"],
  4173. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  4174. referencedClasses: [],
  4175. //>>excludeEnd("ide");
  4176. messageSends: []
  4177. }),
  4178. $globals.Array);
  4179. $core.addMethod(
  4180. $core.method({
  4181. selector: "addAll:",
  4182. protocol: "adding/removing",
  4183. fn: function (aCollection){
  4184. var self=this,$self=this;
  4185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4186. return $core.withContext(function($ctx1) {
  4187. //>>excludeEnd("ctx");
  4188. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  4189. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  4190. return aCollection;;
  4191. return self;
  4192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4193. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  4194. //>>excludeEnd("ctx");
  4195. },
  4196. //>>excludeStart("ide", pragmas.excludeIdeData);
  4197. args: ["aCollection"],
  4198. 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'>",
  4199. referencedClasses: [],
  4200. //>>excludeEnd("ide");
  4201. messageSends: []
  4202. }),
  4203. $globals.Array);
  4204. $core.addMethod(
  4205. $core.method({
  4206. selector: "addFirst:",
  4207. protocol: "adding/removing",
  4208. fn: function (anObject){
  4209. var self=this,$self=this;
  4210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4211. return $core.withContext(function($ctx1) {
  4212. //>>excludeEnd("ctx");
  4213. self.unshift(anObject); return anObject;;
  4214. return self;
  4215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4216. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  4217. //>>excludeEnd("ctx");
  4218. },
  4219. //>>excludeStart("ide", pragmas.excludeIdeData);
  4220. args: ["anObject"],
  4221. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  4222. referencedClasses: [],
  4223. //>>excludeEnd("ide");
  4224. messageSends: []
  4225. }),
  4226. $globals.Array);
  4227. $core.addMethod(
  4228. $core.method({
  4229. selector: "asJavaScriptSource",
  4230. protocol: "converting",
  4231. fn: function (){
  4232. var self=this,$self=this;
  4233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4234. return $core.withContext(function($ctx1) {
  4235. //>>excludeEnd("ctx");
  4236. var $1;
  4237. $1=$recv("[".__comma($recv($self._collect_((function(each){
  4238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4239. return $core.withContext(function($ctx2) {
  4240. //>>excludeEnd("ctx");
  4241. return $recv(each)._asJavaScriptSource();
  4242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4243. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4244. //>>excludeEnd("ctx");
  4245. })))._join_(", "))).__comma("]");
  4246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4247. $ctx1.sendIdx[","]=1;
  4248. //>>excludeEnd("ctx");
  4249. return $1;
  4250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4251. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Array)});
  4252. //>>excludeEnd("ctx");
  4253. },
  4254. //>>excludeStart("ide", pragmas.excludeIdeData);
  4255. args: [],
  4256. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  4257. referencedClasses: [],
  4258. //>>excludeEnd("ide");
  4259. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  4260. }),
  4261. $globals.Array);
  4262. $core.addMethod(
  4263. $core.method({
  4264. selector: "at:put:",
  4265. protocol: "accessing",
  4266. fn: function (anIndex,anObject){
  4267. var self=this,$self=this;
  4268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4269. return $core.withContext(function($ctx1) {
  4270. //>>excludeEnd("ctx");
  4271. return self[anIndex - 1] = anObject;
  4272. return self;
  4273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4274. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  4275. //>>excludeEnd("ctx");
  4276. },
  4277. //>>excludeStart("ide", pragmas.excludeIdeData);
  4278. args: ["anIndex", "anObject"],
  4279. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  4280. referencedClasses: [],
  4281. //>>excludeEnd("ide");
  4282. messageSends: []
  4283. }),
  4284. $globals.Array);
  4285. $core.addMethod(
  4286. $core.method({
  4287. selector: "collect:",
  4288. protocol: "enumerating",
  4289. fn: function (aBlock){
  4290. var self=this,$self=this;
  4291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4292. return $core.withContext(function($ctx1) {
  4293. //>>excludeEnd("ctx");
  4294. return self.map(function(each) {return aBlock._value_(each)});
  4295. return self;
  4296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4297. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  4298. //>>excludeEnd("ctx");
  4299. },
  4300. //>>excludeStart("ide", pragmas.excludeIdeData);
  4301. args: ["aBlock"],
  4302. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  4303. referencedClasses: [],
  4304. //>>excludeEnd("ide");
  4305. messageSends: []
  4306. }),
  4307. $globals.Array);
  4308. $core.addMethod(
  4309. $core.method({
  4310. selector: "copyFrom:to:",
  4311. protocol: "copying",
  4312. fn: function (anIndex,anotherIndex){
  4313. var self=this,$self=this;
  4314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4315. return $core.withContext(function($ctx1) {
  4316. //>>excludeEnd("ctx");
  4317. if (anIndex >= 1 && anotherIndex <= self.length) {
  4318. return self.slice(anIndex - 1, anotherIndex);
  4319. } else {
  4320. self._at_(anIndex);
  4321. self._at_(self.length + 1);
  4322. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4323. };
  4324. return self;
  4325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4326. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  4327. //>>excludeEnd("ctx");
  4328. },
  4329. //>>excludeStart("ide", pragmas.excludeIdeData);
  4330. args: ["anIndex", "anotherIndex"],
  4331. 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'>",
  4332. referencedClasses: [],
  4333. //>>excludeEnd("ide");
  4334. messageSends: []
  4335. }),
  4336. $globals.Array);
  4337. $core.addMethod(
  4338. $core.method({
  4339. selector: "join:",
  4340. protocol: "enumerating",
  4341. fn: function (aString){
  4342. var self=this,$self=this;
  4343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4344. return $core.withContext(function($ctx1) {
  4345. //>>excludeEnd("ctx");
  4346. return self.join(aString);
  4347. return self;
  4348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4349. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  4350. //>>excludeEnd("ctx");
  4351. },
  4352. //>>excludeStart("ide", pragmas.excludeIdeData);
  4353. args: ["aString"],
  4354. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  4355. referencedClasses: [],
  4356. //>>excludeEnd("ide");
  4357. messageSends: []
  4358. }),
  4359. $globals.Array);
  4360. $core.addMethod(
  4361. $core.method({
  4362. selector: "printOn:",
  4363. protocol: "printing",
  4364. fn: function (aStream){
  4365. var self=this,$self=this;
  4366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4367. return $core.withContext(function($ctx1) {
  4368. //>>excludeEnd("ctx");
  4369. (
  4370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4371. $ctx1.supercall = true,
  4372. //>>excludeEnd("ctx");
  4373. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  4374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4375. $ctx1.supercall = false;
  4376. //>>excludeEnd("ctx");;
  4377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4378. $ctx1.sendIdx["printOn:"]=1;
  4379. //>>excludeEnd("ctx");
  4380. $recv(aStream)._nextPutAll_(" (");
  4381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4382. $ctx1.sendIdx["nextPutAll:"]=1;
  4383. //>>excludeEnd("ctx");
  4384. $self._do_separatedBy_((function(each){
  4385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4386. return $core.withContext(function($ctx2) {
  4387. //>>excludeEnd("ctx");
  4388. return $recv(each)._printOn_(aStream);
  4389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4390. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4391. //>>excludeEnd("ctx");
  4392. }),(function(){
  4393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4394. return $core.withContext(function($ctx2) {
  4395. //>>excludeEnd("ctx");
  4396. return $recv(aStream)._nextPutAll_(" ");
  4397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4398. $ctx2.sendIdx["nextPutAll:"]=2;
  4399. //>>excludeEnd("ctx");
  4400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4401. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4402. //>>excludeEnd("ctx");
  4403. }));
  4404. $recv(aStream)._nextPutAll_(")");
  4405. return self;
  4406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4407. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  4408. //>>excludeEnd("ctx");
  4409. },
  4410. //>>excludeStart("ide", pragmas.excludeIdeData);
  4411. args: ["aStream"],
  4412. 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: ')'",
  4413. referencedClasses: [],
  4414. //>>excludeEnd("ide");
  4415. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4416. }),
  4417. $globals.Array);
  4418. $core.addMethod(
  4419. $core.method({
  4420. selector: "remove:ifAbsent:",
  4421. protocol: "adding/removing",
  4422. fn: function (anObject,aBlock){
  4423. var self=this,$self=this;
  4424. var index;
  4425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4426. return $core.withContext(function($ctx1) {
  4427. //>>excludeEnd("ctx");
  4428. var $1;
  4429. index=$self._indexOf_ifAbsent_(anObject,(function(){
  4430. return (0);
  4431. }));
  4432. $1=$recv(index).__eq((0));
  4433. if($core.assert($1)){
  4434. return $recv(aBlock)._value();
  4435. } else {
  4436. $self._removeIndex_(index);
  4437. return anObject;
  4438. }
  4439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4440. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  4441. //>>excludeEnd("ctx");
  4442. },
  4443. //>>excludeStart("ide", pragmas.excludeIdeData);
  4444. args: ["anObject", "aBlock"],
  4445. 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 ]",
  4446. referencedClasses: [],
  4447. //>>excludeEnd("ide");
  4448. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4449. }),
  4450. $globals.Array);
  4451. $core.addMethod(
  4452. $core.method({
  4453. selector: "removeAll",
  4454. protocol: "adding/removing",
  4455. fn: function (){
  4456. var self=this,$self=this;
  4457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4458. return $core.withContext(function($ctx1) {
  4459. //>>excludeEnd("ctx");
  4460. self.length = 0;
  4461. return self;
  4462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4463. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  4464. //>>excludeEnd("ctx");
  4465. },
  4466. //>>excludeStart("ide", pragmas.excludeIdeData);
  4467. args: [],
  4468. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  4469. referencedClasses: [],
  4470. //>>excludeEnd("ide");
  4471. messageSends: []
  4472. }),
  4473. $globals.Array);
  4474. $core.addMethod(
  4475. $core.method({
  4476. selector: "removeFrom:to:",
  4477. protocol: "adding/removing",
  4478. fn: function (aNumber,anotherNumber){
  4479. var self=this,$self=this;
  4480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4481. return $core.withContext(function($ctx1) {
  4482. //>>excludeEnd("ctx");
  4483. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4484. return self;
  4485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4486. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  4487. //>>excludeEnd("ctx");
  4488. },
  4489. //>>excludeStart("ide", pragmas.excludeIdeData);
  4490. args: ["aNumber", "anotherNumber"],
  4491. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  4492. referencedClasses: [],
  4493. //>>excludeEnd("ide");
  4494. messageSends: []
  4495. }),
  4496. $globals.Array);
  4497. $core.addMethod(
  4498. $core.method({
  4499. selector: "removeIndex:",
  4500. protocol: "adding/removing",
  4501. fn: function (anInteger){
  4502. var self=this,$self=this;
  4503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4504. return $core.withContext(function($ctx1) {
  4505. //>>excludeEnd("ctx");
  4506. self.splice(anInteger - 1, 1);
  4507. return self;
  4508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4509. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  4510. //>>excludeEnd("ctx");
  4511. },
  4512. //>>excludeStart("ide", pragmas.excludeIdeData);
  4513. args: ["anInteger"],
  4514. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  4515. referencedClasses: [],
  4516. //>>excludeEnd("ide");
  4517. messageSends: []
  4518. }),
  4519. $globals.Array);
  4520. $core.addMethod(
  4521. $core.method({
  4522. selector: "removeLast",
  4523. protocol: "adding/removing",
  4524. fn: function (){
  4525. var self=this,$self=this;
  4526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4527. return $core.withContext(function($ctx1) {
  4528. //>>excludeEnd("ctx");
  4529. return self.pop();;
  4530. return self;
  4531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4532. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  4533. //>>excludeEnd("ctx");
  4534. },
  4535. //>>excludeStart("ide", pragmas.excludeIdeData);
  4536. args: [],
  4537. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  4538. referencedClasses: [],
  4539. //>>excludeEnd("ide");
  4540. messageSends: []
  4541. }),
  4542. $globals.Array);
  4543. $core.addMethod(
  4544. $core.method({
  4545. selector: "reversed",
  4546. protocol: "converting",
  4547. fn: function (){
  4548. var self=this,$self=this;
  4549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4550. return $core.withContext(function($ctx1) {
  4551. //>>excludeEnd("ctx");
  4552. return self.slice().reverse();
  4553. return self;
  4554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4555. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  4556. //>>excludeEnd("ctx");
  4557. },
  4558. //>>excludeStart("ide", pragmas.excludeIdeData);
  4559. args: [],
  4560. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  4561. referencedClasses: [],
  4562. //>>excludeEnd("ide");
  4563. messageSends: []
  4564. }),
  4565. $globals.Array);
  4566. $core.addMethod(
  4567. $core.method({
  4568. selector: "select:",
  4569. protocol: "enumerating",
  4570. fn: function (aBlock){
  4571. var self=this,$self=this;
  4572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4573. return $core.withContext(function($ctx1) {
  4574. //>>excludeEnd("ctx");
  4575. return self.filter(function(each) {return aBlock._value_(each)});
  4576. return self;
  4577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4578. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  4579. //>>excludeEnd("ctx");
  4580. },
  4581. //>>excludeStart("ide", pragmas.excludeIdeData);
  4582. args: ["aBlock"],
  4583. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  4584. referencedClasses: [],
  4585. //>>excludeEnd("ide");
  4586. messageSends: []
  4587. }),
  4588. $globals.Array);
  4589. $core.addMethod(
  4590. $core.method({
  4591. selector: "shallowCopy",
  4592. protocol: "copying",
  4593. fn: function (){
  4594. var self=this,$self=this;
  4595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4596. return $core.withContext(function($ctx1) {
  4597. //>>excludeEnd("ctx");
  4598. return self.slice();
  4599. return self;
  4600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4601. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  4602. //>>excludeEnd("ctx");
  4603. },
  4604. //>>excludeStart("ide", pragmas.excludeIdeData);
  4605. args: [],
  4606. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  4607. referencedClasses: [],
  4608. //>>excludeEnd("ide");
  4609. messageSends: []
  4610. }),
  4611. $globals.Array);
  4612. $core.addMethod(
  4613. $core.method({
  4614. selector: "sort",
  4615. protocol: "enumerating",
  4616. fn: function (){
  4617. var self=this,$self=this;
  4618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4619. return $core.withContext(function($ctx1) {
  4620. //>>excludeEnd("ctx");
  4621. return $self._sort_((function(a,b){
  4622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4623. return $core.withContext(function($ctx2) {
  4624. //>>excludeEnd("ctx");
  4625. return $recv(a).__lt(b);
  4626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4627. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  4628. //>>excludeEnd("ctx");
  4629. }));
  4630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4631. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  4632. //>>excludeEnd("ctx");
  4633. },
  4634. //>>excludeStart("ide", pragmas.excludeIdeData);
  4635. args: [],
  4636. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  4637. referencedClasses: [],
  4638. //>>excludeEnd("ide");
  4639. messageSends: ["sort:", "<"]
  4640. }),
  4641. $globals.Array);
  4642. $core.addMethod(
  4643. $core.method({
  4644. selector: "sort:",
  4645. protocol: "enumerating",
  4646. fn: function (aBlock){
  4647. var self=this,$self=this;
  4648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4649. return $core.withContext(function($ctx1) {
  4650. //>>excludeEnd("ctx");
  4651. return self.sort(function(a, b) {
  4652. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  4653. })
  4654. ;
  4655. return self;
  4656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4657. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  4658. //>>excludeEnd("ctx");
  4659. },
  4660. //>>excludeStart("ide", pragmas.excludeIdeData);
  4661. args: ["aBlock"],
  4662. 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'>",
  4663. referencedClasses: [],
  4664. //>>excludeEnd("ide");
  4665. messageSends: []
  4666. }),
  4667. $globals.Array);
  4668. $core.addMethod(
  4669. $core.method({
  4670. selector: "sorted",
  4671. protocol: "enumerating",
  4672. fn: function (){
  4673. var self=this,$self=this;
  4674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4675. return $core.withContext(function($ctx1) {
  4676. //>>excludeEnd("ctx");
  4677. return $recv($self._copy())._sort();
  4678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4679. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  4680. //>>excludeEnd("ctx");
  4681. },
  4682. //>>excludeStart("ide", pragmas.excludeIdeData);
  4683. args: [],
  4684. source: "sorted\x0a\x09^ self copy sort",
  4685. referencedClasses: [],
  4686. //>>excludeEnd("ide");
  4687. messageSends: ["sort", "copy"]
  4688. }),
  4689. $globals.Array);
  4690. $core.addMethod(
  4691. $core.method({
  4692. selector: "sorted:",
  4693. protocol: "enumerating",
  4694. fn: function (aBlock){
  4695. var self=this,$self=this;
  4696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4697. return $core.withContext(function($ctx1) {
  4698. //>>excludeEnd("ctx");
  4699. return $recv($self._copy())._sort_(aBlock);
  4700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4701. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  4702. //>>excludeEnd("ctx");
  4703. },
  4704. //>>excludeStart("ide", pragmas.excludeIdeData);
  4705. args: ["aBlock"],
  4706. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  4707. referencedClasses: [],
  4708. //>>excludeEnd("ide");
  4709. messageSends: ["sort:", "copy"]
  4710. }),
  4711. $globals.Array);
  4712. $core.addMethod(
  4713. $core.method({
  4714. selector: "new:",
  4715. protocol: "instance creation",
  4716. fn: function (anInteger){
  4717. var self=this,$self=this;
  4718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4719. return $core.withContext(function($ctx1) {
  4720. //>>excludeEnd("ctx");
  4721. return new Array(anInteger);
  4722. return self;
  4723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4724. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.a$cls)});
  4725. //>>excludeEnd("ctx");
  4726. },
  4727. //>>excludeStart("ide", pragmas.excludeIdeData);
  4728. args: ["anInteger"],
  4729. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  4730. referencedClasses: [],
  4731. //>>excludeEnd("ide");
  4732. messageSends: []
  4733. }),
  4734. $globals.Array.a$cls);
  4735. $core.addMethod(
  4736. $core.method({
  4737. selector: "with:",
  4738. protocol: "instance creation",
  4739. fn: function (anObject){
  4740. var self=this,$self=this;
  4741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4742. return $core.withContext(function($ctx1) {
  4743. //>>excludeEnd("ctx");
  4744. var $1;
  4745. $1=$self._new_((1));
  4746. $recv($1)._at_put_((1),anObject);
  4747. return $recv($1)._yourself();
  4748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4749. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.a$cls)});
  4750. //>>excludeEnd("ctx");
  4751. },
  4752. //>>excludeStart("ide", pragmas.excludeIdeData);
  4753. args: ["anObject"],
  4754. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  4755. referencedClasses: [],
  4756. //>>excludeEnd("ide");
  4757. messageSends: ["at:put:", "new:", "yourself"]
  4758. }),
  4759. $globals.Array.a$cls);
  4760. $core.addMethod(
  4761. $core.method({
  4762. selector: "with:with:",
  4763. protocol: "instance creation",
  4764. fn: function (anObject,anObject2){
  4765. var self=this,$self=this;
  4766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4767. return $core.withContext(function($ctx1) {
  4768. //>>excludeEnd("ctx");
  4769. var $1;
  4770. $1=$self._new_((2));
  4771. $recv($1)._at_put_((1),anObject);
  4772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4773. $ctx1.sendIdx["at:put:"]=1;
  4774. //>>excludeEnd("ctx");
  4775. $recv($1)._at_put_((2),anObject2);
  4776. return $recv($1)._yourself();
  4777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4778. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.a$cls)});
  4779. //>>excludeEnd("ctx");
  4780. },
  4781. //>>excludeStart("ide", pragmas.excludeIdeData);
  4782. args: ["anObject", "anObject2"],
  4783. 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",
  4784. referencedClasses: [],
  4785. //>>excludeEnd("ide");
  4786. messageSends: ["at:put:", "new:", "yourself"]
  4787. }),
  4788. $globals.Array.a$cls);
  4789. $core.addMethod(
  4790. $core.method({
  4791. selector: "with:with:with:",
  4792. protocol: "instance creation",
  4793. fn: function (anObject,anObject2,anObject3){
  4794. var self=this,$self=this;
  4795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4796. return $core.withContext(function($ctx1) {
  4797. //>>excludeEnd("ctx");
  4798. var $1;
  4799. $1=$self._new_((3));
  4800. $recv($1)._at_put_((1),anObject);
  4801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4802. $ctx1.sendIdx["at:put:"]=1;
  4803. //>>excludeEnd("ctx");
  4804. $recv($1)._at_put_((2),anObject2);
  4805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4806. $ctx1.sendIdx["at:put:"]=2;
  4807. //>>excludeEnd("ctx");
  4808. $recv($1)._at_put_((3),anObject3);
  4809. return $recv($1)._yourself();
  4810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4811. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.a$cls)});
  4812. //>>excludeEnd("ctx");
  4813. },
  4814. //>>excludeStart("ide", pragmas.excludeIdeData);
  4815. args: ["anObject", "anObject2", "anObject3"],
  4816. 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",
  4817. referencedClasses: [],
  4818. //>>excludeEnd("ide");
  4819. messageSends: ["at:put:", "new:", "yourself"]
  4820. }),
  4821. $globals.Array.a$cls);
  4822. $core.addMethod(
  4823. $core.method({
  4824. selector: "withAll:",
  4825. protocol: "instance creation",
  4826. fn: function (aCollection){
  4827. var self=this,$self=this;
  4828. var instance,index;
  4829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4830. return $core.withContext(function($ctx1) {
  4831. //>>excludeEnd("ctx");
  4832. index=(1);
  4833. instance=$self._new_($recv(aCollection)._size());
  4834. $recv(aCollection)._do_((function(each){
  4835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4836. return $core.withContext(function($ctx2) {
  4837. //>>excludeEnd("ctx");
  4838. $recv(instance)._at_put_(index,each);
  4839. index=$recv(index).__plus((1));
  4840. return index;
  4841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4842. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4843. //>>excludeEnd("ctx");
  4844. }));
  4845. return instance;
  4846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4847. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.a$cls)});
  4848. //>>excludeEnd("ctx");
  4849. },
  4850. //>>excludeStart("ide", pragmas.excludeIdeData);
  4851. args: ["aCollection"],
  4852. 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",
  4853. referencedClasses: [],
  4854. //>>excludeEnd("ide");
  4855. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  4856. }),
  4857. $globals.Array.a$cls);
  4858. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  4859. //>>excludeStart("ide", pragmas.excludeIdeData);
  4860. $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 >> #,`";
  4861. //>>excludeEnd("ide");
  4862. $core.addMethod(
  4863. $core.method({
  4864. selector: ",",
  4865. protocol: "copying",
  4866. fn: function (aString){
  4867. var self=this,$self=this;
  4868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4869. return $core.withContext(function($ctx1) {
  4870. //>>excludeEnd("ctx");
  4871. return String(self) + aString;
  4872. return self;
  4873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4874. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  4875. //>>excludeEnd("ctx");
  4876. },
  4877. //>>excludeStart("ide", pragmas.excludeIdeData);
  4878. args: ["aString"],
  4879. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  4880. referencedClasses: [],
  4881. //>>excludeEnd("ide");
  4882. messageSends: []
  4883. }),
  4884. $globals.String);
  4885. $core.addMethod(
  4886. $core.method({
  4887. selector: "<",
  4888. protocol: "comparing",
  4889. fn: function (aString){
  4890. var self=this,$self=this;
  4891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4892. return $core.withContext(function($ctx1) {
  4893. //>>excludeEnd("ctx");
  4894. return String(self) < aString._asString();
  4895. return self;
  4896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4897. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  4898. //>>excludeEnd("ctx");
  4899. },
  4900. //>>excludeStart("ide", pragmas.excludeIdeData);
  4901. args: ["aString"],
  4902. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  4903. referencedClasses: [],
  4904. //>>excludeEnd("ide");
  4905. messageSends: []
  4906. }),
  4907. $globals.String);
  4908. $core.addMethod(
  4909. $core.method({
  4910. selector: "<=",
  4911. protocol: "comparing",
  4912. fn: function (aString){
  4913. var self=this,$self=this;
  4914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4915. return $core.withContext(function($ctx1) {
  4916. //>>excludeEnd("ctx");
  4917. return String(self) <= aString._asString();
  4918. return self;
  4919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4920. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  4921. //>>excludeEnd("ctx");
  4922. },
  4923. //>>excludeStart("ide", pragmas.excludeIdeData);
  4924. args: ["aString"],
  4925. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  4926. referencedClasses: [],
  4927. //>>excludeEnd("ide");
  4928. messageSends: []
  4929. }),
  4930. $globals.String);
  4931. $core.addMethod(
  4932. $core.method({
  4933. selector: "=",
  4934. protocol: "comparing",
  4935. fn: function (aString){
  4936. var self=this,$self=this;
  4937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4938. return $core.withContext(function($ctx1) {
  4939. //>>excludeEnd("ctx");
  4940. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  4941. return self;
  4942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4943. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  4944. //>>excludeEnd("ctx");
  4945. },
  4946. //>>excludeStart("ide", pragmas.excludeIdeData);
  4947. args: ["aString"],
  4948. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  4949. referencedClasses: [],
  4950. //>>excludeEnd("ide");
  4951. messageSends: []
  4952. }),
  4953. $globals.String);
  4954. $core.addMethod(
  4955. $core.method({
  4956. selector: "==",
  4957. protocol: "comparing",
  4958. fn: function (aString){
  4959. var self=this,$self=this;
  4960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4961. return $core.withContext(function($ctx1) {
  4962. //>>excludeEnd("ctx");
  4963. if (typeof aString === "string") return String(self) === aString;
  4964. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  4965. else return false;;
  4966. return self;
  4967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4968. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  4969. //>>excludeEnd("ctx");
  4970. },
  4971. //>>excludeStart("ide", pragmas.excludeIdeData);
  4972. args: ["aString"],
  4973. 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'>",
  4974. referencedClasses: [],
  4975. //>>excludeEnd("ide");
  4976. messageSends: []
  4977. }),
  4978. $globals.String);
  4979. $core.addMethod(
  4980. $core.method({
  4981. selector: ">",
  4982. protocol: "comparing",
  4983. fn: function (aString){
  4984. var self=this,$self=this;
  4985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4986. return $core.withContext(function($ctx1) {
  4987. //>>excludeEnd("ctx");
  4988. return String(self) > aString._asString();
  4989. return self;
  4990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4991. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  4992. //>>excludeEnd("ctx");
  4993. },
  4994. //>>excludeStart("ide", pragmas.excludeIdeData);
  4995. args: ["aString"],
  4996. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  4997. referencedClasses: [],
  4998. //>>excludeEnd("ide");
  4999. messageSends: []
  5000. }),
  5001. $globals.String);
  5002. $core.addMethod(
  5003. $core.method({
  5004. selector: ">=",
  5005. protocol: "comparing",
  5006. fn: function (aString){
  5007. var self=this,$self=this;
  5008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5009. return $core.withContext(function($ctx1) {
  5010. //>>excludeEnd("ctx");
  5011. return String(self) >= aString._asString();
  5012. return self;
  5013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5014. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  5015. //>>excludeEnd("ctx");
  5016. },
  5017. //>>excludeStart("ide", pragmas.excludeIdeData);
  5018. args: ["aString"],
  5019. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  5020. referencedClasses: [],
  5021. //>>excludeEnd("ide");
  5022. messageSends: []
  5023. }),
  5024. $globals.String);
  5025. $core.addMethod(
  5026. $core.method({
  5027. selector: "add:",
  5028. protocol: "adding/removing",
  5029. fn: function (anObject){
  5030. var self=this,$self=this;
  5031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5032. return $core.withContext(function($ctx1) {
  5033. //>>excludeEnd("ctx");
  5034. $self._errorReadOnly();
  5035. return self;
  5036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5037. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.String)});
  5038. //>>excludeEnd("ctx");
  5039. },
  5040. //>>excludeStart("ide", pragmas.excludeIdeData);
  5041. args: ["anObject"],
  5042. source: "add: anObject\x0a\x09self errorReadOnly",
  5043. referencedClasses: [],
  5044. //>>excludeEnd("ide");
  5045. messageSends: ["errorReadOnly"]
  5046. }),
  5047. $globals.String);
  5048. $core.addMethod(
  5049. $core.method({
  5050. selector: "asJavaScriptMethodName",
  5051. protocol: "converting",
  5052. fn: function (){
  5053. var self=this,$self=this;
  5054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5055. return $core.withContext(function($ctx1) {
  5056. //>>excludeEnd("ctx");
  5057. return $core.st2js(self);
  5058. return self;
  5059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5060. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  5061. //>>excludeEnd("ctx");
  5062. },
  5063. //>>excludeStart("ide", pragmas.excludeIdeData);
  5064. args: [],
  5065. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  5066. referencedClasses: [],
  5067. //>>excludeEnd("ide");
  5068. messageSends: []
  5069. }),
  5070. $globals.String);
  5071. $core.addMethod(
  5072. $core.method({
  5073. selector: "asJavaScriptObject",
  5074. protocol: "converting",
  5075. fn: function (){
  5076. var self=this,$self=this;
  5077. return self;
  5078. },
  5079. //>>excludeStart("ide", pragmas.excludeIdeData);
  5080. args: [],
  5081. source: "asJavaScriptObject\x0a\x09^ self",
  5082. referencedClasses: [],
  5083. //>>excludeEnd("ide");
  5084. messageSends: []
  5085. }),
  5086. $globals.String);
  5087. $core.addMethod(
  5088. $core.method({
  5089. selector: "asJavaScriptSource",
  5090. protocol: "converting",
  5091. fn: function (){
  5092. var self=this,$self=this;
  5093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5094. return $core.withContext(function($ctx1) {
  5095. //>>excludeEnd("ctx");
  5096. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5097. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5098. else
  5099. return "\"" + self + "\"";
  5100. ;
  5101. return self;
  5102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5103. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  5104. //>>excludeEnd("ctx");
  5105. },
  5106. //>>excludeStart("ide", pragmas.excludeIdeData);
  5107. args: [],
  5108. 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'>",
  5109. referencedClasses: [],
  5110. //>>excludeEnd("ide");
  5111. messageSends: []
  5112. }),
  5113. $globals.String);
  5114. $core.addMethod(
  5115. $core.method({
  5116. selector: "asLowercase",
  5117. protocol: "converting",
  5118. fn: function (){
  5119. var self=this,$self=this;
  5120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5121. return $core.withContext(function($ctx1) {
  5122. //>>excludeEnd("ctx");
  5123. return self.toLowerCase();
  5124. return self;
  5125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5126. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  5127. //>>excludeEnd("ctx");
  5128. },
  5129. //>>excludeStart("ide", pragmas.excludeIdeData);
  5130. args: [],
  5131. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  5132. referencedClasses: [],
  5133. //>>excludeEnd("ide");
  5134. messageSends: []
  5135. }),
  5136. $globals.String);
  5137. $core.addMethod(
  5138. $core.method({
  5139. selector: "asMutator",
  5140. protocol: "converting",
  5141. fn: function (){
  5142. var self=this,$self=this;
  5143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5144. return $core.withContext(function($ctx1) {
  5145. //>>excludeEnd("ctx");
  5146. var $1;
  5147. $1=$recv($self._last()).__eq(":");
  5148. if(!$core.assert($1)){
  5149. return $self.__comma(":");
  5150. }
  5151. return self;
  5152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5153. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  5154. //>>excludeEnd("ctx");
  5155. },
  5156. //>>excludeStart("ide", pragmas.excludeIdeData);
  5157. args: [],
  5158. 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",
  5159. referencedClasses: [],
  5160. //>>excludeEnd("ide");
  5161. messageSends: ["ifFalse:", "=", "last", ","]
  5162. }),
  5163. $globals.String);
  5164. $core.addMethod(
  5165. $core.method({
  5166. selector: "asNumber",
  5167. protocol: "converting",
  5168. fn: function (){
  5169. var self=this,$self=this;
  5170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5171. return $core.withContext(function($ctx1) {
  5172. //>>excludeEnd("ctx");
  5173. return Number(self);
  5174. return self;
  5175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5176. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  5177. //>>excludeEnd("ctx");
  5178. },
  5179. //>>excludeStart("ide", pragmas.excludeIdeData);
  5180. args: [],
  5181. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  5182. referencedClasses: [],
  5183. //>>excludeEnd("ide");
  5184. messageSends: []
  5185. }),
  5186. $globals.String);
  5187. $core.addMethod(
  5188. $core.method({
  5189. selector: "asRegexp",
  5190. protocol: "converting",
  5191. fn: function (){
  5192. var self=this,$self=this;
  5193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5194. return $core.withContext(function($ctx1) {
  5195. //>>excludeEnd("ctx");
  5196. return $recv($globals.RegularExpression)._fromString_(self);
  5197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5198. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  5199. //>>excludeEnd("ctx");
  5200. },
  5201. //>>excludeStart("ide", pragmas.excludeIdeData);
  5202. args: [],
  5203. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  5204. referencedClasses: ["RegularExpression"],
  5205. //>>excludeEnd("ide");
  5206. messageSends: ["fromString:"]
  5207. }),
  5208. $globals.String);
  5209. $core.addMethod(
  5210. $core.method({
  5211. selector: "asString",
  5212. protocol: "converting",
  5213. fn: function (){
  5214. var self=this,$self=this;
  5215. return self;
  5216. },
  5217. //>>excludeStart("ide", pragmas.excludeIdeData);
  5218. args: [],
  5219. source: "asString\x0a\x09^ self",
  5220. referencedClasses: [],
  5221. //>>excludeEnd("ide");
  5222. messageSends: []
  5223. }),
  5224. $globals.String);
  5225. $core.addMethod(
  5226. $core.method({
  5227. selector: "asSymbol",
  5228. protocol: "converting",
  5229. fn: function (){
  5230. var self=this,$self=this;
  5231. return self;
  5232. },
  5233. //>>excludeStart("ide", pragmas.excludeIdeData);
  5234. args: [],
  5235. source: "asSymbol\x0a\x09^ self",
  5236. referencedClasses: [],
  5237. //>>excludeEnd("ide");
  5238. messageSends: []
  5239. }),
  5240. $globals.String);
  5241. $core.addMethod(
  5242. $core.method({
  5243. selector: "asSymbolPrintOn:",
  5244. protocol: "printing",
  5245. fn: function (aStream){
  5246. var self=this,$self=this;
  5247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5248. return $core.withContext(function($ctx1) {
  5249. //>>excludeEnd("ctx");
  5250. var $1;
  5251. $recv(aStream)._nextPutAll_("#");
  5252. $1=$recv($self._asString())._isSelector();
  5253. if($core.assert($1)){
  5254. $recv(aStream)._nextPut_(self);
  5255. } else {
  5256. $self._printOn_(aStream);
  5257. }
  5258. return self;
  5259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5260. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.String)});
  5261. //>>excludeEnd("ctx");
  5262. },
  5263. //>>excludeStart("ide", pragmas.excludeIdeData);
  5264. args: ["aStream"],
  5265. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  5266. referencedClasses: [],
  5267. //>>excludeEnd("ide");
  5268. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  5269. }),
  5270. $globals.String);
  5271. $core.addMethod(
  5272. $core.method({
  5273. selector: "asUppercase",
  5274. protocol: "converting",
  5275. fn: function (){
  5276. var self=this,$self=this;
  5277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5278. return $core.withContext(function($ctx1) {
  5279. //>>excludeEnd("ctx");
  5280. return self.toUpperCase();
  5281. return self;
  5282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5283. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  5284. //>>excludeEnd("ctx");
  5285. },
  5286. //>>excludeStart("ide", pragmas.excludeIdeData);
  5287. args: [],
  5288. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  5289. referencedClasses: [],
  5290. //>>excludeEnd("ide");
  5291. messageSends: []
  5292. }),
  5293. $globals.String);
  5294. $core.addMethod(
  5295. $core.method({
  5296. selector: "asciiValue",
  5297. protocol: "accessing",
  5298. fn: function (){
  5299. var self=this,$self=this;
  5300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5301. return $core.withContext(function($ctx1) {
  5302. //>>excludeEnd("ctx");
  5303. return self.charCodeAt(0);;
  5304. return self;
  5305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5306. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  5307. //>>excludeEnd("ctx");
  5308. },
  5309. //>>excludeStart("ide", pragmas.excludeIdeData);
  5310. args: [],
  5311. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  5312. referencedClasses: [],
  5313. //>>excludeEnd("ide");
  5314. messageSends: []
  5315. }),
  5316. $globals.String);
  5317. $core.addMethod(
  5318. $core.method({
  5319. selector: "at:ifAbsent:",
  5320. protocol: "accessing",
  5321. fn: function (anIndex,aBlock){
  5322. var self=this,$self=this;
  5323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5324. return $core.withContext(function($ctx1) {
  5325. //>>excludeEnd("ctx");
  5326. return String(self)[anIndex - 1] || aBlock._value();
  5327. return self;
  5328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5329. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  5330. //>>excludeEnd("ctx");
  5331. },
  5332. //>>excludeStart("ide", pragmas.excludeIdeData);
  5333. args: ["anIndex", "aBlock"],
  5334. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  5335. referencedClasses: [],
  5336. //>>excludeEnd("ide");
  5337. messageSends: []
  5338. }),
  5339. $globals.String);
  5340. $core.addMethod(
  5341. $core.method({
  5342. selector: "at:ifPresent:ifAbsent:",
  5343. protocol: "accessing",
  5344. fn: function (anIndex,aBlock,anotherBlock){
  5345. var self=this,$self=this;
  5346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5347. return $core.withContext(function($ctx1) {
  5348. //>>excludeEnd("ctx");
  5349. var result = String(self)[anIndex - 1];
  5350. return result ? aBlock._value_(result) : anotherBlock._value();
  5351. ;
  5352. return self;
  5353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5354. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  5355. //>>excludeEnd("ctx");
  5356. },
  5357. //>>excludeStart("ide", pragmas.excludeIdeData);
  5358. args: ["anIndex", "aBlock", "anotherBlock"],
  5359. 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'>",
  5360. referencedClasses: [],
  5361. //>>excludeEnd("ide");
  5362. messageSends: []
  5363. }),
  5364. $globals.String);
  5365. $core.addMethod(
  5366. $core.method({
  5367. selector: "at:put:",
  5368. protocol: "accessing",
  5369. fn: function (anIndex,anObject){
  5370. var self=this,$self=this;
  5371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5372. return $core.withContext(function($ctx1) {
  5373. //>>excludeEnd("ctx");
  5374. $self._errorReadOnly();
  5375. return self;
  5376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5377. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.String)});
  5378. //>>excludeEnd("ctx");
  5379. },
  5380. //>>excludeStart("ide", pragmas.excludeIdeData);
  5381. args: ["anIndex", "anObject"],
  5382. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5383. referencedClasses: [],
  5384. //>>excludeEnd("ide");
  5385. messageSends: ["errorReadOnly"]
  5386. }),
  5387. $globals.String);
  5388. $core.addMethod(
  5389. $core.method({
  5390. selector: "capitalized",
  5391. protocol: "converting",
  5392. fn: function (){
  5393. var self=this,$self=this;
  5394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5395. return $core.withContext(function($ctx1) {
  5396. //>>excludeEnd("ctx");
  5397. return $self._ifNotEmpty_((function(){
  5398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5399. return $core.withContext(function($ctx2) {
  5400. //>>excludeEnd("ctx");
  5401. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  5402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5403. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5404. //>>excludeEnd("ctx");
  5405. }));
  5406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5407. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  5408. //>>excludeEnd("ctx");
  5409. },
  5410. //>>excludeStart("ide", pragmas.excludeIdeData);
  5411. args: [],
  5412. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  5413. referencedClasses: [],
  5414. //>>excludeEnd("ide");
  5415. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  5416. }),
  5417. $globals.String);
  5418. $core.addMethod(
  5419. $core.method({
  5420. selector: "charCodeAt:",
  5421. protocol: "accessing",
  5422. fn: function (anInteger){
  5423. var self=this,$self=this;
  5424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5425. return $core.withContext(function($ctx1) {
  5426. //>>excludeEnd("ctx");
  5427. return self.charCodeAt(anInteger - 1);
  5428. return self;
  5429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5430. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  5431. //>>excludeEnd("ctx");
  5432. },
  5433. //>>excludeStart("ide", pragmas.excludeIdeData);
  5434. args: ["anInteger"],
  5435. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  5436. referencedClasses: [],
  5437. //>>excludeEnd("ide");
  5438. messageSends: []
  5439. }),
  5440. $globals.String);
  5441. $core.addMethod(
  5442. $core.method({
  5443. selector: "copyFrom:to:",
  5444. protocol: "copying",
  5445. fn: function (anIndex,anotherIndex){
  5446. var self=this,$self=this;
  5447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5448. return $core.withContext(function($ctx1) {
  5449. //>>excludeEnd("ctx");
  5450. return self.substring(anIndex - 1, anotherIndex);
  5451. return self;
  5452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5453. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  5454. //>>excludeEnd("ctx");
  5455. },
  5456. //>>excludeStart("ide", pragmas.excludeIdeData);
  5457. args: ["anIndex", "anotherIndex"],
  5458. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  5459. referencedClasses: [],
  5460. //>>excludeEnd("ide");
  5461. messageSends: []
  5462. }),
  5463. $globals.String);
  5464. $core.addMethod(
  5465. $core.method({
  5466. selector: "crlfSanitized",
  5467. protocol: "converting",
  5468. fn: function (){
  5469. var self=this,$self=this;
  5470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5471. return $core.withContext(function($ctx1) {
  5472. //>>excludeEnd("ctx");
  5473. return $recv($self._lines())._join_($recv($globals.String)._lf());
  5474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5475. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  5476. //>>excludeEnd("ctx");
  5477. },
  5478. //>>excludeStart("ide", pragmas.excludeIdeData);
  5479. args: [],
  5480. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  5481. referencedClasses: ["String"],
  5482. //>>excludeEnd("ide");
  5483. messageSends: ["join:", "lines", "lf"]
  5484. }),
  5485. $globals.String);
  5486. $core.addMethod(
  5487. $core.method({
  5488. selector: "deepCopy",
  5489. protocol: "copying",
  5490. fn: function (){
  5491. var self=this,$self=this;
  5492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5493. return $core.withContext(function($ctx1) {
  5494. //>>excludeEnd("ctx");
  5495. return $self._shallowCopy();
  5496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5497. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  5498. //>>excludeEnd("ctx");
  5499. },
  5500. //>>excludeStart("ide", pragmas.excludeIdeData);
  5501. args: [],
  5502. source: "deepCopy\x0a\x09^ self shallowCopy",
  5503. referencedClasses: [],
  5504. //>>excludeEnd("ide");
  5505. messageSends: ["shallowCopy"]
  5506. }),
  5507. $globals.String);
  5508. $core.addMethod(
  5509. $core.method({
  5510. selector: "errorReadOnly",
  5511. protocol: "error handling",
  5512. fn: function (){
  5513. var self=this,$self=this;
  5514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5515. return $core.withContext(function($ctx1) {
  5516. //>>excludeEnd("ctx");
  5517. $self._error_("Object is read-only");
  5518. return self;
  5519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5520. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.String)});
  5521. //>>excludeEnd("ctx");
  5522. },
  5523. //>>excludeStart("ide", pragmas.excludeIdeData);
  5524. args: [],
  5525. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5526. referencedClasses: [],
  5527. //>>excludeEnd("ide");
  5528. messageSends: ["error:"]
  5529. }),
  5530. $globals.String);
  5531. $core.addMethod(
  5532. $core.method({
  5533. selector: "escaped",
  5534. protocol: "converting",
  5535. fn: function (){
  5536. var self=this,$self=this;
  5537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5538. return $core.withContext(function($ctx1) {
  5539. //>>excludeEnd("ctx");
  5540. return escape(self);
  5541. return self;
  5542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5543. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  5544. //>>excludeEnd("ctx");
  5545. },
  5546. //>>excludeStart("ide", pragmas.excludeIdeData);
  5547. args: [],
  5548. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  5549. referencedClasses: [],
  5550. //>>excludeEnd("ide");
  5551. messageSends: []
  5552. }),
  5553. $globals.String);
  5554. $core.addMethod(
  5555. $core.method({
  5556. selector: "includesSubString:",
  5557. protocol: "testing",
  5558. fn: function (subString){
  5559. var self=this,$self=this;
  5560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5561. return $core.withContext(function($ctx1) {
  5562. //>>excludeEnd("ctx");
  5563. return self.indexOf(subString) != -1;
  5564. return self;
  5565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5566. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  5567. //>>excludeEnd("ctx");
  5568. },
  5569. //>>excludeStart("ide", pragmas.excludeIdeData);
  5570. args: ["subString"],
  5571. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  5572. referencedClasses: [],
  5573. //>>excludeEnd("ide");
  5574. messageSends: []
  5575. }),
  5576. $globals.String);
  5577. $core.addMethod(
  5578. $core.method({
  5579. selector: "isCapitalized",
  5580. protocol: "testing",
  5581. fn: function (){
  5582. var self=this,$self=this;
  5583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5584. return $core.withContext(function($ctx1) {
  5585. //>>excludeEnd("ctx");
  5586. var $2,$1;
  5587. $2=$self._first();
  5588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5589. $ctx1.sendIdx["first"]=1;
  5590. //>>excludeEnd("ctx");
  5591. $1=$recv($2)._asUppercase();
  5592. return $recv($1).__eq_eq($self._first());
  5593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5594. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  5595. //>>excludeEnd("ctx");
  5596. },
  5597. //>>excludeStart("ide", pragmas.excludeIdeData);
  5598. args: [],
  5599. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  5600. referencedClasses: [],
  5601. //>>excludeEnd("ide");
  5602. messageSends: ["==", "asUppercase", "first"]
  5603. }),
  5604. $globals.String);
  5605. $core.addMethod(
  5606. $core.method({
  5607. selector: "isImmutable",
  5608. protocol: "testing",
  5609. fn: function (){
  5610. var self=this,$self=this;
  5611. return true;
  5612. },
  5613. //>>excludeStart("ide", pragmas.excludeIdeData);
  5614. args: [],
  5615. source: "isImmutable\x0a\x09^ true",
  5616. referencedClasses: [],
  5617. //>>excludeEnd("ide");
  5618. messageSends: []
  5619. }),
  5620. $globals.String);
  5621. $core.addMethod(
  5622. $core.method({
  5623. selector: "isSelector",
  5624. protocol: "testing",
  5625. fn: function (){
  5626. var self=this,$self=this;
  5627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5628. return $core.withContext(function($ctx1) {
  5629. //>>excludeEnd("ctx");
  5630. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  5631. return self;
  5632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5633. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  5634. //>>excludeEnd("ctx");
  5635. },
  5636. //>>excludeStart("ide", pragmas.excludeIdeData);
  5637. args: [],
  5638. 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>",
  5639. referencedClasses: [],
  5640. //>>excludeEnd("ide");
  5641. messageSends: []
  5642. }),
  5643. $globals.String);
  5644. $core.addMethod(
  5645. $core.method({
  5646. selector: "isString",
  5647. protocol: "testing",
  5648. fn: function (){
  5649. var self=this,$self=this;
  5650. return true;
  5651. },
  5652. //>>excludeStart("ide", pragmas.excludeIdeData);
  5653. args: [],
  5654. source: "isString\x0a\x09^ true",
  5655. referencedClasses: [],
  5656. //>>excludeEnd("ide");
  5657. messageSends: []
  5658. }),
  5659. $globals.String);
  5660. $core.addMethod(
  5661. $core.method({
  5662. selector: "isVowel",
  5663. protocol: "testing",
  5664. fn: function (){
  5665. var self=this,$self=this;
  5666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5667. return $core.withContext(function($ctx1) {
  5668. //>>excludeEnd("ctx");
  5669. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  5670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5671. return $core.withContext(function($ctx2) {
  5672. //>>excludeEnd("ctx");
  5673. return "aeiou"._includes_($self._asLowercase());
  5674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5675. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5676. //>>excludeEnd("ctx");
  5677. }));
  5678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5679. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  5680. //>>excludeEnd("ctx");
  5681. },
  5682. //>>excludeStart("ide", pragmas.excludeIdeData);
  5683. args: [],
  5684. 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 ]",
  5685. referencedClasses: [],
  5686. //>>excludeEnd("ide");
  5687. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  5688. }),
  5689. $globals.String);
  5690. $core.addMethod(
  5691. $core.method({
  5692. selector: "join:",
  5693. protocol: "split join",
  5694. fn: function (aCollection){
  5695. var self=this,$self=this;
  5696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5697. return $core.withContext(function($ctx1) {
  5698. //>>excludeEnd("ctx");
  5699. return $recv($globals.String)._streamContents_((function(stream){
  5700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5701. return $core.withContext(function($ctx2) {
  5702. //>>excludeEnd("ctx");
  5703. return $recv(aCollection)._do_separatedBy_((function(each){
  5704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5705. return $core.withContext(function($ctx3) {
  5706. //>>excludeEnd("ctx");
  5707. return $recv(stream)._nextPutAll_($recv(each)._asString());
  5708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5709. $ctx3.sendIdx["nextPutAll:"]=1;
  5710. //>>excludeEnd("ctx");
  5711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5712. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  5713. //>>excludeEnd("ctx");
  5714. }),(function(){
  5715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5716. return $core.withContext(function($ctx3) {
  5717. //>>excludeEnd("ctx");
  5718. return $recv(stream)._nextPutAll_(self);
  5719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5720. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5721. //>>excludeEnd("ctx");
  5722. }));
  5723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5724. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  5725. //>>excludeEnd("ctx");
  5726. }));
  5727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5728. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  5729. //>>excludeEnd("ctx");
  5730. },
  5731. //>>excludeStart("ide", pragmas.excludeIdeData);
  5732. args: ["aCollection"],
  5733. 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 ]]",
  5734. referencedClasses: ["String"],
  5735. //>>excludeEnd("ide");
  5736. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  5737. }),
  5738. $globals.String);
  5739. $core.addMethod(
  5740. $core.method({
  5741. selector: "lineIndicesDo:",
  5742. protocol: "split join",
  5743. fn: function (aBlock){
  5744. var self=this,$self=this;
  5745. var cr,lf,start,sz,nextLF,nextCR;
  5746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5747. return $core.withContext(function($ctx1) {
  5748. //>>excludeEnd("ctx");
  5749. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  5750. var $early={};
  5751. try {
  5752. start=(1);
  5753. sz=$self._size();
  5754. cr=$recv($globals.String)._cr();
  5755. nextCR=$self._indexOf_startingAt_(cr,(1));
  5756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5757. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  5758. //>>excludeEnd("ctx");
  5759. lf=$recv($globals.String)._lf();
  5760. nextLF=$self._indexOf_startingAt_(lf,(1));
  5761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5762. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  5763. //>>excludeEnd("ctx");
  5764. $recv((function(){
  5765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5766. return $core.withContext(function($ctx2) {
  5767. //>>excludeEnd("ctx");
  5768. return $recv(start).__lt_eq(sz);
  5769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5771. //>>excludeEnd("ctx");
  5772. }))._whileTrue_((function(){
  5773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5774. return $core.withContext(function($ctx2) {
  5775. //>>excludeEnd("ctx");
  5776. $2=$recv(nextLF).__eq((0));
  5777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5778. $ctx2.sendIdx["="]=1;
  5779. //>>excludeEnd("ctx");
  5780. $1=$recv($2)._and_((function(){
  5781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5782. return $core.withContext(function($ctx3) {
  5783. //>>excludeEnd("ctx");
  5784. return $recv(nextCR).__eq((0));
  5785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5786. $ctx3.sendIdx["="]=2;
  5787. //>>excludeEnd("ctx");
  5788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5789. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5790. //>>excludeEnd("ctx");
  5791. }));
  5792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5793. $ctx2.sendIdx["and:"]=1;
  5794. //>>excludeEnd("ctx");
  5795. if($core.assert($1)){
  5796. $recv(aBlock)._value_value_value_(start,sz,sz);
  5797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5798. $ctx2.sendIdx["value:value:value:"]=1;
  5799. //>>excludeEnd("ctx");
  5800. throw $early=[self];
  5801. }
  5802. $4=$recv(nextCR).__eq((0));
  5803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5804. $ctx2.sendIdx["="]=3;
  5805. //>>excludeEnd("ctx");
  5806. $3=$recv($4)._or_((function(){
  5807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5808. return $core.withContext(function($ctx3) {
  5809. //>>excludeEnd("ctx");
  5810. $5=(0).__lt(nextLF);
  5811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5812. $ctx3.sendIdx["<"]=1;
  5813. //>>excludeEnd("ctx");
  5814. return $recv($5)._and_((function(){
  5815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5816. return $core.withContext(function($ctx4) {
  5817. //>>excludeEnd("ctx");
  5818. return $recv(nextLF).__lt(nextCR);
  5819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5820. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  5821. //>>excludeEnd("ctx");
  5822. }));
  5823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5824. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  5825. //>>excludeEnd("ctx");
  5826. }));
  5827. if($core.assert($3)){
  5828. $6=start;
  5829. $7=$recv(nextLF).__minus((1));
  5830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5831. $ctx2.sendIdx["-"]=1;
  5832. //>>excludeEnd("ctx");
  5833. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  5834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5835. $ctx2.sendIdx["value:value:value:"]=2;
  5836. //>>excludeEnd("ctx");
  5837. start=(1).__plus(nextLF);
  5838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5839. $ctx2.sendIdx["+"]=1;
  5840. //>>excludeEnd("ctx");
  5841. nextLF=$self._indexOf_startingAt_(lf,start);
  5842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5843. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  5844. //>>excludeEnd("ctx");
  5845. return nextLF;
  5846. } else {
  5847. $9=(1).__plus(nextCR);
  5848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5849. $ctx2.sendIdx["+"]=2;
  5850. //>>excludeEnd("ctx");
  5851. $8=$recv($9).__eq(nextLF);
  5852. if($core.assert($8)){
  5853. $10=start;
  5854. $11=$recv(nextCR).__minus((1));
  5855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5856. $ctx2.sendIdx["-"]=2;
  5857. //>>excludeEnd("ctx");
  5858. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  5859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5860. $ctx2.sendIdx["value:value:value:"]=3;
  5861. //>>excludeEnd("ctx");
  5862. start=(1).__plus(nextLF);
  5863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5864. $ctx2.sendIdx["+"]=3;
  5865. //>>excludeEnd("ctx");
  5866. nextCR=$self._indexOf_startingAt_(cr,start);
  5867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5868. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  5869. //>>excludeEnd("ctx");
  5870. nextLF=$self._indexOf_startingAt_(lf,start);
  5871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5872. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  5873. //>>excludeEnd("ctx");
  5874. return nextLF;
  5875. } else {
  5876. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  5877. start=(1).__plus(nextCR);
  5878. nextCR=$self._indexOf_startingAt_(cr,start);
  5879. return nextCR;
  5880. }
  5881. }
  5882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5884. //>>excludeEnd("ctx");
  5885. }));
  5886. return self;
  5887. }
  5888. catch(e) {if(e===$early)return e[0]; throw e}
  5889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5890. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  5891. //>>excludeEnd("ctx");
  5892. },
  5893. //>>excludeStart("ide", pragmas.excludeIdeData);
  5894. args: ["aBlock"],
  5895. 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 ] ]]",
  5896. referencedClasses: ["String"],
  5897. //>>excludeEnd("ide");
  5898. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  5899. }),
  5900. $globals.String);
  5901. $core.addMethod(
  5902. $core.method({
  5903. selector: "lineNumber:",
  5904. protocol: "split join",
  5905. fn: function (anIndex){
  5906. var self=this,$self=this;
  5907. var lineCount;
  5908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5909. return $core.withContext(function($ctx1) {
  5910. //>>excludeEnd("ctx");
  5911. var $2,$1;
  5912. var $early={};
  5913. try {
  5914. lineCount=(0);
  5915. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  5916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5917. return $core.withContext(function($ctx2) {
  5918. //>>excludeEnd("ctx");
  5919. lineCount=$recv(lineCount).__plus((1));
  5920. $2=lineCount;
  5921. $1=$recv($2).__eq(anIndex);
  5922. if($core.assert($1)){
  5923. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  5924. }
  5925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5926. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  5927. //>>excludeEnd("ctx");
  5928. }));
  5929. return nil;
  5930. }
  5931. catch(e) {if(e===$early)return e[0]; throw e}
  5932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5933. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  5934. //>>excludeEnd("ctx");
  5935. },
  5936. //>>excludeStart("ide", pragmas.excludeIdeData);
  5937. args: ["anIndex"],
  5938. 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",
  5939. referencedClasses: [],
  5940. //>>excludeEnd("ide");
  5941. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  5942. }),
  5943. $globals.String);
  5944. $core.addMethod(
  5945. $core.method({
  5946. selector: "lines",
  5947. protocol: "split join",
  5948. fn: function (){
  5949. var self=this,$self=this;
  5950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5951. return $core.withContext(function($ctx1) {
  5952. //>>excludeEnd("ctx");
  5953. var result = self.split(/\r\n|\r|\n/);
  5954. if (!result[result.length-1]) result.pop();
  5955. return result;;
  5956. return self;
  5957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5958. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  5959. //>>excludeEnd("ctx");
  5960. },
  5961. //>>excludeStart("ide", pragmas.excludeIdeData);
  5962. args: [],
  5963. 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'>",
  5964. referencedClasses: [],
  5965. //>>excludeEnd("ide");
  5966. messageSends: []
  5967. }),
  5968. $globals.String);
  5969. $core.addMethod(
  5970. $core.method({
  5971. selector: "linesDo:",
  5972. protocol: "split join",
  5973. fn: function (aBlock){
  5974. var self=this,$self=this;
  5975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5976. return $core.withContext(function($ctx1) {
  5977. //>>excludeEnd("ctx");
  5978. $recv($self._lines())._do_(aBlock);
  5979. return self;
  5980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5981. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  5982. //>>excludeEnd("ctx");
  5983. },
  5984. //>>excludeStart("ide", pragmas.excludeIdeData);
  5985. args: ["aBlock"],
  5986. 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",
  5987. referencedClasses: [],
  5988. //>>excludeEnd("ide");
  5989. messageSends: ["do:", "lines"]
  5990. }),
  5991. $globals.String);
  5992. $core.addMethod(
  5993. $core.method({
  5994. selector: "match:",
  5995. protocol: "regular expressions",
  5996. fn: function (aRegexp){
  5997. var self=this,$self=this;
  5998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5999. return $core.withContext(function($ctx1) {
  6000. //>>excludeEnd("ctx");
  6001. return self.search(aRegexp) != -1;
  6002. return self;
  6003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6004. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  6005. //>>excludeEnd("ctx");
  6006. },
  6007. //>>excludeStart("ide", pragmas.excludeIdeData);
  6008. args: ["aRegexp"],
  6009. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  6010. referencedClasses: [],
  6011. //>>excludeEnd("ide");
  6012. messageSends: []
  6013. }),
  6014. $globals.String);
  6015. $core.addMethod(
  6016. $core.method({
  6017. selector: "matchesOf:",
  6018. protocol: "regular expressions",
  6019. fn: function (aRegularExpression){
  6020. var self=this,$self=this;
  6021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6022. return $core.withContext(function($ctx1) {
  6023. //>>excludeEnd("ctx");
  6024. return self.match(aRegularExpression);
  6025. return self;
  6026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6027. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  6028. //>>excludeEnd("ctx");
  6029. },
  6030. //>>excludeStart("ide", pragmas.excludeIdeData);
  6031. args: ["aRegularExpression"],
  6032. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  6033. referencedClasses: [],
  6034. //>>excludeEnd("ide");
  6035. messageSends: []
  6036. }),
  6037. $globals.String);
  6038. $core.addMethod(
  6039. $core.method({
  6040. selector: "printNl",
  6041. protocol: "printing",
  6042. fn: function (){
  6043. var self=this,$self=this;
  6044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6045. return $core.withContext(function($ctx1) {
  6046. //>>excludeEnd("ctx");
  6047. console.log(self);
  6048. return self;
  6049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6050. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  6051. //>>excludeEnd("ctx");
  6052. },
  6053. //>>excludeStart("ide", pragmas.excludeIdeData);
  6054. args: [],
  6055. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  6056. referencedClasses: [],
  6057. //>>excludeEnd("ide");
  6058. messageSends: []
  6059. }),
  6060. $globals.String);
  6061. $core.addMethod(
  6062. $core.method({
  6063. selector: "printOn:",
  6064. protocol: "printing",
  6065. fn: function (aStream){
  6066. var self=this,$self=this;
  6067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6068. return $core.withContext(function($ctx1) {
  6069. //>>excludeEnd("ctx");
  6070. $recv(aStream)._nextPutAll_("'");
  6071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6072. $ctx1.sendIdx["nextPutAll:"]=1;
  6073. //>>excludeEnd("ctx");
  6074. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  6075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6076. $ctx1.sendIdx["nextPutAll:"]=2;
  6077. //>>excludeEnd("ctx");
  6078. $recv(aStream)._nextPutAll_("'");
  6079. return self;
  6080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6081. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  6082. //>>excludeEnd("ctx");
  6083. },
  6084. //>>excludeStart("ide", pragmas.excludeIdeData);
  6085. args: ["aStream"],
  6086. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  6087. referencedClasses: [],
  6088. //>>excludeEnd("ide");
  6089. messageSends: ["nextPutAll:", "replace:with:"]
  6090. }),
  6091. $globals.String);
  6092. $core.addMethod(
  6093. $core.method({
  6094. selector: "putOn:",
  6095. protocol: "streaming",
  6096. fn: function (aStream){
  6097. var self=this,$self=this;
  6098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6099. return $core.withContext(function($ctx1) {
  6100. //>>excludeEnd("ctx");
  6101. $recv(aStream)._nextPutString_(self);
  6102. return self;
  6103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6104. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.String)});
  6105. //>>excludeEnd("ctx");
  6106. },
  6107. //>>excludeStart("ide", pragmas.excludeIdeData);
  6108. args: ["aStream"],
  6109. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  6110. referencedClasses: [],
  6111. //>>excludeEnd("ide");
  6112. messageSends: ["nextPutString:"]
  6113. }),
  6114. $globals.String);
  6115. $core.addMethod(
  6116. $core.method({
  6117. selector: "remove:",
  6118. protocol: "adding/removing",
  6119. fn: function (anObject){
  6120. var self=this,$self=this;
  6121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6122. return $core.withContext(function($ctx1) {
  6123. //>>excludeEnd("ctx");
  6124. $self._errorReadOnly();
  6125. return self;
  6126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6127. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.String)});
  6128. //>>excludeEnd("ctx");
  6129. },
  6130. //>>excludeStart("ide", pragmas.excludeIdeData);
  6131. args: ["anObject"],
  6132. source: "remove: anObject\x0a\x09self errorReadOnly",
  6133. referencedClasses: [],
  6134. //>>excludeEnd("ide");
  6135. messageSends: ["errorReadOnly"]
  6136. }),
  6137. $globals.String);
  6138. $core.addMethod(
  6139. $core.method({
  6140. selector: "remove:ifAbsent:",
  6141. protocol: "adding/removing",
  6142. fn: function (anObject,aBlock){
  6143. var self=this,$self=this;
  6144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6145. return $core.withContext(function($ctx1) {
  6146. //>>excludeEnd("ctx");
  6147. $self._errorReadOnly();
  6148. return self;
  6149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6150. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.String)});
  6151. //>>excludeEnd("ctx");
  6152. },
  6153. //>>excludeStart("ide", pragmas.excludeIdeData);
  6154. args: ["anObject", "aBlock"],
  6155. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  6156. referencedClasses: [],
  6157. //>>excludeEnd("ide");
  6158. messageSends: ["errorReadOnly"]
  6159. }),
  6160. $globals.String);
  6161. $core.addMethod(
  6162. $core.method({
  6163. selector: "replace:with:",
  6164. protocol: "regular expressions",
  6165. fn: function (aString,anotherString){
  6166. var self=this,$self=this;
  6167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6168. return $core.withContext(function($ctx1) {
  6169. //>>excludeEnd("ctx");
  6170. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6172. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  6173. //>>excludeEnd("ctx");
  6174. },
  6175. //>>excludeStart("ide", pragmas.excludeIdeData);
  6176. args: ["aString", "anotherString"],
  6177. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6178. referencedClasses: ["RegularExpression"],
  6179. //>>excludeEnd("ide");
  6180. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6181. }),
  6182. $globals.String);
  6183. $core.addMethod(
  6184. $core.method({
  6185. selector: "replaceRegexp:with:",
  6186. protocol: "regular expressions",
  6187. fn: function (aRegexp,aString){
  6188. var self=this,$self=this;
  6189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6190. return $core.withContext(function($ctx1) {
  6191. //>>excludeEnd("ctx");
  6192. return self.replace(aRegexp, aString);
  6193. return self;
  6194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6195. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  6196. //>>excludeEnd("ctx");
  6197. },
  6198. //>>excludeStart("ide", pragmas.excludeIdeData);
  6199. args: ["aRegexp", "aString"],
  6200. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  6201. referencedClasses: [],
  6202. //>>excludeEnd("ide");
  6203. messageSends: []
  6204. }),
  6205. $globals.String);
  6206. $core.addMethod(
  6207. $core.method({
  6208. selector: "reversed",
  6209. protocol: "converting",
  6210. fn: function (){
  6211. var self=this,$self=this;
  6212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6213. return $core.withContext(function($ctx1) {
  6214. //>>excludeEnd("ctx");
  6215. return self.split("").reverse().join("");
  6216. return self;
  6217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6218. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  6219. //>>excludeEnd("ctx");
  6220. },
  6221. //>>excludeStart("ide", pragmas.excludeIdeData);
  6222. args: [],
  6223. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  6224. referencedClasses: [],
  6225. //>>excludeEnd("ide");
  6226. messageSends: []
  6227. }),
  6228. $globals.String);
  6229. $core.addMethod(
  6230. $core.method({
  6231. selector: "shallowCopy",
  6232. protocol: "copying",
  6233. fn: function (){
  6234. var self=this,$self=this;
  6235. return self;
  6236. },
  6237. //>>excludeStart("ide", pragmas.excludeIdeData);
  6238. args: [],
  6239. source: "shallowCopy\x0a\x09^ self",
  6240. referencedClasses: [],
  6241. //>>excludeEnd("ide");
  6242. messageSends: []
  6243. }),
  6244. $globals.String);
  6245. $core.addMethod(
  6246. $core.method({
  6247. selector: "subStrings:",
  6248. protocol: "split join",
  6249. fn: function (aString){
  6250. var self=this,$self=this;
  6251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6252. return $core.withContext(function($ctx1) {
  6253. //>>excludeEnd("ctx");
  6254. return $self._tokenize_(aString);
  6255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6256. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  6257. //>>excludeEnd("ctx");
  6258. },
  6259. //>>excludeStart("ide", pragmas.excludeIdeData);
  6260. args: ["aString"],
  6261. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6262. referencedClasses: [],
  6263. //>>excludeEnd("ide");
  6264. messageSends: ["tokenize:"]
  6265. }),
  6266. $globals.String);
  6267. $core.addMethod(
  6268. $core.method({
  6269. selector: "symbolPrintString",
  6270. protocol: "printing",
  6271. fn: function (){
  6272. var self=this,$self=this;
  6273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6274. return $core.withContext(function($ctx1) {
  6275. //>>excludeEnd("ctx");
  6276. return $recv($globals.String)._streamContents_((function(str){
  6277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6278. return $core.withContext(function($ctx2) {
  6279. //>>excludeEnd("ctx");
  6280. return $self._asSymbolPrintOn_(str);
  6281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6282. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  6283. //>>excludeEnd("ctx");
  6284. }));
  6285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6286. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.String)});
  6287. //>>excludeEnd("ctx");
  6288. },
  6289. //>>excludeStart("ide", pragmas.excludeIdeData);
  6290. args: [],
  6291. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  6292. referencedClasses: ["String"],
  6293. //>>excludeEnd("ide");
  6294. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  6295. }),
  6296. $globals.String);
  6297. $core.addMethod(
  6298. $core.method({
  6299. selector: "tokenize:",
  6300. protocol: "split join",
  6301. fn: function (aString){
  6302. var self=this,$self=this;
  6303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6304. return $core.withContext(function($ctx1) {
  6305. //>>excludeEnd("ctx");
  6306. return self.split(aString);
  6307. return self;
  6308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6309. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  6310. //>>excludeEnd("ctx");
  6311. },
  6312. //>>excludeStart("ide", pragmas.excludeIdeData);
  6313. args: ["aString"],
  6314. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  6315. referencedClasses: [],
  6316. //>>excludeEnd("ide");
  6317. messageSends: []
  6318. }),
  6319. $globals.String);
  6320. $core.addMethod(
  6321. $core.method({
  6322. selector: "trimBoth",
  6323. protocol: "regular expressions",
  6324. fn: function (){
  6325. var self=this,$self=this;
  6326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6327. return $core.withContext(function($ctx1) {
  6328. //>>excludeEnd("ctx");
  6329. return $self._trimBoth_("\x5cs");
  6330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6331. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  6332. //>>excludeEnd("ctx");
  6333. },
  6334. //>>excludeStart("ide", pragmas.excludeIdeData);
  6335. args: [],
  6336. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  6337. referencedClasses: [],
  6338. //>>excludeEnd("ide");
  6339. messageSends: ["trimBoth:"]
  6340. }),
  6341. $globals.String);
  6342. $core.addMethod(
  6343. $core.method({
  6344. selector: "trimBoth:",
  6345. protocol: "regular expressions",
  6346. fn: function (separators){
  6347. var self=this,$self=this;
  6348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6349. return $core.withContext(function($ctx1) {
  6350. //>>excludeEnd("ctx");
  6351. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  6352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6353. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  6354. //>>excludeEnd("ctx");
  6355. },
  6356. //>>excludeStart("ide", pragmas.excludeIdeData);
  6357. args: ["separators"],
  6358. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  6359. referencedClasses: [],
  6360. //>>excludeEnd("ide");
  6361. messageSends: ["trimRight:", "trimLeft:"]
  6362. }),
  6363. $globals.String);
  6364. $core.addMethod(
  6365. $core.method({
  6366. selector: "trimLeft",
  6367. protocol: "regular expressions",
  6368. fn: function (){
  6369. var self=this,$self=this;
  6370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6371. return $core.withContext(function($ctx1) {
  6372. //>>excludeEnd("ctx");
  6373. return $self._trimLeft_("\x5cs");
  6374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6375. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  6376. //>>excludeEnd("ctx");
  6377. },
  6378. //>>excludeStart("ide", pragmas.excludeIdeData);
  6379. args: [],
  6380. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  6381. referencedClasses: [],
  6382. //>>excludeEnd("ide");
  6383. messageSends: ["trimLeft:"]
  6384. }),
  6385. $globals.String);
  6386. $core.addMethod(
  6387. $core.method({
  6388. selector: "trimLeft:",
  6389. protocol: "regular expressions",
  6390. fn: function (separators){
  6391. var self=this,$self=this;
  6392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6393. return $core.withContext(function($ctx1) {
  6394. //>>excludeEnd("ctx");
  6395. var $2,$1;
  6396. $2=$recv("^[".__comma(separators)).__comma("]+");
  6397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6398. $ctx1.sendIdx[","]=1;
  6399. //>>excludeEnd("ctx");
  6400. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6401. return $self._replaceRegexp_with_($1,"");
  6402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6403. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  6404. //>>excludeEnd("ctx");
  6405. },
  6406. //>>excludeStart("ide", pragmas.excludeIdeData);
  6407. args: ["separators"],
  6408. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  6409. referencedClasses: ["RegularExpression"],
  6410. //>>excludeEnd("ide");
  6411. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6412. }),
  6413. $globals.String);
  6414. $core.addMethod(
  6415. $core.method({
  6416. selector: "trimRight",
  6417. protocol: "regular expressions",
  6418. fn: function (){
  6419. var self=this,$self=this;
  6420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6421. return $core.withContext(function($ctx1) {
  6422. //>>excludeEnd("ctx");
  6423. return $self._trimRight_("\x5cs");
  6424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6425. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  6426. //>>excludeEnd("ctx");
  6427. },
  6428. //>>excludeStart("ide", pragmas.excludeIdeData);
  6429. args: [],
  6430. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  6431. referencedClasses: [],
  6432. //>>excludeEnd("ide");
  6433. messageSends: ["trimRight:"]
  6434. }),
  6435. $globals.String);
  6436. $core.addMethod(
  6437. $core.method({
  6438. selector: "trimRight:",
  6439. protocol: "regular expressions",
  6440. fn: function (separators){
  6441. var self=this,$self=this;
  6442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6443. return $core.withContext(function($ctx1) {
  6444. //>>excludeEnd("ctx");
  6445. var $2,$1;
  6446. $2=$recv("[".__comma(separators)).__comma("]+$");
  6447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6448. $ctx1.sendIdx[","]=1;
  6449. //>>excludeEnd("ctx");
  6450. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6451. return $self._replaceRegexp_with_($1,"");
  6452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6453. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  6454. //>>excludeEnd("ctx");
  6455. },
  6456. //>>excludeStart("ide", pragmas.excludeIdeData);
  6457. args: ["separators"],
  6458. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  6459. referencedClasses: ["RegularExpression"],
  6460. //>>excludeEnd("ide");
  6461. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6462. }),
  6463. $globals.String);
  6464. $core.addMethod(
  6465. $core.method({
  6466. selector: "unescaped",
  6467. protocol: "converting",
  6468. fn: function (){
  6469. var self=this,$self=this;
  6470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6471. return $core.withContext(function($ctx1) {
  6472. //>>excludeEnd("ctx");
  6473. return unescape(self);
  6474. return self;
  6475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6476. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  6477. //>>excludeEnd("ctx");
  6478. },
  6479. //>>excludeStart("ide", pragmas.excludeIdeData);
  6480. args: [],
  6481. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  6482. referencedClasses: [],
  6483. //>>excludeEnd("ide");
  6484. messageSends: []
  6485. }),
  6486. $globals.String);
  6487. $core.addMethod(
  6488. $core.method({
  6489. selector: "uriComponentDecoded",
  6490. protocol: "converting",
  6491. fn: function (){
  6492. var self=this,$self=this;
  6493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6494. return $core.withContext(function($ctx1) {
  6495. //>>excludeEnd("ctx");
  6496. return decodeURIComponent(self);
  6497. return self;
  6498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6499. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  6500. //>>excludeEnd("ctx");
  6501. },
  6502. //>>excludeStart("ide", pragmas.excludeIdeData);
  6503. args: [],
  6504. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  6505. referencedClasses: [],
  6506. //>>excludeEnd("ide");
  6507. messageSends: []
  6508. }),
  6509. $globals.String);
  6510. $core.addMethod(
  6511. $core.method({
  6512. selector: "uriComponentEncoded",
  6513. protocol: "converting",
  6514. fn: function (){
  6515. var self=this,$self=this;
  6516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6517. return $core.withContext(function($ctx1) {
  6518. //>>excludeEnd("ctx");
  6519. return encodeURIComponent(self);
  6520. return self;
  6521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6522. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  6523. //>>excludeEnd("ctx");
  6524. },
  6525. //>>excludeStart("ide", pragmas.excludeIdeData);
  6526. args: [],
  6527. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  6528. referencedClasses: [],
  6529. //>>excludeEnd("ide");
  6530. messageSends: []
  6531. }),
  6532. $globals.String);
  6533. $core.addMethod(
  6534. $core.method({
  6535. selector: "uriDecoded",
  6536. protocol: "converting",
  6537. fn: function (){
  6538. var self=this,$self=this;
  6539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6540. return $core.withContext(function($ctx1) {
  6541. //>>excludeEnd("ctx");
  6542. return decodeURI(self);
  6543. return self;
  6544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6545. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  6546. //>>excludeEnd("ctx");
  6547. },
  6548. //>>excludeStart("ide", pragmas.excludeIdeData);
  6549. args: [],
  6550. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  6551. referencedClasses: [],
  6552. //>>excludeEnd("ide");
  6553. messageSends: []
  6554. }),
  6555. $globals.String);
  6556. $core.addMethod(
  6557. $core.method({
  6558. selector: "uriEncoded",
  6559. protocol: "converting",
  6560. fn: function (){
  6561. var self=this,$self=this;
  6562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6563. return $core.withContext(function($ctx1) {
  6564. //>>excludeEnd("ctx");
  6565. return encodeURI(self);
  6566. return self;
  6567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6568. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  6569. //>>excludeEnd("ctx");
  6570. },
  6571. //>>excludeStart("ide", pragmas.excludeIdeData);
  6572. args: [],
  6573. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  6574. referencedClasses: [],
  6575. //>>excludeEnd("ide");
  6576. messageSends: []
  6577. }),
  6578. $globals.String);
  6579. $core.addMethod(
  6580. $core.method({
  6581. selector: "value:",
  6582. protocol: "evaluating",
  6583. fn: function (anObject){
  6584. var self=this,$self=this;
  6585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6586. return $core.withContext(function($ctx1) {
  6587. //>>excludeEnd("ctx");
  6588. return $recv(anObject)._perform_(self);
  6589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6590. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  6591. //>>excludeEnd("ctx");
  6592. },
  6593. //>>excludeStart("ide", pragmas.excludeIdeData);
  6594. args: ["anObject"],
  6595. source: "value: anObject \x0a\x09^ anObject perform: self",
  6596. referencedClasses: [],
  6597. //>>excludeEnd("ide");
  6598. messageSends: ["perform:"]
  6599. }),
  6600. $globals.String);
  6601. $core.addMethod(
  6602. $core.method({
  6603. selector: "cr",
  6604. protocol: "accessing",
  6605. fn: function (){
  6606. var self=this,$self=this;
  6607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6608. return $core.withContext(function($ctx1) {
  6609. //>>excludeEnd("ctx");
  6610. return "\r";
  6611. return self;
  6612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6613. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.a$cls)});
  6614. //>>excludeEnd("ctx");
  6615. },
  6616. //>>excludeStart("ide", pragmas.excludeIdeData);
  6617. args: [],
  6618. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  6619. referencedClasses: [],
  6620. //>>excludeEnd("ide");
  6621. messageSends: []
  6622. }),
  6623. $globals.String.a$cls);
  6624. $core.addMethod(
  6625. $core.method({
  6626. selector: "crlf",
  6627. protocol: "accessing",
  6628. fn: function (){
  6629. var self=this,$self=this;
  6630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6631. return $core.withContext(function($ctx1) {
  6632. //>>excludeEnd("ctx");
  6633. return "\r\n";
  6634. return self;
  6635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6636. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.a$cls)});
  6637. //>>excludeEnd("ctx");
  6638. },
  6639. //>>excludeStart("ide", pragmas.excludeIdeData);
  6640. args: [],
  6641. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  6642. referencedClasses: [],
  6643. //>>excludeEnd("ide");
  6644. messageSends: []
  6645. }),
  6646. $globals.String.a$cls);
  6647. $core.addMethod(
  6648. $core.method({
  6649. selector: "esc",
  6650. protocol: "accessing",
  6651. fn: function (){
  6652. var self=this,$self=this;
  6653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6654. return $core.withContext(function($ctx1) {
  6655. //>>excludeEnd("ctx");
  6656. return $self._fromCharCode_((27));
  6657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6658. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.a$cls)});
  6659. //>>excludeEnd("ctx");
  6660. },
  6661. //>>excludeStart("ide", pragmas.excludeIdeData);
  6662. args: [],
  6663. source: "esc\x0a\x09^ self fromCharCode: 27",
  6664. referencedClasses: [],
  6665. //>>excludeEnd("ide");
  6666. messageSends: ["fromCharCode:"]
  6667. }),
  6668. $globals.String.a$cls);
  6669. $core.addMethod(
  6670. $core.method({
  6671. selector: "fromCharCode:",
  6672. protocol: "instance creation",
  6673. fn: function (anInteger){
  6674. var self=this,$self=this;
  6675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6676. return $core.withContext(function($ctx1) {
  6677. //>>excludeEnd("ctx");
  6678. return String.fromCharCode(anInteger);
  6679. return self;
  6680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6681. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.a$cls)});
  6682. //>>excludeEnd("ctx");
  6683. },
  6684. //>>excludeStart("ide", pragmas.excludeIdeData);
  6685. args: ["anInteger"],
  6686. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  6687. referencedClasses: [],
  6688. //>>excludeEnd("ide");
  6689. messageSends: []
  6690. }),
  6691. $globals.String.a$cls);
  6692. $core.addMethod(
  6693. $core.method({
  6694. selector: "fromString:",
  6695. protocol: "instance creation",
  6696. fn: function (aString){
  6697. var self=this,$self=this;
  6698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6699. return $core.withContext(function($ctx1) {
  6700. //>>excludeEnd("ctx");
  6701. return String(aString);
  6702. return self;
  6703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6704. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.a$cls)});
  6705. //>>excludeEnd("ctx");
  6706. },
  6707. //>>excludeStart("ide", pragmas.excludeIdeData);
  6708. args: ["aString"],
  6709. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  6710. referencedClasses: [],
  6711. //>>excludeEnd("ide");
  6712. messageSends: []
  6713. }),
  6714. $globals.String.a$cls);
  6715. $core.addMethod(
  6716. $core.method({
  6717. selector: "lf",
  6718. protocol: "accessing",
  6719. fn: function (){
  6720. var self=this,$self=this;
  6721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6722. return $core.withContext(function($ctx1) {
  6723. //>>excludeEnd("ctx");
  6724. return "\n";
  6725. return self;
  6726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6727. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.a$cls)});
  6728. //>>excludeEnd("ctx");
  6729. },
  6730. //>>excludeStart("ide", pragmas.excludeIdeData);
  6731. args: [],
  6732. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  6733. referencedClasses: [],
  6734. //>>excludeEnd("ide");
  6735. messageSends: []
  6736. }),
  6737. $globals.String.a$cls);
  6738. $core.addMethod(
  6739. $core.method({
  6740. selector: "random",
  6741. protocol: "random",
  6742. fn: function (){
  6743. var self=this,$self=this;
  6744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6745. return $core.withContext(function($ctx1) {
  6746. //>>excludeEnd("ctx");
  6747. return ((10+22*Math.random())/32).toString(32).slice(2);;
  6748. return self;
  6749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6750. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.a$cls)});
  6751. //>>excludeEnd("ctx");
  6752. },
  6753. //>>excludeStart("ide", pragmas.excludeIdeData);
  6754. args: [],
  6755. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return ((10+22*Math.random())/32).toString(32).slice(2);'>",
  6756. referencedClasses: [],
  6757. //>>excludeEnd("ide");
  6758. messageSends: []
  6759. }),
  6760. $globals.String.a$cls);
  6761. $core.addMethod(
  6762. $core.method({
  6763. selector: "randomNotIn:",
  6764. protocol: "random",
  6765. fn: function (aString){
  6766. var self=this,$self=this;
  6767. var result;
  6768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6769. return $core.withContext(function($ctx1) {
  6770. //>>excludeEnd("ctx");
  6771. $recv((function(){
  6772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6773. return $core.withContext(function($ctx2) {
  6774. //>>excludeEnd("ctx");
  6775. result=$self._random();
  6776. return $recv(aString)._includesSubString_(result);
  6777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6778. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6779. //>>excludeEnd("ctx");
  6780. }))._whileTrue();
  6781. return result;
  6782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6783. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.a$cls)});
  6784. //>>excludeEnd("ctx");
  6785. },
  6786. //>>excludeStart("ide", pragmas.excludeIdeData);
  6787. args: ["aString"],
  6788. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  6789. referencedClasses: [],
  6790. //>>excludeEnd("ide");
  6791. messageSends: ["whileTrue", "random", "includesSubString:"]
  6792. }),
  6793. $globals.String.a$cls);
  6794. $core.addMethod(
  6795. $core.method({
  6796. selector: "space",
  6797. protocol: "accessing",
  6798. fn: function (){
  6799. var self=this,$self=this;
  6800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6801. return $core.withContext(function($ctx1) {
  6802. //>>excludeEnd("ctx");
  6803. return " ";
  6804. return self;
  6805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6806. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.a$cls)});
  6807. //>>excludeEnd("ctx");
  6808. },
  6809. //>>excludeStart("ide", pragmas.excludeIdeData);
  6810. args: [],
  6811. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  6812. referencedClasses: [],
  6813. //>>excludeEnd("ide");
  6814. messageSends: []
  6815. }),
  6816. $globals.String.a$cls);
  6817. $core.addMethod(
  6818. $core.method({
  6819. selector: "streamClass",
  6820. protocol: "accessing",
  6821. fn: function (){
  6822. var self=this,$self=this;
  6823. return $globals.StringStream;
  6824. },
  6825. //>>excludeStart("ide", pragmas.excludeIdeData);
  6826. args: [],
  6827. source: "streamClass\x0a\x09\x09^ StringStream",
  6828. referencedClasses: ["StringStream"],
  6829. //>>excludeEnd("ide");
  6830. messageSends: []
  6831. }),
  6832. $globals.String.a$cls);
  6833. $core.addMethod(
  6834. $core.method({
  6835. selector: "tab",
  6836. protocol: "accessing",
  6837. fn: function (){
  6838. var self=this,$self=this;
  6839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6840. return $core.withContext(function($ctx1) {
  6841. //>>excludeEnd("ctx");
  6842. return "\t";
  6843. return self;
  6844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6845. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.a$cls)});
  6846. //>>excludeEnd("ctx");
  6847. },
  6848. //>>excludeStart("ide", pragmas.excludeIdeData);
  6849. args: [],
  6850. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  6851. referencedClasses: [],
  6852. //>>excludeEnd("ide");
  6853. messageSends: []
  6854. }),
  6855. $globals.String.a$cls);
  6856. $core.addMethod(
  6857. $core.method({
  6858. selector: "value:",
  6859. protocol: "instance creation",
  6860. fn: function (aUTFCharCode){
  6861. var self=this,$self=this;
  6862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6863. return $core.withContext(function($ctx1) {
  6864. //>>excludeEnd("ctx");
  6865. return String.fromCharCode(aUTFCharCode);;
  6866. return self;
  6867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6868. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.a$cls)});
  6869. //>>excludeEnd("ctx");
  6870. },
  6871. //>>excludeStart("ide", pragmas.excludeIdeData);
  6872. args: ["aUTFCharCode"],
  6873. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  6874. referencedClasses: [],
  6875. //>>excludeEnd("ide");
  6876. messageSends: []
  6877. }),
  6878. $globals.String.a$cls);
  6879. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  6880. //>>excludeStart("ide", pragmas.excludeIdeData);
  6881. $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`.";
  6882. //>>excludeEnd("ide");
  6883. $core.addMethod(
  6884. $core.method({
  6885. selector: "=",
  6886. protocol: "comparing",
  6887. fn: function (aCollection){
  6888. var self=this,$self=this;
  6889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6890. return $core.withContext(function($ctx1) {
  6891. //>>excludeEnd("ctx");
  6892. var $2,$1,$4,$3,$5;
  6893. var $early={};
  6894. try {
  6895. $2=$self._class();
  6896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6897. $ctx1.sendIdx["class"]=1;
  6898. //>>excludeEnd("ctx");
  6899. $1=$recv($2).__eq($recv(aCollection)._class());
  6900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6901. $ctx1.sendIdx["="]=1;
  6902. //>>excludeEnd("ctx");
  6903. if(!$core.assert($1)){
  6904. return false;
  6905. }
  6906. $4=$self._size();
  6907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6908. $ctx1.sendIdx["size"]=1;
  6909. //>>excludeEnd("ctx");
  6910. $3=$recv($4).__eq($recv(aCollection)._size());
  6911. if(!$core.assert($3)){
  6912. return false;
  6913. }
  6914. $self._do_((function(each){
  6915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6916. return $core.withContext(function($ctx2) {
  6917. //>>excludeEnd("ctx");
  6918. $5=$recv(aCollection)._includes_(each);
  6919. if(!$core.assert($5)){
  6920. throw $early=[false];
  6921. }
  6922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6923. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  6924. //>>excludeEnd("ctx");
  6925. }));
  6926. return true;
  6927. }
  6928. catch(e) {if(e===$early)return e[0]; throw e}
  6929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6930. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  6931. //>>excludeEnd("ctx");
  6932. },
  6933. //>>excludeStart("ide", pragmas.excludeIdeData);
  6934. args: ["aCollection"],
  6935. 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",
  6936. referencedClasses: [],
  6937. //>>excludeEnd("ide");
  6938. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  6939. }),
  6940. $globals.Set);
  6941. $core.addMethod(
  6942. $core.method({
  6943. selector: "add:",
  6944. protocol: "adding/removing",
  6945. fn: function (anObject){
  6946. var self=this,$self=this;
  6947. var bucket;
  6948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6949. return $core.withContext(function($ctx1) {
  6950. //>>excludeEnd("ctx");
  6951. var $1,$receiver;
  6952. bucket=$self._bucketsOfElement_(anObject);
  6953. $1=$recv(bucket)._second();
  6954. if(($receiver = $1) == null || $receiver.a$nil){
  6955. var object,slowBucket;
  6956. object=$recv(bucket)._first();
  6957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6958. $ctx1.sendIdx["first"]=1;
  6959. //>>excludeEnd("ctx");
  6960. slowBucket=$recv(bucket)._third();
  6961. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  6962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6963. return $core.withContext(function($ctx2) {
  6964. //>>excludeEnd("ctx");
  6965. $recv(slowBucket)._add_(object);
  6966. $self["@size"]=$recv($self["@size"]).__plus((1));
  6967. return $self["@size"];
  6968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6969. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6970. //>>excludeEnd("ctx");
  6971. }));
  6972. return object;
  6973. } else {
  6974. var primitiveBucket;
  6975. primitiveBucket=$receiver;
  6976. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  6977. }
  6978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6979. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  6980. //>>excludeEnd("ctx");
  6981. },
  6982. //>>excludeStart("ide", pragmas.excludeIdeData);
  6983. args: ["anObject"],
  6984. 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 ]",
  6985. referencedClasses: [],
  6986. //>>excludeEnd("ide");
  6987. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  6988. }),
  6989. $globals.Set);
  6990. $core.addMethod(
  6991. $core.method({
  6992. selector: "add:in:",
  6993. protocol: "private",
  6994. fn: function (anObject,anotherObject){
  6995. var self=this,$self=this;
  6996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6997. return $core.withContext(function($ctx1) {
  6998. //>>excludeEnd("ctx");
  6999. if (anObject in anotherObject.store) { return anObject; }
  7000. $self['@size']++;
  7001. anotherObject.store[anObject] = true;
  7002. return anObject;
  7003. ;
  7004. return self;
  7005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7006. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7007. //>>excludeEnd("ctx");
  7008. },
  7009. //>>excludeStart("ide", pragmas.excludeIdeData);
  7010. args: ["anObject", "anotherObject"],
  7011. source: "add: anObject in: anotherObject\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) { return anObject; }\x0a\x09\x09$self[''@size'']++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09'>",
  7012. referencedClasses: [],
  7013. //>>excludeEnd("ide");
  7014. messageSends: []
  7015. }),
  7016. $globals.Set);
  7017. $core.addMethod(
  7018. $core.method({
  7019. selector: "bucketsOfElement:",
  7020. protocol: "private",
  7021. fn: function (anObject){
  7022. var self=this,$self=this;
  7023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7024. return $core.withContext(function($ctx1) {
  7025. //>>excludeEnd("ctx");
  7026. // include nil to well-known objects under "boolean" fastBucket
  7027. if (anObject == null || anObject.a$nil) return [ null, $self['@fastBuckets'].boolean ];
  7028. var prim = anObject.valueOf();
  7029. if (typeof prim === "object" || typeof prim === "function" || !$self['@fastBuckets'][typeof prim]) {
  7030. var bucket = null;
  7031. $self['@slowBucketStores'].some(function (store) {
  7032. return bucket = store._bucketOfElement_(anObject);
  7033. });
  7034. return [ anObject, null, bucket || $self['@defaultBucket'] ];
  7035. }
  7036. return [ prim, $self['@fastBuckets'][typeof prim] ];
  7037. ;
  7038. return self;
  7039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7040. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  7041. //>>excludeEnd("ctx");
  7042. },
  7043. //>>excludeStart("ide", pragmas.excludeIdeData);
  7044. args: ["anObject"],
  7045. 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'>",
  7046. referencedClasses: [],
  7047. //>>excludeEnd("ide");
  7048. messageSends: []
  7049. }),
  7050. $globals.Set);
  7051. $core.addMethod(
  7052. $core.method({
  7053. selector: "classNameOf:",
  7054. protocol: "private",
  7055. fn: function (anObject){
  7056. var self=this,$self=this;
  7057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7058. return $core.withContext(function($ctx1) {
  7059. //>>excludeEnd("ctx");
  7060. return anObject.a$cls != null && anObject.a$cls.name;
  7061. return self;
  7062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7063. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  7064. //>>excludeEnd("ctx");
  7065. },
  7066. //>>excludeStart("ide", pragmas.excludeIdeData);
  7067. args: ["anObject"],
  7068. 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'>",
  7069. referencedClasses: [],
  7070. //>>excludeEnd("ide");
  7071. messageSends: []
  7072. }),
  7073. $globals.Set);
  7074. $core.addMethod(
  7075. $core.method({
  7076. selector: "collect:",
  7077. protocol: "enumerating",
  7078. fn: function (aBlock){
  7079. var self=this,$self=this;
  7080. var collection;
  7081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7082. return $core.withContext(function($ctx1) {
  7083. //>>excludeEnd("ctx");
  7084. collection=$recv($self._class())._new();
  7085. $self._do_((function(each){
  7086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7087. return $core.withContext(function($ctx2) {
  7088. //>>excludeEnd("ctx");
  7089. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7091. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7092. //>>excludeEnd("ctx");
  7093. }));
  7094. return collection;
  7095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7096. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  7097. //>>excludeEnd("ctx");
  7098. },
  7099. //>>excludeStart("ide", pragmas.excludeIdeData);
  7100. args: ["aBlock"],
  7101. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7102. referencedClasses: [],
  7103. //>>excludeEnd("ide");
  7104. messageSends: ["new", "class", "do:", "add:", "value:"]
  7105. }),
  7106. $globals.Set);
  7107. $core.addMethod(
  7108. $core.method({
  7109. selector: "do:",
  7110. protocol: "enumerating",
  7111. fn: function (aBlock){
  7112. var self=this,$self=this;
  7113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7114. return $core.withContext(function($ctx1) {
  7115. //>>excludeEnd("ctx");
  7116. var el, keys, i;
  7117. el = $self['@fastBuckets'];
  7118. keys = Object.keys(el);
  7119. for (i = 0; i < keys.length; ++i) {
  7120. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7121. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7122. else { store._do_(aBlock); }
  7123. }
  7124. el = $self['@slowBucketStores'];
  7125. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7126. $self['@defaultBucket']._do_(aBlock);
  7127. ;
  7128. return self;
  7129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7130. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  7131. //>>excludeEnd("ctx");
  7132. },
  7133. //>>excludeStart("ide", pragmas.excludeIdeData);
  7134. args: ["aBlock"],
  7135. 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'>",
  7136. referencedClasses: [],
  7137. //>>excludeEnd("ide");
  7138. messageSends: []
  7139. }),
  7140. $globals.Set);
  7141. $core.addMethod(
  7142. $core.method({
  7143. selector: "includes:",
  7144. protocol: "testing",
  7145. fn: function (anObject){
  7146. var self=this,$self=this;
  7147. var bucket;
  7148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7149. return $core.withContext(function($ctx1) {
  7150. //>>excludeEnd("ctx");
  7151. var $1,$2,$3,$receiver;
  7152. bucket=$self._bucketsOfElement_(anObject);
  7153. $1=$recv(bucket)._second();
  7154. if(($receiver = $1) == null || $receiver.a$nil){
  7155. $2=$recv(bucket)._third();
  7156. $3=$recv(bucket)._first();
  7157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7158. $ctx1.sendIdx["first"]=1;
  7159. //>>excludeEnd("ctx");
  7160. return $recv($2)._includes_($3);
  7161. } else {
  7162. var primitiveBucket;
  7163. primitiveBucket=$receiver;
  7164. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7165. }
  7166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7167. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7168. //>>excludeEnd("ctx");
  7169. },
  7170. //>>excludeStart("ide", pragmas.excludeIdeData);
  7171. args: ["anObject"],
  7172. 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 ]",
  7173. referencedClasses: [],
  7174. //>>excludeEnd("ide");
  7175. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7176. }),
  7177. $globals.Set);
  7178. $core.addMethod(
  7179. $core.method({
  7180. selector: "includes:in:",
  7181. protocol: "private",
  7182. fn: function (anObject,anotherObject){
  7183. var self=this,$self=this;
  7184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7185. return $core.withContext(function($ctx1) {
  7186. //>>excludeEnd("ctx");
  7187. return anObject in anotherObject.store;
  7188. return self;
  7189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7190. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7191. //>>excludeEnd("ctx");
  7192. },
  7193. //>>excludeStart("ide", pragmas.excludeIdeData);
  7194. args: ["anObject", "anotherObject"],
  7195. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  7196. referencedClasses: [],
  7197. //>>excludeEnd("ide");
  7198. messageSends: []
  7199. }),
  7200. $globals.Set);
  7201. $core.addMethod(
  7202. $core.method({
  7203. selector: "initialize",
  7204. protocol: "initialization",
  7205. fn: function (){
  7206. var self=this,$self=this;
  7207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7208. return $core.withContext(function($ctx1) {
  7209. //>>excludeEnd("ctx");
  7210. (
  7211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7212. $ctx1.supercall = true,
  7213. //>>excludeEnd("ctx");
  7214. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  7215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7216. $ctx1.supercall = false;
  7217. //>>excludeEnd("ctx");;
  7218. $self["@defaultBucket"]=[];
  7219. $self._initializeSlowBucketStores();
  7220. $self._removeAll();
  7221. return self;
  7222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7223. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  7224. //>>excludeEnd("ctx");
  7225. },
  7226. //>>excludeStart("ide", pragmas.excludeIdeData);
  7227. args: [],
  7228. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7229. referencedClasses: [],
  7230. //>>excludeEnd("ide");
  7231. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7232. }),
  7233. $globals.Set);
  7234. $core.addMethod(
  7235. $core.method({
  7236. selector: "initializeSlowBucketStores",
  7237. protocol: "initialization",
  7238. fn: function (){
  7239. var self=this,$self=this;
  7240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7241. return $core.withContext(function($ctx1) {
  7242. //>>excludeEnd("ctx");
  7243. var $1;
  7244. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7246. return $core.withContext(function($ctx2) {
  7247. //>>excludeEnd("ctx");
  7248. return $self._classNameOf_(x);
  7249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7250. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7251. //>>excludeEnd("ctx");
  7252. }));
  7253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7254. $ctx1.sendIdx["hashBlock:"]=1;
  7255. //>>excludeEnd("ctx");
  7256. $self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7258. return $core.withContext(function($ctx2) {
  7259. //>>excludeEnd("ctx");
  7260. return $self._jsConstructorNameOf_(x);
  7261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7262. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7263. //>>excludeEnd("ctx");
  7264. }))];
  7265. return self;
  7266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7267. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  7268. //>>excludeEnd("ctx");
  7269. },
  7270. //>>excludeStart("ide", pragmas.excludeIdeData);
  7271. args: [],
  7272. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7273. referencedClasses: ["ArrayBucketStore"],
  7274. //>>excludeEnd("ide");
  7275. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  7276. }),
  7277. $globals.Set);
  7278. $core.addMethod(
  7279. $core.method({
  7280. selector: "jsConstructorNameOf:",
  7281. protocol: "private",
  7282. fn: function (anObject){
  7283. var self=this,$self=this;
  7284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7285. return $core.withContext(function($ctx1) {
  7286. //>>excludeEnd("ctx");
  7287. return anObject.constructor && anObject.constructor.name;
  7288. return self;
  7289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7290. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  7291. //>>excludeEnd("ctx");
  7292. },
  7293. //>>excludeStart("ide", pragmas.excludeIdeData);
  7294. args: ["anObject"],
  7295. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  7296. referencedClasses: [],
  7297. //>>excludeEnd("ide");
  7298. messageSends: []
  7299. }),
  7300. $globals.Set);
  7301. $core.addMethod(
  7302. $core.method({
  7303. selector: "printOn:",
  7304. protocol: "printing",
  7305. fn: function (aStream){
  7306. var self=this,$self=this;
  7307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7308. return $core.withContext(function($ctx1) {
  7309. //>>excludeEnd("ctx");
  7310. (
  7311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7312. $ctx1.supercall = true,
  7313. //>>excludeEnd("ctx");
  7314. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  7315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7316. $ctx1.supercall = false;
  7317. //>>excludeEnd("ctx");;
  7318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7319. $ctx1.sendIdx["printOn:"]=1;
  7320. //>>excludeEnd("ctx");
  7321. $recv(aStream)._nextPutAll_(" (");
  7322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7323. $ctx1.sendIdx["nextPutAll:"]=1;
  7324. //>>excludeEnd("ctx");
  7325. $self._do_separatedBy_((function(each){
  7326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7327. return $core.withContext(function($ctx2) {
  7328. //>>excludeEnd("ctx");
  7329. return $recv(each)._printOn_(aStream);
  7330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7331. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7332. //>>excludeEnd("ctx");
  7333. }),(function(){
  7334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7335. return $core.withContext(function($ctx2) {
  7336. //>>excludeEnd("ctx");
  7337. return $recv(aStream)._nextPutAll_(" ");
  7338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7339. $ctx2.sendIdx["nextPutAll:"]=2;
  7340. //>>excludeEnd("ctx");
  7341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7343. //>>excludeEnd("ctx");
  7344. }));
  7345. $recv(aStream)._nextPutAll_(")");
  7346. return self;
  7347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7348. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  7349. //>>excludeEnd("ctx");
  7350. },
  7351. //>>excludeStart("ide", pragmas.excludeIdeData);
  7352. args: ["aStream"],
  7353. 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: ')'",
  7354. referencedClasses: [],
  7355. //>>excludeEnd("ide");
  7356. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  7357. }),
  7358. $globals.Set);
  7359. $core.addMethod(
  7360. $core.method({
  7361. selector: "remove:ifAbsent:",
  7362. protocol: "adding/removing",
  7363. fn: function (anObject,aBlock){
  7364. var self=this,$self=this;
  7365. var bucket;
  7366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7367. return $core.withContext(function($ctx1) {
  7368. //>>excludeEnd("ctx");
  7369. var $1,$2,$3,$receiver;
  7370. var $early={};
  7371. try {
  7372. bucket=$self._bucketsOfElement_(anObject);
  7373. $1=$recv(bucket)._second();
  7374. if(($receiver = $1) == null || $receiver.a$nil){
  7375. $2=$recv(bucket)._third();
  7376. $3=$recv(bucket)._first();
  7377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7378. $ctx1.sendIdx["first"]=1;
  7379. //>>excludeEnd("ctx");
  7380. $recv($2)._remove_ifAbsent_($3,(function(){
  7381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7382. return $core.withContext(function($ctx2) {
  7383. //>>excludeEnd("ctx");
  7384. throw $early=[$recv(aBlock)._value()];
  7385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7387. //>>excludeEnd("ctx");
  7388. }));
  7389. $self["@size"]=$recv($self["@size"]).__minus((1));
  7390. return $self["@size"];
  7391. } else {
  7392. var primitiveBucket;
  7393. primitiveBucket=$receiver;
  7394. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  7395. }
  7396. }
  7397. catch(e) {if(e===$early)return e[0]; throw e}
  7398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7399. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  7400. //>>excludeEnd("ctx");
  7401. },
  7402. //>>excludeStart("ide", pragmas.excludeIdeData);
  7403. args: ["anObject", "aBlock"],
  7404. 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 ifAbsent: aBlock ]",
  7405. referencedClasses: [],
  7406. //>>excludeEnd("ide");
  7407. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:ifAbsent:"]
  7408. }),
  7409. $globals.Set);
  7410. $core.addMethod(
  7411. $core.method({
  7412. selector: "remove:in:ifAbsent:",
  7413. protocol: "private",
  7414. fn: function (anObject,anotherObject,aBlock){
  7415. var self=this,$self=this;
  7416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7417. return $core.withContext(function($ctx1) {
  7418. //>>excludeEnd("ctx");
  7419. if (anObject in anotherObject.store) {
  7420. delete anotherObject.store[anObject];
  7421. $self['@size']--;
  7422. return anObject;
  7423. } else {
  7424. return aBlock._value();
  7425. };
  7426. return self;
  7427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7428. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock},$globals.Set)});
  7429. //>>excludeEnd("ctx");
  7430. },
  7431. //>>excludeStart("ide", pragmas.excludeIdeData);
  7432. args: ["anObject", "anotherObject", "aBlock"],
  7433. source: "remove: anObject in: anotherObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) {\x0a\x09\x09\x09delete anotherObject.store[anObject];\x0a\x09\x09\x09$self[''@size'']--;\x0a\x09\x09\x09return anObject;\x0a\x09\x09} else {\x0a\x09\x09\x09return aBlock._value();\x0a\x09\x09}'>",
  7434. referencedClasses: [],
  7435. //>>excludeEnd("ide");
  7436. messageSends: []
  7437. }),
  7438. $globals.Set);
  7439. $core.addMethod(
  7440. $core.method({
  7441. selector: "removeAll",
  7442. protocol: "adding/removing",
  7443. fn: function (){
  7444. var self=this,$self=this;
  7445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7446. return $core.withContext(function($ctx1) {
  7447. //>>excludeEnd("ctx");
  7448. $self['@fastBuckets'] = {
  7449. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  7450. "number": { store: Object.create(null), fn: Number },
  7451. "string": { store: Object.create(null) }
  7452. };
  7453. $self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  7454. $self['@defaultBucket']._removeAll();
  7455. $self['@size'] = 0;
  7456. ;
  7457. return self;
  7458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7459. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  7460. //>>excludeEnd("ctx");
  7461. },
  7462. //>>excludeStart("ide", pragmas.excludeIdeData);
  7463. args: [],
  7464. 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'>",
  7465. referencedClasses: [],
  7466. //>>excludeEnd("ide");
  7467. messageSends: []
  7468. }),
  7469. $globals.Set);
  7470. $core.addMethod(
  7471. $core.method({
  7472. selector: "select:",
  7473. protocol: "enumerating",
  7474. fn: function (aBlock){
  7475. var self=this,$self=this;
  7476. var collection;
  7477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7478. return $core.withContext(function($ctx1) {
  7479. //>>excludeEnd("ctx");
  7480. var $1;
  7481. collection=$recv($self._class())._new();
  7482. $self._do_((function(each){
  7483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7484. return $core.withContext(function($ctx2) {
  7485. //>>excludeEnd("ctx");
  7486. $1=$recv(aBlock)._value_(each);
  7487. if($core.assert($1)){
  7488. return $recv(collection)._add_(each);
  7489. }
  7490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7491. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7492. //>>excludeEnd("ctx");
  7493. }));
  7494. return collection;
  7495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7496. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  7497. //>>excludeEnd("ctx");
  7498. },
  7499. //>>excludeStart("ide", pragmas.excludeIdeData);
  7500. args: ["aBlock"],
  7501. 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",
  7502. referencedClasses: [],
  7503. //>>excludeEnd("ide");
  7504. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7505. }),
  7506. $globals.Set);
  7507. $core.addMethod(
  7508. $core.method({
  7509. selector: "select:thenCollect:",
  7510. protocol: "enumerating",
  7511. fn: function (selectBlock,collectBlock){
  7512. var self=this,$self=this;
  7513. var collection;
  7514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7515. return $core.withContext(function($ctx1) {
  7516. //>>excludeEnd("ctx");
  7517. var $1;
  7518. collection=$recv($self._class())._new();
  7519. $self._do_((function(each){
  7520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7521. return $core.withContext(function($ctx2) {
  7522. //>>excludeEnd("ctx");
  7523. $1=$recv(selectBlock)._value_(each);
  7524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7525. $ctx2.sendIdx["value:"]=1;
  7526. //>>excludeEnd("ctx");
  7527. if($core.assert($1)){
  7528. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  7529. }
  7530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7531. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7532. //>>excludeEnd("ctx");
  7533. }));
  7534. return collection;
  7535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7536. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  7537. //>>excludeEnd("ctx");
  7538. },
  7539. //>>excludeStart("ide", pragmas.excludeIdeData);
  7540. args: ["selectBlock", "collectBlock"],
  7541. 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",
  7542. referencedClasses: [],
  7543. //>>excludeEnd("ide");
  7544. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7545. }),
  7546. $globals.Set);
  7547. $core.addMethod(
  7548. $core.method({
  7549. selector: "size",
  7550. protocol: "accessing",
  7551. fn: function (){
  7552. var self=this,$self=this;
  7553. return $self["@size"];
  7554. },
  7555. //>>excludeStart("ide", pragmas.excludeIdeData);
  7556. args: [],
  7557. source: "size\x0a\x09^ size",
  7558. referencedClasses: [],
  7559. //>>excludeEnd("ide");
  7560. messageSends: []
  7561. }),
  7562. $globals.Set);
  7563. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  7564. //>>excludeStart("ide", pragmas.excludeIdeData);
  7565. $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.";
  7566. //>>excludeEnd("ide");
  7567. $core.addMethod(
  7568. $core.method({
  7569. selector: "<<",
  7570. protocol: "writing",
  7571. fn: function (anObject){
  7572. var self=this,$self=this;
  7573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7574. return $core.withContext(function($ctx1) {
  7575. //>>excludeEnd("ctx");
  7576. $self._write_(anObject);
  7577. return self;
  7578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7579. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  7580. //>>excludeEnd("ctx");
  7581. },
  7582. //>>excludeStart("ide", pragmas.excludeIdeData);
  7583. args: ["anObject"],
  7584. source: "<< anObject\x0a\x09self write: anObject",
  7585. referencedClasses: [],
  7586. //>>excludeEnd("ide");
  7587. messageSends: ["write:"]
  7588. }),
  7589. $globals.ProtoStream);
  7590. $core.addMethod(
  7591. $core.method({
  7592. selector: "atEnd",
  7593. protocol: "testing",
  7594. fn: function (){
  7595. var self=this,$self=this;
  7596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7597. return $core.withContext(function($ctx1) {
  7598. //>>excludeEnd("ctx");
  7599. $self._subclassResponsibility();
  7600. return self;
  7601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7602. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  7603. //>>excludeEnd("ctx");
  7604. },
  7605. //>>excludeStart("ide", pragmas.excludeIdeData);
  7606. args: [],
  7607. source: "atEnd\x0a\x09self subclassResponsibility",
  7608. referencedClasses: [],
  7609. //>>excludeEnd("ide");
  7610. messageSends: ["subclassResponsibility"]
  7611. }),
  7612. $globals.ProtoStream);
  7613. $core.addMethod(
  7614. $core.method({
  7615. selector: "atStart",
  7616. protocol: "testing",
  7617. fn: function (){
  7618. var self=this,$self=this;
  7619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7620. return $core.withContext(function($ctx1) {
  7621. //>>excludeEnd("ctx");
  7622. $self._subclassResponsibility();
  7623. return self;
  7624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7625. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  7626. //>>excludeEnd("ctx");
  7627. },
  7628. //>>excludeStart("ide", pragmas.excludeIdeData);
  7629. args: [],
  7630. source: "atStart\x0a\x09self subclassResponsibility",
  7631. referencedClasses: [],
  7632. //>>excludeEnd("ide");
  7633. messageSends: ["subclassResponsibility"]
  7634. }),
  7635. $globals.ProtoStream);
  7636. $core.addMethod(
  7637. $core.method({
  7638. selector: "contents",
  7639. protocol: "accessing",
  7640. fn: function (){
  7641. var self=this,$self=this;
  7642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7643. return $core.withContext(function($ctx1) {
  7644. //>>excludeEnd("ctx");
  7645. $self._subclassResponsibility();
  7646. return self;
  7647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7648. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  7649. //>>excludeEnd("ctx");
  7650. },
  7651. //>>excludeStart("ide", pragmas.excludeIdeData);
  7652. args: [],
  7653. source: "contents\x0a\x09self subclassResponsibility",
  7654. referencedClasses: [],
  7655. //>>excludeEnd("ide");
  7656. messageSends: ["subclassResponsibility"]
  7657. }),
  7658. $globals.ProtoStream);
  7659. $core.addMethod(
  7660. $core.method({
  7661. selector: "do:",
  7662. protocol: "enumerating",
  7663. fn: function (aBlock){
  7664. var self=this,$self=this;
  7665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7666. return $core.withContext(function($ctx1) {
  7667. //>>excludeEnd("ctx");
  7668. $recv((function(){
  7669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7670. return $core.withContext(function($ctx2) {
  7671. //>>excludeEnd("ctx");
  7672. return $self._atEnd();
  7673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7675. //>>excludeEnd("ctx");
  7676. }))._whileFalse_((function(){
  7677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7678. return $core.withContext(function($ctx2) {
  7679. //>>excludeEnd("ctx");
  7680. return $recv(aBlock)._value_($self._next());
  7681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7682. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7683. //>>excludeEnd("ctx");
  7684. }));
  7685. return self;
  7686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7687. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  7688. //>>excludeEnd("ctx");
  7689. },
  7690. //>>excludeStart("ide", pragmas.excludeIdeData);
  7691. args: ["aBlock"],
  7692. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  7693. referencedClasses: [],
  7694. //>>excludeEnd("ide");
  7695. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  7696. }),
  7697. $globals.ProtoStream);
  7698. $core.addMethod(
  7699. $core.method({
  7700. selector: "isEmpty",
  7701. protocol: "testing",
  7702. fn: function (){
  7703. var self=this,$self=this;
  7704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7705. return $core.withContext(function($ctx1) {
  7706. //>>excludeEnd("ctx");
  7707. return $recv($self._atStart())._and_((function(){
  7708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7709. return $core.withContext(function($ctx2) {
  7710. //>>excludeEnd("ctx");
  7711. return $self._atEnd();
  7712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7713. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7714. //>>excludeEnd("ctx");
  7715. }));
  7716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7717. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  7718. //>>excludeEnd("ctx");
  7719. },
  7720. //>>excludeStart("ide", pragmas.excludeIdeData);
  7721. args: [],
  7722. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  7723. referencedClasses: [],
  7724. //>>excludeEnd("ide");
  7725. messageSends: ["and:", "atStart", "atEnd"]
  7726. }),
  7727. $globals.ProtoStream);
  7728. $core.addMethod(
  7729. $core.method({
  7730. selector: "next",
  7731. protocol: "reading",
  7732. fn: function (){
  7733. var self=this,$self=this;
  7734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7735. return $core.withContext(function($ctx1) {
  7736. //>>excludeEnd("ctx");
  7737. var $1;
  7738. $1=$self._atEnd();
  7739. if($core.assert($1)){
  7740. return nil;
  7741. } else {
  7742. return $self._subclassResponsibility();
  7743. }
  7744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7745. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  7746. //>>excludeEnd("ctx");
  7747. },
  7748. //>>excludeStart("ide", pragmas.excludeIdeData);
  7749. args: [],
  7750. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7751. referencedClasses: [],
  7752. //>>excludeEnd("ide");
  7753. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7754. }),
  7755. $globals.ProtoStream);
  7756. $core.addMethod(
  7757. $core.method({
  7758. selector: "nextPut:",
  7759. protocol: "writing",
  7760. fn: function (anObject){
  7761. var self=this,$self=this;
  7762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7763. return $core.withContext(function($ctx1) {
  7764. //>>excludeEnd("ctx");
  7765. $self._subclassResponsibility();
  7766. return self;
  7767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7768. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  7769. //>>excludeEnd("ctx");
  7770. },
  7771. //>>excludeStart("ide", pragmas.excludeIdeData);
  7772. args: ["anObject"],
  7773. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  7774. referencedClasses: [],
  7775. //>>excludeEnd("ide");
  7776. messageSends: ["subclassResponsibility"]
  7777. }),
  7778. $globals.ProtoStream);
  7779. $core.addMethod(
  7780. $core.method({
  7781. selector: "nextPutAll:",
  7782. protocol: "writing",
  7783. fn: function (aCollection){
  7784. var self=this,$self=this;
  7785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7786. return $core.withContext(function($ctx1) {
  7787. //>>excludeEnd("ctx");
  7788. $recv(aCollection)._do_((function(each){
  7789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7790. return $core.withContext(function($ctx2) {
  7791. //>>excludeEnd("ctx");
  7792. return $self._nextPut_(each);
  7793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7794. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7795. //>>excludeEnd("ctx");
  7796. }));
  7797. return self;
  7798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7799. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  7800. //>>excludeEnd("ctx");
  7801. },
  7802. //>>excludeStart("ide", pragmas.excludeIdeData);
  7803. args: ["aCollection"],
  7804. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  7805. referencedClasses: [],
  7806. //>>excludeEnd("ide");
  7807. messageSends: ["do:", "nextPut:"]
  7808. }),
  7809. $globals.ProtoStream);
  7810. $core.addMethod(
  7811. $core.method({
  7812. selector: "nextPutString:",
  7813. protocol: "writing",
  7814. fn: function (aString){
  7815. var self=this,$self=this;
  7816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7817. return $core.withContext(function($ctx1) {
  7818. //>>excludeEnd("ctx");
  7819. $self._nextPut_(aString);
  7820. return self;
  7821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7822. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  7823. //>>excludeEnd("ctx");
  7824. },
  7825. //>>excludeStart("ide", pragmas.excludeIdeData);
  7826. args: ["aString"],
  7827. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  7828. referencedClasses: [],
  7829. //>>excludeEnd("ide");
  7830. messageSends: ["nextPut:"]
  7831. }),
  7832. $globals.ProtoStream);
  7833. $core.addMethod(
  7834. $core.method({
  7835. selector: "peek",
  7836. protocol: "reading",
  7837. fn: function (){
  7838. var self=this,$self=this;
  7839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7840. return $core.withContext(function($ctx1) {
  7841. //>>excludeEnd("ctx");
  7842. var $1;
  7843. $1=$self._atEnd();
  7844. if($core.assert($1)){
  7845. return nil;
  7846. } else {
  7847. return $self._subclassResponsibility();
  7848. }
  7849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7850. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  7851. //>>excludeEnd("ctx");
  7852. },
  7853. //>>excludeStart("ide", pragmas.excludeIdeData);
  7854. args: [],
  7855. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7856. referencedClasses: [],
  7857. //>>excludeEnd("ide");
  7858. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7859. }),
  7860. $globals.ProtoStream);
  7861. $core.addMethod(
  7862. $core.method({
  7863. selector: "reset",
  7864. protocol: "actions",
  7865. fn: function (){
  7866. var self=this,$self=this;
  7867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7868. return $core.withContext(function($ctx1) {
  7869. //>>excludeEnd("ctx");
  7870. $self._subclassResponsibility();
  7871. return self;
  7872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7873. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  7874. //>>excludeEnd("ctx");
  7875. },
  7876. //>>excludeStart("ide", pragmas.excludeIdeData);
  7877. args: [],
  7878. source: "reset\x0a\x09self subclassResponsibility",
  7879. referencedClasses: [],
  7880. //>>excludeEnd("ide");
  7881. messageSends: ["subclassResponsibility"]
  7882. }),
  7883. $globals.ProtoStream);
  7884. $core.addMethod(
  7885. $core.method({
  7886. selector: "resetContents",
  7887. protocol: "actions",
  7888. fn: function (){
  7889. var self=this,$self=this;
  7890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7891. return $core.withContext(function($ctx1) {
  7892. //>>excludeEnd("ctx");
  7893. $self._subclassResponsibility();
  7894. return self;
  7895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7896. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  7897. //>>excludeEnd("ctx");
  7898. },
  7899. //>>excludeStart("ide", pragmas.excludeIdeData);
  7900. args: [],
  7901. source: "resetContents\x0a\x09self subclassResponsibility",
  7902. referencedClasses: [],
  7903. //>>excludeEnd("ide");
  7904. messageSends: ["subclassResponsibility"]
  7905. }),
  7906. $globals.ProtoStream);
  7907. $core.addMethod(
  7908. $core.method({
  7909. selector: "setToEnd",
  7910. protocol: "positioning",
  7911. fn: function (){
  7912. var self=this,$self=this;
  7913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7914. return $core.withContext(function($ctx1) {
  7915. //>>excludeEnd("ctx");
  7916. $self._subclassResponsibility();
  7917. return self;
  7918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7919. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  7920. //>>excludeEnd("ctx");
  7921. },
  7922. //>>excludeStart("ide", pragmas.excludeIdeData);
  7923. args: [],
  7924. source: "setToEnd\x0a\x09self subclassResponsibility",
  7925. referencedClasses: [],
  7926. //>>excludeEnd("ide");
  7927. messageSends: ["subclassResponsibility"]
  7928. }),
  7929. $globals.ProtoStream);
  7930. $core.addMethod(
  7931. $core.method({
  7932. selector: "setToStart",
  7933. protocol: "positioning",
  7934. fn: function (){
  7935. var self=this,$self=this;
  7936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7937. return $core.withContext(function($ctx1) {
  7938. //>>excludeEnd("ctx");
  7939. $self._reset();
  7940. return self;
  7941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7942. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  7943. //>>excludeEnd("ctx");
  7944. },
  7945. //>>excludeStart("ide", pragmas.excludeIdeData);
  7946. args: [],
  7947. source: "setToStart\x0a\x09self reset",
  7948. referencedClasses: [],
  7949. //>>excludeEnd("ide");
  7950. messageSends: ["reset"]
  7951. }),
  7952. $globals.ProtoStream);
  7953. $core.addMethod(
  7954. $core.method({
  7955. selector: "write:",
  7956. protocol: "writing",
  7957. fn: function (anObject){
  7958. var self=this,$self=this;
  7959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7960. return $core.withContext(function($ctx1) {
  7961. //>>excludeEnd("ctx");
  7962. $recv(anObject)._putOn_(self);
  7963. return self;
  7964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7965. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  7966. //>>excludeEnd("ctx");
  7967. },
  7968. //>>excludeStart("ide", pragmas.excludeIdeData);
  7969. args: ["anObject"],
  7970. source: "write: anObject\x0a\x09anObject putOn: self",
  7971. referencedClasses: [],
  7972. //>>excludeEnd("ide");
  7973. messageSends: ["putOn:"]
  7974. }),
  7975. $globals.ProtoStream);
  7976. $core.addMethod(
  7977. $core.method({
  7978. selector: "on:",
  7979. protocol: "instance creation",
  7980. fn: function (aCollection){
  7981. var self=this,$self=this;
  7982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7983. return $core.withContext(function($ctx1) {
  7984. //>>excludeEnd("ctx");
  7985. var $1;
  7986. $1=$self._new();
  7987. $recv($1)._setCollection_(aCollection);
  7988. $recv($1)._setStreamSize_($recv(aCollection)._size());
  7989. return $recv($1)._yourself();
  7990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7991. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.a$cls)});
  7992. //>>excludeEnd("ctx");
  7993. },
  7994. //>>excludeStart("ide", pragmas.excludeIdeData);
  7995. args: ["aCollection"],
  7996. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  7997. referencedClasses: [],
  7998. //>>excludeEnd("ide");
  7999. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8000. }),
  8001. $globals.ProtoStream.a$cls);
  8002. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  8003. //>>excludeStart("ide", pragmas.excludeIdeData);
  8004. $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.";
  8005. //>>excludeEnd("ide");
  8006. $core.addMethod(
  8007. $core.method({
  8008. selector: "atEnd",
  8009. protocol: "testing",
  8010. fn: function (){
  8011. var self=this,$self=this;
  8012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8013. return $core.withContext(function($ctx1) {
  8014. //>>excludeEnd("ctx");
  8015. return $recv($self._position()).__eq($self._size());
  8016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8017. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  8018. //>>excludeEnd("ctx");
  8019. },
  8020. //>>excludeStart("ide", pragmas.excludeIdeData);
  8021. args: [],
  8022. source: "atEnd\x0a\x09^ self position = self size",
  8023. referencedClasses: [],
  8024. //>>excludeEnd("ide");
  8025. messageSends: ["=", "position", "size"]
  8026. }),
  8027. $globals.Stream);
  8028. $core.addMethod(
  8029. $core.method({
  8030. selector: "atStart",
  8031. protocol: "testing",
  8032. fn: function (){
  8033. var self=this,$self=this;
  8034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8035. return $core.withContext(function($ctx1) {
  8036. //>>excludeEnd("ctx");
  8037. return $recv($self._position()).__eq((0));
  8038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8039. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  8040. //>>excludeEnd("ctx");
  8041. },
  8042. //>>excludeStart("ide", pragmas.excludeIdeData);
  8043. args: [],
  8044. source: "atStart\x0a\x09^ self position = 0",
  8045. referencedClasses: [],
  8046. //>>excludeEnd("ide");
  8047. messageSends: ["=", "position"]
  8048. }),
  8049. $globals.Stream);
  8050. $core.addMethod(
  8051. $core.method({
  8052. selector: "close",
  8053. protocol: "actions",
  8054. fn: function (){
  8055. var self=this,$self=this;
  8056. return self;
  8057. },
  8058. //>>excludeStart("ide", pragmas.excludeIdeData);
  8059. args: [],
  8060. source: "close",
  8061. referencedClasses: [],
  8062. //>>excludeEnd("ide");
  8063. messageSends: []
  8064. }),
  8065. $globals.Stream);
  8066. $core.addMethod(
  8067. $core.method({
  8068. selector: "collection",
  8069. protocol: "accessing",
  8070. fn: function (){
  8071. var self=this,$self=this;
  8072. return $self["@collection"];
  8073. },
  8074. //>>excludeStart("ide", pragmas.excludeIdeData);
  8075. args: [],
  8076. source: "collection\x0a\x09^ collection",
  8077. referencedClasses: [],
  8078. //>>excludeEnd("ide");
  8079. messageSends: []
  8080. }),
  8081. $globals.Stream);
  8082. $core.addMethod(
  8083. $core.method({
  8084. selector: "contents",
  8085. protocol: "accessing",
  8086. fn: function (){
  8087. var self=this,$self=this;
  8088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8089. return $core.withContext(function($ctx1) {
  8090. //>>excludeEnd("ctx");
  8091. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  8092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8093. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  8094. //>>excludeEnd("ctx");
  8095. },
  8096. //>>excludeStart("ide", pragmas.excludeIdeData);
  8097. args: [],
  8098. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8099. referencedClasses: [],
  8100. //>>excludeEnd("ide");
  8101. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8102. }),
  8103. $globals.Stream);
  8104. $core.addMethod(
  8105. $core.method({
  8106. selector: "flush",
  8107. protocol: "actions",
  8108. fn: function (){
  8109. var self=this,$self=this;
  8110. return self;
  8111. },
  8112. //>>excludeStart("ide", pragmas.excludeIdeData);
  8113. args: [],
  8114. source: "flush",
  8115. referencedClasses: [],
  8116. //>>excludeEnd("ide");
  8117. messageSends: []
  8118. }),
  8119. $globals.Stream);
  8120. $core.addMethod(
  8121. $core.method({
  8122. selector: "isEmpty",
  8123. protocol: "testing",
  8124. fn: function (){
  8125. var self=this,$self=this;
  8126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8127. return $core.withContext(function($ctx1) {
  8128. //>>excludeEnd("ctx");
  8129. return $recv($self._size()).__eq((0));
  8130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8131. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  8132. //>>excludeEnd("ctx");
  8133. },
  8134. //>>excludeStart("ide", pragmas.excludeIdeData);
  8135. args: [],
  8136. source: "isEmpty\x0a\x09^ self size = 0",
  8137. referencedClasses: [],
  8138. //>>excludeEnd("ide");
  8139. messageSends: ["=", "size"]
  8140. }),
  8141. $globals.Stream);
  8142. $core.addMethod(
  8143. $core.method({
  8144. selector: "next",
  8145. protocol: "reading",
  8146. fn: function (){
  8147. var self=this,$self=this;
  8148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8149. return $core.withContext(function($ctx1) {
  8150. //>>excludeEnd("ctx");
  8151. var $1,$3,$2;
  8152. $1=$self._atEnd();
  8153. if($core.assert($1)){
  8154. return nil;
  8155. } else {
  8156. $3=$self._position();
  8157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8158. $ctx1.sendIdx["position"]=1;
  8159. //>>excludeEnd("ctx");
  8160. $2=$recv($3).__plus((1));
  8161. $self._position_($2);
  8162. return $recv($self["@collection"])._at_($self._position());
  8163. }
  8164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8165. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  8166. //>>excludeEnd("ctx");
  8167. },
  8168. //>>excludeStart("ide", pragmas.excludeIdeData);
  8169. args: [],
  8170. 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 ]",
  8171. referencedClasses: [],
  8172. //>>excludeEnd("ide");
  8173. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8174. }),
  8175. $globals.Stream);
  8176. $core.addMethod(
  8177. $core.method({
  8178. selector: "next:",
  8179. protocol: "reading",
  8180. fn: function (anInteger){
  8181. var self=this,$self=this;
  8182. var tempCollection;
  8183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8184. return $core.withContext(function($ctx1) {
  8185. //>>excludeEnd("ctx");
  8186. var $1;
  8187. tempCollection=$recv($recv($self._collection())._class())._new();
  8188. $recv(anInteger)._timesRepeat_((function(){
  8189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8190. return $core.withContext(function($ctx2) {
  8191. //>>excludeEnd("ctx");
  8192. $1=$self._atEnd();
  8193. if(!$core.assert($1)){
  8194. return $recv(tempCollection)._add_($self._next());
  8195. }
  8196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8197. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8198. //>>excludeEnd("ctx");
  8199. }));
  8200. return tempCollection;
  8201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8202. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  8203. //>>excludeEnd("ctx");
  8204. },
  8205. //>>excludeStart("ide", pragmas.excludeIdeData);
  8206. args: ["anInteger"],
  8207. 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",
  8208. referencedClasses: [],
  8209. //>>excludeEnd("ide");
  8210. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8211. }),
  8212. $globals.Stream);
  8213. $core.addMethod(
  8214. $core.method({
  8215. selector: "nextPut:",
  8216. protocol: "writing",
  8217. fn: function (anObject){
  8218. var self=this,$self=this;
  8219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8220. return $core.withContext(function($ctx1) {
  8221. //>>excludeEnd("ctx");
  8222. var $2,$1,$3,$4;
  8223. $2=$self._position();
  8224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8225. $ctx1.sendIdx["position"]=1;
  8226. //>>excludeEnd("ctx");
  8227. $1=$recv($2).__plus((1));
  8228. $self._position_($1);
  8229. $3=$self._collection();
  8230. $4=$self._position();
  8231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8232. $ctx1.sendIdx["position"]=2;
  8233. //>>excludeEnd("ctx");
  8234. $recv($3)._at_put_($4,anObject);
  8235. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8236. return self;
  8237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8238. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  8239. //>>excludeEnd("ctx");
  8240. },
  8241. //>>excludeStart("ide", pragmas.excludeIdeData);
  8242. args: ["anObject"],
  8243. 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)",
  8244. referencedClasses: [],
  8245. //>>excludeEnd("ide");
  8246. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8247. }),
  8248. $globals.Stream);
  8249. $core.addMethod(
  8250. $core.method({
  8251. selector: "peek",
  8252. protocol: "reading",
  8253. fn: function (){
  8254. var self=this,$self=this;
  8255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8256. return $core.withContext(function($ctx1) {
  8257. //>>excludeEnd("ctx");
  8258. var $1;
  8259. $1=$self._atEnd();
  8260. if(!$core.assert($1)){
  8261. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  8262. }
  8263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8264. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  8265. //>>excludeEnd("ctx");
  8266. },
  8267. //>>excludeStart("ide", pragmas.excludeIdeData);
  8268. args: [],
  8269. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8270. referencedClasses: [],
  8271. //>>excludeEnd("ide");
  8272. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8273. }),
  8274. $globals.Stream);
  8275. $core.addMethod(
  8276. $core.method({
  8277. selector: "position",
  8278. protocol: "accessing",
  8279. fn: function (){
  8280. var self=this,$self=this;
  8281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8282. return $core.withContext(function($ctx1) {
  8283. //>>excludeEnd("ctx");
  8284. var $1,$receiver;
  8285. $1=$self["@position"];
  8286. if(($receiver = $1) == null || $receiver.a$nil){
  8287. $self["@position"]=(0);
  8288. return $self["@position"];
  8289. } else {
  8290. return $1;
  8291. }
  8292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8293. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  8294. //>>excludeEnd("ctx");
  8295. },
  8296. //>>excludeStart("ide", pragmas.excludeIdeData);
  8297. args: [],
  8298. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  8299. referencedClasses: [],
  8300. //>>excludeEnd("ide");
  8301. messageSends: ["ifNil:"]
  8302. }),
  8303. $globals.Stream);
  8304. $core.addMethod(
  8305. $core.method({
  8306. selector: "position:",
  8307. protocol: "accessing",
  8308. fn: function (anInteger){
  8309. var self=this,$self=this;
  8310. $self["@position"]=anInteger;
  8311. return self;
  8312. },
  8313. //>>excludeStart("ide", pragmas.excludeIdeData);
  8314. args: ["anInteger"],
  8315. source: "position: anInteger\x0a\x09position := anInteger",
  8316. referencedClasses: [],
  8317. //>>excludeEnd("ide");
  8318. messageSends: []
  8319. }),
  8320. $globals.Stream);
  8321. $core.addMethod(
  8322. $core.method({
  8323. selector: "reset",
  8324. protocol: "actions",
  8325. fn: function (){
  8326. var self=this,$self=this;
  8327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8328. return $core.withContext(function($ctx1) {
  8329. //>>excludeEnd("ctx");
  8330. $self._position_((0));
  8331. return self;
  8332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8333. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  8334. //>>excludeEnd("ctx");
  8335. },
  8336. //>>excludeStart("ide", pragmas.excludeIdeData);
  8337. args: [],
  8338. source: "reset\x0a\x09self position: 0",
  8339. referencedClasses: [],
  8340. //>>excludeEnd("ide");
  8341. messageSends: ["position:"]
  8342. }),
  8343. $globals.Stream);
  8344. $core.addMethod(
  8345. $core.method({
  8346. selector: "resetContents",
  8347. protocol: "actions",
  8348. fn: function (){
  8349. var self=this,$self=this;
  8350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8351. return $core.withContext(function($ctx1) {
  8352. //>>excludeEnd("ctx");
  8353. $self._reset();
  8354. $self._setStreamSize_((0));
  8355. return self;
  8356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8357. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  8358. //>>excludeEnd("ctx");
  8359. },
  8360. //>>excludeStart("ide", pragmas.excludeIdeData);
  8361. args: [],
  8362. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  8363. referencedClasses: [],
  8364. //>>excludeEnd("ide");
  8365. messageSends: ["reset", "setStreamSize:"]
  8366. }),
  8367. $globals.Stream);
  8368. $core.addMethod(
  8369. $core.method({
  8370. selector: "setCollection:",
  8371. protocol: "accessing",
  8372. fn: function (aCollection){
  8373. var self=this,$self=this;
  8374. $self["@collection"]=aCollection;
  8375. return self;
  8376. },
  8377. //>>excludeStart("ide", pragmas.excludeIdeData);
  8378. args: ["aCollection"],
  8379. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  8380. referencedClasses: [],
  8381. //>>excludeEnd("ide");
  8382. messageSends: []
  8383. }),
  8384. $globals.Stream);
  8385. $core.addMethod(
  8386. $core.method({
  8387. selector: "setStreamSize:",
  8388. protocol: "accessing",
  8389. fn: function (anInteger){
  8390. var self=this,$self=this;
  8391. $self["@streamSize"]=anInteger;
  8392. return self;
  8393. },
  8394. //>>excludeStart("ide", pragmas.excludeIdeData);
  8395. args: ["anInteger"],
  8396. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  8397. referencedClasses: [],
  8398. //>>excludeEnd("ide");
  8399. messageSends: []
  8400. }),
  8401. $globals.Stream);
  8402. $core.addMethod(
  8403. $core.method({
  8404. selector: "setToEnd",
  8405. protocol: "positioning",
  8406. fn: function (){
  8407. var self=this,$self=this;
  8408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8409. return $core.withContext(function($ctx1) {
  8410. //>>excludeEnd("ctx");
  8411. $self._position_($self._size());
  8412. return self;
  8413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8414. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  8415. //>>excludeEnd("ctx");
  8416. },
  8417. //>>excludeStart("ide", pragmas.excludeIdeData);
  8418. args: [],
  8419. source: "setToEnd\x0a\x09self position: self size",
  8420. referencedClasses: [],
  8421. //>>excludeEnd("ide");
  8422. messageSends: ["position:", "size"]
  8423. }),
  8424. $globals.Stream);
  8425. $core.addMethod(
  8426. $core.method({
  8427. selector: "size",
  8428. protocol: "accessing",
  8429. fn: function (){
  8430. var self=this,$self=this;
  8431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8432. return $core.withContext(function($ctx1) {
  8433. //>>excludeEnd("ctx");
  8434. return $self._streamSize();
  8435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8436. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  8437. //>>excludeEnd("ctx");
  8438. },
  8439. //>>excludeStart("ide", pragmas.excludeIdeData);
  8440. args: [],
  8441. source: "size\x0a\x09^ self streamSize",
  8442. referencedClasses: [],
  8443. //>>excludeEnd("ide");
  8444. messageSends: ["streamSize"]
  8445. }),
  8446. $globals.Stream);
  8447. $core.addMethod(
  8448. $core.method({
  8449. selector: "skip:",
  8450. protocol: "positioning",
  8451. fn: function (anInteger){
  8452. var self=this,$self=this;
  8453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8454. return $core.withContext(function($ctx1) {
  8455. //>>excludeEnd("ctx");
  8456. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  8457. return self;
  8458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8459. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  8460. //>>excludeEnd("ctx");
  8461. },
  8462. //>>excludeStart("ide", pragmas.excludeIdeData);
  8463. args: ["anInteger"],
  8464. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  8465. referencedClasses: [],
  8466. //>>excludeEnd("ide");
  8467. messageSends: ["position:", "min:max:", "+", "position", "size"]
  8468. }),
  8469. $globals.Stream);
  8470. $core.addMethod(
  8471. $core.method({
  8472. selector: "streamSize",
  8473. protocol: "accessing",
  8474. fn: function (){
  8475. var self=this,$self=this;
  8476. return $self["@streamSize"];
  8477. },
  8478. //>>excludeStart("ide", pragmas.excludeIdeData);
  8479. args: [],
  8480. source: "streamSize\x0a\x09^ streamSize",
  8481. referencedClasses: [],
  8482. //>>excludeEnd("ide");
  8483. messageSends: []
  8484. }),
  8485. $globals.Stream);
  8486. $core.addMethod(
  8487. $core.method({
  8488. selector: "on:",
  8489. protocol: "instance creation",
  8490. fn: function (aCollection){
  8491. var self=this,$self=this;
  8492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8493. return $core.withContext(function($ctx1) {
  8494. //>>excludeEnd("ctx");
  8495. var $1;
  8496. $1=$self._new();
  8497. $recv($1)._setCollection_(aCollection);
  8498. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8499. return $recv($1)._yourself();
  8500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8501. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.a$cls)});
  8502. //>>excludeEnd("ctx");
  8503. },
  8504. //>>excludeStart("ide", pragmas.excludeIdeData);
  8505. args: ["aCollection"],
  8506. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8507. referencedClasses: [],
  8508. //>>excludeEnd("ide");
  8509. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8510. }),
  8511. $globals.Stream.a$cls);
  8512. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  8513. //>>excludeStart("ide", pragmas.excludeIdeData);
  8514. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  8515. //>>excludeEnd("ide");
  8516. $core.addMethod(
  8517. $core.method({
  8518. selector: "cr",
  8519. protocol: "writing",
  8520. fn: function (){
  8521. var self=this,$self=this;
  8522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8523. return $core.withContext(function($ctx1) {
  8524. //>>excludeEnd("ctx");
  8525. return $self._nextPutAll_($recv($globals.String)._cr());
  8526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8527. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  8528. //>>excludeEnd("ctx");
  8529. },
  8530. //>>excludeStart("ide", pragmas.excludeIdeData);
  8531. args: [],
  8532. source: "cr\x0a\x09^ self nextPutAll: String cr",
  8533. referencedClasses: ["String"],
  8534. //>>excludeEnd("ide");
  8535. messageSends: ["nextPutAll:", "cr"]
  8536. }),
  8537. $globals.StringStream);
  8538. $core.addMethod(
  8539. $core.method({
  8540. selector: "crlf",
  8541. protocol: "writing",
  8542. fn: function (){
  8543. var self=this,$self=this;
  8544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8545. return $core.withContext(function($ctx1) {
  8546. //>>excludeEnd("ctx");
  8547. return $self._nextPutAll_($recv($globals.String)._crlf());
  8548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8549. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  8550. //>>excludeEnd("ctx");
  8551. },
  8552. //>>excludeStart("ide", pragmas.excludeIdeData);
  8553. args: [],
  8554. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  8555. referencedClasses: ["String"],
  8556. //>>excludeEnd("ide");
  8557. messageSends: ["nextPutAll:", "crlf"]
  8558. }),
  8559. $globals.StringStream);
  8560. $core.addMethod(
  8561. $core.method({
  8562. selector: "lf",
  8563. protocol: "writing",
  8564. fn: function (){
  8565. var self=this,$self=this;
  8566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8567. return $core.withContext(function($ctx1) {
  8568. //>>excludeEnd("ctx");
  8569. return $self._nextPutAll_($recv($globals.String)._lf());
  8570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8571. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  8572. //>>excludeEnd("ctx");
  8573. },
  8574. //>>excludeStart("ide", pragmas.excludeIdeData);
  8575. args: [],
  8576. source: "lf\x0a\x09^ self nextPutAll: String lf",
  8577. referencedClasses: ["String"],
  8578. //>>excludeEnd("ide");
  8579. messageSends: ["nextPutAll:", "lf"]
  8580. }),
  8581. $globals.StringStream);
  8582. $core.addMethod(
  8583. $core.method({
  8584. selector: "next:",
  8585. protocol: "reading",
  8586. fn: function (anInteger){
  8587. var self=this,$self=this;
  8588. var tempCollection;
  8589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8590. return $core.withContext(function($ctx1) {
  8591. //>>excludeEnd("ctx");
  8592. var $1;
  8593. tempCollection=$recv($recv($self._collection())._class())._new();
  8594. $recv(anInteger)._timesRepeat_((function(){
  8595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8596. return $core.withContext(function($ctx2) {
  8597. //>>excludeEnd("ctx");
  8598. $1=$self._atEnd();
  8599. if(!$core.assert($1)){
  8600. tempCollection=$recv(tempCollection).__comma($self._next());
  8601. return tempCollection;
  8602. }
  8603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8604. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8605. //>>excludeEnd("ctx");
  8606. }));
  8607. return tempCollection;
  8608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8609. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  8610. //>>excludeEnd("ctx");
  8611. },
  8612. //>>excludeStart("ide", pragmas.excludeIdeData);
  8613. args: ["anInteger"],
  8614. 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",
  8615. referencedClasses: [],
  8616. //>>excludeEnd("ide");
  8617. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  8618. }),
  8619. $globals.StringStream);
  8620. $core.addMethod(
  8621. $core.method({
  8622. selector: "nextPut:",
  8623. protocol: "writing",
  8624. fn: function (aString){
  8625. var self=this,$self=this;
  8626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8627. return $core.withContext(function($ctx1) {
  8628. //>>excludeEnd("ctx");
  8629. $self._nextPutAll_(aString);
  8630. return self;
  8631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8632. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  8633. //>>excludeEnd("ctx");
  8634. },
  8635. //>>excludeStart("ide", pragmas.excludeIdeData);
  8636. args: ["aString"],
  8637. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  8638. referencedClasses: [],
  8639. //>>excludeEnd("ide");
  8640. messageSends: ["nextPutAll:"]
  8641. }),
  8642. $globals.StringStream);
  8643. $core.addMethod(
  8644. $core.method({
  8645. selector: "nextPutAll:",
  8646. protocol: "writing",
  8647. fn: function (aString){
  8648. var self=this,$self=this;
  8649. var pre,post;
  8650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8651. return $core.withContext(function($ctx1) {
  8652. //>>excludeEnd("ctx");
  8653. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  8654. $1=$self._atEnd();
  8655. if($core.assert($1)){
  8656. $3=$self._collection();
  8657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8658. $ctx1.sendIdx["collection"]=1;
  8659. //>>excludeEnd("ctx");
  8660. $2=$recv($3).__comma(aString);
  8661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8662. $ctx1.sendIdx[","]=1;
  8663. //>>excludeEnd("ctx");
  8664. $self._setCollection_($2);
  8665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8666. $ctx1.sendIdx["setCollection:"]=1;
  8667. //>>excludeEnd("ctx");
  8668. } else {
  8669. $4=$self._collection();
  8670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8671. $ctx1.sendIdx["collection"]=2;
  8672. //>>excludeEnd("ctx");
  8673. $5=$self._position();
  8674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8675. $ctx1.sendIdx["position"]=1;
  8676. //>>excludeEnd("ctx");
  8677. pre=$recv($4)._copyFrom_to_((1),$5);
  8678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8679. $ctx1.sendIdx["copyFrom:to:"]=1;
  8680. //>>excludeEnd("ctx");
  8681. $6=$self._collection();
  8682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8683. $ctx1.sendIdx["collection"]=3;
  8684. //>>excludeEnd("ctx");
  8685. $9=$self._position();
  8686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8687. $ctx1.sendIdx["position"]=2;
  8688. //>>excludeEnd("ctx");
  8689. $8=$recv($9).__plus((1));
  8690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8691. $ctx1.sendIdx["+"]=2;
  8692. //>>excludeEnd("ctx");
  8693. $10=$recv(aString)._size();
  8694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8695. $ctx1.sendIdx["size"]=1;
  8696. //>>excludeEnd("ctx");
  8697. $7=$recv($8).__plus($10);
  8698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8699. $ctx1.sendIdx["+"]=1;
  8700. //>>excludeEnd("ctx");
  8701. $11=$recv($self._collection())._size();
  8702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8703. $ctx1.sendIdx["size"]=2;
  8704. //>>excludeEnd("ctx");
  8705. post=$recv($6)._copyFrom_to_($7,$11);
  8706. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  8707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8708. $ctx1.sendIdx[","]=2;
  8709. //>>excludeEnd("ctx");
  8710. $self._setCollection_($12);
  8711. }
  8712. $14=$self._position();
  8713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8714. $ctx1.sendIdx["position"]=3;
  8715. //>>excludeEnd("ctx");
  8716. $13=$recv($14).__plus($recv(aString)._size());
  8717. $self._position_($13);
  8718. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8719. return self;
  8720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8721. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  8722. //>>excludeEnd("ctx");
  8723. },
  8724. //>>excludeStart("ide", pragmas.excludeIdeData);
  8725. args: ["aString"],
  8726. 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)",
  8727. referencedClasses: [],
  8728. //>>excludeEnd("ide");
  8729. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  8730. }),
  8731. $globals.StringStream);
  8732. $core.addMethod(
  8733. $core.method({
  8734. selector: "nextPutString:",
  8735. protocol: "writing",
  8736. fn: function (aString){
  8737. var self=this,$self=this;
  8738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8739. return $core.withContext(function($ctx1) {
  8740. //>>excludeEnd("ctx");
  8741. $self._nextPutAll_(aString);
  8742. return self;
  8743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8744. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  8745. //>>excludeEnd("ctx");
  8746. },
  8747. //>>excludeStart("ide", pragmas.excludeIdeData);
  8748. args: ["aString"],
  8749. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  8750. referencedClasses: [],
  8751. //>>excludeEnd("ide");
  8752. messageSends: ["nextPutAll:"]
  8753. }),
  8754. $globals.StringStream);
  8755. $core.addMethod(
  8756. $core.method({
  8757. selector: "print:",
  8758. protocol: "writing",
  8759. fn: function (anObject){
  8760. var self=this,$self=this;
  8761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8762. return $core.withContext(function($ctx1) {
  8763. //>>excludeEnd("ctx");
  8764. $recv(anObject)._printOn_(self);
  8765. return self;
  8766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8767. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  8768. //>>excludeEnd("ctx");
  8769. },
  8770. //>>excludeStart("ide", pragmas.excludeIdeData);
  8771. args: ["anObject"],
  8772. source: "print: anObject\x0a\x09anObject printOn: self",
  8773. referencedClasses: [],
  8774. //>>excludeEnd("ide");
  8775. messageSends: ["printOn:"]
  8776. }),
  8777. $globals.StringStream);
  8778. $core.addMethod(
  8779. $core.method({
  8780. selector: "printSymbol:",
  8781. protocol: "writing",
  8782. fn: function (anObject){
  8783. var self=this,$self=this;
  8784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8785. return $core.withContext(function($ctx1) {
  8786. //>>excludeEnd("ctx");
  8787. $recv(anObject)._asSymbolPrintOn_(self);
  8788. return self;
  8789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8790. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  8791. //>>excludeEnd("ctx");
  8792. },
  8793. //>>excludeStart("ide", pragmas.excludeIdeData);
  8794. args: ["anObject"],
  8795. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  8796. referencedClasses: [],
  8797. //>>excludeEnd("ide");
  8798. messageSends: ["asSymbolPrintOn:"]
  8799. }),
  8800. $globals.StringStream);
  8801. $core.addMethod(
  8802. $core.method({
  8803. selector: "space",
  8804. protocol: "writing",
  8805. fn: function (){
  8806. var self=this,$self=this;
  8807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8808. return $core.withContext(function($ctx1) {
  8809. //>>excludeEnd("ctx");
  8810. $self._nextPut_(" ");
  8811. return self;
  8812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8813. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  8814. //>>excludeEnd("ctx");
  8815. },
  8816. //>>excludeStart("ide", pragmas.excludeIdeData);
  8817. args: [],
  8818. source: "space\x0a\x09self nextPut: ' '",
  8819. referencedClasses: [],
  8820. //>>excludeEnd("ide");
  8821. messageSends: ["nextPut:"]
  8822. }),
  8823. $globals.StringStream);
  8824. $core.addMethod(
  8825. $core.method({
  8826. selector: "tab",
  8827. protocol: "writing",
  8828. fn: function (){
  8829. var self=this,$self=this;
  8830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8831. return $core.withContext(function($ctx1) {
  8832. //>>excludeEnd("ctx");
  8833. return $self._nextPutAll_($recv($globals.String)._tab());
  8834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8835. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  8836. //>>excludeEnd("ctx");
  8837. },
  8838. //>>excludeStart("ide", pragmas.excludeIdeData);
  8839. args: [],
  8840. source: "tab\x0a\x09^ self nextPutAll: String tab",
  8841. referencedClasses: ["String"],
  8842. //>>excludeEnd("ide");
  8843. messageSends: ["nextPutAll:", "tab"]
  8844. }),
  8845. $globals.StringStream);
  8846. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  8847. //>>excludeStart("ide", pragmas.excludeIdeData);
  8848. $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.";
  8849. //>>excludeEnd("ide");
  8850. $core.addMethod(
  8851. $core.method({
  8852. selector: "initialize",
  8853. protocol: "initialization",
  8854. fn: function (){
  8855. var self=this,$self=this;
  8856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8857. return $core.withContext(function($ctx1) {
  8858. //>>excludeEnd("ctx");
  8859. (
  8860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8861. $ctx1.supercall = true,
  8862. //>>excludeEnd("ctx");
  8863. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  8864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8865. $ctx1.supercall = false;
  8866. //>>excludeEnd("ctx");;
  8867. $self["@read"]=$recv($globals.OrderedCollection)._new();
  8868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8869. $ctx1.sendIdx["new"]=1;
  8870. //>>excludeEnd("ctx");
  8871. $self["@write"]=$recv($globals.OrderedCollection)._new();
  8872. $self["@readIndex"]=(1);
  8873. return self;
  8874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8875. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  8876. //>>excludeEnd("ctx");
  8877. },
  8878. //>>excludeStart("ide", pragmas.excludeIdeData);
  8879. args: [],
  8880. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  8881. referencedClasses: ["OrderedCollection"],
  8882. //>>excludeEnd("ide");
  8883. messageSends: ["initialize", "new"]
  8884. }),
  8885. $globals.Queue);
  8886. $core.addMethod(
  8887. $core.method({
  8888. selector: "next",
  8889. protocol: "accessing",
  8890. fn: function (){
  8891. var self=this,$self=this;
  8892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8893. return $core.withContext(function($ctx1) {
  8894. //>>excludeEnd("ctx");
  8895. return $self._nextIfAbsent_((function(){
  8896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8897. return $core.withContext(function($ctx2) {
  8898. //>>excludeEnd("ctx");
  8899. return $self._error_("Cannot read from empty Queue.");
  8900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8902. //>>excludeEnd("ctx");
  8903. }));
  8904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8905. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  8906. //>>excludeEnd("ctx");
  8907. },
  8908. //>>excludeStart("ide", pragmas.excludeIdeData);
  8909. args: [],
  8910. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  8911. referencedClasses: [],
  8912. //>>excludeEnd("ide");
  8913. messageSends: ["nextIfAbsent:", "error:"]
  8914. }),
  8915. $globals.Queue);
  8916. $core.addMethod(
  8917. $core.method({
  8918. selector: "nextIfAbsent:",
  8919. protocol: "accessing",
  8920. fn: function (aBlock){
  8921. var self=this,$self=this;
  8922. var result;
  8923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8924. return $core.withContext(function($ctx1) {
  8925. //>>excludeEnd("ctx");
  8926. var $1;
  8927. var $early={};
  8928. try {
  8929. result=$recv($self["@read"])._at_ifAbsent_($self["@readIndex"],(function(){
  8930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8931. return $core.withContext(function($ctx2) {
  8932. //>>excludeEnd("ctx");
  8933. $recv($self["@write"])._ifEmpty_((function(){
  8934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8935. return $core.withContext(function($ctx3) {
  8936. //>>excludeEnd("ctx");
  8937. $1=$recv($self["@readIndex"]).__gt((1));
  8938. if($core.assert($1)){
  8939. $self["@read"]=[];
  8940. $self["@readIndex"]=(1);
  8941. $self["@readIndex"];
  8942. }
  8943. throw $early=[$recv(aBlock)._value()];
  8944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8945. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  8946. //>>excludeEnd("ctx");
  8947. }));
  8948. $self["@read"]=$self["@write"];
  8949. $self["@readIndex"]=(1);
  8950. $self["@write"]=$recv($globals.OrderedCollection)._new();
  8951. return $recv($self["@read"])._first();
  8952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8953. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8954. //>>excludeEnd("ctx");
  8955. }));
  8956. $recv($self["@read"])._at_put_($self["@readIndex"],nil);
  8957. $self["@readIndex"]=$recv($self["@readIndex"]).__plus((1));
  8958. return result;
  8959. }
  8960. catch(e) {if(e===$early)return e[0]; throw e}
  8961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8962. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  8963. //>>excludeEnd("ctx");
  8964. },
  8965. //>>excludeStart("ide", pragmas.excludeIdeData);
  8966. args: ["aBlock"],
  8967. 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",
  8968. referencedClasses: ["OrderedCollection"],
  8969. //>>excludeEnd("ide");
  8970. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  8971. }),
  8972. $globals.Queue);
  8973. $core.addMethod(
  8974. $core.method({
  8975. selector: "nextPut:",
  8976. protocol: "accessing",
  8977. fn: function (anObject){
  8978. var self=this,$self=this;
  8979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8980. return $core.withContext(function($ctx1) {
  8981. //>>excludeEnd("ctx");
  8982. $recv($self["@write"])._add_(anObject);
  8983. return self;
  8984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8985. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  8986. //>>excludeEnd("ctx");
  8987. },
  8988. //>>excludeStart("ide", pragmas.excludeIdeData);
  8989. args: ["anObject"],
  8990. source: "nextPut: anObject\x0a\x09write add: anObject",
  8991. referencedClasses: [],
  8992. //>>excludeEnd("ide");
  8993. messageSends: ["add:"]
  8994. }),
  8995. $globals.Queue);
  8996. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  8997. //>>excludeStart("ide", pragmas.excludeIdeData);
  8998. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  8999. //>>excludeEnd("ide");
  9000. $core.addMethod(
  9001. $core.method({
  9002. selector: "compile:",
  9003. protocol: "evaluating",
  9004. fn: function (aString){
  9005. var self=this,$self=this;
  9006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9007. return $core.withContext(function($ctx1) {
  9008. //>>excludeEnd("ctx");
  9009. return self.compile(aString);
  9010. return self;
  9011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9012. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  9013. //>>excludeEnd("ctx");
  9014. },
  9015. //>>excludeStart("ide", pragmas.excludeIdeData);
  9016. args: ["aString"],
  9017. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  9018. referencedClasses: [],
  9019. //>>excludeEnd("ide");
  9020. messageSends: []
  9021. }),
  9022. $globals.RegularExpression);
  9023. $core.addMethod(
  9024. $core.method({
  9025. selector: "exec:",
  9026. protocol: "evaluating",
  9027. fn: function (aString){
  9028. var self=this,$self=this;
  9029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9030. return $core.withContext(function($ctx1) {
  9031. //>>excludeEnd("ctx");
  9032. return self.exec(aString) || nil;
  9033. return self;
  9034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9035. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  9036. //>>excludeEnd("ctx");
  9037. },
  9038. //>>excludeStart("ide", pragmas.excludeIdeData);
  9039. args: ["aString"],
  9040. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  9041. referencedClasses: [],
  9042. //>>excludeEnd("ide");
  9043. messageSends: []
  9044. }),
  9045. $globals.RegularExpression);
  9046. $core.addMethod(
  9047. $core.method({
  9048. selector: "test:",
  9049. protocol: "evaluating",
  9050. fn: function (aString){
  9051. var self=this,$self=this;
  9052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9053. return $core.withContext(function($ctx1) {
  9054. //>>excludeEnd("ctx");
  9055. return self.test(aString);
  9056. return self;
  9057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9058. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  9059. //>>excludeEnd("ctx");
  9060. },
  9061. //>>excludeStart("ide", pragmas.excludeIdeData);
  9062. args: ["aString"],
  9063. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  9064. referencedClasses: [],
  9065. //>>excludeEnd("ide");
  9066. messageSends: []
  9067. }),
  9068. $globals.RegularExpression);
  9069. $core.addMethod(
  9070. $core.method({
  9071. selector: "fromString:",
  9072. protocol: "instance creation",
  9073. fn: function (aString){
  9074. var self=this,$self=this;
  9075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9076. return $core.withContext(function($ctx1) {
  9077. //>>excludeEnd("ctx");
  9078. return $self._fromString_flag_(aString,"");
  9079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9080. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.a$cls)});
  9081. //>>excludeEnd("ctx");
  9082. },
  9083. //>>excludeStart("ide", pragmas.excludeIdeData);
  9084. args: ["aString"],
  9085. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9086. referencedClasses: [],
  9087. //>>excludeEnd("ide");
  9088. messageSends: ["fromString:flag:"]
  9089. }),
  9090. $globals.RegularExpression.a$cls);
  9091. $core.addMethod(
  9092. $core.method({
  9093. selector: "fromString:flag:",
  9094. protocol: "instance creation",
  9095. fn: function (aString,anotherString){
  9096. var self=this,$self=this;
  9097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9098. return $core.withContext(function($ctx1) {
  9099. //>>excludeEnd("ctx");
  9100. return new RegExp(aString, anotherString);
  9101. return self;
  9102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9103. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.a$cls)});
  9104. //>>excludeEnd("ctx");
  9105. },
  9106. //>>excludeStart("ide", pragmas.excludeIdeData);
  9107. args: ["aString", "anotherString"],
  9108. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  9109. referencedClasses: [],
  9110. //>>excludeEnd("ide");
  9111. messageSends: []
  9112. }),
  9113. $globals.RegularExpression.a$cls);
  9114. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  9115. $core.addMethod(
  9116. $core.method({
  9117. selector: "at:",
  9118. protocol: "accessing",
  9119. fn: function (anIndex){
  9120. var self=this,$self=this;
  9121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9122. return $core.withContext(function($ctx1) {
  9123. //>>excludeEnd("ctx");
  9124. return $self._at_ifAbsent_(anIndex,(function(){
  9125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9126. return $core.withContext(function($ctx2) {
  9127. //>>excludeEnd("ctx");
  9128. return $self._errorNotFound();
  9129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9130. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9131. //>>excludeEnd("ctx");
  9132. }));
  9133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9134. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.TKeyValueCollection)});
  9135. //>>excludeEnd("ctx");
  9136. },
  9137. //>>excludeStart("ide", pragmas.excludeIdeData);
  9138. args: ["anIndex"],
  9139. 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 ]",
  9140. referencedClasses: [],
  9141. //>>excludeEnd("ide");
  9142. messageSends: ["at:ifAbsent:", "errorNotFound"]
  9143. }),
  9144. $globals.TKeyValueCollection);
  9145. $core.addMethod(
  9146. $core.method({
  9147. selector: "at:ifAbsent:",
  9148. protocol: "accessing",
  9149. fn: function (anIndex,aBlock){
  9150. var self=this,$self=this;
  9151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9152. return $core.withContext(function($ctx1) {
  9153. //>>excludeEnd("ctx");
  9154. $self._subclassResponsibility();
  9155. return self;
  9156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9157. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.TKeyValueCollection)});
  9158. //>>excludeEnd("ctx");
  9159. },
  9160. //>>excludeStart("ide", pragmas.excludeIdeData);
  9161. args: ["anIndex", "aBlock"],
  9162. 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",
  9163. referencedClasses: [],
  9164. //>>excludeEnd("ide");
  9165. messageSends: ["subclassResponsibility"]
  9166. }),
  9167. $globals.TKeyValueCollection);
  9168. $core.addMethod(
  9169. $core.method({
  9170. selector: "at:ifAbsentPut:",
  9171. protocol: "accessing",
  9172. fn: function (aKey,aBlock){
  9173. var self=this,$self=this;
  9174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9175. return $core.withContext(function($ctx1) {
  9176. //>>excludeEnd("ctx");
  9177. return $self._at_ifAbsent_(aKey,(function(){
  9178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9179. return $core.withContext(function($ctx2) {
  9180. //>>excludeEnd("ctx");
  9181. return $self._at_put_(aKey,$recv(aBlock)._value());
  9182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9183. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9184. //>>excludeEnd("ctx");
  9185. }));
  9186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9187. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.TKeyValueCollection)});
  9188. //>>excludeEnd("ctx");
  9189. },
  9190. //>>excludeStart("ide", pragmas.excludeIdeData);
  9191. args: ["aKey", "aBlock"],
  9192. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  9193. referencedClasses: [],
  9194. //>>excludeEnd("ide");
  9195. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  9196. }),
  9197. $globals.TKeyValueCollection);
  9198. $core.addMethod(
  9199. $core.method({
  9200. selector: "at:ifPresent:",
  9201. protocol: "accessing",
  9202. fn: function (anIndex,aBlock){
  9203. var self=this,$self=this;
  9204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9205. return $core.withContext(function($ctx1) {
  9206. //>>excludeEnd("ctx");
  9207. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  9208. return nil;
  9209. }));
  9210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9211. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.TKeyValueCollection)});
  9212. //>>excludeEnd("ctx");
  9213. },
  9214. //>>excludeStart("ide", pragmas.excludeIdeData);
  9215. args: ["anIndex", "aBlock"],
  9216. 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 ]",
  9217. referencedClasses: [],
  9218. //>>excludeEnd("ide");
  9219. messageSends: ["at:ifPresent:ifAbsent:"]
  9220. }),
  9221. $globals.TKeyValueCollection);
  9222. $core.addMethod(
  9223. $core.method({
  9224. selector: "at:ifPresent:ifAbsent:",
  9225. protocol: "accessing",
  9226. fn: function (anIndex,aBlock,anotherBlock){
  9227. var self=this,$self=this;
  9228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9229. return $core.withContext(function($ctx1) {
  9230. //>>excludeEnd("ctx");
  9231. $self._subclassResponsibility();
  9232. return self;
  9233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9234. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TKeyValueCollection)});
  9235. //>>excludeEnd("ctx");
  9236. },
  9237. //>>excludeStart("ide", pragmas.excludeIdeData);
  9238. args: ["anIndex", "aBlock", "anotherBlock"],
  9239. 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",
  9240. referencedClasses: [],
  9241. //>>excludeEnd("ide");
  9242. messageSends: ["subclassResponsibility"]
  9243. }),
  9244. $globals.TKeyValueCollection);
  9245. $core.addMethod(
  9246. $core.method({
  9247. selector: "at:put:",
  9248. protocol: "accessing",
  9249. fn: function (anIndex,anObject){
  9250. var self=this,$self=this;
  9251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9252. return $core.withContext(function($ctx1) {
  9253. //>>excludeEnd("ctx");
  9254. $self._subclassResponsibility();
  9255. return self;
  9256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9257. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.TKeyValueCollection)});
  9258. //>>excludeEnd("ctx");
  9259. },
  9260. //>>excludeStart("ide", pragmas.excludeIdeData);
  9261. args: ["anIndex", "anObject"],
  9262. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  9263. referencedClasses: [],
  9264. //>>excludeEnd("ide");
  9265. messageSends: ["subclassResponsibility"]
  9266. }),
  9267. $globals.TKeyValueCollection);
  9268. $core.addMethod(
  9269. $core.method({
  9270. selector: "indexOf:",
  9271. protocol: "accessing",
  9272. fn: function (anObject){
  9273. var self=this,$self=this;
  9274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9275. return $core.withContext(function($ctx1) {
  9276. //>>excludeEnd("ctx");
  9277. return $self._indexOf_ifAbsent_(anObject,(function(){
  9278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9279. return $core.withContext(function($ctx2) {
  9280. //>>excludeEnd("ctx");
  9281. return $self._errorNotFound();
  9282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9283. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9284. //>>excludeEnd("ctx");
  9285. }));
  9286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9287. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.TKeyValueCollection)});
  9288. //>>excludeEnd("ctx");
  9289. },
  9290. //>>excludeStart("ide", pragmas.excludeIdeData);
  9291. args: ["anObject"],
  9292. 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 ]",
  9293. referencedClasses: [],
  9294. //>>excludeEnd("ide");
  9295. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  9296. }),
  9297. $globals.TKeyValueCollection);
  9298. $core.addMethod(
  9299. $core.method({
  9300. selector: "indexOf:ifAbsent:",
  9301. protocol: "accessing",
  9302. fn: function (anObject,aBlock){
  9303. var self=this,$self=this;
  9304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9305. return $core.withContext(function($ctx1) {
  9306. //>>excludeEnd("ctx");
  9307. $self._subclassResponsibility();
  9308. return self;
  9309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9310. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.TKeyValueCollection)});
  9311. //>>excludeEnd("ctx");
  9312. },
  9313. //>>excludeStart("ide", pragmas.excludeIdeData);
  9314. args: ["anObject", "aBlock"],
  9315. 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",
  9316. referencedClasses: [],
  9317. //>>excludeEnd("ide");
  9318. messageSends: ["subclassResponsibility"]
  9319. }),
  9320. $globals.TKeyValueCollection);
  9321. $core.addMethod(
  9322. $core.method({
  9323. selector: "with:do:",
  9324. protocol: "enumerating",
  9325. fn: function (anotherCollection,aBlock){
  9326. var self=this,$self=this;
  9327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9328. return $core.withContext(function($ctx1) {
  9329. //>>excludeEnd("ctx");
  9330. $self._withIndexDo_((function(each,index){
  9331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9332. return $core.withContext(function($ctx2) {
  9333. //>>excludeEnd("ctx");
  9334. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  9335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9336. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  9337. //>>excludeEnd("ctx");
  9338. }));
  9339. return self;
  9340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9341. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.TKeyValueCollection)});
  9342. //>>excludeEnd("ctx");
  9343. },
  9344. //>>excludeStart("ide", pragmas.excludeIdeData);
  9345. args: ["anotherCollection", "aBlock"],
  9346. 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) ]",
  9347. referencedClasses: [],
  9348. //>>excludeEnd("ide");
  9349. messageSends: ["withIndexDo:", "value:value:", "at:"]
  9350. }),
  9351. $globals.TKeyValueCollection);
  9352. $core.addMethod(
  9353. $core.method({
  9354. selector: "withIndexDo:",
  9355. protocol: "enumerating",
  9356. fn: function (aBlock){
  9357. var self=this,$self=this;
  9358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9359. return $core.withContext(function($ctx1) {
  9360. //>>excludeEnd("ctx");
  9361. $self._subclassResponsibility();
  9362. return self;
  9363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9364. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.TKeyValueCollection)});
  9365. //>>excludeEnd("ctx");
  9366. },
  9367. //>>excludeStart("ide", pragmas.excludeIdeData);
  9368. args: ["aBlock"],
  9369. 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",
  9370. referencedClasses: [],
  9371. //>>excludeEnd("ide");
  9372. messageSends: ["subclassResponsibility"]
  9373. }),
  9374. $globals.TKeyValueCollection);
  9375. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  9376. $core.addMethod(
  9377. $core.method({
  9378. selector: "at:ifAbsent:",
  9379. protocol: "accessing",
  9380. fn: function (anIndex,aBlock){
  9381. var self=this,$self=this;
  9382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9383. return $core.withContext(function($ctx1) {
  9384. //>>excludeEnd("ctx");
  9385. return anIndex >= 1 && anIndex <= self.length
  9386. ? self[anIndex - 1]
  9387. : aBlock._value()
  9388. ;
  9389. return self;
  9390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9391. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9392. //>>excludeEnd("ctx");
  9393. },
  9394. //>>excludeStart("ide", pragmas.excludeIdeData);
  9395. args: ["anIndex", "aBlock"],
  9396. 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'>",
  9397. referencedClasses: [],
  9398. //>>excludeEnd("ide");
  9399. messageSends: []
  9400. }),
  9401. $globals.TNativeZeroBasedCollection);
  9402. $core.addMethod(
  9403. $core.method({
  9404. selector: "at:ifPresent:ifAbsent:",
  9405. protocol: "accessing",
  9406. fn: function (anIndex,aBlock,anotherBlock){
  9407. var self=this,$self=this;
  9408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9409. return $core.withContext(function($ctx1) {
  9410. //>>excludeEnd("ctx");
  9411. return anIndex >= 1 && anIndex <= self.length
  9412. ? aBlock._value_(self[anIndex - 1])
  9413. : anotherBlock._value()
  9414. ;
  9415. return self;
  9416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9417. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TNativeZeroBasedCollection)});
  9418. //>>excludeEnd("ctx");
  9419. },
  9420. //>>excludeStart("ide", pragmas.excludeIdeData);
  9421. args: ["anIndex", "aBlock", "anotherBlock"],
  9422. 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'>",
  9423. referencedClasses: [],
  9424. //>>excludeEnd("ide");
  9425. messageSends: []
  9426. }),
  9427. $globals.TNativeZeroBasedCollection);
  9428. $core.addMethod(
  9429. $core.method({
  9430. selector: "detect:ifNone:",
  9431. protocol: "enumerating",
  9432. fn: function (aBlock,anotherBlock){
  9433. var self=this,$self=this;
  9434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9435. return $core.withContext(function($ctx1) {
  9436. //>>excludeEnd("ctx");
  9437. for(var i = 0; i < self.length; i++)
  9438. if(aBlock._value_(self[i]))
  9439. return self[i];
  9440. return anotherBlock._value();
  9441. ;
  9442. return self;
  9443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9444. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.TNativeZeroBasedCollection)});
  9445. //>>excludeEnd("ctx");
  9446. },
  9447. //>>excludeStart("ide", pragmas.excludeIdeData);
  9448. args: ["aBlock", "anotherBlock"],
  9449. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock._value_(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09'>",
  9450. referencedClasses: [],
  9451. //>>excludeEnd("ide");
  9452. messageSends: []
  9453. }),
  9454. $globals.TNativeZeroBasedCollection);
  9455. $core.addMethod(
  9456. $core.method({
  9457. selector: "do:",
  9458. protocol: "enumerating",
  9459. fn: function (aBlock){
  9460. var self=this,$self=this;
  9461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9462. return $core.withContext(function($ctx1) {
  9463. //>>excludeEnd("ctx");
  9464. for(var i=0; i < self.length; i++) {
  9465. aBlock._value_(self[i]);
  9466. }
  9467. ;
  9468. return self;
  9469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9470. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9471. //>>excludeEnd("ctx");
  9472. },
  9473. //>>excludeStart("ide", pragmas.excludeIdeData);
  9474. args: ["aBlock"],
  9475. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09'>",
  9476. referencedClasses: [],
  9477. //>>excludeEnd("ide");
  9478. messageSends: []
  9479. }),
  9480. $globals.TNativeZeroBasedCollection);
  9481. $core.addMethod(
  9482. $core.method({
  9483. selector: "indexOf:ifAbsent:",
  9484. protocol: "accessing",
  9485. fn: function (anObject,aBlock){
  9486. var self=this,$self=this;
  9487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9488. return $core.withContext(function($ctx1) {
  9489. //>>excludeEnd("ctx");
  9490. for(var i=0; i < self.length; i++) {
  9491. if($recv(self[i]).__eq(anObject)) {return i+1}
  9492. };
  9493. return aBlock._value();
  9494. ;
  9495. return self;
  9496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9497. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9498. //>>excludeEnd("ctx");
  9499. },
  9500. //>>excludeStart("ide", pragmas.excludeIdeData);
  9501. args: ["anObject", "aBlock"],
  9502. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  9503. referencedClasses: [],
  9504. //>>excludeEnd("ide");
  9505. messageSends: []
  9506. }),
  9507. $globals.TNativeZeroBasedCollection);
  9508. $core.addMethod(
  9509. $core.method({
  9510. selector: "indexOf:startingAt:ifAbsent:",
  9511. protocol: "accessing",
  9512. fn: function (anObject,start,aBlock){
  9513. var self=this,$self=this;
  9514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9515. return $core.withContext(function($ctx1) {
  9516. //>>excludeEnd("ctx");
  9517. for(var i=start - 1; i < self.length; i++){
  9518. if($recv(self[i]).__eq(anObject)) {return i+1}
  9519. }
  9520. return aBlock._value();
  9521. ;
  9522. return self;
  9523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9524. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9525. //>>excludeEnd("ctx");
  9526. },
  9527. //>>excludeStart("ide", pragmas.excludeIdeData);
  9528. args: ["anObject", "start", "aBlock"],
  9529. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=start - 1; i < self.length; i++){\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  9530. referencedClasses: [],
  9531. //>>excludeEnd("ide");
  9532. messageSends: []
  9533. }),
  9534. $globals.TNativeZeroBasedCollection);
  9535. $core.addMethod(
  9536. $core.method({
  9537. selector: "single",
  9538. protocol: "accessing",
  9539. fn: function (){
  9540. var self=this,$self=this;
  9541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9542. return $core.withContext(function($ctx1) {
  9543. //>>excludeEnd("ctx");
  9544. if (self.length == 0) throw new Error("Collection is empty");
  9545. if (self.length > 1) throw new Error("Collection holds more than one element.");
  9546. return self[0];;
  9547. return self;
  9548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9549. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.TNativeZeroBasedCollection)});
  9550. //>>excludeEnd("ctx");
  9551. },
  9552. //>>excludeStart("ide", pragmas.excludeIdeData);
  9553. args: [],
  9554. 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[0];\x0a'>",
  9555. referencedClasses: [],
  9556. //>>excludeEnd("ide");
  9557. messageSends: []
  9558. }),
  9559. $globals.TNativeZeroBasedCollection);
  9560. $core.addMethod(
  9561. $core.method({
  9562. selector: "size",
  9563. protocol: "accessing",
  9564. fn: function (){
  9565. var self=this,$self=this;
  9566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9567. return $core.withContext(function($ctx1) {
  9568. //>>excludeEnd("ctx");
  9569. return self.length;
  9570. return self;
  9571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9572. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.TNativeZeroBasedCollection)});
  9573. //>>excludeEnd("ctx");
  9574. },
  9575. //>>excludeStart("ide", pragmas.excludeIdeData);
  9576. args: [],
  9577. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  9578. referencedClasses: [],
  9579. //>>excludeEnd("ide");
  9580. messageSends: []
  9581. }),
  9582. $globals.TNativeZeroBasedCollection);
  9583. $core.addMethod(
  9584. $core.method({
  9585. selector: "with:do:",
  9586. protocol: "enumerating",
  9587. fn: function (anotherCollection,aBlock){
  9588. var self=this,$self=this;
  9589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9590. return $core.withContext(function($ctx1) {
  9591. //>>excludeEnd("ctx");
  9592. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  9593. for(var i=0; i<self.length; i++) {
  9594. aBlock._value_value_(self[i], anotherCollection[i]);
  9595. }
  9596. ;
  9597. return self;
  9598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9599. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9600. //>>excludeEnd("ctx");
  9601. },
  9602. //>>excludeStart("ide", pragmas.excludeIdeData);
  9603. args: ["anotherCollection", "aBlock"],
  9604. source: "with: anotherCollection do: aBlock\x0a\x09<inlineJS: '\x0a\x09 $recv(anotherCollection)._first_(0); // #guardSequenceableCollection\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09'>",
  9605. referencedClasses: [],
  9606. //>>excludeEnd("ide");
  9607. messageSends: []
  9608. }),
  9609. $globals.TNativeZeroBasedCollection);
  9610. $core.addMethod(
  9611. $core.method({
  9612. selector: "withIndexDo:",
  9613. protocol: "enumerating",
  9614. fn: function (aBlock){
  9615. var self=this,$self=this;
  9616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9617. return $core.withContext(function($ctx1) {
  9618. //>>excludeEnd("ctx");
  9619. for(var i=0; i < self.length; i++) {
  9620. aBlock._value_value_(self[i], i+1);
  9621. }
  9622. ;
  9623. return self;
  9624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9625. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9626. //>>excludeEnd("ctx");
  9627. },
  9628. //>>excludeStart("ide", pragmas.excludeIdeData);
  9629. args: ["aBlock"],
  9630. source: "withIndexDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], i+1);\x0a\x09\x09}\x0a\x09'>",
  9631. referencedClasses: [],
  9632. //>>excludeEnd("ide");
  9633. messageSends: []
  9634. }),
  9635. $globals.TNativeZeroBasedCollection);
  9636. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  9637. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  9638. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  9639. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  9640. });