Kernel-Collections.js 367 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611
  1. define(["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  2. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. var $pkg = $core.addPackage("Kernel-Collections");
  4. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  5. $core.addClass("Association", $globals.Object, "Kernel-Collections");
  6. $core.setSlots($globals.Association, ["key", "value"]);
  7. //>>excludeStart("ide", pragmas.excludeIdeData);
  8. $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:`";
  9. //>>excludeEnd("ide");
  10. $core.addMethod(
  11. $core.method({
  12. selector: "=",
  13. protocol: "comparing",
  14. //>>excludeStart("ide", pragmas.excludeIdeData);
  15. args: ["anAssociation"],
  16. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  17. referencedClasses: [],
  18. //>>excludeEnd("ide");
  19. pragmas: [],
  20. messageSends: ["and:", "=", "class", "key", "value"]
  21. }, function ($methodClass){ return function (anAssociation){
  22. var self=this,$self=this;
  23. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24. return $core.withContext(function($ctx1) {
  25. //>>excludeEnd("ctx");
  26. if($core.assert([$recv([$self._class()
  27. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28. ,$ctx1.sendIdx["class"]=1
  29. //>>excludeEnd("ctx");
  30. ][0]).__eq($recv(anAssociation)._class())
  31. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32. ,$ctx1.sendIdx["="]=1
  33. //>>excludeEnd("ctx");
  34. ][0])){
  35. if($core.assert([$recv([$self._key()
  36. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37. ,$ctx1.sendIdx["key"]=1
  38. //>>excludeEnd("ctx");
  39. ][0]).__eq($recv(anAssociation)._key())
  40. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41. ,$ctx1.sendIdx["="]=2
  42. //>>excludeEnd("ctx");
  43. ][0])){
  44. return $recv([$self._value()
  45. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46. ,$ctx1.sendIdx["value"]=1
  47. //>>excludeEnd("ctx");
  48. ][0]).__eq($recv(anAssociation)._value());
  49. } else {
  50. return false;
  51. }
  52. } else {
  53. return false;
  54. }
  55. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation})});
  57. //>>excludeEnd("ctx");
  58. }; }),
  59. $globals.Association);
  60. $core.addMethod(
  61. $core.method({
  62. selector: "key",
  63. protocol: "accessing",
  64. //>>excludeStart("ide", pragmas.excludeIdeData);
  65. args: [],
  66. source: "key\x0a\x09^ key",
  67. referencedClasses: [],
  68. //>>excludeEnd("ide");
  69. pragmas: [],
  70. messageSends: []
  71. }, function ($methodClass){ return function (){
  72. var self=this,$self=this;
  73. return $self.key;
  74. }; }),
  75. $globals.Association);
  76. $core.addMethod(
  77. $core.method({
  78. selector: "key:",
  79. protocol: "accessing",
  80. //>>excludeStart("ide", pragmas.excludeIdeData);
  81. args: ["aKey"],
  82. source: "key: aKey\x0a\x09key := aKey",
  83. referencedClasses: [],
  84. //>>excludeEnd("ide");
  85. pragmas: [],
  86. messageSends: []
  87. }, function ($methodClass){ return function (aKey){
  88. var self=this,$self=this;
  89. $self.key=aKey;
  90. return self;
  91. }; }),
  92. $globals.Association);
  93. $core.addMethod(
  94. $core.method({
  95. selector: "printOn:",
  96. protocol: "printing",
  97. //>>excludeStart("ide", pragmas.excludeIdeData);
  98. args: ["aStream"],
  99. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  100. referencedClasses: [],
  101. //>>excludeEnd("ide");
  102. pragmas: [],
  103. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  104. }, function ($methodClass){ return function (aStream){
  105. var self=this,$self=this;
  106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  107. return $core.withContext(function($ctx1) {
  108. //>>excludeEnd("ctx");
  109. [$recv($self._key())._printOn_(aStream)
  110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  111. ,$ctx1.sendIdx["printOn:"]=1
  112. //>>excludeEnd("ctx");
  113. ][0];
  114. $recv(aStream)._nextPutAll_(" -> ");
  115. $recv($self._value())._printOn_(aStream);
  116. return self;
  117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  118. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  119. //>>excludeEnd("ctx");
  120. }; }),
  121. $globals.Association);
  122. $core.addMethod(
  123. $core.method({
  124. selector: "value",
  125. protocol: "accessing",
  126. //>>excludeStart("ide", pragmas.excludeIdeData);
  127. args: [],
  128. source: "value\x0a\x09^ value",
  129. referencedClasses: [],
  130. //>>excludeEnd("ide");
  131. pragmas: [],
  132. messageSends: []
  133. }, function ($methodClass){ return function (){
  134. var self=this,$self=this;
  135. return $self.value;
  136. }; }),
  137. $globals.Association);
  138. $core.addMethod(
  139. $core.method({
  140. selector: "value:",
  141. protocol: "accessing",
  142. //>>excludeStart("ide", pragmas.excludeIdeData);
  143. args: ["aValue"],
  144. source: "value: aValue\x0a\x09value := aValue",
  145. referencedClasses: [],
  146. //>>excludeEnd("ide");
  147. pragmas: [],
  148. messageSends: []
  149. }, function ($methodClass){ return function (aValue){
  150. var self=this,$self=this;
  151. $self.value=aValue;
  152. return self;
  153. }; }),
  154. $globals.Association);
  155. $core.addMethod(
  156. $core.method({
  157. selector: "key:value:",
  158. protocol: "instance creation",
  159. //>>excludeStart("ide", pragmas.excludeIdeData);
  160. args: ["aKey", "aValue"],
  161. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  162. referencedClasses: [],
  163. //>>excludeEnd("ide");
  164. pragmas: [],
  165. messageSends: ["key:", "new", "value:", "yourself"]
  166. }, function ($methodClass){ return function (aKey,aValue){
  167. var self=this,$self=this;
  168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  169. return $core.withContext(function($ctx1) {
  170. //>>excludeEnd("ctx");
  171. var $1;
  172. $1=$self._new();
  173. $recv($1)._key_(aKey);
  174. $recv($1)._value_(aValue);
  175. return $recv($1)._yourself();
  176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  177. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue})});
  178. //>>excludeEnd("ctx");
  179. }; }),
  180. $globals.Association.a$cls);
  181. $core.addClass("BucketStore", $globals.Object, "Kernel-Collections");
  182. $core.setSlots($globals.BucketStore, ["buckets", "hashBlock"]);
  183. //>>excludeStart("ide", pragmas.excludeIdeData);
  184. $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`.";
  185. //>>excludeEnd("ide");
  186. $core.addMethod(
  187. $core.method({
  188. selector: "bucketOfElement:",
  189. protocol: "accessing",
  190. //>>excludeStart("ide", pragmas.excludeIdeData);
  191. args: ["anObject"],
  192. 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'>",
  193. referencedClasses: [],
  194. //>>excludeEnd("ide");
  195. pragmas: [["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"]]],
  196. messageSends: []
  197. }, function ($methodClass){ return function (anObject){
  198. var self=this,$self=this;
  199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  200. return $core.withContext(function($ctx1) {
  201. //>>excludeEnd("ctx");
  202. var hash = $self.hashBlock(anObject);
  203. if (!hash) return null;
  204. var buckets = $self.buckets,
  205. bucket = buckets[hash];
  206. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  207. return bucket;
  208. ;
  209. return self;
  210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  211. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject})});
  212. //>>excludeEnd("ctx");
  213. }; }),
  214. $globals.BucketStore);
  215. $core.addMethod(
  216. $core.method({
  217. selector: "do:",
  218. protocol: "enumerating",
  219. //>>excludeStart("ide", pragmas.excludeIdeData);
  220. args: ["aBlock"],
  221. 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'>",
  222. referencedClasses: [],
  223. //>>excludeEnd("ide");
  224. pragmas: [["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"]]],
  225. messageSends: []
  226. }, function ($methodClass){ return function (aBlock){
  227. var self=this,$self=this;
  228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  229. return $core.withContext(function($ctx1) {
  230. //>>excludeEnd("ctx");
  231. var buckets = $self.buckets;
  232. var keys = Object.keys(buckets);
  233. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  234. ;
  235. return self;
  236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  237. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  238. //>>excludeEnd("ctx");
  239. }; }),
  240. $globals.BucketStore);
  241. $core.addMethod(
  242. $core.method({
  243. selector: "hashBlock:",
  244. protocol: "accessing",
  245. //>>excludeStart("ide", pragmas.excludeIdeData);
  246. args: ["aBlock"],
  247. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  248. referencedClasses: [],
  249. //>>excludeEnd("ide");
  250. pragmas: [],
  251. messageSends: []
  252. }, function ($methodClass){ return function (aBlock){
  253. var self=this,$self=this;
  254. $self.hashBlock=aBlock;
  255. return self;
  256. }; }),
  257. $globals.BucketStore);
  258. $core.addMethod(
  259. $core.method({
  260. selector: "initialize",
  261. protocol: "initialization",
  262. //>>excludeStart("ide", pragmas.excludeIdeData);
  263. args: [],
  264. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  265. referencedClasses: [],
  266. //>>excludeEnd("ide");
  267. pragmas: [],
  268. messageSends: ["initialize", "removeAll"]
  269. }, function ($methodClass){ return function (){
  270. var self=this,$self=this;
  271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  272. return $core.withContext(function($ctx1) {
  273. //>>excludeEnd("ctx");
  274. [(
  275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  276. $ctx1.supercall = true,
  277. //>>excludeEnd("ctx");
  278. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  280. ,$ctx1.supercall = false
  281. //>>excludeEnd("ctx");
  282. ][0];
  283. $self._removeAll();
  284. return self;
  285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  286. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  287. //>>excludeEnd("ctx");
  288. }; }),
  289. $globals.BucketStore);
  290. $core.addMethod(
  291. $core.method({
  292. selector: "newBucket",
  293. protocol: "private",
  294. //>>excludeStart("ide", pragmas.excludeIdeData);
  295. args: [],
  296. source: "newBucket\x0a\x09self subclassResponsibility",
  297. referencedClasses: [],
  298. //>>excludeEnd("ide");
  299. pragmas: [],
  300. messageSends: ["subclassResponsibility"]
  301. }, function ($methodClass){ return function (){
  302. var self=this,$self=this;
  303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  304. return $core.withContext(function($ctx1) {
  305. //>>excludeEnd("ctx");
  306. $self._subclassResponsibility();
  307. return self;
  308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  309. }, function($ctx1) {$ctx1.fill(self,"newBucket",{})});
  310. //>>excludeEnd("ctx");
  311. }; }),
  312. $globals.BucketStore);
  313. $core.addMethod(
  314. $core.method({
  315. selector: "removeAll",
  316. protocol: "adding/removing",
  317. //>>excludeStart("ide", pragmas.excludeIdeData);
  318. args: [],
  319. source: "removeAll\x0a\x09<inlineJS: '$self.buckets = Object.create(null);'>",
  320. referencedClasses: [],
  321. //>>excludeEnd("ide");
  322. pragmas: [["inlineJS:", ["$self.buckets = Object.create(null);"]]],
  323. messageSends: []
  324. }, function ($methodClass){ return function (){
  325. var self=this,$self=this;
  326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  327. return $core.withContext(function($ctx1) {
  328. //>>excludeEnd("ctx");
  329. $self.buckets = Object.create(null);;
  330. return self;
  331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  332. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  333. //>>excludeEnd("ctx");
  334. }; }),
  335. $globals.BucketStore);
  336. $core.addMethod(
  337. $core.method({
  338. selector: "hashBlock:",
  339. protocol: "instance creation",
  340. //>>excludeStart("ide", pragmas.excludeIdeData);
  341. args: ["aBlock"],
  342. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  343. referencedClasses: [],
  344. //>>excludeEnd("ide");
  345. pragmas: [],
  346. messageSends: ["hashBlock:", "new", "yourself"]
  347. }, function ($methodClass){ return function (aBlock){
  348. var self=this,$self=this;
  349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  350. return $core.withContext(function($ctx1) {
  351. //>>excludeEnd("ctx");
  352. var $1;
  353. $1=$self._new();
  354. $recv($1)._hashBlock_(aBlock);
  355. return $recv($1)._yourself();
  356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  357. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock})});
  358. //>>excludeEnd("ctx");
  359. }; }),
  360. $globals.BucketStore.a$cls);
  361. $core.addClass("ArrayBucketStore", $globals.BucketStore, "Kernel-Collections");
  362. //>>excludeStart("ide", pragmas.excludeIdeData);
  363. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  364. //>>excludeEnd("ide");
  365. $core.addMethod(
  366. $core.method({
  367. selector: "newBucket",
  368. protocol: "private",
  369. //>>excludeStart("ide", pragmas.excludeIdeData);
  370. args: [],
  371. source: "newBucket\x0a\x09^ #()",
  372. referencedClasses: [],
  373. //>>excludeEnd("ide");
  374. pragmas: [],
  375. messageSends: []
  376. }, function ($methodClass){ return function (){
  377. var self=this,$self=this;
  378. return [];
  379. }; }),
  380. $globals.ArrayBucketStore);
  381. $core.addClass("Collection", $globals.Object, "Kernel-Collections");
  382. //>>excludeStart("ide", pragmas.excludeIdeData);
  383. $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.";
  384. //>>excludeEnd("ide");
  385. $core.addMethod(
  386. $core.method({
  387. selector: ",",
  388. protocol: "copying",
  389. //>>excludeStart("ide", pragmas.excludeIdeData);
  390. args: ["aCollection"],
  391. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  392. referencedClasses: [],
  393. //>>excludeEnd("ide");
  394. pragmas: [],
  395. messageSends: ["addAll:", "copy", "yourself"]
  396. }, function ($methodClass){ return function (aCollection){
  397. var self=this,$self=this;
  398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  399. return $core.withContext(function($ctx1) {
  400. //>>excludeEnd("ctx");
  401. var $1;
  402. $1=$self._copy();
  403. $recv($1)._addAll_(aCollection);
  404. return $recv($1)._yourself();
  405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  406. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection})});
  407. //>>excludeEnd("ctx");
  408. }; }),
  409. $globals.Collection);
  410. $core.addMethod(
  411. $core.method({
  412. selector: "add:",
  413. protocol: "adding/removing",
  414. //>>excludeStart("ide", pragmas.excludeIdeData);
  415. args: ["anObject"],
  416. source: "add: anObject\x0a\x09self subclassResponsibility",
  417. referencedClasses: [],
  418. //>>excludeEnd("ide");
  419. pragmas: [],
  420. messageSends: ["subclassResponsibility"]
  421. }, function ($methodClass){ return function (anObject){
  422. var self=this,$self=this;
  423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  424. return $core.withContext(function($ctx1) {
  425. //>>excludeEnd("ctx");
  426. $self._subclassResponsibility();
  427. return self;
  428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  429. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  430. //>>excludeEnd("ctx");
  431. }; }),
  432. $globals.Collection);
  433. $core.addMethod(
  434. $core.method({
  435. selector: "addAll:",
  436. protocol: "adding/removing",
  437. //>>excludeStart("ide", pragmas.excludeIdeData);
  438. args: ["aCollection"],
  439. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  440. referencedClasses: [],
  441. //>>excludeEnd("ide");
  442. pragmas: [],
  443. messageSends: ["do:", "add:"]
  444. }, function ($methodClass){ return function (aCollection){
  445. var self=this,$self=this;
  446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  447. return $core.withContext(function($ctx1) {
  448. //>>excludeEnd("ctx");
  449. $recv(aCollection)._do_((function(each){
  450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  451. return $core.withContext(function($ctx2) {
  452. //>>excludeEnd("ctx");
  453. return $self._add_(each);
  454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  455. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  456. //>>excludeEnd("ctx");
  457. }));
  458. return aCollection;
  459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  460. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  461. //>>excludeEnd("ctx");
  462. }; }),
  463. $globals.Collection);
  464. $core.addMethod(
  465. $core.method({
  466. selector: "allSatisfy:",
  467. protocol: "enumerating",
  468. //>>excludeStart("ide", pragmas.excludeIdeData);
  469. args: ["aBlock"],
  470. 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",
  471. referencedClasses: [],
  472. //>>excludeEnd("ide");
  473. pragmas: [],
  474. messageSends: ["do:", "ifFalse:", "value:"]
  475. }, function ($methodClass){ return function (aBlock){
  476. var self=this,$self=this;
  477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  478. return $core.withContext(function($ctx1) {
  479. //>>excludeEnd("ctx");
  480. var $early={};
  481. try {
  482. $self._do_((function(each){
  483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  484. return $core.withContext(function($ctx2) {
  485. //>>excludeEnd("ctx");
  486. if(!$core.assert($recv(aBlock)._value_(each))){
  487. throw $early=[false];
  488. }
  489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  490. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  491. //>>excludeEnd("ctx");
  492. }));
  493. return true;
  494. }
  495. catch(e) {if(e===$early)return e[0]; throw e}
  496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  497. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock})});
  498. //>>excludeEnd("ctx");
  499. }; }),
  500. $globals.Collection);
  501. $core.addMethod(
  502. $core.method({
  503. selector: "anyOne",
  504. protocol: "accessing",
  505. //>>excludeStart("ide", pragmas.excludeIdeData);
  506. args: [],
  507. 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 ]",
  508. referencedClasses: [],
  509. //>>excludeEnd("ide");
  510. pragmas: [],
  511. messageSends: ["ifEmpty:", "error:", "do:"]
  512. }, function ($methodClass){ return function (){
  513. var self=this,$self=this;
  514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  515. return $core.withContext(function($ctx1) {
  516. //>>excludeEnd("ctx");
  517. var $early={};
  518. try {
  519. $self._ifEmpty_((function(){
  520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  521. return $core.withContext(function($ctx2) {
  522. //>>excludeEnd("ctx");
  523. return $self._error_("Collection is empty");
  524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  525. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  526. //>>excludeEnd("ctx");
  527. }));
  528. $self._do_((function(each){
  529. throw $early=[each];
  530. }));
  531. return self;
  532. }
  533. catch(e) {if(e===$early)return e[0]; throw e}
  534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  535. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  536. //>>excludeEnd("ctx");
  537. }; }),
  538. $globals.Collection);
  539. $core.addMethod(
  540. $core.method({
  541. selector: "anySatisfy:",
  542. protocol: "enumerating",
  543. //>>excludeStart("ide", pragmas.excludeIdeData);
  544. args: ["aBlock"],
  545. 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",
  546. referencedClasses: [],
  547. //>>excludeEnd("ide");
  548. pragmas: [],
  549. messageSends: ["do:", "ifTrue:", "value:"]
  550. }, function ($methodClass){ return function (aBlock){
  551. var self=this,$self=this;
  552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  553. return $core.withContext(function($ctx1) {
  554. //>>excludeEnd("ctx");
  555. var $early={};
  556. try {
  557. $self._do_((function(each){
  558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  559. return $core.withContext(function($ctx2) {
  560. //>>excludeEnd("ctx");
  561. if($core.assert($recv(aBlock)._value_(each))){
  562. throw $early=[true];
  563. }
  564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  565. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  566. //>>excludeEnd("ctx");
  567. }));
  568. return false;
  569. }
  570. catch(e) {if(e===$early)return e[0]; throw e}
  571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  572. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock})});
  573. //>>excludeEnd("ctx");
  574. }; }),
  575. $globals.Collection);
  576. $core.addMethod(
  577. $core.method({
  578. selector: "asArray",
  579. protocol: "converting",
  580. //>>excludeStart("ide", pragmas.excludeIdeData);
  581. args: [],
  582. source: "asArray\x0a\x09^ Array withAll: self",
  583. referencedClasses: ["Array"],
  584. //>>excludeEnd("ide");
  585. pragmas: [],
  586. messageSends: ["withAll:"]
  587. }, function ($methodClass){ return function (){
  588. var self=this,$self=this;
  589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  590. return $core.withContext(function($ctx1) {
  591. //>>excludeEnd("ctx");
  592. return $recv($globals.Array)._withAll_(self);
  593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  594. }, function($ctx1) {$ctx1.fill(self,"asArray",{})});
  595. //>>excludeEnd("ctx");
  596. }; }),
  597. $globals.Collection);
  598. $core.addMethod(
  599. $core.method({
  600. selector: "asJavaScriptObject",
  601. protocol: "converting",
  602. //>>excludeStart("ide", pragmas.excludeIdeData);
  603. args: [],
  604. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  605. referencedClasses: [],
  606. //>>excludeEnd("ide");
  607. pragmas: [],
  608. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  609. }, function ($methodClass){ return function (){
  610. var self=this,$self=this;
  611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  612. return $core.withContext(function($ctx1) {
  613. //>>excludeEnd("ctx");
  614. return $recv($self._asArray())._collect_((function(each){
  615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  616. return $core.withContext(function($ctx2) {
  617. //>>excludeEnd("ctx");
  618. return $recv(each)._asJavaScriptObject();
  619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  620. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  621. //>>excludeEnd("ctx");
  622. }));
  623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  624. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{})});
  625. //>>excludeEnd("ctx");
  626. }; }),
  627. $globals.Collection);
  628. $core.addMethod(
  629. $core.method({
  630. selector: "asOrderedCollection",
  631. protocol: "converting",
  632. //>>excludeStart("ide", pragmas.excludeIdeData);
  633. args: [],
  634. source: "asOrderedCollection\x0a\x09^ self asArray",
  635. referencedClasses: [],
  636. //>>excludeEnd("ide");
  637. pragmas: [],
  638. messageSends: ["asArray"]
  639. }, function ($methodClass){ return function (){
  640. var self=this,$self=this;
  641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  642. return $core.withContext(function($ctx1) {
  643. //>>excludeEnd("ctx");
  644. return $self._asArray();
  645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  646. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{})});
  647. //>>excludeEnd("ctx");
  648. }; }),
  649. $globals.Collection);
  650. $core.addMethod(
  651. $core.method({
  652. selector: "asSet",
  653. protocol: "converting",
  654. //>>excludeStart("ide", pragmas.excludeIdeData);
  655. args: [],
  656. source: "asSet\x0a\x09^ Set withAll: self",
  657. referencedClasses: ["Set"],
  658. //>>excludeEnd("ide");
  659. pragmas: [],
  660. messageSends: ["withAll:"]
  661. }, function ($methodClass){ return function (){
  662. var self=this,$self=this;
  663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  664. return $core.withContext(function($ctx1) {
  665. //>>excludeEnd("ctx");
  666. return $recv($globals.Set)._withAll_(self);
  667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  668. }, function($ctx1) {$ctx1.fill(self,"asSet",{})});
  669. //>>excludeEnd("ctx");
  670. }; }),
  671. $globals.Collection);
  672. $core.addMethod(
  673. $core.method({
  674. selector: "collect:",
  675. protocol: "enumerating",
  676. //>>excludeStart("ide", pragmas.excludeIdeData);
  677. args: ["aBlock"],
  678. 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",
  679. referencedClasses: [],
  680. //>>excludeEnd("ide");
  681. pragmas: [],
  682. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  683. }, function ($methodClass){ return function (aBlock){
  684. var self=this,$self=this;
  685. var stream;
  686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  687. return $core.withContext(function($ctx1) {
  688. //>>excludeEnd("ctx");
  689. stream=$recv($recv($self._class())._new())._writeStream();
  690. $self._do_((function(each){
  691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  692. return $core.withContext(function($ctx2) {
  693. //>>excludeEnd("ctx");
  694. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  696. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  697. //>>excludeEnd("ctx");
  698. }));
  699. return $recv(stream)._contents();
  700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  701. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream})});
  702. //>>excludeEnd("ctx");
  703. }; }),
  704. $globals.Collection);
  705. $core.addMethod(
  706. $core.method({
  707. selector: "copyEmpty",
  708. protocol: "copying",
  709. //>>excludeStart("ide", pragmas.excludeIdeData);
  710. args: [],
  711. source: "copyEmpty\x0a\x09^ self class new",
  712. referencedClasses: [],
  713. //>>excludeEnd("ide");
  714. pragmas: [],
  715. messageSends: ["new", "class"]
  716. }, function ($methodClass){ return function (){
  717. var self=this,$self=this;
  718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  719. return $core.withContext(function($ctx1) {
  720. //>>excludeEnd("ctx");
  721. return $recv($self._class())._new();
  722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  723. }, function($ctx1) {$ctx1.fill(self,"copyEmpty",{})});
  724. //>>excludeEnd("ctx");
  725. }; }),
  726. $globals.Collection);
  727. $core.addMethod(
  728. $core.method({
  729. selector: "copyWith:",
  730. protocol: "copying",
  731. //>>excludeStart("ide", pragmas.excludeIdeData);
  732. args: ["anObject"],
  733. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  734. referencedClasses: [],
  735. //>>excludeEnd("ide");
  736. pragmas: [],
  737. messageSends: ["add:", "copy", "yourself"]
  738. }, function ($methodClass){ return function (anObject){
  739. var self=this,$self=this;
  740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  741. return $core.withContext(function($ctx1) {
  742. //>>excludeEnd("ctx");
  743. var $1;
  744. $1=$self._copy();
  745. $recv($1)._add_(anObject);
  746. return $recv($1)._yourself();
  747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  748. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject})});
  749. //>>excludeEnd("ctx");
  750. }; }),
  751. $globals.Collection);
  752. $core.addMethod(
  753. $core.method({
  754. selector: "copyWithAll:",
  755. protocol: "copying",
  756. //>>excludeStart("ide", pragmas.excludeIdeData);
  757. args: ["aCollection"],
  758. source: "copyWithAll: aCollection\x0a\x09self deprecatedAPI: 'Use #, instead.'.\x0a\x09^ self, aCollection",
  759. referencedClasses: [],
  760. //>>excludeEnd("ide");
  761. pragmas: [],
  762. messageSends: ["deprecatedAPI:", ","]
  763. }, function ($methodClass){ return function (aCollection){
  764. var self=this,$self=this;
  765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  766. return $core.withContext(function($ctx1) {
  767. //>>excludeEnd("ctx");
  768. $self._deprecatedAPI_("Use #, instead.");
  769. return $self.__comma(aCollection);
  770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  771. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection})});
  772. //>>excludeEnd("ctx");
  773. }; }),
  774. $globals.Collection);
  775. $core.addMethod(
  776. $core.method({
  777. selector: "copyWithout:",
  778. protocol: "copying",
  779. //>>excludeStart("ide", pragmas.excludeIdeData);
  780. args: ["anObject"],
  781. 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 ]",
  782. referencedClasses: [],
  783. //>>excludeEnd("ide");
  784. pragmas: [],
  785. messageSends: ["reject:", "="]
  786. }, function ($methodClass){ return function (anObject){
  787. var self=this,$self=this;
  788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  789. return $core.withContext(function($ctx1) {
  790. //>>excludeEnd("ctx");
  791. return $self._reject_((function(each){
  792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  793. return $core.withContext(function($ctx2) {
  794. //>>excludeEnd("ctx");
  795. return $recv(each).__eq(anObject);
  796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  797. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  798. //>>excludeEnd("ctx");
  799. }));
  800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  801. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject})});
  802. //>>excludeEnd("ctx");
  803. }; }),
  804. $globals.Collection);
  805. $core.addMethod(
  806. $core.method({
  807. selector: "copyWithoutAll:",
  808. protocol: "copying",
  809. //>>excludeStart("ide", pragmas.excludeIdeData);
  810. args: ["aCollection"],
  811. 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 ]",
  812. referencedClasses: [],
  813. //>>excludeEnd("ide");
  814. pragmas: [],
  815. messageSends: ["reject:", "includes:"]
  816. }, function ($methodClass){ return function (aCollection){
  817. var self=this,$self=this;
  818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  819. return $core.withContext(function($ctx1) {
  820. //>>excludeEnd("ctx");
  821. return $self._reject_((function(each){
  822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  823. return $core.withContext(function($ctx2) {
  824. //>>excludeEnd("ctx");
  825. return $recv(aCollection)._includes_(each);
  826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  827. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  828. //>>excludeEnd("ctx");
  829. }));
  830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  831. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection})});
  832. //>>excludeEnd("ctx");
  833. }; }),
  834. $globals.Collection);
  835. $core.addMethod(
  836. $core.method({
  837. selector: "deepCopy",
  838. protocol: "copying",
  839. //>>excludeStart("ide", pragmas.excludeIdeData);
  840. args: [],
  841. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  842. referencedClasses: [],
  843. //>>excludeEnd("ide");
  844. pragmas: [],
  845. messageSends: ["collect:", "deepCopy"]
  846. }, function ($methodClass){ return function (){
  847. var self=this,$self=this;
  848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  849. return $core.withContext(function($ctx1) {
  850. //>>excludeEnd("ctx");
  851. return $self._collect_((function(each){
  852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  853. return $core.withContext(function($ctx2) {
  854. //>>excludeEnd("ctx");
  855. return $recv(each)._deepCopy();
  856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  857. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  858. //>>excludeEnd("ctx");
  859. }));
  860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  861. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  862. //>>excludeEnd("ctx");
  863. }; }),
  864. $globals.Collection);
  865. $core.addMethod(
  866. $core.method({
  867. selector: "detect:",
  868. protocol: "enumerating",
  869. //>>excludeStart("ide", pragmas.excludeIdeData);
  870. args: ["aBlock"],
  871. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  872. referencedClasses: [],
  873. //>>excludeEnd("ide");
  874. pragmas: [],
  875. messageSends: ["detect:ifNone:", "errorNotFound"]
  876. }, function ($methodClass){ return function (aBlock){
  877. var self=this,$self=this;
  878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  879. return $core.withContext(function($ctx1) {
  880. //>>excludeEnd("ctx");
  881. return $self._detect_ifNone_(aBlock,(function(){
  882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  883. return $core.withContext(function($ctx2) {
  884. //>>excludeEnd("ctx");
  885. return $self._errorNotFound();
  886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  887. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  888. //>>excludeEnd("ctx");
  889. }));
  890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  891. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock})});
  892. //>>excludeEnd("ctx");
  893. }; }),
  894. $globals.Collection);
  895. $core.addMethod(
  896. $core.method({
  897. selector: "detect:ifNone:",
  898. protocol: "enumerating",
  899. //>>excludeStart("ide", pragmas.excludeIdeData);
  900. args: ["aBlock", "anotherBlock"],
  901. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  902. referencedClasses: [],
  903. //>>excludeEnd("ide");
  904. pragmas: [],
  905. messageSends: ["do:", "ifTrue:", "value:", "value"]
  906. }, function ($methodClass){ return function (aBlock,anotherBlock){
  907. var self=this,$self=this;
  908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  909. return $core.withContext(function($ctx1) {
  910. //>>excludeEnd("ctx");
  911. var $early={};
  912. try {
  913. $self._do_((function(each){
  914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  915. return $core.withContext(function($ctx2) {
  916. //>>excludeEnd("ctx");
  917. if($core.assert($recv(aBlock)._value_(each))){
  918. throw $early=[each];
  919. }
  920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  921. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  922. //>>excludeEnd("ctx");
  923. }));
  924. return $recv(anotherBlock)._value();
  925. }
  926. catch(e) {if(e===$early)return e[0]; throw e}
  927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  928. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  929. //>>excludeEnd("ctx");
  930. }; }),
  931. $globals.Collection);
  932. $core.addMethod(
  933. $core.method({
  934. selector: "do:",
  935. protocol: "enumerating",
  936. //>>excludeStart("ide", pragmas.excludeIdeData);
  937. args: ["aBlock"],
  938. source: "do: aBlock\x0a\x09self subclassResponsibility",
  939. referencedClasses: [],
  940. //>>excludeEnd("ide");
  941. pragmas: [],
  942. messageSends: ["subclassResponsibility"]
  943. }, function ($methodClass){ return function (aBlock){
  944. var self=this,$self=this;
  945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  946. return $core.withContext(function($ctx1) {
  947. //>>excludeEnd("ctx");
  948. $self._subclassResponsibility();
  949. return self;
  950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  951. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  952. //>>excludeEnd("ctx");
  953. }; }),
  954. $globals.Collection);
  955. $core.addMethod(
  956. $core.method({
  957. selector: "do:separatedBy:",
  958. protocol: "enumerating",
  959. //>>excludeStart("ide", pragmas.excludeIdeData);
  960. args: ["aBlock", "anotherBlock"],
  961. 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 ]",
  962. referencedClasses: [],
  963. //>>excludeEnd("ide");
  964. pragmas: [],
  965. messageSends: ["do:", "value", "value:"]
  966. }, function ($methodClass){ return function (aBlock,anotherBlock){
  967. var self=this,$self=this;
  968. var actionBeforeElement;
  969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  970. return $core.withContext(function($ctx1) {
  971. //>>excludeEnd("ctx");
  972. actionBeforeElement=(function(){
  973. actionBeforeElement=anotherBlock;
  974. return actionBeforeElement;
  975. });
  976. $self._do_((function(each){
  977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  978. return $core.withContext(function($ctx2) {
  979. //>>excludeEnd("ctx");
  980. $recv(actionBeforeElement)._value();
  981. return $recv(aBlock)._value_(each);
  982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  983. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  984. //>>excludeEnd("ctx");
  985. }));
  986. return self;
  987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  988. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement})});
  989. //>>excludeEnd("ctx");
  990. }; }),
  991. $globals.Collection);
  992. $core.addMethod(
  993. $core.method({
  994. selector: "errorNotFound",
  995. protocol: "error handling",
  996. //>>excludeStart("ide", pragmas.excludeIdeData);
  997. args: [],
  998. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  999. referencedClasses: [],
  1000. //>>excludeEnd("ide");
  1001. pragmas: [],
  1002. messageSends: ["error:"]
  1003. }, function ($methodClass){ return function (){
  1004. var self=this,$self=this;
  1005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1006. return $core.withContext(function($ctx1) {
  1007. //>>excludeEnd("ctx");
  1008. $self._error_("Object is not in the collection");
  1009. return self;
  1010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1011. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{})});
  1012. //>>excludeEnd("ctx");
  1013. }; }),
  1014. $globals.Collection);
  1015. $core.addMethod(
  1016. $core.method({
  1017. selector: "ifEmpty:",
  1018. protocol: "testing",
  1019. //>>excludeStart("ide", pragmas.excludeIdeData);
  1020. args: ["aBlock"],
  1021. 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 ]",
  1022. referencedClasses: [],
  1023. //>>excludeEnd("ide");
  1024. pragmas: [],
  1025. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  1026. }, function ($methodClass){ return function (aBlock){
  1027. var self=this,$self=this;
  1028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1029. return $core.withContext(function($ctx1) {
  1030. //>>excludeEnd("ctx");
  1031. if($core.assert($self._isEmpty())){
  1032. return $recv(aBlock)._value();
  1033. } else {
  1034. return self;
  1035. }
  1036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1037. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock})});
  1038. //>>excludeEnd("ctx");
  1039. }; }),
  1040. $globals.Collection);
  1041. $core.addMethod(
  1042. $core.method({
  1043. selector: "ifEmpty:ifNotEmpty:",
  1044. protocol: "testing",
  1045. //>>excludeStart("ide", pragmas.excludeIdeData);
  1046. args: ["aBlock", "anotherBlock"],
  1047. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  1048. referencedClasses: [],
  1049. //>>excludeEnd("ide");
  1050. pragmas: [],
  1051. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  1052. }, function ($methodClass){ return function (aBlock,anotherBlock){
  1053. var self=this,$self=this;
  1054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1055. return $core.withContext(function($ctx1) {
  1056. //>>excludeEnd("ctx");
  1057. if($core.assert($self._isEmpty())){
  1058. return $recv(aBlock)._value();
  1059. } else {
  1060. return $recv(anotherBlock)._value_(self);
  1061. }
  1062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1063. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  1064. //>>excludeEnd("ctx");
  1065. }; }),
  1066. $globals.Collection);
  1067. $core.addMethod(
  1068. $core.method({
  1069. selector: "ifNotEmpty:",
  1070. protocol: "testing",
  1071. //>>excludeStart("ide", pragmas.excludeIdeData);
  1072. args: ["aBlock"],
  1073. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  1074. referencedClasses: [],
  1075. //>>excludeEnd("ide");
  1076. pragmas: [],
  1077. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1078. }, function ($methodClass){ return function (aBlock){
  1079. var self=this,$self=this;
  1080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1081. return $core.withContext(function($ctx1) {
  1082. //>>excludeEnd("ctx");
  1083. if($core.assert($self._notEmpty())){
  1084. return $recv(aBlock)._value_(self);
  1085. } else {
  1086. return self;
  1087. }
  1088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1089. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock})});
  1090. //>>excludeEnd("ctx");
  1091. }; }),
  1092. $globals.Collection);
  1093. $core.addMethod(
  1094. $core.method({
  1095. selector: "ifNotEmpty:ifEmpty:",
  1096. protocol: "testing",
  1097. //>>excludeStart("ide", pragmas.excludeIdeData);
  1098. args: ["aBlock", "anotherBlock"],
  1099. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  1100. referencedClasses: [],
  1101. //>>excludeEnd("ide");
  1102. pragmas: [],
  1103. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  1104. }, function ($methodClass){ return function (aBlock,anotherBlock){
  1105. var self=this,$self=this;
  1106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1107. return $core.withContext(function($ctx1) {
  1108. //>>excludeEnd("ctx");
  1109. if($core.assert($self._notEmpty())){
  1110. return $recv(aBlock)._value_(self);
  1111. } else {
  1112. return $recv(anotherBlock)._value();
  1113. }
  1114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1115. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  1116. //>>excludeEnd("ctx");
  1117. }; }),
  1118. $globals.Collection);
  1119. $core.addMethod(
  1120. $core.method({
  1121. selector: "includes:",
  1122. protocol: "testing",
  1123. //>>excludeStart("ide", pragmas.excludeIdeData);
  1124. args: ["anObject"],
  1125. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  1126. referencedClasses: [],
  1127. //>>excludeEnd("ide");
  1128. pragmas: [],
  1129. messageSends: ["anySatisfy:", "="]
  1130. }, function ($methodClass){ return function (anObject){
  1131. var self=this,$self=this;
  1132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1133. return $core.withContext(function($ctx1) {
  1134. //>>excludeEnd("ctx");
  1135. return $self._anySatisfy_((function(each){
  1136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1137. return $core.withContext(function($ctx2) {
  1138. //>>excludeEnd("ctx");
  1139. return $recv(each).__eq(anObject);
  1140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1141. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1142. //>>excludeEnd("ctx");
  1143. }));
  1144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1145. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  1146. //>>excludeEnd("ctx");
  1147. }; }),
  1148. $globals.Collection);
  1149. $core.addMethod(
  1150. $core.method({
  1151. selector: "inject:into:",
  1152. protocol: "enumerating",
  1153. //>>excludeStart("ide", pragmas.excludeIdeData);
  1154. args: ["anObject", "aBlock"],
  1155. 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",
  1156. referencedClasses: [],
  1157. //>>excludeEnd("ide");
  1158. pragmas: [],
  1159. messageSends: ["do:", "value:value:"]
  1160. }, function ($methodClass){ return function (anObject,aBlock){
  1161. var self=this,$self=this;
  1162. var result;
  1163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1164. return $core.withContext(function($ctx1) {
  1165. //>>excludeEnd("ctx");
  1166. result=anObject;
  1167. $self._do_((function(each){
  1168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1169. return $core.withContext(function($ctx2) {
  1170. //>>excludeEnd("ctx");
  1171. result=$recv(aBlock)._value_value_(result,each);
  1172. return result;
  1173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1174. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1175. //>>excludeEnd("ctx");
  1176. }));
  1177. return result;
  1178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1179. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result})});
  1180. //>>excludeEnd("ctx");
  1181. }; }),
  1182. $globals.Collection);
  1183. $core.addMethod(
  1184. $core.method({
  1185. selector: "intersection:",
  1186. protocol: "enumerating",
  1187. //>>excludeStart("ide", pragmas.excludeIdeData);
  1188. args: ["aCollection"],
  1189. 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",
  1190. referencedClasses: ["Set"],
  1191. //>>excludeEnd("ide");
  1192. pragmas: [],
  1193. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  1194. }, function ($methodClass){ return function (aCollection){
  1195. var self=this,$self=this;
  1196. var set,outputSet;
  1197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1198. return $core.withContext(function($ctx1) {
  1199. //>>excludeEnd("ctx");
  1200. var $1;
  1201. set=$self._asSet();
  1202. outputSet=$recv($globals.Set)._new();
  1203. $recv(aCollection)._do_((function(each){
  1204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1205. return $core.withContext(function($ctx2) {
  1206. //>>excludeEnd("ctx");
  1207. if($core.assert([$recv(set)._includes_(each)
  1208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1209. ,$ctx2.sendIdx["includes:"]=1
  1210. //>>excludeEnd("ctx");
  1211. ][0])){
  1212. $1=$recv($recv(outputSet)._includes_(each))._not();
  1213. } else {
  1214. $1=false;
  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})});
  1226. //>>excludeEnd("ctx");
  1227. }; }),
  1228. $globals.Collection);
  1229. $core.addMethod(
  1230. $core.method({
  1231. selector: "isEmpty",
  1232. protocol: "testing",
  1233. //>>excludeStart("ide", pragmas.excludeIdeData);
  1234. args: [],
  1235. source: "isEmpty\x0a\x09^ self size = 0",
  1236. referencedClasses: [],
  1237. //>>excludeEnd("ide");
  1238. pragmas: [],
  1239. messageSends: ["=", "size"]
  1240. }, function ($methodClass){ return 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",{})});
  1248. //>>excludeEnd("ctx");
  1249. }; }),
  1250. $globals.Collection);
  1251. $core.addMethod(
  1252. $core.method({
  1253. selector: "noneSatisfy:",
  1254. protocol: "enumerating",
  1255. //>>excludeStart("ide", pragmas.excludeIdeData);
  1256. args: ["aBlock"],
  1257. 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",
  1258. referencedClasses: [],
  1259. //>>excludeEnd("ide");
  1260. pragmas: [],
  1261. messageSends: ["do:", "ifTrue:", "value:"]
  1262. }, function ($methodClass){ return function (aBlock){
  1263. var self=this,$self=this;
  1264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1265. return $core.withContext(function($ctx1) {
  1266. //>>excludeEnd("ctx");
  1267. var $early={};
  1268. try {
  1269. $self._do_((function(item){
  1270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1271. return $core.withContext(function($ctx2) {
  1272. //>>excludeEnd("ctx");
  1273. if($core.assert($recv(aBlock)._value_(item))){
  1274. throw $early=[false];
  1275. }
  1276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1277. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  1278. //>>excludeEnd("ctx");
  1279. }));
  1280. return true;
  1281. }
  1282. catch(e) {if(e===$early)return e[0]; throw e}
  1283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1284. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock})});
  1285. //>>excludeEnd("ctx");
  1286. }; }),
  1287. $globals.Collection);
  1288. $core.addMethod(
  1289. $core.method({
  1290. selector: "notEmpty",
  1291. protocol: "testing",
  1292. //>>excludeStart("ide", pragmas.excludeIdeData);
  1293. args: [],
  1294. source: "notEmpty\x0a\x09^ self isEmpty not",
  1295. referencedClasses: [],
  1296. //>>excludeEnd("ide");
  1297. pragmas: [],
  1298. messageSends: ["not", "isEmpty"]
  1299. }, function ($methodClass){ return function (){
  1300. var self=this,$self=this;
  1301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1302. return $core.withContext(function($ctx1) {
  1303. //>>excludeEnd("ctx");
  1304. return $recv($self._isEmpty())._not();
  1305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1306. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{})});
  1307. //>>excludeEnd("ctx");
  1308. }; }),
  1309. $globals.Collection);
  1310. $core.addMethod(
  1311. $core.method({
  1312. selector: "occurrencesOf:",
  1313. protocol: "accessing",
  1314. //>>excludeStart("ide", pragmas.excludeIdeData);
  1315. args: ["anObject"],
  1316. 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",
  1317. referencedClasses: [],
  1318. //>>excludeEnd("ide");
  1319. pragmas: [],
  1320. messageSends: ["do:", "ifTrue:", "=", "+"]
  1321. }, function ($methodClass){ return function (anObject){
  1322. var self=this,$self=this;
  1323. var tally;
  1324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1325. return $core.withContext(function($ctx1) {
  1326. //>>excludeEnd("ctx");
  1327. tally=(0);
  1328. $self._do_((function(each){
  1329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1330. return $core.withContext(function($ctx2) {
  1331. //>>excludeEnd("ctx");
  1332. if($core.assert($recv(anObject).__eq(each))){
  1333. tally=$recv(tally).__plus((1));
  1334. return tally;
  1335. }
  1336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1337. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1338. //>>excludeEnd("ctx");
  1339. }));
  1340. return tally;
  1341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1342. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally})});
  1343. //>>excludeEnd("ctx");
  1344. }; }),
  1345. $globals.Collection);
  1346. $core.addMethod(
  1347. $core.method({
  1348. selector: "putOn:",
  1349. protocol: "streaming",
  1350. //>>excludeStart("ide", pragmas.excludeIdeData);
  1351. args: ["aStream"],
  1352. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  1353. referencedClasses: [],
  1354. //>>excludeEnd("ide");
  1355. pragmas: [],
  1356. messageSends: ["do:", "putOn:"]
  1357. }, function ($methodClass){ return function (aStream){
  1358. var self=this,$self=this;
  1359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1360. return $core.withContext(function($ctx1) {
  1361. //>>excludeEnd("ctx");
  1362. $self._do_((function(each){
  1363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1364. return $core.withContext(function($ctx2) {
  1365. //>>excludeEnd("ctx");
  1366. return $recv(each)._putOn_(aStream);
  1367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1368. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1369. //>>excludeEnd("ctx");
  1370. }));
  1371. return self;
  1372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1373. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  1374. //>>excludeEnd("ctx");
  1375. }; }),
  1376. $globals.Collection);
  1377. $core.addMethod(
  1378. $core.method({
  1379. selector: "reject:",
  1380. protocol: "enumerating",
  1381. //>>excludeStart("ide", pragmas.excludeIdeData);
  1382. args: ["aBlock"],
  1383. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  1384. referencedClasses: [],
  1385. //>>excludeEnd("ide");
  1386. pragmas: [],
  1387. messageSends: ["select:", "=", "value:"]
  1388. }, function ($methodClass){ return function (aBlock){
  1389. var self=this,$self=this;
  1390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1391. return $core.withContext(function($ctx1) {
  1392. //>>excludeEnd("ctx");
  1393. return $self._select_((function(each){
  1394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1395. return $core.withContext(function($ctx2) {
  1396. //>>excludeEnd("ctx");
  1397. return $recv($recv(aBlock)._value_(each)).__eq(false);
  1398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1399. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1400. //>>excludeEnd("ctx");
  1401. }));
  1402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1403. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock})});
  1404. //>>excludeEnd("ctx");
  1405. }; }),
  1406. $globals.Collection);
  1407. $core.addMethod(
  1408. $core.method({
  1409. selector: "remove:",
  1410. protocol: "adding/removing",
  1411. //>>excludeStart("ide", pragmas.excludeIdeData);
  1412. args: ["anObject"],
  1413. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  1414. referencedClasses: [],
  1415. //>>excludeEnd("ide");
  1416. pragmas: [],
  1417. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  1418. }, function ($methodClass){ return function (anObject){
  1419. var self=this,$self=this;
  1420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1421. return $core.withContext(function($ctx1) {
  1422. //>>excludeEnd("ctx");
  1423. return $self._remove_ifAbsent_(anObject,(function(){
  1424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1425. return $core.withContext(function($ctx2) {
  1426. //>>excludeEnd("ctx");
  1427. return $self._errorNotFound();
  1428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1429. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1430. //>>excludeEnd("ctx");
  1431. }));
  1432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1433. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  1434. //>>excludeEnd("ctx");
  1435. }; }),
  1436. $globals.Collection);
  1437. $core.addMethod(
  1438. $core.method({
  1439. selector: "remove:ifAbsent:",
  1440. protocol: "adding/removing",
  1441. //>>excludeStart("ide", pragmas.excludeIdeData);
  1442. args: ["anObject", "aBlock"],
  1443. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1444. referencedClasses: [],
  1445. //>>excludeEnd("ide");
  1446. pragmas: [],
  1447. messageSends: ["subclassResponsibility"]
  1448. }, function ($methodClass){ return function (anObject,aBlock){
  1449. var self=this,$self=this;
  1450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1451. return $core.withContext(function($ctx1) {
  1452. //>>excludeEnd("ctx");
  1453. $self._subclassResponsibility();
  1454. return self;
  1455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1456. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  1457. //>>excludeEnd("ctx");
  1458. }; }),
  1459. $globals.Collection);
  1460. $core.addMethod(
  1461. $core.method({
  1462. selector: "removeAll",
  1463. protocol: "adding/removing",
  1464. //>>excludeStart("ide", pragmas.excludeIdeData);
  1465. args: [],
  1466. source: "removeAll\x0a\x09self subclassResponsibility",
  1467. referencedClasses: [],
  1468. //>>excludeEnd("ide");
  1469. pragmas: [],
  1470. messageSends: ["subclassResponsibility"]
  1471. }, function ($methodClass){ return function (){
  1472. var self=this,$self=this;
  1473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1474. return $core.withContext(function($ctx1) {
  1475. //>>excludeEnd("ctx");
  1476. $self._subclassResponsibility();
  1477. return self;
  1478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1479. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  1480. //>>excludeEnd("ctx");
  1481. }; }),
  1482. $globals.Collection);
  1483. $core.addMethod(
  1484. $core.method({
  1485. selector: "select:",
  1486. protocol: "enumerating",
  1487. //>>excludeStart("ide", pragmas.excludeIdeData);
  1488. args: ["aBlock"],
  1489. 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",
  1490. referencedClasses: [],
  1491. //>>excludeEnd("ide");
  1492. pragmas: [],
  1493. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1494. }, function ($methodClass){ return function (aBlock){
  1495. var self=this,$self=this;
  1496. var stream;
  1497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1498. return $core.withContext(function($ctx1) {
  1499. //>>excludeEnd("ctx");
  1500. stream=$recv($recv($self._class())._new())._writeStream();
  1501. $self._do_((function(each){
  1502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1503. return $core.withContext(function($ctx2) {
  1504. //>>excludeEnd("ctx");
  1505. if($core.assert($recv(aBlock)._value_(each))){
  1506. return $recv(stream)._nextPut_(each);
  1507. }
  1508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1509. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1510. //>>excludeEnd("ctx");
  1511. }));
  1512. return $recv(stream)._contents();
  1513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1514. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream})});
  1515. //>>excludeEnd("ctx");
  1516. }; }),
  1517. $globals.Collection);
  1518. $core.addMethod(
  1519. $core.method({
  1520. selector: "select:thenCollect:",
  1521. protocol: "enumerating",
  1522. //>>excludeStart("ide", pragmas.excludeIdeData);
  1523. args: ["selectBlock", "collectBlock"],
  1524. 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",
  1525. referencedClasses: [],
  1526. //>>excludeEnd("ide");
  1527. pragmas: [],
  1528. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1529. }, function ($methodClass){ return function (selectBlock,collectBlock){
  1530. var self=this,$self=this;
  1531. var stream;
  1532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1533. return $core.withContext(function($ctx1) {
  1534. //>>excludeEnd("ctx");
  1535. stream=$recv($recv($self._class())._new())._writeStream();
  1536. $self._do_((function(each){
  1537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1538. return $core.withContext(function($ctx2) {
  1539. //>>excludeEnd("ctx");
  1540. if($core.assert([$recv(selectBlock)._value_(each)
  1541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1542. ,$ctx2.sendIdx["value:"]=1
  1543. //>>excludeEnd("ctx");
  1544. ][0])){
  1545. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  1546. }
  1547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1548. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1549. //>>excludeEnd("ctx");
  1550. }));
  1551. return $recv(stream)._contents();
  1552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1553. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream})});
  1554. //>>excludeEnd("ctx");
  1555. }; }),
  1556. $globals.Collection);
  1557. $core.addMethod(
  1558. $core.method({
  1559. selector: "shallowCopy",
  1560. protocol: "copying",
  1561. //>>excludeStart("ide", pragmas.excludeIdeData);
  1562. args: [],
  1563. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  1564. referencedClasses: [],
  1565. //>>excludeEnd("ide");
  1566. pragmas: [],
  1567. messageSends: ["collect:"]
  1568. }, function ($methodClass){ return function (){
  1569. var self=this,$self=this;
  1570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1571. return $core.withContext(function($ctx1) {
  1572. //>>excludeEnd("ctx");
  1573. return $self._collect_((function(each){
  1574. return each;
  1575. }));
  1576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1577. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  1578. //>>excludeEnd("ctx");
  1579. }; }),
  1580. $globals.Collection);
  1581. $core.addMethod(
  1582. $core.method({
  1583. selector: "shortenedPrintString",
  1584. protocol: "printing",
  1585. //>>excludeStart("ide", pragmas.excludeIdeData);
  1586. args: [],
  1587. source: "shortenedPrintString\x0a\x09^ self size <= 1\x0a\x09\x09ifTrue: [ self printString ]\x0a\x09\x09ifFalse: [ (self copyEmpty copyWith: self anyOne) printString, ' ... ', (self size - 1) asString, ' more items' ]",
  1588. referencedClasses: [],
  1589. //>>excludeEnd("ide");
  1590. pragmas: [],
  1591. messageSends: ["ifTrue:ifFalse:", "<=", "size", "printString", ",", "copyWith:", "copyEmpty", "anyOne", "asString", "-"]
  1592. }, function ($methodClass){ return function (){
  1593. var self=this,$self=this;
  1594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1595. return $core.withContext(function($ctx1) {
  1596. //>>excludeEnd("ctx");
  1597. if($core.assert($recv([$self._size()
  1598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1599. ,$ctx1.sendIdx["size"]=1
  1600. //>>excludeEnd("ctx");
  1601. ][0]).__lt_eq((1)))){
  1602. return [$self._printString()
  1603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1604. ,$ctx1.sendIdx["printString"]=1
  1605. //>>excludeEnd("ctx");
  1606. ][0];
  1607. } else {
  1608. return [$recv([$recv($recv($recv($recv($self._copyEmpty())._copyWith_($self._anyOne()))._printString()).__comma(" ... ")).__comma($recv($recv($self._size()).__minus((1)))._asString())
  1609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1610. ,$ctx1.sendIdx[","]=2
  1611. //>>excludeEnd("ctx");
  1612. ][0]).__comma(" more items")
  1613. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1614. ,$ctx1.sendIdx[","]=1
  1615. //>>excludeEnd("ctx");
  1616. ][0];
  1617. }
  1618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1619. }, function($ctx1) {$ctx1.fill(self,"shortenedPrintString",{})});
  1620. //>>excludeEnd("ctx");
  1621. }; }),
  1622. $globals.Collection);
  1623. $core.addMethod(
  1624. $core.method({
  1625. selector: "single",
  1626. protocol: "accessing",
  1627. //>>excludeStart("ide", pragmas.excludeIdeData);
  1628. args: [],
  1629. 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",
  1630. referencedClasses: [],
  1631. //>>excludeEnd("ide");
  1632. pragmas: [],
  1633. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  1634. }, function ($methodClass){ return function (){
  1635. var self=this,$self=this;
  1636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1637. return $core.withContext(function($ctx1) {
  1638. //>>excludeEnd("ctx");
  1639. $self._ifEmpty_((function(){
  1640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1641. return $core.withContext(function($ctx2) {
  1642. //>>excludeEnd("ctx");
  1643. return [$self._error_("Collection is empty")
  1644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1645. ,$ctx2.sendIdx["error:"]=1
  1646. //>>excludeEnd("ctx");
  1647. ][0];
  1648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1649. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1650. //>>excludeEnd("ctx");
  1651. }));
  1652. if($core.assert($recv($self._size()).__gt((1)))){
  1653. $self._error_("Collection holds more than one element");
  1654. }
  1655. return $self._anyOne();
  1656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1657. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  1658. //>>excludeEnd("ctx");
  1659. }; }),
  1660. $globals.Collection);
  1661. $core.addMethod(
  1662. $core.method({
  1663. selector: "size",
  1664. protocol: "accessing",
  1665. //>>excludeStart("ide", pragmas.excludeIdeData);
  1666. args: [],
  1667. source: "size\x0a\x09self subclassResponsibility",
  1668. referencedClasses: [],
  1669. //>>excludeEnd("ide");
  1670. pragmas: [],
  1671. messageSends: ["subclassResponsibility"]
  1672. }, function ($methodClass){ return function (){
  1673. var self=this,$self=this;
  1674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1675. return $core.withContext(function($ctx1) {
  1676. //>>excludeEnd("ctx");
  1677. $self._subclassResponsibility();
  1678. return self;
  1679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1680. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  1681. //>>excludeEnd("ctx");
  1682. }; }),
  1683. $globals.Collection);
  1684. $core.addMethod(
  1685. $core.method({
  1686. selector: "classTag",
  1687. protocol: "accessing",
  1688. //>>excludeStart("ide", pragmas.excludeIdeData);
  1689. args: [],
  1690. 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'",
  1691. referencedClasses: [],
  1692. //>>excludeEnd("ide");
  1693. pragmas: [],
  1694. messageSends: []
  1695. }, function ($methodClass){ return function (){
  1696. var self=this,$self=this;
  1697. return "collection";
  1698. }; }),
  1699. $globals.Collection.a$cls);
  1700. $core.addMethod(
  1701. $core.method({
  1702. selector: "new:",
  1703. protocol: "instance creation",
  1704. //>>excludeStart("ide", pragmas.excludeIdeData);
  1705. args: ["anInteger"],
  1706. source: "new: anInteger\x0a\x09^ self new",
  1707. referencedClasses: [],
  1708. //>>excludeEnd("ide");
  1709. pragmas: [],
  1710. messageSends: ["new"]
  1711. }, function ($methodClass){ return function (anInteger){
  1712. var self=this,$self=this;
  1713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1714. return $core.withContext(function($ctx1) {
  1715. //>>excludeEnd("ctx");
  1716. return $self._new();
  1717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1718. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  1719. //>>excludeEnd("ctx");
  1720. }; }),
  1721. $globals.Collection.a$cls);
  1722. $core.addMethod(
  1723. $core.method({
  1724. selector: "with:",
  1725. protocol: "instance creation",
  1726. //>>excludeStart("ide", pragmas.excludeIdeData);
  1727. args: ["anObject"],
  1728. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1729. referencedClasses: [],
  1730. //>>excludeEnd("ide");
  1731. pragmas: [],
  1732. messageSends: ["add:", "new", "yourself"]
  1733. }, function ($methodClass){ return function (anObject){
  1734. var self=this,$self=this;
  1735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1736. return $core.withContext(function($ctx1) {
  1737. //>>excludeEnd("ctx");
  1738. var $1;
  1739. $1=$self._new();
  1740. $recv($1)._add_(anObject);
  1741. return $recv($1)._yourself();
  1742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1743. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  1744. //>>excludeEnd("ctx");
  1745. }; }),
  1746. $globals.Collection.a$cls);
  1747. $core.addMethod(
  1748. $core.method({
  1749. selector: "with:with:",
  1750. protocol: "instance creation",
  1751. //>>excludeStart("ide", pragmas.excludeIdeData);
  1752. args: ["anObject", "anotherObject"],
  1753. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1754. referencedClasses: [],
  1755. //>>excludeEnd("ide");
  1756. pragmas: [],
  1757. messageSends: ["add:", "new", "yourself"]
  1758. }, function ($methodClass){ return function (anObject,anotherObject){
  1759. var self=this,$self=this;
  1760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1761. return $core.withContext(function($ctx1) {
  1762. //>>excludeEnd("ctx");
  1763. var $1;
  1764. $1=$self._new();
  1765. [$recv($1)._add_(anObject)
  1766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1767. ,$ctx1.sendIdx["add:"]=1
  1768. //>>excludeEnd("ctx");
  1769. ][0];
  1770. $recv($1)._add_(anotherObject);
  1771. return $recv($1)._yourself();
  1772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1773. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject})});
  1774. //>>excludeEnd("ctx");
  1775. }; }),
  1776. $globals.Collection.a$cls);
  1777. $core.addMethod(
  1778. $core.method({
  1779. selector: "with:with:with:",
  1780. protocol: "instance creation",
  1781. //>>excludeStart("ide", pragmas.excludeIdeData);
  1782. args: ["firstObject", "secondObject", "thirdObject"],
  1783. 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",
  1784. referencedClasses: [],
  1785. //>>excludeEnd("ide");
  1786. pragmas: [],
  1787. messageSends: ["add:", "new", "yourself"]
  1788. }, function ($methodClass){ return function (firstObject,secondObject,thirdObject){
  1789. var self=this,$self=this;
  1790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1791. return $core.withContext(function($ctx1) {
  1792. //>>excludeEnd("ctx");
  1793. var $1;
  1794. $1=$self._new();
  1795. [$recv($1)._add_(firstObject)
  1796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1797. ,$ctx1.sendIdx["add:"]=1
  1798. //>>excludeEnd("ctx");
  1799. ][0];
  1800. [$recv($1)._add_(secondObject)
  1801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1802. ,$ctx1.sendIdx["add:"]=2
  1803. //>>excludeEnd("ctx");
  1804. ][0];
  1805. $recv($1)._add_(thirdObject);
  1806. return $recv($1)._yourself();
  1807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1808. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject})});
  1809. //>>excludeEnd("ctx");
  1810. }; }),
  1811. $globals.Collection.a$cls);
  1812. $core.addMethod(
  1813. $core.method({
  1814. selector: "withAll:",
  1815. protocol: "instance creation",
  1816. //>>excludeStart("ide", pragmas.excludeIdeData);
  1817. args: ["aCollection"],
  1818. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1819. referencedClasses: [],
  1820. //>>excludeEnd("ide");
  1821. pragmas: [],
  1822. messageSends: ["addAll:", "new", "yourself"]
  1823. }, function ($methodClass){ return function (aCollection){
  1824. var self=this,$self=this;
  1825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1826. return $core.withContext(function($ctx1) {
  1827. //>>excludeEnd("ctx");
  1828. var $1;
  1829. $1=$self._new();
  1830. $recv($1)._addAll_(aCollection);
  1831. return $recv($1)._yourself();
  1832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1833. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection})});
  1834. //>>excludeEnd("ctx");
  1835. }; }),
  1836. $globals.Collection.a$cls);
  1837. $core.addClass("AssociativeCollection", $globals.Collection, "Kernel-Collections");
  1838. //>>excludeStart("ide", pragmas.excludeIdeData);
  1839. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  1840. //>>excludeEnd("ide");
  1841. $core.addMethod(
  1842. $core.method({
  1843. selector: "=",
  1844. protocol: "comparing",
  1845. //>>excludeStart("ide", pragmas.excludeIdeData);
  1846. args: ["anAssociativeCollection"],
  1847. source: "= anAssociativeCollection\x0a\x09^ self class = anAssociativeCollection class and: [\x0a\x09\x09self size = anAssociativeCollection size and: [\x0a\x09\x09\x09| comparisons |\x0a\x09\x09\x09comparisons := OrderedCollection new.\x0a\x09\x09\x09(self associations allSatisfy: [ :each |\x0a\x09\x09\x09\x09anAssociativeCollection at: each key\x0a\x09\x09\x09\x09\x09ifPresent: [ :otherValue | comparisons add: { each value. otherValue }. true ]\x0a\x09\x09\x09\x09\x09ifAbsent: [ false ] ]) and: [\x0a\x09\x09\x09\x09\x09\x09comparisons allSatisfy: [ :each | each first = each second ] ] ] ]",
  1848. referencedClasses: ["OrderedCollection"],
  1849. //>>excludeEnd("ide");
  1850. pragmas: [],
  1851. messageSends: ["and:", "=", "class", "size", "new", "allSatisfy:", "associations", "at:ifPresent:ifAbsent:", "key", "add:", "value", "first", "second"]
  1852. }, function ($methodClass){ return function (anAssociativeCollection){
  1853. var self=this,$self=this;
  1854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1855. return $core.withContext(function($ctx1) {
  1856. //>>excludeEnd("ctx");
  1857. if($core.assert([$recv([$self._class()
  1858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1859. ,$ctx1.sendIdx["class"]=1
  1860. //>>excludeEnd("ctx");
  1861. ][0]).__eq($recv(anAssociativeCollection)._class())
  1862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1863. ,$ctx1.sendIdx["="]=1
  1864. //>>excludeEnd("ctx");
  1865. ][0])){
  1866. if($core.assert([$recv([$self._size()
  1867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1868. ,$ctx1.sendIdx["size"]=1
  1869. //>>excludeEnd("ctx");
  1870. ][0]).__eq($recv(anAssociativeCollection)._size())
  1871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1872. ,$ctx1.sendIdx["="]=2
  1873. //>>excludeEnd("ctx");
  1874. ][0])){
  1875. var comparisons;
  1876. comparisons=$recv($globals.OrderedCollection)._new();
  1877. if($core.assert([$recv($self._associations())._allSatisfy_((function(each){
  1878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1879. return $core.withContext(function($ctx2) {
  1880. //>>excludeEnd("ctx");
  1881. return $recv(anAssociativeCollection)._at_ifPresent_ifAbsent_($recv(each)._key(),(function(otherValue){
  1882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1883. return $core.withContext(function($ctx3) {
  1884. //>>excludeEnd("ctx");
  1885. $recv(comparisons)._add_([$recv(each)._value(),otherValue]);
  1886. return true;
  1887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1888. }, function($ctx3) {$ctx3.fillBlock({otherValue:otherValue},$ctx2,4)});
  1889. //>>excludeEnd("ctx");
  1890. }),(function(){
  1891. return false;
  1892. }));
  1893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1894. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  1895. //>>excludeEnd("ctx");
  1896. }))
  1897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1898. ,$ctx1.sendIdx["allSatisfy:"]=1
  1899. //>>excludeEnd("ctx");
  1900. ][0])){
  1901. return $recv(comparisons)._allSatisfy_((function(each){
  1902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1903. return $core.withContext(function($ctx2) {
  1904. //>>excludeEnd("ctx");
  1905. return $recv($recv(each)._first()).__eq($recv(each)._second());
  1906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1907. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  1908. //>>excludeEnd("ctx");
  1909. }));
  1910. } else {
  1911. return false;
  1912. }
  1913. } else {
  1914. return false;
  1915. }
  1916. } else {
  1917. return false;
  1918. }
  1919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1920. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociativeCollection:anAssociativeCollection})});
  1921. //>>excludeEnd("ctx");
  1922. }; }),
  1923. $globals.AssociativeCollection);
  1924. $core.addMethod(
  1925. $core.method({
  1926. selector: "add:",
  1927. protocol: "adding/removing",
  1928. //>>excludeStart("ide", pragmas.excludeIdeData);
  1929. args: ["anAssociation"],
  1930. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  1931. referencedClasses: [],
  1932. //>>excludeEnd("ide");
  1933. pragmas: [],
  1934. messageSends: ["at:put:", "key", "value"]
  1935. }, function ($methodClass){ return function (anAssociation){
  1936. var self=this,$self=this;
  1937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1938. return $core.withContext(function($ctx1) {
  1939. //>>excludeEnd("ctx");
  1940. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  1941. return self;
  1942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1943. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation})});
  1944. //>>excludeEnd("ctx");
  1945. }; }),
  1946. $globals.AssociativeCollection);
  1947. $core.addMethod(
  1948. $core.method({
  1949. selector: "addAll:",
  1950. protocol: "adding/removing",
  1951. //>>excludeStart("ide", pragmas.excludeIdeData);
  1952. args: ["anAssociativeCollection"],
  1953. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  1954. referencedClasses: [],
  1955. //>>excludeEnd("ide");
  1956. pragmas: [],
  1957. messageSends: ["addAll:", "associations"]
  1958. }, function ($methodClass){ return function (anAssociativeCollection){
  1959. var self=this,$self=this;
  1960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1961. return $core.withContext(function($ctx1) {
  1962. //>>excludeEnd("ctx");
  1963. [(
  1964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1965. $ctx1.supercall = true,
  1966. //>>excludeEnd("ctx");
  1967. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._addAll_.call($self,$recv(anAssociativeCollection)._associations()))
  1968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1969. ,$ctx1.supercall = false
  1970. //>>excludeEnd("ctx");
  1971. ][0];
  1972. return anAssociativeCollection;
  1973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1974. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection})});
  1975. //>>excludeEnd("ctx");
  1976. }; }),
  1977. $globals.AssociativeCollection);
  1978. $core.addMethod(
  1979. $core.method({
  1980. selector: "asDictionary",
  1981. protocol: "converting",
  1982. //>>excludeStart("ide", pragmas.excludeIdeData);
  1983. args: [],
  1984. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  1985. referencedClasses: ["Dictionary"],
  1986. //>>excludeEnd("ide");
  1987. pragmas: [],
  1988. messageSends: ["from:", "associations"]
  1989. }, function ($methodClass){ return function (){
  1990. var self=this,$self=this;
  1991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1992. return $core.withContext(function($ctx1) {
  1993. //>>excludeEnd("ctx");
  1994. return $recv($globals.Dictionary)._from_($self._associations());
  1995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1996. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{})});
  1997. //>>excludeEnd("ctx");
  1998. }; }),
  1999. $globals.AssociativeCollection);
  2000. $core.addMethod(
  2001. $core.method({
  2002. selector: "asHashedCollection",
  2003. protocol: "converting",
  2004. //>>excludeStart("ide", pragmas.excludeIdeData);
  2005. args: [],
  2006. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  2007. referencedClasses: ["HashedCollection"],
  2008. //>>excludeEnd("ide");
  2009. pragmas: [],
  2010. messageSends: ["from:", "associations"]
  2011. }, function ($methodClass){ return function (){
  2012. var self=this,$self=this;
  2013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2014. return $core.withContext(function($ctx1) {
  2015. //>>excludeEnd("ctx");
  2016. return $recv($globals.HashedCollection)._from_($self._associations());
  2017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2018. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{})});
  2019. //>>excludeEnd("ctx");
  2020. }; }),
  2021. $globals.AssociativeCollection);
  2022. $core.addMethod(
  2023. $core.method({
  2024. selector: "asJavaScriptObject",
  2025. protocol: "converting",
  2026. //>>excludeStart("ide", pragmas.excludeIdeData);
  2027. args: [],
  2028. 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",
  2029. referencedClasses: ["HashedCollection"],
  2030. //>>excludeEnd("ide");
  2031. pragmas: [],
  2032. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  2033. }, function ($methodClass){ return function (){
  2034. var self=this,$self=this;
  2035. var hash;
  2036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2037. return $core.withContext(function($ctx1) {
  2038. //>>excludeEnd("ctx");
  2039. hash=$recv($globals.HashedCollection)._new();
  2040. $self._keysAndValuesDo_((function(key,value){
  2041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2042. return $core.withContext(function($ctx2) {
  2043. //>>excludeEnd("ctx");
  2044. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  2045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2046. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2047. //>>excludeEnd("ctx");
  2048. }));
  2049. return hash;
  2050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2051. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash})});
  2052. //>>excludeEnd("ctx");
  2053. }; }),
  2054. $globals.AssociativeCollection);
  2055. $core.addMethod(
  2056. $core.method({
  2057. selector: "associations",
  2058. protocol: "accessing",
  2059. //>>excludeStart("ide", pragmas.excludeIdeData);
  2060. args: [],
  2061. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  2062. referencedClasses: [],
  2063. //>>excludeEnd("ide");
  2064. pragmas: [],
  2065. messageSends: ["associationsDo:", "add:"]
  2066. }, function ($methodClass){ return function (){
  2067. var self=this,$self=this;
  2068. var associations;
  2069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2070. return $core.withContext(function($ctx1) {
  2071. //>>excludeEnd("ctx");
  2072. associations=[];
  2073. $self._associationsDo_((function(each){
  2074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2075. return $core.withContext(function($ctx2) {
  2076. //>>excludeEnd("ctx");
  2077. return $recv(associations)._add_(each);
  2078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2079. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2080. //>>excludeEnd("ctx");
  2081. }));
  2082. return associations;
  2083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2084. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations})});
  2085. //>>excludeEnd("ctx");
  2086. }; }),
  2087. $globals.AssociativeCollection);
  2088. $core.addMethod(
  2089. $core.method({
  2090. selector: "associationsDo:",
  2091. protocol: "enumerating",
  2092. //>>excludeStart("ide", pragmas.excludeIdeData);
  2093. args: ["aBlock"],
  2094. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2095. referencedClasses: ["Association"],
  2096. //>>excludeEnd("ide");
  2097. pragmas: [],
  2098. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2099. }, function ($methodClass){ return function (aBlock){
  2100. var self=this,$self=this;
  2101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2102. return $core.withContext(function($ctx1) {
  2103. //>>excludeEnd("ctx");
  2104. $self._keysAndValuesDo_((function(key,value){
  2105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2106. return $core.withContext(function($ctx2) {
  2107. //>>excludeEnd("ctx");
  2108. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  2109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2110. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2111. //>>excludeEnd("ctx");
  2112. }));
  2113. return self;
  2114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2115. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock})});
  2116. //>>excludeEnd("ctx");
  2117. }; }),
  2118. $globals.AssociativeCollection);
  2119. $core.addMethod(
  2120. $core.method({
  2121. selector: "at:ifPresent:ifAbsent:",
  2122. protocol: "accessing",
  2123. //>>excludeStart("ide", pragmas.excludeIdeData);
  2124. args: ["aKey", "aBlock", "anotherBlock"],
  2125. 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 ]",
  2126. referencedClasses: [],
  2127. //>>excludeEnd("ide");
  2128. pragmas: [],
  2129. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2130. }, function ($methodClass){ return function (aKey,aBlock,anotherBlock){
  2131. var self=this,$self=this;
  2132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2133. return $core.withContext(function($ctx1) {
  2134. //>>excludeEnd("ctx");
  2135. if($core.assert($self._includesKey_(aKey))){
  2136. return $recv(aBlock)._value_($self._at_(aKey));
  2137. } else {
  2138. return $recv(anotherBlock)._value();
  2139. }
  2140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2141. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock})});
  2142. //>>excludeEnd("ctx");
  2143. }; }),
  2144. $globals.AssociativeCollection);
  2145. $core.addMethod(
  2146. $core.method({
  2147. selector: "collect:",
  2148. protocol: "enumerating",
  2149. //>>excludeStart("ide", pragmas.excludeIdeData);
  2150. args: ["aBlock"],
  2151. 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",
  2152. referencedClasses: [],
  2153. //>>excludeEnd("ide");
  2154. pragmas: [],
  2155. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  2156. }, function ($methodClass){ return function (aBlock){
  2157. var self=this,$self=this;
  2158. var newDict;
  2159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2160. return $core.withContext(function($ctx1) {
  2161. //>>excludeEnd("ctx");
  2162. newDict=$recv($self._class())._new();
  2163. $self._keysAndValuesDo_((function(key,value){
  2164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2165. return $core.withContext(function($ctx2) {
  2166. //>>excludeEnd("ctx");
  2167. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  2168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2169. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2170. //>>excludeEnd("ctx");
  2171. }));
  2172. return newDict;
  2173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2174. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict})});
  2175. //>>excludeEnd("ctx");
  2176. }; }),
  2177. $globals.AssociativeCollection);
  2178. $core.addMethod(
  2179. $core.method({
  2180. selector: "deepCopy",
  2181. protocol: "copying",
  2182. //>>excludeStart("ide", pragmas.excludeIdeData);
  2183. args: [],
  2184. 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",
  2185. referencedClasses: [],
  2186. //>>excludeEnd("ide");
  2187. pragmas: [],
  2188. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  2189. }, function ($methodClass){ return function (){
  2190. var self=this,$self=this;
  2191. var copy;
  2192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2193. return $core.withContext(function($ctx1) {
  2194. //>>excludeEnd("ctx");
  2195. copy=$recv($self._class())._new();
  2196. $self._keysAndValuesDo_((function(key,value){
  2197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2198. return $core.withContext(function($ctx2) {
  2199. //>>excludeEnd("ctx");
  2200. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  2201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2202. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2203. //>>excludeEnd("ctx");
  2204. }));
  2205. return copy;
  2206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2207. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy})});
  2208. //>>excludeEnd("ctx");
  2209. }; }),
  2210. $globals.AssociativeCollection);
  2211. $core.addMethod(
  2212. $core.method({
  2213. selector: "detect:ifNone:",
  2214. protocol: "enumerating",
  2215. //>>excludeStart("ide", pragmas.excludeIdeData);
  2216. args: ["aBlock", "anotherBlock"],
  2217. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  2218. referencedClasses: [],
  2219. //>>excludeEnd("ide");
  2220. pragmas: [],
  2221. messageSends: ["detect:ifNone:", "values"]
  2222. }, function ($methodClass){ return function (aBlock,anotherBlock){
  2223. var self=this,$self=this;
  2224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2225. return $core.withContext(function($ctx1) {
  2226. //>>excludeEnd("ctx");
  2227. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  2228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2229. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  2230. //>>excludeEnd("ctx");
  2231. }; }),
  2232. $globals.AssociativeCollection);
  2233. $core.addMethod(
  2234. $core.method({
  2235. selector: "do:",
  2236. protocol: "enumerating",
  2237. //>>excludeStart("ide", pragmas.excludeIdeData);
  2238. args: ["aBlock"],
  2239. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  2240. referencedClasses: [],
  2241. //>>excludeEnd("ide");
  2242. pragmas: [],
  2243. messageSends: ["valuesDo:"]
  2244. }, function ($methodClass){ return function (aBlock){
  2245. var self=this,$self=this;
  2246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2247. return $core.withContext(function($ctx1) {
  2248. //>>excludeEnd("ctx");
  2249. $self._valuesDo_(aBlock);
  2250. return self;
  2251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2252. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  2253. //>>excludeEnd("ctx");
  2254. }; }),
  2255. $globals.AssociativeCollection);
  2256. $core.addMethod(
  2257. $core.method({
  2258. selector: "includes:",
  2259. protocol: "enumerating",
  2260. //>>excludeStart("ide", pragmas.excludeIdeData);
  2261. args: ["anObject"],
  2262. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  2263. referencedClasses: [],
  2264. //>>excludeEnd("ide");
  2265. pragmas: [],
  2266. messageSends: ["includes:", "values"]
  2267. }, function ($methodClass){ return function (anObject){
  2268. var self=this,$self=this;
  2269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2270. return $core.withContext(function($ctx1) {
  2271. //>>excludeEnd("ctx");
  2272. return $recv($self._values())._includes_(anObject);
  2273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2274. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  2275. //>>excludeEnd("ctx");
  2276. }; }),
  2277. $globals.AssociativeCollection);
  2278. $core.addMethod(
  2279. $core.method({
  2280. selector: "includesKey:",
  2281. protocol: "testing",
  2282. //>>excludeStart("ide", pragmas.excludeIdeData);
  2283. args: ["aKey"],
  2284. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  2285. referencedClasses: [],
  2286. //>>excludeEnd("ide");
  2287. pragmas: [],
  2288. messageSends: ["subclassResponsibility"]
  2289. }, function ($methodClass){ return function (aKey){
  2290. var self=this,$self=this;
  2291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2292. return $core.withContext(function($ctx1) {
  2293. //>>excludeEnd("ctx");
  2294. $self._subclassResponsibility();
  2295. return self;
  2296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2297. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  2298. //>>excludeEnd("ctx");
  2299. }; }),
  2300. $globals.AssociativeCollection);
  2301. $core.addMethod(
  2302. $core.method({
  2303. selector: "indexOf:ifAbsent:",
  2304. protocol: "accessing",
  2305. //>>excludeStart("ide", pragmas.excludeIdeData);
  2306. args: ["anObject", "aBlock"],
  2307. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  2308. referencedClasses: [],
  2309. //>>excludeEnd("ide");
  2310. pragmas: [],
  2311. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  2312. }, function ($methodClass){ return function (anObject,aBlock){
  2313. var self=this,$self=this;
  2314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2315. return $core.withContext(function($ctx1) {
  2316. //>>excludeEnd("ctx");
  2317. return $recv($self._keys())._detect_ifNone_((function(each){
  2318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2319. return $core.withContext(function($ctx2) {
  2320. //>>excludeEnd("ctx");
  2321. return $recv($self._at_(each)).__eq(anObject);
  2322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2323. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2324. //>>excludeEnd("ctx");
  2325. }),aBlock);
  2326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2327. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  2328. //>>excludeEnd("ctx");
  2329. }; }),
  2330. $globals.AssociativeCollection);
  2331. $core.addMethod(
  2332. $core.method({
  2333. selector: "keyAtValue:",
  2334. protocol: "accessing",
  2335. //>>excludeStart("ide", pragmas.excludeIdeData);
  2336. args: ["anObject"],
  2337. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  2338. referencedClasses: [],
  2339. //>>excludeEnd("ide");
  2340. pragmas: [],
  2341. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  2342. }, function ($methodClass){ return function (anObject){
  2343. var self=this,$self=this;
  2344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2345. return $core.withContext(function($ctx1) {
  2346. //>>excludeEnd("ctx");
  2347. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  2348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2349. return $core.withContext(function($ctx2) {
  2350. //>>excludeEnd("ctx");
  2351. return $self._errorNotFound();
  2352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2353. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2354. //>>excludeEnd("ctx");
  2355. }));
  2356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2357. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject})});
  2358. //>>excludeEnd("ctx");
  2359. }; }),
  2360. $globals.AssociativeCollection);
  2361. $core.addMethod(
  2362. $core.method({
  2363. selector: "keyAtValue:ifAbsent:",
  2364. protocol: "accessing",
  2365. //>>excludeStart("ide", pragmas.excludeIdeData);
  2366. args: ["anObject", "aBlock"],
  2367. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  2368. referencedClasses: [],
  2369. //>>excludeEnd("ide");
  2370. pragmas: [],
  2371. messageSends: ["indexOf:ifAbsent:"]
  2372. }, function ($methodClass){ return function (anObject,aBlock){
  2373. var self=this,$self=this;
  2374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2375. return $core.withContext(function($ctx1) {
  2376. //>>excludeEnd("ctx");
  2377. return $self._indexOf_ifAbsent_(anObject,aBlock);
  2378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2379. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  2380. //>>excludeEnd("ctx");
  2381. }; }),
  2382. $globals.AssociativeCollection);
  2383. $core.addMethod(
  2384. $core.method({
  2385. selector: "keys",
  2386. protocol: "accessing",
  2387. //>>excludeStart("ide", pragmas.excludeIdeData);
  2388. args: [],
  2389. source: "keys\x0a\x09self subclassResponsibility",
  2390. referencedClasses: [],
  2391. //>>excludeEnd("ide");
  2392. pragmas: [],
  2393. messageSends: ["subclassResponsibility"]
  2394. }, function ($methodClass){ return function (){
  2395. var self=this,$self=this;
  2396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2397. return $core.withContext(function($ctx1) {
  2398. //>>excludeEnd("ctx");
  2399. $self._subclassResponsibility();
  2400. return self;
  2401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2402. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  2403. //>>excludeEnd("ctx");
  2404. }; }),
  2405. $globals.AssociativeCollection);
  2406. $core.addMethod(
  2407. $core.method({
  2408. selector: "keysAndValuesDo:",
  2409. protocol: "enumerating",
  2410. //>>excludeStart("ide", pragmas.excludeIdeData);
  2411. args: ["aBlock"],
  2412. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  2413. referencedClasses: [],
  2414. //>>excludeEnd("ide");
  2415. pragmas: [],
  2416. messageSends: ["keysDo:", "value:value:", "at:"]
  2417. }, function ($methodClass){ return function (aBlock){
  2418. var self=this,$self=this;
  2419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2420. return $core.withContext(function($ctx1) {
  2421. //>>excludeEnd("ctx");
  2422. $self._keysDo_((function(each){
  2423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2424. return $core.withContext(function($ctx2) {
  2425. //>>excludeEnd("ctx");
  2426. return $recv(aBlock)._value_value_(each,$self._at_(each));
  2427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2428. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2429. //>>excludeEnd("ctx");
  2430. }));
  2431. return self;
  2432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2433. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  2434. //>>excludeEnd("ctx");
  2435. }; }),
  2436. $globals.AssociativeCollection);
  2437. $core.addMethod(
  2438. $core.method({
  2439. selector: "keysDo:",
  2440. protocol: "enumerating",
  2441. //>>excludeStart("ide", pragmas.excludeIdeData);
  2442. args: ["aBlock"],
  2443. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  2444. referencedClasses: [],
  2445. //>>excludeEnd("ide");
  2446. pragmas: [],
  2447. messageSends: ["subclassResponsibility"]
  2448. }, function ($methodClass){ return function (aBlock){
  2449. var self=this,$self=this;
  2450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2451. return $core.withContext(function($ctx1) {
  2452. //>>excludeEnd("ctx");
  2453. $self._subclassResponsibility();
  2454. return self;
  2455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2456. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  2457. //>>excludeEnd("ctx");
  2458. }; }),
  2459. $globals.AssociativeCollection);
  2460. $core.addMethod(
  2461. $core.method({
  2462. selector: "printOn:",
  2463. protocol: "printing",
  2464. //>>excludeStart("ide", pragmas.excludeIdeData);
  2465. args: ["aStream"],
  2466. 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: ')'",
  2467. referencedClasses: [],
  2468. //>>excludeEnd("ide");
  2469. pragmas: [],
  2470. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  2471. }, function ($methodClass){ return function (aStream){
  2472. var self=this,$self=this;
  2473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2474. return $core.withContext(function($ctx1) {
  2475. //>>excludeEnd("ctx");
  2476. [(
  2477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2478. $ctx1.supercall = true,
  2479. //>>excludeEnd("ctx");
  2480. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  2481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2482. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  2483. //>>excludeEnd("ctx");
  2484. ][0];
  2485. [$recv(aStream)._nextPutAll_(" (")
  2486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2487. ,$ctx1.sendIdx["nextPutAll:"]=1
  2488. //>>excludeEnd("ctx");
  2489. ][0];
  2490. $recv($self._associations())._do_separatedBy_((function(each){
  2491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2492. return $core.withContext(function($ctx2) {
  2493. //>>excludeEnd("ctx");
  2494. return $recv(each)._printOn_(aStream);
  2495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2496. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2497. //>>excludeEnd("ctx");
  2498. }),(function(){
  2499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2500. return $core.withContext(function($ctx2) {
  2501. //>>excludeEnd("ctx");
  2502. return [$recv(aStream)._nextPutAll_(" , ")
  2503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2504. ,$ctx2.sendIdx["nextPutAll:"]=2
  2505. //>>excludeEnd("ctx");
  2506. ][0];
  2507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2508. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2509. //>>excludeEnd("ctx");
  2510. }));
  2511. $recv(aStream)._nextPutAll_(")");
  2512. return self;
  2513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2514. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  2515. //>>excludeEnd("ctx");
  2516. }; }),
  2517. $globals.AssociativeCollection);
  2518. $core.addMethod(
  2519. $core.method({
  2520. selector: "remove:ifAbsent:",
  2521. protocol: "adding/removing",
  2522. //>>excludeStart("ide", pragmas.excludeIdeData);
  2523. args: ["aKey", "aBlock"],
  2524. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  2525. referencedClasses: [],
  2526. //>>excludeEnd("ide");
  2527. pragmas: [],
  2528. messageSends: ["removeKey:ifAbsent:"]
  2529. }, function ($methodClass){ return function (aKey,aBlock){
  2530. var self=this,$self=this;
  2531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2532. return $core.withContext(function($ctx1) {
  2533. //>>excludeEnd("ctx");
  2534. return $self._removeKey_ifAbsent_(aKey,aBlock);
  2535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2536. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2537. //>>excludeEnd("ctx");
  2538. }; }),
  2539. $globals.AssociativeCollection);
  2540. $core.addMethod(
  2541. $core.method({
  2542. selector: "removeAll",
  2543. protocol: "adding/removing",
  2544. //>>excludeStart("ide", pragmas.excludeIdeData);
  2545. args: [],
  2546. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  2547. referencedClasses: [],
  2548. //>>excludeEnd("ide");
  2549. pragmas: [],
  2550. messageSends: ["do:", "keys", "removeKey:"]
  2551. }, function ($methodClass){ return function (){
  2552. var self=this,$self=this;
  2553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2554. return $core.withContext(function($ctx1) {
  2555. //>>excludeEnd("ctx");
  2556. return $recv($self._keys())._do_((function(each){
  2557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2558. return $core.withContext(function($ctx2) {
  2559. //>>excludeEnd("ctx");
  2560. return $self._removeKey_(each);
  2561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2562. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2563. //>>excludeEnd("ctx");
  2564. }));
  2565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2566. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  2567. //>>excludeEnd("ctx");
  2568. }; }),
  2569. $globals.AssociativeCollection);
  2570. $core.addMethod(
  2571. $core.method({
  2572. selector: "removeKey:",
  2573. protocol: "adding/removing",
  2574. //>>excludeStart("ide", pragmas.excludeIdeData);
  2575. args: ["aKey"],
  2576. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  2577. referencedClasses: [],
  2578. //>>excludeEnd("ide");
  2579. pragmas: [],
  2580. messageSends: ["remove:"]
  2581. }, function ($methodClass){ return function (aKey){
  2582. var self=this,$self=this;
  2583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2584. return $core.withContext(function($ctx1) {
  2585. //>>excludeEnd("ctx");
  2586. return $self._remove_(aKey);
  2587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2588. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey})});
  2589. //>>excludeEnd("ctx");
  2590. }; }),
  2591. $globals.AssociativeCollection);
  2592. $core.addMethod(
  2593. $core.method({
  2594. selector: "removeKey:ifAbsent:",
  2595. protocol: "adding/removing",
  2596. //>>excludeStart("ide", pragmas.excludeIdeData);
  2597. args: ["aKey", "aBlock"],
  2598. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2599. referencedClasses: [],
  2600. //>>excludeEnd("ide");
  2601. pragmas: [],
  2602. messageSends: ["subclassResponsibility"]
  2603. }, function ($methodClass){ return function (aKey,aBlock){
  2604. var self=this,$self=this;
  2605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2606. return $core.withContext(function($ctx1) {
  2607. //>>excludeEnd("ctx");
  2608. $self._subclassResponsibility();
  2609. return self;
  2610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2611. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2612. //>>excludeEnd("ctx");
  2613. }; }),
  2614. $globals.AssociativeCollection);
  2615. $core.addMethod(
  2616. $core.method({
  2617. selector: "select:",
  2618. protocol: "enumerating",
  2619. //>>excludeStart("ide", pragmas.excludeIdeData);
  2620. args: ["aBlock"],
  2621. 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",
  2622. referencedClasses: [],
  2623. //>>excludeEnd("ide");
  2624. pragmas: [],
  2625. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2626. }, function ($methodClass){ return function (aBlock){
  2627. var self=this,$self=this;
  2628. var newDict;
  2629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2630. return $core.withContext(function($ctx1) {
  2631. //>>excludeEnd("ctx");
  2632. newDict=$recv($self._class())._new();
  2633. $self._keysAndValuesDo_((function(key,value){
  2634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2635. return $core.withContext(function($ctx2) {
  2636. //>>excludeEnd("ctx");
  2637. if($core.assert($recv(aBlock)._value_(value))){
  2638. return $recv(newDict)._at_put_(key,value);
  2639. }
  2640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2641. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2642. //>>excludeEnd("ctx");
  2643. }));
  2644. return newDict;
  2645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2646. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict})});
  2647. //>>excludeEnd("ctx");
  2648. }; }),
  2649. $globals.AssociativeCollection);
  2650. $core.addMethod(
  2651. $core.method({
  2652. selector: "select:thenCollect:",
  2653. protocol: "enumerating",
  2654. //>>excludeStart("ide", pragmas.excludeIdeData);
  2655. args: ["selectBlock", "collectBlock"],
  2656. 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",
  2657. referencedClasses: [],
  2658. //>>excludeEnd("ide");
  2659. pragmas: [],
  2660. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2661. }, function ($methodClass){ return function (selectBlock,collectBlock){
  2662. var self=this,$self=this;
  2663. var newDict;
  2664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2665. return $core.withContext(function($ctx1) {
  2666. //>>excludeEnd("ctx");
  2667. newDict=$recv($self._class())._new();
  2668. $self._keysAndValuesDo_((function(key,value){
  2669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2670. return $core.withContext(function($ctx2) {
  2671. //>>excludeEnd("ctx");
  2672. if($core.assert([$recv(selectBlock)._value_(value)
  2673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2674. ,$ctx2.sendIdx["value:"]=1
  2675. //>>excludeEnd("ctx");
  2676. ][0])){
  2677. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  2678. }
  2679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2680. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2681. //>>excludeEnd("ctx");
  2682. }));
  2683. return newDict;
  2684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2685. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict})});
  2686. //>>excludeEnd("ctx");
  2687. }; }),
  2688. $globals.AssociativeCollection);
  2689. $core.addMethod(
  2690. $core.method({
  2691. selector: "shallowCopy",
  2692. protocol: "copying",
  2693. //>>excludeStart("ide", pragmas.excludeIdeData);
  2694. args: [],
  2695. 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",
  2696. referencedClasses: [],
  2697. //>>excludeEnd("ide");
  2698. pragmas: [],
  2699. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2700. }, function ($methodClass){ return function (){
  2701. var self=this,$self=this;
  2702. var copy;
  2703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2704. return $core.withContext(function($ctx1) {
  2705. //>>excludeEnd("ctx");
  2706. copy=$recv($self._class())._new();
  2707. $self._keysAndValuesDo_((function(key,value){
  2708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2709. return $core.withContext(function($ctx2) {
  2710. //>>excludeEnd("ctx");
  2711. return $recv(copy)._at_put_(key,value);
  2712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2713. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2714. //>>excludeEnd("ctx");
  2715. }));
  2716. return copy;
  2717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2718. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy})});
  2719. //>>excludeEnd("ctx");
  2720. }; }),
  2721. $globals.AssociativeCollection);
  2722. $core.addMethod(
  2723. $core.method({
  2724. selector: "shortenedPrintString",
  2725. protocol: "printing",
  2726. //>>excludeStart("ide", pragmas.excludeIdeData);
  2727. args: [],
  2728. source: "shortenedPrintString\x0a\x09^ self size <= 1\x0a\x09\x09ifTrue: [ self printString ]\x0a\x09\x09ifFalse: [ | key | key := self keys anyOne. (self copyEmpty at: key put: (self at: key); yourself) printString, ' ... ', (self size - 1) asString, ' more items' ]",
  2729. referencedClasses: [],
  2730. //>>excludeEnd("ide");
  2731. pragmas: [],
  2732. messageSends: ["ifTrue:ifFalse:", "<=", "size", "printString", "anyOne", "keys", ",", "at:put:", "copyEmpty", "at:", "yourself", "asString", "-"]
  2733. }, function ($methodClass){ return function (){
  2734. var self=this,$self=this;
  2735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2736. return $core.withContext(function($ctx1) {
  2737. //>>excludeEnd("ctx");
  2738. var $1;
  2739. if($core.assert($recv([$self._size()
  2740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2741. ,$ctx1.sendIdx["size"]=1
  2742. //>>excludeEnd("ctx");
  2743. ][0]).__lt_eq((1)))){
  2744. return [$self._printString()
  2745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2746. ,$ctx1.sendIdx["printString"]=1
  2747. //>>excludeEnd("ctx");
  2748. ][0];
  2749. } else {
  2750. var key;
  2751. key=$recv($self._keys())._anyOne();
  2752. $1=$self._copyEmpty();
  2753. $recv($1)._at_put_(key,$self._at_(key));
  2754. return [$recv([$recv($recv($recv($recv($1)._yourself())._printString()).__comma(" ... ")).__comma($recv($recv($self._size()).__minus((1)))._asString())
  2755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2756. ,$ctx1.sendIdx[","]=2
  2757. //>>excludeEnd("ctx");
  2758. ][0]).__comma(" more items")
  2759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2760. ,$ctx1.sendIdx[","]=1
  2761. //>>excludeEnd("ctx");
  2762. ][0];
  2763. }
  2764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2765. }, function($ctx1) {$ctx1.fill(self,"shortenedPrintString",{})});
  2766. //>>excludeEnd("ctx");
  2767. }; }),
  2768. $globals.AssociativeCollection);
  2769. $core.addMethod(
  2770. $core.method({
  2771. selector: "size",
  2772. protocol: "accessing",
  2773. //>>excludeStart("ide", pragmas.excludeIdeData);
  2774. args: [],
  2775. source: "size\x0a\x09^ self keys size",
  2776. referencedClasses: [],
  2777. //>>excludeEnd("ide");
  2778. pragmas: [],
  2779. messageSends: ["size", "keys"]
  2780. }, function ($methodClass){ return function (){
  2781. var self=this,$self=this;
  2782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2783. return $core.withContext(function($ctx1) {
  2784. //>>excludeEnd("ctx");
  2785. return $recv($self._keys())._size();
  2786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2787. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  2788. //>>excludeEnd("ctx");
  2789. }; }),
  2790. $globals.AssociativeCollection);
  2791. $core.addMethod(
  2792. $core.method({
  2793. selector: "values",
  2794. protocol: "accessing",
  2795. //>>excludeStart("ide", pragmas.excludeIdeData);
  2796. args: [],
  2797. source: "values\x0a\x09self subclassResponsibility",
  2798. referencedClasses: [],
  2799. //>>excludeEnd("ide");
  2800. pragmas: [],
  2801. messageSends: ["subclassResponsibility"]
  2802. }, function ($methodClass){ return function (){
  2803. var self=this,$self=this;
  2804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2805. return $core.withContext(function($ctx1) {
  2806. //>>excludeEnd("ctx");
  2807. $self._subclassResponsibility();
  2808. return self;
  2809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2810. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  2811. //>>excludeEnd("ctx");
  2812. }; }),
  2813. $globals.AssociativeCollection);
  2814. $core.addMethod(
  2815. $core.method({
  2816. selector: "valuesDo:",
  2817. protocol: "enumerating",
  2818. //>>excludeStart("ide", pragmas.excludeIdeData);
  2819. args: ["aBlock"],
  2820. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2821. referencedClasses: [],
  2822. //>>excludeEnd("ide");
  2823. pragmas: [],
  2824. messageSends: ["subclassResponsibility"]
  2825. }, function ($methodClass){ return function (aBlock){
  2826. var self=this,$self=this;
  2827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2828. return $core.withContext(function($ctx1) {
  2829. //>>excludeEnd("ctx");
  2830. $self._subclassResponsibility();
  2831. return self;
  2832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2833. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  2834. //>>excludeEnd("ctx");
  2835. }; }),
  2836. $globals.AssociativeCollection);
  2837. $core.addMethod(
  2838. $core.method({
  2839. selector: "withIndexDo:",
  2840. protocol: "enumerating",
  2841. //>>excludeStart("ide", pragmas.excludeIdeData);
  2842. args: ["aBlock"],
  2843. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  2844. referencedClasses: [],
  2845. //>>excludeEnd("ide");
  2846. pragmas: [],
  2847. messageSends: ["keysAndValuesDo:", "value:value:"]
  2848. }, function ($methodClass){ return function (aBlock){
  2849. var self=this,$self=this;
  2850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2851. return $core.withContext(function($ctx1) {
  2852. //>>excludeEnd("ctx");
  2853. $self._keysAndValuesDo_((function(key,value){
  2854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2855. return $core.withContext(function($ctx2) {
  2856. //>>excludeEnd("ctx");
  2857. return $recv(aBlock)._value_value_(value,key);
  2858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2859. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2860. //>>excludeEnd("ctx");
  2861. }));
  2862. return self;
  2863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2864. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  2865. //>>excludeEnd("ctx");
  2866. }; }),
  2867. $globals.AssociativeCollection);
  2868. $core.addMethod(
  2869. $core.method({
  2870. selector: "from:",
  2871. protocol: "instance creation",
  2872. //>>excludeStart("ide", pragmas.excludeIdeData);
  2873. args: ["aCollection"],
  2874. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  2875. referencedClasses: [],
  2876. //>>excludeEnd("ide");
  2877. pragmas: [],
  2878. messageSends: ["new", "do:", "add:"]
  2879. }, function ($methodClass){ return function (aCollection){
  2880. var self=this,$self=this;
  2881. var newCollection;
  2882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2883. return $core.withContext(function($ctx1) {
  2884. //>>excludeEnd("ctx");
  2885. newCollection=$self._new();
  2886. $recv(aCollection)._do_((function(each){
  2887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2888. return $core.withContext(function($ctx2) {
  2889. //>>excludeEnd("ctx");
  2890. return $recv(newCollection)._add_(each);
  2891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2892. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2893. //>>excludeEnd("ctx");
  2894. }));
  2895. return newCollection;
  2896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2897. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection})});
  2898. //>>excludeEnd("ctx");
  2899. }; }),
  2900. $globals.AssociativeCollection.a$cls);
  2901. $core.addMethod(
  2902. $core.method({
  2903. selector: "fromPairs:",
  2904. protocol: "instance creation",
  2905. //>>excludeStart("ide", pragmas.excludeIdeData);
  2906. args: ["aCollection"],
  2907. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  2908. referencedClasses: [],
  2909. //>>excludeEnd("ide");
  2910. pragmas: [],
  2911. messageSends: ["from:"]
  2912. }, function ($methodClass){ return function (aCollection){
  2913. var self=this,$self=this;
  2914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2915. return $core.withContext(function($ctx1) {
  2916. //>>excludeEnd("ctx");
  2917. return $self._from_(aCollection);
  2918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2919. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection})});
  2920. //>>excludeEnd("ctx");
  2921. }; }),
  2922. $globals.AssociativeCollection.a$cls);
  2923. $core.addMethod(
  2924. $core.method({
  2925. selector: "newFromPairs:",
  2926. protocol: "instance creation",
  2927. //>>excludeStart("ide", pragmas.excludeIdeData);
  2928. args: ["aCollection"],
  2929. 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",
  2930. referencedClasses: [],
  2931. //>>excludeEnd("ide");
  2932. pragmas: [],
  2933. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  2934. }, function ($methodClass){ return function (aCollection){
  2935. var self=this,$self=this;
  2936. var newCollection;
  2937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2938. return $core.withContext(function($ctx1) {
  2939. //>>excludeEnd("ctx");
  2940. if(!$core.assert($recv([$recv(aCollection)._size()
  2941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2942. ,$ctx1.sendIdx["size"]=1
  2943. //>>excludeEnd("ctx");
  2944. ][0])._even())){
  2945. $self._error_("#newFromPairs only accepts arrays of an even length");
  2946. }
  2947. newCollection=$self._new();
  2948. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  2949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2950. return $core.withContext(function($ctx2) {
  2951. //>>excludeEnd("ctx");
  2952. return $recv(newCollection)._at_put_([$recv(aCollection)._at_(each)
  2953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2954. ,$ctx2.sendIdx["at:"]=1
  2955. //>>excludeEnd("ctx");
  2956. ][0],$recv(aCollection)._at_($recv(each).__plus((1))));
  2957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2958. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2959. //>>excludeEnd("ctx");
  2960. }));
  2961. return newCollection;
  2962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2963. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection})});
  2964. //>>excludeEnd("ctx");
  2965. }; }),
  2966. $globals.AssociativeCollection.a$cls);
  2967. $core.addClass("Dictionary", $globals.AssociativeCollection, "Kernel-Collections");
  2968. $core.setSlots($globals.Dictionary, ["keys", "values"]);
  2969. //>>excludeStart("ide", pragmas.excludeIdeData);
  2970. $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.";
  2971. //>>excludeEnd("ide");
  2972. $core.addMethod(
  2973. $core.method({
  2974. selector: "at:ifAbsent:",
  2975. protocol: "accessing",
  2976. //>>excludeStart("ide", pragmas.excludeIdeData);
  2977. args: ["aKey", "aBlock"],
  2978. 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'>",
  2979. referencedClasses: [],
  2980. //>>excludeEnd("ide");
  2981. pragmas: [["inlineJS:", ["\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? $self.values[index] : aBlock._value();\x0a\x09"]]],
  2982. messageSends: []
  2983. }, function ($methodClass){ return function (aKey,aBlock){
  2984. var self=this,$self=this;
  2985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2986. return $core.withContext(function($ctx1) {
  2987. //>>excludeEnd("ctx");
  2988. var index = $self._positionOfKey_(aKey);
  2989. return index >=0 ? $self.values[index] : aBlock._value();
  2990. ;
  2991. return self;
  2992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2993. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2994. //>>excludeEnd("ctx");
  2995. }; }),
  2996. $globals.Dictionary);
  2997. $core.addMethod(
  2998. $core.method({
  2999. selector: "at:put:",
  3000. protocol: "accessing",
  3001. //>>excludeStart("ide", pragmas.excludeIdeData);
  3002. args: ["aKey", "aValue"],
  3003. 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'>",
  3004. referencedClasses: [],
  3005. //>>excludeEnd("ide");
  3006. pragmas: [["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"]]],
  3007. messageSends: []
  3008. }, function ($methodClass){ return function (aKey,aValue){
  3009. var self=this,$self=this;
  3010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3011. return $core.withContext(function($ctx1) {
  3012. //>>excludeEnd("ctx");
  3013. var index = $self._positionOfKey_(aKey);
  3014. if(index === -1) {
  3015. var keys = $self.keys;
  3016. index = keys.length;
  3017. keys.push(aKey);
  3018. }
  3019. return $self.values[index] = aValue;
  3020. ;
  3021. return self;
  3022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3023. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  3024. //>>excludeEnd("ctx");
  3025. }; }),
  3026. $globals.Dictionary);
  3027. $core.addMethod(
  3028. $core.method({
  3029. selector: "includesKey:",
  3030. protocol: "testing",
  3031. //>>excludeStart("ide", pragmas.excludeIdeData);
  3032. args: ["aKey"],
  3033. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  3034. referencedClasses: [],
  3035. //>>excludeEnd("ide");
  3036. pragmas: [["inlineJS:", ["return $self._positionOfKey_(aKey) >= 0;"]]],
  3037. messageSends: []
  3038. }, function ($methodClass){ return function (aKey){
  3039. var self=this,$self=this;
  3040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3041. return $core.withContext(function($ctx1) {
  3042. //>>excludeEnd("ctx");
  3043. return $self._positionOfKey_(aKey) >= 0;;
  3044. return self;
  3045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3046. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  3047. //>>excludeEnd("ctx");
  3048. }; }),
  3049. $globals.Dictionary);
  3050. $core.addMethod(
  3051. $core.method({
  3052. selector: "indexOf:ifAbsent:",
  3053. protocol: "accessing",
  3054. //>>excludeStart("ide", pragmas.excludeIdeData);
  3055. args: ["anObject", "aBlock"],
  3056. 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 ]",
  3057. referencedClasses: [],
  3058. //>>excludeEnd("ide");
  3059. pragmas: [],
  3060. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  3061. }, function ($methodClass){ return function (anObject,aBlock){
  3062. var self=this,$self=this;
  3063. var index;
  3064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3065. return $core.withContext(function($ctx1) {
  3066. //>>excludeEnd("ctx");
  3067. index=$recv($self.values)._indexOf_ifAbsent_(anObject,(function(){
  3068. return (0);
  3069. }));
  3070. if($core.assert($recv(index).__eq((0)))){
  3071. return $recv(aBlock)._value();
  3072. } else {
  3073. return $recv($self.keys)._at_(index);
  3074. }
  3075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3076. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  3077. //>>excludeEnd("ctx");
  3078. }; }),
  3079. $globals.Dictionary);
  3080. $core.addMethod(
  3081. $core.method({
  3082. selector: "initialize",
  3083. protocol: "initialization",
  3084. //>>excludeStart("ide", pragmas.excludeIdeData);
  3085. args: [],
  3086. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  3087. referencedClasses: [],
  3088. //>>excludeEnd("ide");
  3089. pragmas: [],
  3090. messageSends: ["initialize"]
  3091. }, function ($methodClass){ return function (){
  3092. var self=this,$self=this;
  3093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3094. return $core.withContext(function($ctx1) {
  3095. //>>excludeEnd("ctx");
  3096. [(
  3097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3098. $ctx1.supercall = true,
  3099. //>>excludeEnd("ctx");
  3100. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  3101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3102. ,$ctx1.supercall = false
  3103. //>>excludeEnd("ctx");
  3104. ][0];
  3105. $self.keys=[];
  3106. $self.values=[];
  3107. return self;
  3108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3109. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  3110. //>>excludeEnd("ctx");
  3111. }; }),
  3112. $globals.Dictionary);
  3113. $core.addMethod(
  3114. $core.method({
  3115. selector: "keys",
  3116. protocol: "accessing",
  3117. //>>excludeStart("ide", pragmas.excludeIdeData);
  3118. args: [],
  3119. source: "keys\x0a\x09^ keys copy",
  3120. referencedClasses: [],
  3121. //>>excludeEnd("ide");
  3122. pragmas: [],
  3123. messageSends: ["copy"]
  3124. }, function ($methodClass){ return function (){
  3125. var self=this,$self=this;
  3126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3127. return $core.withContext(function($ctx1) {
  3128. //>>excludeEnd("ctx");
  3129. return $recv($self.keys)._copy();
  3130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3131. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  3132. //>>excludeEnd("ctx");
  3133. }; }),
  3134. $globals.Dictionary);
  3135. $core.addMethod(
  3136. $core.method({
  3137. selector: "keysAndValuesDo:",
  3138. protocol: "enumerating",
  3139. //>>excludeStart("ide", pragmas.excludeIdeData);
  3140. args: ["aBlock"],
  3141. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3142. referencedClasses: [],
  3143. //>>excludeEnd("ide");
  3144. pragmas: [],
  3145. messageSends: ["with:do:"]
  3146. }, function ($methodClass){ return function (aBlock){
  3147. var self=this,$self=this;
  3148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3149. return $core.withContext(function($ctx1) {
  3150. //>>excludeEnd("ctx");
  3151. return $recv($self.keys)._with_do_($self.values,aBlock);
  3152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3153. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  3154. //>>excludeEnd("ctx");
  3155. }; }),
  3156. $globals.Dictionary);
  3157. $core.addMethod(
  3158. $core.method({
  3159. selector: "keysDo:",
  3160. protocol: "enumerating",
  3161. //>>excludeStart("ide", pragmas.excludeIdeData);
  3162. args: ["aBlock"],
  3163. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3164. referencedClasses: [],
  3165. //>>excludeEnd("ide");
  3166. pragmas: [],
  3167. messageSends: ["do:"]
  3168. }, function ($methodClass){ return function (aBlock){
  3169. var self=this,$self=this;
  3170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3171. return $core.withContext(function($ctx1) {
  3172. //>>excludeEnd("ctx");
  3173. return $recv($self.keys)._do_(aBlock);
  3174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3175. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  3176. //>>excludeEnd("ctx");
  3177. }; }),
  3178. $globals.Dictionary);
  3179. $core.addMethod(
  3180. $core.method({
  3181. selector: "positionOfKey:",
  3182. protocol: "private",
  3183. //>>excludeStart("ide", pragmas.excludeIdeData);
  3184. args: ["anObject"],
  3185. 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'>",
  3186. referencedClasses: [],
  3187. //>>excludeEnd("ide");
  3188. pragmas: [["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"]]],
  3189. messageSends: []
  3190. }, function ($methodClass){ return function (anObject){
  3191. var self=this,$self=this;
  3192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3193. return $core.withContext(function($ctx1) {
  3194. //>>excludeEnd("ctx");
  3195. var keys = $self.keys;
  3196. for(var i=0;i<keys.length;i++){
  3197. if(keys[i].__eq(anObject)) { return i;}
  3198. }
  3199. return -1;
  3200. ;
  3201. return self;
  3202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3203. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject})});
  3204. //>>excludeEnd("ctx");
  3205. }; }),
  3206. $globals.Dictionary);
  3207. $core.addMethod(
  3208. $core.method({
  3209. selector: "removeAll",
  3210. protocol: "adding/removing",
  3211. //>>excludeStart("ide", pragmas.excludeIdeData);
  3212. args: [],
  3213. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3214. referencedClasses: [],
  3215. //>>excludeEnd("ide");
  3216. pragmas: [],
  3217. messageSends: ["removeAll"]
  3218. }, function ($methodClass){ return function (){
  3219. var self=this,$self=this;
  3220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3221. return $core.withContext(function($ctx1) {
  3222. //>>excludeEnd("ctx");
  3223. [$recv($self.keys)._removeAll()
  3224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3225. ,$ctx1.sendIdx["removeAll"]=1
  3226. //>>excludeEnd("ctx");
  3227. ][0];
  3228. $recv($self.values)._removeAll();
  3229. return self;
  3230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3231. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  3232. //>>excludeEnd("ctx");
  3233. }; }),
  3234. $globals.Dictionary);
  3235. $core.addMethod(
  3236. $core.method({
  3237. selector: "removeKey:ifAbsent:",
  3238. protocol: "adding/removing",
  3239. //>>excludeStart("ide", pragmas.excludeIdeData);
  3240. args: ["aKey", "aBlock"],
  3241. 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'>",
  3242. referencedClasses: [],
  3243. //>>excludeEnd("ide");
  3244. pragmas: [["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"]]],
  3245. messageSends: []
  3246. }, function ($methodClass){ return function (aKey,aBlock){
  3247. var self=this,$self=this;
  3248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3249. return $core.withContext(function($ctx1) {
  3250. //>>excludeEnd("ctx");
  3251. var index = $self._positionOfKey_(aKey);
  3252. if(index === -1) {
  3253. return aBlock._value()
  3254. } else {
  3255. var keys = $self.keys, values = $self.values;
  3256. var value = values[index], l = keys.length;
  3257. keys[index] = keys[l-1];
  3258. keys.pop();
  3259. values[index] = values[l-1];
  3260. values.pop();
  3261. return value;
  3262. }
  3263. ;
  3264. return self;
  3265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3266. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3267. //>>excludeEnd("ctx");
  3268. }; }),
  3269. $globals.Dictionary);
  3270. $core.addMethod(
  3271. $core.method({
  3272. selector: "values",
  3273. protocol: "accessing",
  3274. //>>excludeStart("ide", pragmas.excludeIdeData);
  3275. args: [],
  3276. source: "values\x0a\x09^ values",
  3277. referencedClasses: [],
  3278. //>>excludeEnd("ide");
  3279. pragmas: [],
  3280. messageSends: []
  3281. }, function ($methodClass){ return function (){
  3282. var self=this,$self=this;
  3283. return $self.values;
  3284. }; }),
  3285. $globals.Dictionary);
  3286. $core.addMethod(
  3287. $core.method({
  3288. selector: "valuesDo:",
  3289. protocol: "enumerating",
  3290. //>>excludeStart("ide", pragmas.excludeIdeData);
  3291. args: ["aBlock"],
  3292. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3293. referencedClasses: [],
  3294. //>>excludeEnd("ide");
  3295. pragmas: [],
  3296. messageSends: ["do:"]
  3297. }, function ($methodClass){ return function (aBlock){
  3298. var self=this,$self=this;
  3299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3300. return $core.withContext(function($ctx1) {
  3301. //>>excludeEnd("ctx");
  3302. return $recv($self.values)._do_(aBlock);
  3303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3304. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  3305. //>>excludeEnd("ctx");
  3306. }; }),
  3307. $globals.Dictionary);
  3308. $core.addClass("HashedCollection", $globals.AssociativeCollection, "Kernel-Collections");
  3309. //>>excludeStart("ide", pragmas.excludeIdeData);
  3310. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3311. //>>excludeEnd("ide");
  3312. $core.addMethod(
  3313. $core.method({
  3314. selector: "asJavaScriptSource",
  3315. protocol: "accessing",
  3316. //>>excludeStart("ide", pragmas.excludeIdeData);
  3317. args: [],
  3318. source: "asJavaScriptSource\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09str nextPut: '{'.\x0a\x09\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09\x09str nextPutAll: key asJavaScriptSource; nextPut: ':'; nextPutAll: value asJavaScriptSource; nextPut: ',' ].\x0a\x09\x09str skip: -1; nextPut: '}' ]",
  3319. referencedClasses: ["String"],
  3320. //>>excludeEnd("ide");
  3321. pragmas: [],
  3322. messageSends: ["streamContents:", "nextPut:", "keysAndValuesDo:", "nextPutAll:", "asJavaScriptSource", "skip:"]
  3323. }, function ($methodClass){ return function (){
  3324. var self=this,$self=this;
  3325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3326. return $core.withContext(function($ctx1) {
  3327. //>>excludeEnd("ctx");
  3328. return $recv($globals.String)._streamContents_((function(str){
  3329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3330. return $core.withContext(function($ctx2) {
  3331. //>>excludeEnd("ctx");
  3332. [$recv(str)._nextPut_("{")
  3333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3334. ,$ctx2.sendIdx["nextPut:"]=1
  3335. //>>excludeEnd("ctx");
  3336. ][0];
  3337. $self._keysAndValuesDo_((function(key,value){
  3338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3339. return $core.withContext(function($ctx3) {
  3340. //>>excludeEnd("ctx");
  3341. [$recv(str)._nextPutAll_([$recv(key)._asJavaScriptSource()
  3342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3343. ,$ctx3.sendIdx["asJavaScriptSource"]=1
  3344. //>>excludeEnd("ctx");
  3345. ][0])
  3346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3347. ,$ctx3.sendIdx["nextPutAll:"]=1
  3348. //>>excludeEnd("ctx");
  3349. ][0];
  3350. [$recv(str)._nextPut_(":")
  3351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3352. ,$ctx3.sendIdx["nextPut:"]=2
  3353. //>>excludeEnd("ctx");
  3354. ][0];
  3355. $recv(str)._nextPutAll_($recv(value)._asJavaScriptSource());
  3356. return [$recv(str)._nextPut_(",")
  3357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3358. ,$ctx3.sendIdx["nextPut:"]=3
  3359. //>>excludeEnd("ctx");
  3360. ][0];
  3361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3362. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  3363. //>>excludeEnd("ctx");
  3364. }));
  3365. $recv(str)._skip_((-1));
  3366. return $recv(str)._nextPut_("}");
  3367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3368. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  3369. //>>excludeEnd("ctx");
  3370. }));
  3371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3372. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  3373. //>>excludeEnd("ctx");
  3374. }; }),
  3375. $globals.HashedCollection);
  3376. $core.addMethod(
  3377. $core.method({
  3378. selector: "at:ifAbsent:",
  3379. protocol: "accessing",
  3380. //>>excludeStart("ide", pragmas.excludeIdeData);
  3381. args: ["aKey", "aBlock"],
  3382. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3383. referencedClasses: [],
  3384. //>>excludeEnd("ide");
  3385. pragmas: [],
  3386. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3387. }, function ($methodClass){ return function (aKey,aBlock){
  3388. var self=this,$self=this;
  3389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3390. return $core.withContext(function($ctx1) {
  3391. //>>excludeEnd("ctx");
  3392. if($core.assert($self._includesKey_(aKey))){
  3393. return $self._basicAt_(aKey);
  3394. } else {
  3395. return $recv(aBlock)._value();
  3396. }
  3397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3398. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3399. //>>excludeEnd("ctx");
  3400. }; }),
  3401. $globals.HashedCollection);
  3402. $core.addMethod(
  3403. $core.method({
  3404. selector: "at:put:",
  3405. protocol: "accessing",
  3406. //>>excludeStart("ide", pragmas.excludeIdeData);
  3407. args: ["aKey", "aValue"],
  3408. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3409. referencedClasses: [],
  3410. //>>excludeEnd("ide");
  3411. pragmas: [],
  3412. messageSends: ["basicAt:put:"]
  3413. }, function ($methodClass){ return function (aKey,aValue){
  3414. var self=this,$self=this;
  3415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3416. return $core.withContext(function($ctx1) {
  3417. //>>excludeEnd("ctx");
  3418. return $self._basicAt_put_(aKey,aValue);
  3419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3420. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  3421. //>>excludeEnd("ctx");
  3422. }; }),
  3423. $globals.HashedCollection);
  3424. $core.addMethod(
  3425. $core.method({
  3426. selector: "includesKey:",
  3427. protocol: "testing",
  3428. //>>excludeStart("ide", pragmas.excludeIdeData);
  3429. args: ["aKey"],
  3430. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  3431. referencedClasses: [],
  3432. //>>excludeEnd("ide");
  3433. pragmas: [["inlineJS:", ["return self.hasOwnProperty(aKey)"]]],
  3434. messageSends: []
  3435. }, function ($methodClass){ return function (aKey){
  3436. var self=this,$self=this;
  3437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3438. return $core.withContext(function($ctx1) {
  3439. //>>excludeEnd("ctx");
  3440. return self.hasOwnProperty(aKey);
  3441. return self;
  3442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3443. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  3444. //>>excludeEnd("ctx");
  3445. }; }),
  3446. $globals.HashedCollection);
  3447. $core.addMethod(
  3448. $core.method({
  3449. selector: "keys",
  3450. protocol: "accessing",
  3451. //>>excludeStart("ide", pragmas.excludeIdeData);
  3452. args: [],
  3453. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  3454. referencedClasses: [],
  3455. //>>excludeEnd("ide");
  3456. pragmas: [["inlineJS:", ["return Object.keys(self)"]]],
  3457. messageSends: []
  3458. }, function ($methodClass){ return function (){
  3459. var self=this,$self=this;
  3460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3461. return $core.withContext(function($ctx1) {
  3462. //>>excludeEnd("ctx");
  3463. return Object.keys(self);
  3464. return self;
  3465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3466. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  3467. //>>excludeEnd("ctx");
  3468. }; }),
  3469. $globals.HashedCollection);
  3470. $core.addMethod(
  3471. $core.method({
  3472. selector: "keysDo:",
  3473. protocol: "enumerating",
  3474. //>>excludeStart("ide", pragmas.excludeIdeData);
  3475. args: ["aBlock"],
  3476. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3477. referencedClasses: [],
  3478. //>>excludeEnd("ide");
  3479. pragmas: [],
  3480. messageSends: ["do:", "keys"]
  3481. }, function ($methodClass){ return function (aBlock){
  3482. var self=this,$self=this;
  3483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3484. return $core.withContext(function($ctx1) {
  3485. //>>excludeEnd("ctx");
  3486. $recv($self._keys())._do_(aBlock);
  3487. return self;
  3488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3489. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  3490. //>>excludeEnd("ctx");
  3491. }; }),
  3492. $globals.HashedCollection);
  3493. $core.addMethod(
  3494. $core.method({
  3495. selector: "removeKey:ifAbsent:",
  3496. protocol: "adding/removing",
  3497. //>>excludeStart("ide", pragmas.excludeIdeData);
  3498. args: ["aKey", "aBlock"],
  3499. 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 ]",
  3500. referencedClasses: [],
  3501. //>>excludeEnd("ide");
  3502. pragmas: [],
  3503. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3504. }, function ($methodClass){ return function (aKey,aBlock){
  3505. var self=this,$self=this;
  3506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3507. return $core.withContext(function($ctx1) {
  3508. //>>excludeEnd("ctx");
  3509. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3511. return $core.withContext(function($ctx2) {
  3512. //>>excludeEnd("ctx");
  3513. $self._basicDelete_(aKey);
  3514. return removed;
  3515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3516. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3517. //>>excludeEnd("ctx");
  3518. }),(function(){
  3519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3520. return $core.withContext(function($ctx2) {
  3521. //>>excludeEnd("ctx");
  3522. return $recv(aBlock)._value();
  3523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3525. //>>excludeEnd("ctx");
  3526. }));
  3527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3528. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3529. //>>excludeEnd("ctx");
  3530. }; }),
  3531. $globals.HashedCollection);
  3532. $core.addMethod(
  3533. $core.method({
  3534. selector: "values",
  3535. protocol: "accessing",
  3536. //>>excludeStart("ide", pragmas.excludeIdeData);
  3537. args: [],
  3538. 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'>",
  3539. referencedClasses: [],
  3540. //>>excludeEnd("ide");
  3541. pragmas: [["inlineJS:", ["\x0a\x09\x09return $self._keys().map(function(key){\x0a\x09\x09\x09return $self._at_(key);\x0a\x09\x09});\x0a\x09"]]],
  3542. messageSends: []
  3543. }, function ($methodClass){ return function (){
  3544. var self=this,$self=this;
  3545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3546. return $core.withContext(function($ctx1) {
  3547. //>>excludeEnd("ctx");
  3548. return $self._keys().map(function(key){
  3549. return $self._at_(key);
  3550. });
  3551. ;
  3552. return self;
  3553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3554. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  3555. //>>excludeEnd("ctx");
  3556. }; }),
  3557. $globals.HashedCollection);
  3558. $core.addMethod(
  3559. $core.method({
  3560. selector: "valuesDo:",
  3561. protocol: "enumerating",
  3562. //>>excludeStart("ide", pragmas.excludeIdeData);
  3563. args: ["aBlock"],
  3564. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3565. referencedClasses: [],
  3566. //>>excludeEnd("ide");
  3567. pragmas: [],
  3568. messageSends: ["do:", "values"]
  3569. }, function ($methodClass){ return function (aBlock){
  3570. var self=this,$self=this;
  3571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3572. return $core.withContext(function($ctx1) {
  3573. //>>excludeEnd("ctx");
  3574. $recv($self._values())._do_(aBlock);
  3575. return self;
  3576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3577. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  3578. //>>excludeEnd("ctx");
  3579. }; }),
  3580. $globals.HashedCollection);
  3581. $core.addClass("SequenceableCollection", $globals.Collection, "Kernel-Collections");
  3582. //>>excludeStart("ide", pragmas.excludeIdeData);
  3583. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3584. //>>excludeEnd("ide");
  3585. $core.addMethod(
  3586. $core.method({
  3587. selector: "=",
  3588. protocol: "comparing",
  3589. //>>excludeStart("ide", pragmas.excludeIdeData);
  3590. args: ["aCollection"],
  3591. 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",
  3592. referencedClasses: [],
  3593. //>>excludeEnd("ide");
  3594. pragmas: [],
  3595. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3596. }, function ($methodClass){ return function (aCollection){
  3597. var self=this,$self=this;
  3598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3599. return $core.withContext(function($ctx1) {
  3600. //>>excludeEnd("ctx");
  3601. var $1;
  3602. var $early={};
  3603. try {
  3604. if($core.assert([$recv([$self._class()
  3605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3606. ,$ctx1.sendIdx["class"]=1
  3607. //>>excludeEnd("ctx");
  3608. ][0]).__eq($recv(aCollection)._class())
  3609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3610. ,$ctx1.sendIdx["="]=1
  3611. //>>excludeEnd("ctx");
  3612. ][0])){
  3613. $1=[$recv([$self._size()
  3614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3615. ,$ctx1.sendIdx["size"]=1
  3616. //>>excludeEnd("ctx");
  3617. ][0]).__eq($recv(aCollection)._size())
  3618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3619. ,$ctx1.sendIdx["="]=2
  3620. //>>excludeEnd("ctx");
  3621. ][0];
  3622. } else {
  3623. $1=false;
  3624. }
  3625. if(!$core.assert($1)){
  3626. return false;
  3627. }
  3628. $self._withIndexDo_((function(each,i){
  3629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3630. return $core.withContext(function($ctx2) {
  3631. //>>excludeEnd("ctx");
  3632. if(!$core.assert($recv($recv(aCollection)._at_(i)).__eq(each))){
  3633. throw $early=[false];
  3634. }
  3635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3636. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3637. //>>excludeEnd("ctx");
  3638. }));
  3639. return true;
  3640. }
  3641. catch(e) {if(e===$early)return e[0]; throw e}
  3642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3643. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  3644. //>>excludeEnd("ctx");
  3645. }; }),
  3646. $globals.SequenceableCollection);
  3647. $core.addMethod(
  3648. $core.method({
  3649. selector: "addLast:",
  3650. protocol: "adding/removing",
  3651. //>>excludeStart("ide", pragmas.excludeIdeData);
  3652. args: ["anObject"],
  3653. source: "addLast: anObject\x0a\x09self add: anObject",
  3654. referencedClasses: [],
  3655. //>>excludeEnd("ide");
  3656. pragmas: [],
  3657. messageSends: ["add:"]
  3658. }, function ($methodClass){ return function (anObject){
  3659. var self=this,$self=this;
  3660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3661. return $core.withContext(function($ctx1) {
  3662. //>>excludeEnd("ctx");
  3663. $self._add_(anObject);
  3664. return self;
  3665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3666. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject})});
  3667. //>>excludeEnd("ctx");
  3668. }; }),
  3669. $globals.SequenceableCollection);
  3670. $core.addMethod(
  3671. $core.method({
  3672. selector: "allButFirst",
  3673. protocol: "accessing",
  3674. //>>excludeStart("ide", pragmas.excludeIdeData);
  3675. args: [],
  3676. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3677. referencedClasses: [],
  3678. //>>excludeEnd("ide");
  3679. pragmas: [],
  3680. messageSends: ["copyFrom:to:", "size"]
  3681. }, function ($methodClass){ return function (){
  3682. var self=this,$self=this;
  3683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3684. return $core.withContext(function($ctx1) {
  3685. //>>excludeEnd("ctx");
  3686. return $self._copyFrom_to_((2),$self._size());
  3687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3688. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{})});
  3689. //>>excludeEnd("ctx");
  3690. }; }),
  3691. $globals.SequenceableCollection);
  3692. $core.addMethod(
  3693. $core.method({
  3694. selector: "allButLast",
  3695. protocol: "accessing",
  3696. //>>excludeStart("ide", pragmas.excludeIdeData);
  3697. args: [],
  3698. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  3699. referencedClasses: [],
  3700. //>>excludeEnd("ide");
  3701. pragmas: [],
  3702. messageSends: ["copyFrom:to:", "-", "size"]
  3703. }, function ($methodClass){ return function (){
  3704. var self=this,$self=this;
  3705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3706. return $core.withContext(function($ctx1) {
  3707. //>>excludeEnd("ctx");
  3708. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  3709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3710. }, function($ctx1) {$ctx1.fill(self,"allButLast",{})});
  3711. //>>excludeEnd("ctx");
  3712. }; }),
  3713. $globals.SequenceableCollection);
  3714. $core.addMethod(
  3715. $core.method({
  3716. selector: "anyOne",
  3717. protocol: "accessing",
  3718. //>>excludeStart("ide", pragmas.excludeIdeData);
  3719. args: [],
  3720. source: "anyOne\x0a\x09^ self at: 1",
  3721. referencedClasses: [],
  3722. //>>excludeEnd("ide");
  3723. pragmas: [],
  3724. messageSends: ["at:"]
  3725. }, function ($methodClass){ return function (){
  3726. var self=this,$self=this;
  3727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3728. return $core.withContext(function($ctx1) {
  3729. //>>excludeEnd("ctx");
  3730. return $self._at_((1));
  3731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3732. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  3733. //>>excludeEnd("ctx");
  3734. }; }),
  3735. $globals.SequenceableCollection);
  3736. $core.addMethod(
  3737. $core.method({
  3738. selector: "atRandom",
  3739. protocol: "accessing",
  3740. //>>excludeStart("ide", pragmas.excludeIdeData);
  3741. args: [],
  3742. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3743. referencedClasses: [],
  3744. //>>excludeEnd("ide");
  3745. pragmas: [],
  3746. messageSends: ["at:", "atRandom", "size"]
  3747. }, function ($methodClass){ return function (){
  3748. var self=this,$self=this;
  3749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3750. return $core.withContext(function($ctx1) {
  3751. //>>excludeEnd("ctx");
  3752. return $self._at_($recv($self._size())._atRandom());
  3753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3754. }, function($ctx1) {$ctx1.fill(self,"atRandom",{})});
  3755. //>>excludeEnd("ctx");
  3756. }; }),
  3757. $globals.SequenceableCollection);
  3758. $core.addMethod(
  3759. $core.method({
  3760. selector: "beginsWith:",
  3761. protocol: "testing",
  3762. //>>excludeStart("ide", pragmas.excludeIdeData);
  3763. args: ["prefix"],
  3764. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3765. referencedClasses: [],
  3766. //>>excludeEnd("ide");
  3767. pragmas: [],
  3768. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3769. }, function ($methodClass){ return function (prefix){
  3770. var self=this,$self=this;
  3771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3772. return $core.withContext(function($ctx1) {
  3773. //>>excludeEnd("ctx");
  3774. if($core.assert($recv([$self._size()
  3775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3776. ,$ctx1.sendIdx["size"]=1
  3777. //>>excludeEnd("ctx");
  3778. ][0]).__lt([$recv(prefix)._size()
  3779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3780. ,$ctx1.sendIdx["size"]=2
  3781. //>>excludeEnd("ctx");
  3782. ][0]))){
  3783. return false;
  3784. }
  3785. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  3786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3787. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix})});
  3788. //>>excludeEnd("ctx");
  3789. }; }),
  3790. $globals.SequenceableCollection);
  3791. $core.addMethod(
  3792. $core.method({
  3793. selector: "copyFrom:to:",
  3794. protocol: "copying",
  3795. //>>excludeStart("ide", pragmas.excludeIdeData);
  3796. args: ["anIndex", "anotherIndex"],
  3797. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  3798. referencedClasses: [],
  3799. //>>excludeEnd("ide");
  3800. pragmas: [],
  3801. messageSends: ["subclassResponsibility"]
  3802. }, function ($methodClass){ return function (anIndex,anotherIndex){
  3803. var self=this,$self=this;
  3804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3805. return $core.withContext(function($ctx1) {
  3806. //>>excludeEnd("ctx");
  3807. $self._subclassResponsibility();
  3808. return self;
  3809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3810. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  3811. //>>excludeEnd("ctx");
  3812. }; }),
  3813. $globals.SequenceableCollection);
  3814. $core.addMethod(
  3815. $core.method({
  3816. selector: "copyWithFirst:",
  3817. protocol: "copying",
  3818. //>>excludeStart("ide", pragmas.excludeIdeData);
  3819. args: ["anObject"],
  3820. source: "copyWithFirst: anObject\x0a\x09^ (self class with: anObject) addAll: self; yourself",
  3821. referencedClasses: [],
  3822. //>>excludeEnd("ide");
  3823. pragmas: [],
  3824. messageSends: ["addAll:", "with:", "class", "yourself"]
  3825. }, function ($methodClass){ return function (anObject){
  3826. var self=this,$self=this;
  3827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3828. return $core.withContext(function($ctx1) {
  3829. //>>excludeEnd("ctx");
  3830. var $1;
  3831. $1=$recv($self._class())._with_(anObject);
  3832. $recv($1)._addAll_(self);
  3833. return $recv($1)._yourself();
  3834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3835. }, function($ctx1) {$ctx1.fill(self,"copyWithFirst:",{anObject:anObject})});
  3836. //>>excludeEnd("ctx");
  3837. }; }),
  3838. $globals.SequenceableCollection);
  3839. $core.addMethod(
  3840. $core.method({
  3841. selector: "endsWith:",
  3842. protocol: "testing",
  3843. //>>excludeStart("ide", pragmas.excludeIdeData);
  3844. args: ["suffix"],
  3845. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  3846. referencedClasses: [],
  3847. //>>excludeEnd("ide");
  3848. pragmas: [],
  3849. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  3850. }, function ($methodClass){ return function (suffix){
  3851. var self=this,$self=this;
  3852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3853. return $core.withContext(function($ctx1) {
  3854. //>>excludeEnd("ctx");
  3855. if($core.assert($recv([$self._size()
  3856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3857. ,$ctx1.sendIdx["size"]=1
  3858. //>>excludeEnd("ctx");
  3859. ][0]).__lt([$recv(suffix)._size()
  3860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3861. ,$ctx1.sendIdx["size"]=2
  3862. //>>excludeEnd("ctx");
  3863. ][0]))){
  3864. return false;
  3865. }
  3866. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  3867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3868. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix})});
  3869. //>>excludeEnd("ctx");
  3870. }; }),
  3871. $globals.SequenceableCollection);
  3872. $core.addMethod(
  3873. $core.method({
  3874. selector: "first",
  3875. protocol: "accessing",
  3876. //>>excludeStart("ide", pragmas.excludeIdeData);
  3877. args: [],
  3878. source: "first\x0a\x09^ self at: 1",
  3879. referencedClasses: [],
  3880. //>>excludeEnd("ide");
  3881. pragmas: [],
  3882. messageSends: ["at:"]
  3883. }, function ($methodClass){ return function (){
  3884. var self=this,$self=this;
  3885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3886. return $core.withContext(function($ctx1) {
  3887. //>>excludeEnd("ctx");
  3888. return $self._at_((1));
  3889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3890. }, function($ctx1) {$ctx1.fill(self,"first",{})});
  3891. //>>excludeEnd("ctx");
  3892. }; }),
  3893. $globals.SequenceableCollection);
  3894. $core.addMethod(
  3895. $core.method({
  3896. selector: "first:",
  3897. protocol: "accessing",
  3898. //>>excludeStart("ide", pragmas.excludeIdeData);
  3899. args: ["aNumber"],
  3900. 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",
  3901. referencedClasses: [],
  3902. //>>excludeEnd("ide");
  3903. pragmas: [],
  3904. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  3905. }, function ($methodClass){ return function (aNumber){
  3906. var self=this,$self=this;
  3907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3908. return $core.withContext(function($ctx1) {
  3909. //>>excludeEnd("ctx");
  3910. if($core.assert($recv($self._size()).__lt(aNumber))){
  3911. $self._error_("Invalid number of elements");
  3912. }
  3913. return $self._copyFrom_to_((1),aNumber);
  3914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3915. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber})});
  3916. //>>excludeEnd("ctx");
  3917. }; }),
  3918. $globals.SequenceableCollection);
  3919. $core.addMethod(
  3920. $core.method({
  3921. selector: "fourth",
  3922. protocol: "accessing",
  3923. //>>excludeStart("ide", pragmas.excludeIdeData);
  3924. args: [],
  3925. source: "fourth\x0a\x09^ self at: 4",
  3926. referencedClasses: [],
  3927. //>>excludeEnd("ide");
  3928. pragmas: [],
  3929. messageSends: ["at:"]
  3930. }, function ($methodClass){ return function (){
  3931. var self=this,$self=this;
  3932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3933. return $core.withContext(function($ctx1) {
  3934. //>>excludeEnd("ctx");
  3935. return $self._at_((4));
  3936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3937. }, function($ctx1) {$ctx1.fill(self,"fourth",{})});
  3938. //>>excludeEnd("ctx");
  3939. }; }),
  3940. $globals.SequenceableCollection);
  3941. $core.addMethod(
  3942. $core.method({
  3943. selector: "includes:",
  3944. protocol: "testing",
  3945. //>>excludeStart("ide", pragmas.excludeIdeData);
  3946. args: ["anObject"],
  3947. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  3948. referencedClasses: [],
  3949. //>>excludeEnd("ide");
  3950. pragmas: [],
  3951. messageSends: ["notNil", "indexOf:ifAbsent:"]
  3952. }, function ($methodClass){ return function (anObject){
  3953. var self=this,$self=this;
  3954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3955. return $core.withContext(function($ctx1) {
  3956. //>>excludeEnd("ctx");
  3957. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  3958. return nil;
  3959. })))._notNil();
  3960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3961. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  3962. //>>excludeEnd("ctx");
  3963. }; }),
  3964. $globals.SequenceableCollection);
  3965. $core.addMethod(
  3966. $core.method({
  3967. selector: "indexOf:startingAt:",
  3968. protocol: "accessing",
  3969. //>>excludeStart("ide", pragmas.excludeIdeData);
  3970. args: ["anObject", "start"],
  3971. 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 ]",
  3972. referencedClasses: [],
  3973. //>>excludeEnd("ide");
  3974. pragmas: [],
  3975. messageSends: ["indexOf:startingAt:ifAbsent:"]
  3976. }, function ($methodClass){ return function (anObject,start){
  3977. var self=this,$self=this;
  3978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3979. return $core.withContext(function($ctx1) {
  3980. //>>excludeEnd("ctx");
  3981. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  3982. return (0);
  3983. }));
  3984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3985. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start})});
  3986. //>>excludeEnd("ctx");
  3987. }; }),
  3988. $globals.SequenceableCollection);
  3989. $core.addMethod(
  3990. $core.method({
  3991. selector: "indexOf:startingAt:ifAbsent:",
  3992. protocol: "accessing",
  3993. //>>excludeStart("ide", pragmas.excludeIdeData);
  3994. args: ["anObject", "start", "aBlock"],
  3995. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  3996. referencedClasses: [],
  3997. //>>excludeEnd("ide");
  3998. pragmas: [],
  3999. messageSends: ["subclassResponsibility"]
  4000. }, function ($methodClass){ return function (anObject,start,aBlock){
  4001. var self=this,$self=this;
  4002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4003. return $core.withContext(function($ctx1) {
  4004. //>>excludeEnd("ctx");
  4005. $self._subclassResponsibility();
  4006. return self;
  4007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4008. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  4009. //>>excludeEnd("ctx");
  4010. }; }),
  4011. $globals.SequenceableCollection);
  4012. $core.addMethod(
  4013. $core.method({
  4014. selector: "last",
  4015. protocol: "accessing",
  4016. //>>excludeStart("ide", pragmas.excludeIdeData);
  4017. args: [],
  4018. source: "last\x0a\x09^ self at: self size",
  4019. referencedClasses: [],
  4020. //>>excludeEnd("ide");
  4021. pragmas: [],
  4022. messageSends: ["at:", "size"]
  4023. }, function ($methodClass){ return function (){
  4024. var self=this,$self=this;
  4025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4026. return $core.withContext(function($ctx1) {
  4027. //>>excludeEnd("ctx");
  4028. return $self._at_($self._size());
  4029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4030. }, function($ctx1) {$ctx1.fill(self,"last",{})});
  4031. //>>excludeEnd("ctx");
  4032. }; }),
  4033. $globals.SequenceableCollection);
  4034. $core.addMethod(
  4035. $core.method({
  4036. selector: "last:",
  4037. protocol: "accessing",
  4038. //>>excludeStart("ide", pragmas.excludeIdeData);
  4039. args: ["aNumber"],
  4040. 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",
  4041. referencedClasses: [],
  4042. //>>excludeEnd("ide");
  4043. pragmas: [],
  4044. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  4045. }, function ($methodClass){ return function (aNumber){
  4046. var self=this,$self=this;
  4047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4048. return $core.withContext(function($ctx1) {
  4049. //>>excludeEnd("ctx");
  4050. if($core.assert($recv([$self._size()
  4051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4052. ,$ctx1.sendIdx["size"]=1
  4053. //>>excludeEnd("ctx");
  4054. ][0]).__lt(aNumber))){
  4055. $self._error_("Invalid number of elements");
  4056. }
  4057. return $self._copyFrom_to_($recv($recv([$self._size()
  4058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4059. ,$ctx1.sendIdx["size"]=2
  4060. //>>excludeEnd("ctx");
  4061. ][0]).__minus(aNumber)).__plus((1)),$self._size());
  4062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4063. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber})});
  4064. //>>excludeEnd("ctx");
  4065. }; }),
  4066. $globals.SequenceableCollection);
  4067. $core.addMethod(
  4068. $core.method({
  4069. selector: "newStream",
  4070. protocol: "streaming",
  4071. //>>excludeStart("ide", pragmas.excludeIdeData);
  4072. args: [],
  4073. source: "newStream\x0a\x09^ self streamClass on: self",
  4074. referencedClasses: [],
  4075. //>>excludeEnd("ide");
  4076. pragmas: [],
  4077. messageSends: ["on:", "streamClass"]
  4078. }, function ($methodClass){ return function (){
  4079. var self=this,$self=this;
  4080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4081. return $core.withContext(function($ctx1) {
  4082. //>>excludeEnd("ctx");
  4083. return $recv($self._streamClass())._on_(self);
  4084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4085. }, function($ctx1) {$ctx1.fill(self,"newStream",{})});
  4086. //>>excludeEnd("ctx");
  4087. }; }),
  4088. $globals.SequenceableCollection);
  4089. $core.addMethod(
  4090. $core.method({
  4091. selector: "pairsCollect:",
  4092. protocol: "enumerating",
  4093. //>>excludeStart("ide", pragmas.excludeIdeData);
  4094. args: ["aBlock"],
  4095. source: "pairsCollect: aBlock\x0a\x09\x22Evaluate aBlock with my elements taken two at a time,\x0a\x09and return an Array with the results\x22\x0a\x0a\x09\x22(#(1 'fred' 2 'charlie' 3 'elmer') pairsCollect: [:a :b | b, ' is number ', a printString]) >>> #('fred is number 1' 'charlie is number 2' 'elmer is number 3')\x22\x0a\x0a\x09^ (1 to: self size // 2) collect: [ :index |\x0a\x09\x09aBlock value: (self at: 2 * index - 1) value: (self at: 2 * index) ]",
  4096. referencedClasses: [],
  4097. //>>excludeEnd("ide");
  4098. pragmas: [],
  4099. messageSends: ["collect:", "to:", "//", "size", "value:value:", "at:", "-", "*"]
  4100. }, function ($methodClass){ return function (aBlock){
  4101. var self=this,$self=this;
  4102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4103. return $core.withContext(function($ctx1) {
  4104. //>>excludeEnd("ctx");
  4105. return $recv((1)._to_($recv($self._size()).__slash_slash((2))))._collect_((function(index){
  4106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4107. return $core.withContext(function($ctx2) {
  4108. //>>excludeEnd("ctx");
  4109. return $recv(aBlock)._value_value_([$self._at_($recv([(2).__star(index)
  4110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4111. ,$ctx2.sendIdx["*"]=1
  4112. //>>excludeEnd("ctx");
  4113. ][0]).__minus((1)))
  4114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4115. ,$ctx2.sendIdx["at:"]=1
  4116. //>>excludeEnd("ctx");
  4117. ][0],$self._at_((2).__star(index)));
  4118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4119. }, function($ctx2) {$ctx2.fillBlock({index:index},$ctx1,1)});
  4120. //>>excludeEnd("ctx");
  4121. }));
  4122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4123. }, function($ctx1) {$ctx1.fill(self,"pairsCollect:",{aBlock:aBlock})});
  4124. //>>excludeEnd("ctx");
  4125. }; }),
  4126. $globals.SequenceableCollection);
  4127. $core.addMethod(
  4128. $core.method({
  4129. selector: "pairsDo:",
  4130. protocol: "enumerating",
  4131. //>>excludeStart("ide", pragmas.excludeIdeData);
  4132. args: ["aBlock"],
  4133. source: "pairsDo: aBlock\x0a\x09\x22Evaluate aBlock with my elements taken two at a time.\x0a\x09If there's an odd number of items, ignore the last one.\x0a\x09Allows use of a flattened array for things that naturally group into pairs.\x0a\x09See also pairsCollect:\x22\x0a\x0a\x09\x22(#(1 'fred' 2 'charlie' 3 'elmer') pairsDo: [:a :b | Transcript cr; show: b, ' is number ', a printString]) >>> #(1 'fred' 2 'charlie' 3 'elmer')\x22\x0a\x0a\x091 to: self size // 2 do: [ :index |\x0a\x09\x09aBlock value: (self at: 2 * index - 1) value: (self at: 2 * index) ]",
  4134. referencedClasses: [],
  4135. //>>excludeEnd("ide");
  4136. pragmas: [],
  4137. messageSends: ["to:do:", "//", "size", "value:value:", "at:", "-", "*"]
  4138. }, function ($methodClass){ return function (aBlock){
  4139. var self=this,$self=this;
  4140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4141. return $core.withContext(function($ctx1) {
  4142. //>>excludeEnd("ctx");
  4143. (1)._to_do_($recv($self._size()).__slash_slash((2)),(function(index){
  4144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4145. return $core.withContext(function($ctx2) {
  4146. //>>excludeEnd("ctx");
  4147. return $recv(aBlock)._value_value_([$self._at_($recv([(2).__star(index)
  4148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4149. ,$ctx2.sendIdx["*"]=1
  4150. //>>excludeEnd("ctx");
  4151. ][0]).__minus((1)))
  4152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4153. ,$ctx2.sendIdx["at:"]=1
  4154. //>>excludeEnd("ctx");
  4155. ][0],$self._at_((2).__star(index)));
  4156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4157. }, function($ctx2) {$ctx2.fillBlock({index:index},$ctx1,1)});
  4158. //>>excludeEnd("ctx");
  4159. }));
  4160. return self;
  4161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4162. }, function($ctx1) {$ctx1.fill(self,"pairsDo:",{aBlock:aBlock})});
  4163. //>>excludeEnd("ctx");
  4164. }; }),
  4165. $globals.SequenceableCollection);
  4166. $core.addMethod(
  4167. $core.method({
  4168. selector: "readStream",
  4169. protocol: "streaming",
  4170. //>>excludeStart("ide", pragmas.excludeIdeData);
  4171. args: [],
  4172. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4173. referencedClasses: [],
  4174. //>>excludeEnd("ide");
  4175. pragmas: [],
  4176. messageSends: ["stream"]
  4177. }, function ($methodClass){ return function (){
  4178. var self=this,$self=this;
  4179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4180. return $core.withContext(function($ctx1) {
  4181. //>>excludeEnd("ctx");
  4182. return $self._stream();
  4183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4184. }, function($ctx1) {$ctx1.fill(self,"readStream",{})});
  4185. //>>excludeEnd("ctx");
  4186. }; }),
  4187. $globals.SequenceableCollection);
  4188. $core.addMethod(
  4189. $core.method({
  4190. selector: "removeLast",
  4191. protocol: "adding/removing",
  4192. //>>excludeStart("ide", pragmas.excludeIdeData);
  4193. args: [],
  4194. source: "removeLast\x0a\x09^ self remove: self last",
  4195. referencedClasses: [],
  4196. //>>excludeEnd("ide");
  4197. pragmas: [],
  4198. messageSends: ["remove:", "last"]
  4199. }, function ($methodClass){ return function (){
  4200. var self=this,$self=this;
  4201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4202. return $core.withContext(function($ctx1) {
  4203. //>>excludeEnd("ctx");
  4204. return $self._remove_($self._last());
  4205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4206. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  4207. //>>excludeEnd("ctx");
  4208. }; }),
  4209. $globals.SequenceableCollection);
  4210. $core.addMethod(
  4211. $core.method({
  4212. selector: "reverseDo:",
  4213. protocol: "enumerating",
  4214. //>>excludeStart("ide", pragmas.excludeIdeData);
  4215. args: ["aBlock"],
  4216. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  4217. referencedClasses: [],
  4218. //>>excludeEnd("ide");
  4219. pragmas: [],
  4220. messageSends: ["do:", "reversed"]
  4221. }, function ($methodClass){ return function (aBlock){
  4222. var self=this,$self=this;
  4223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4224. return $core.withContext(function($ctx1) {
  4225. //>>excludeEnd("ctx");
  4226. $recv($self._reversed())._do_(aBlock);
  4227. return self;
  4228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4229. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock})});
  4230. //>>excludeEnd("ctx");
  4231. }; }),
  4232. $globals.SequenceableCollection);
  4233. $core.addMethod(
  4234. $core.method({
  4235. selector: "reversed",
  4236. protocol: "converting",
  4237. //>>excludeStart("ide", pragmas.excludeIdeData);
  4238. args: [],
  4239. source: "reversed\x0a\x09self subclassResponsibility",
  4240. referencedClasses: [],
  4241. //>>excludeEnd("ide");
  4242. pragmas: [],
  4243. messageSends: ["subclassResponsibility"]
  4244. }, function ($methodClass){ return function (){
  4245. var self=this,$self=this;
  4246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4247. return $core.withContext(function($ctx1) {
  4248. //>>excludeEnd("ctx");
  4249. $self._subclassResponsibility();
  4250. return self;
  4251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4252. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  4253. //>>excludeEnd("ctx");
  4254. }; }),
  4255. $globals.SequenceableCollection);
  4256. $core.addMethod(
  4257. $core.method({
  4258. selector: "second",
  4259. protocol: "accessing",
  4260. //>>excludeStart("ide", pragmas.excludeIdeData);
  4261. args: [],
  4262. source: "second\x0a\x09^ self at: 2",
  4263. referencedClasses: [],
  4264. //>>excludeEnd("ide");
  4265. pragmas: [],
  4266. messageSends: ["at:"]
  4267. }, function ($methodClass){ return function (){
  4268. var self=this,$self=this;
  4269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4270. return $core.withContext(function($ctx1) {
  4271. //>>excludeEnd("ctx");
  4272. return $self._at_((2));
  4273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4274. }, function($ctx1) {$ctx1.fill(self,"second",{})});
  4275. //>>excludeEnd("ctx");
  4276. }; }),
  4277. $globals.SequenceableCollection);
  4278. $core.addMethod(
  4279. $core.method({
  4280. selector: "stream",
  4281. protocol: "streaming",
  4282. //>>excludeStart("ide", pragmas.excludeIdeData);
  4283. args: [],
  4284. source: "stream\x0a\x09^ self newStream",
  4285. referencedClasses: [],
  4286. //>>excludeEnd("ide");
  4287. pragmas: [],
  4288. messageSends: ["newStream"]
  4289. }, function ($methodClass){ return function (){
  4290. var self=this,$self=this;
  4291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4292. return $core.withContext(function($ctx1) {
  4293. //>>excludeEnd("ctx");
  4294. return $self._newStream();
  4295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4296. }, function($ctx1) {$ctx1.fill(self,"stream",{})});
  4297. //>>excludeEnd("ctx");
  4298. }; }),
  4299. $globals.SequenceableCollection);
  4300. $core.addMethod(
  4301. $core.method({
  4302. selector: "streamClass",
  4303. protocol: "streaming",
  4304. //>>excludeStart("ide", pragmas.excludeIdeData);
  4305. args: [],
  4306. source: "streamClass\x0a\x09^ self class streamClass",
  4307. referencedClasses: [],
  4308. //>>excludeEnd("ide");
  4309. pragmas: [],
  4310. messageSends: ["streamClass", "class"]
  4311. }, function ($methodClass){ return function (){
  4312. var self=this,$self=this;
  4313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4314. return $core.withContext(function($ctx1) {
  4315. //>>excludeEnd("ctx");
  4316. return $recv($self._class())._streamClass();
  4317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4318. }, function($ctx1) {$ctx1.fill(self,"streamClass",{})});
  4319. //>>excludeEnd("ctx");
  4320. }; }),
  4321. $globals.SequenceableCollection);
  4322. $core.addMethod(
  4323. $core.method({
  4324. selector: "third",
  4325. protocol: "accessing",
  4326. //>>excludeStart("ide", pragmas.excludeIdeData);
  4327. args: [],
  4328. source: "third\x0a\x09^ self at: 3",
  4329. referencedClasses: [],
  4330. //>>excludeEnd("ide");
  4331. pragmas: [],
  4332. messageSends: ["at:"]
  4333. }, function ($methodClass){ return function (){
  4334. var self=this,$self=this;
  4335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4336. return $core.withContext(function($ctx1) {
  4337. //>>excludeEnd("ctx");
  4338. return $self._at_((3));
  4339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4340. }, function($ctx1) {$ctx1.fill(self,"third",{})});
  4341. //>>excludeEnd("ctx");
  4342. }; }),
  4343. $globals.SequenceableCollection);
  4344. $core.addMethod(
  4345. $core.method({
  4346. selector: "writeStream",
  4347. protocol: "streaming",
  4348. //>>excludeStart("ide", pragmas.excludeIdeData);
  4349. args: [],
  4350. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4351. referencedClasses: [],
  4352. //>>excludeEnd("ide");
  4353. pragmas: [],
  4354. messageSends: ["stream"]
  4355. }, function ($methodClass){ return function (){
  4356. var self=this,$self=this;
  4357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4358. return $core.withContext(function($ctx1) {
  4359. //>>excludeEnd("ctx");
  4360. return $self._stream();
  4361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4362. }, function($ctx1) {$ctx1.fill(self,"writeStream",{})});
  4363. //>>excludeEnd("ctx");
  4364. }; }),
  4365. $globals.SequenceableCollection);
  4366. $core.addMethod(
  4367. $core.method({
  4368. selector: "streamClass",
  4369. protocol: "accessing",
  4370. //>>excludeStart("ide", pragmas.excludeIdeData);
  4371. args: [],
  4372. source: "streamClass\x0a\x09\x09^ Stream",
  4373. referencedClasses: ["Stream"],
  4374. //>>excludeEnd("ide");
  4375. pragmas: [],
  4376. messageSends: []
  4377. }, function ($methodClass){ return function (){
  4378. var self=this,$self=this;
  4379. return $globals.Stream;
  4380. }; }),
  4381. $globals.SequenceableCollection.a$cls);
  4382. $core.addMethod(
  4383. $core.method({
  4384. selector: "streamContents:",
  4385. protocol: "streaming",
  4386. //>>excludeStart("ide", pragmas.excludeIdeData);
  4387. args: ["aBlock"],
  4388. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4389. referencedClasses: [],
  4390. //>>excludeEnd("ide");
  4391. pragmas: [],
  4392. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4393. }, function ($methodClass){ return function (aBlock){
  4394. var self=this,$self=this;
  4395. var stream;
  4396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4397. return $core.withContext(function($ctx1) {
  4398. //>>excludeEnd("ctx");
  4399. stream=$recv($self._streamClass())._on_($self._new());
  4400. $recv(aBlock)._value_(stream);
  4401. return $recv(stream)._contents();
  4402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4403. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream})});
  4404. //>>excludeEnd("ctx");
  4405. }; }),
  4406. $globals.SequenceableCollection.a$cls);
  4407. $core.addClass("Array", $globals.SequenceableCollection, "Kernel-Collections");
  4408. //>>excludeStart("ide", pragmas.excludeIdeData);
  4409. $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`.";
  4410. //>>excludeEnd("ide");
  4411. $core.addMethod(
  4412. $core.method({
  4413. selector: "add:",
  4414. protocol: "adding/removing",
  4415. //>>excludeStart("ide", pragmas.excludeIdeData);
  4416. args: ["anObject"],
  4417. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  4418. referencedClasses: [],
  4419. //>>excludeEnd("ide");
  4420. pragmas: [["inlineJS:", ["self.push(anObject); return anObject;"]]],
  4421. messageSends: []
  4422. }, function ($methodClass){ return function (anObject){
  4423. var self=this,$self=this;
  4424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4425. return $core.withContext(function($ctx1) {
  4426. //>>excludeEnd("ctx");
  4427. self.push(anObject); return anObject;;
  4428. return self;
  4429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4430. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  4431. //>>excludeEnd("ctx");
  4432. }; }),
  4433. $globals.Array);
  4434. $core.addMethod(
  4435. $core.method({
  4436. selector: "addAll:",
  4437. protocol: "adding/removing",
  4438. //>>excludeStart("ide", pragmas.excludeIdeData);
  4439. args: ["aCollection"],
  4440. 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'>",
  4441. referencedClasses: [],
  4442. //>>excludeEnd("ide");
  4443. pragmas: [["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;"]]],
  4444. messageSends: []
  4445. }, function ($methodClass){ return function (aCollection){
  4446. var self=this,$self=this;
  4447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4448. return $core.withContext(function($ctx1) {
  4449. //>>excludeEnd("ctx");
  4450. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  4451. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  4452. return aCollection;;
  4453. return self;
  4454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4455. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  4456. //>>excludeEnd("ctx");
  4457. }; }),
  4458. $globals.Array);
  4459. $core.addMethod(
  4460. $core.method({
  4461. selector: "addFirst:",
  4462. protocol: "adding/removing",
  4463. //>>excludeStart("ide", pragmas.excludeIdeData);
  4464. args: ["anObject"],
  4465. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  4466. referencedClasses: [],
  4467. //>>excludeEnd("ide");
  4468. pragmas: [["inlineJS:", ["self.unshift(anObject); return anObject;"]]],
  4469. messageSends: []
  4470. }, function ($methodClass){ return function (anObject){
  4471. var self=this,$self=this;
  4472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4473. return $core.withContext(function($ctx1) {
  4474. //>>excludeEnd("ctx");
  4475. self.unshift(anObject); return anObject;;
  4476. return self;
  4477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4478. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject})});
  4479. //>>excludeEnd("ctx");
  4480. }; }),
  4481. $globals.Array);
  4482. $core.addMethod(
  4483. $core.method({
  4484. selector: "allIn:",
  4485. protocol: "enumerating",
  4486. //>>excludeStart("ide", pragmas.excludeIdeData);
  4487. args: ["aBlock"],
  4488. source: "allIn: aBlock\x0a\x09^ aBlock valueWithPossibleArguments:\x0a\x09\x09\x22collect to match #in: behaviour\x22\x0a\x09\x09(self collect: [ :each | each in: [ :x | x ] ])",
  4489. referencedClasses: [],
  4490. //>>excludeEnd("ide");
  4491. pragmas: [],
  4492. messageSends: ["valueWithPossibleArguments:", "collect:", "in:"]
  4493. }, function ($methodClass){ return function (aBlock){
  4494. var self=this,$self=this;
  4495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4496. return $core.withContext(function($ctx1) {
  4497. //>>excludeEnd("ctx");
  4498. return $recv(aBlock)._valueWithPossibleArguments_($self._collect_((function(each){
  4499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4500. return $core.withContext(function($ctx2) {
  4501. //>>excludeEnd("ctx");
  4502. return $recv(each)._in_((function(x){
  4503. return x;
  4504. }));
  4505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4507. //>>excludeEnd("ctx");
  4508. })));
  4509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4510. }, function($ctx1) {$ctx1.fill(self,"allIn:",{aBlock:aBlock})});
  4511. //>>excludeEnd("ctx");
  4512. }; }),
  4513. $globals.Array);
  4514. $core.addMethod(
  4515. $core.method({
  4516. selector: "appendToString:",
  4517. protocol: "copying",
  4518. //>>excludeStart("ide", pragmas.excludeIdeData);
  4519. args: ["aString"],
  4520. source: "appendToString: aString\x0a<inlineJS: '\x0a\x09for (var i = 0, l = $self.length; i < l; ++i) {\x0a\x09\x09var el = $self[i];\x0a\x09\x09if ((typeof el === \x22string\x22) || $recv(el)._isString()) {\x0a\x09\x09\x09if (el.length === 1) { aString += el; continue; }\x0a\x09\x09}\x0a\x09\x09$self._error_(\x22Not a character.\x22);\x0a\x09}\x0a\x09return aString'>",
  4521. referencedClasses: [],
  4522. //>>excludeEnd("ide");
  4523. pragmas: [["inlineJS:", ["\x0a\x09for (var i = 0, l = $self.length; i < l; ++i) {\x0a\x09\x09var el = $self[i];\x0a\x09\x09if ((typeof el === \x22string\x22) || $recv(el)._isString()) {\x0a\x09\x09\x09if (el.length === 1) { aString += el; continue; }\x0a\x09\x09}\x0a\x09\x09$self._error_(\x22Not a character.\x22);\x0a\x09}\x0a\x09return aString"]]],
  4524. messageSends: []
  4525. }, function ($methodClass){ return function (aString){
  4526. var self=this,$self=this;
  4527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4528. return $core.withContext(function($ctx1) {
  4529. //>>excludeEnd("ctx");
  4530. for (var i = 0, l = $self.length; i < l; ++i) {
  4531. var el = $self[i];
  4532. if ((typeof el === "string") || $recv(el)._isString()) {
  4533. if (el.length === 1) { aString += el; continue; }
  4534. }
  4535. $self._error_("Not a character.");
  4536. }
  4537. return aString;
  4538. return self;
  4539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4540. }, function($ctx1) {$ctx1.fill(self,"appendToString:",{aString:aString})});
  4541. //>>excludeEnd("ctx");
  4542. }; }),
  4543. $globals.Array);
  4544. $core.addMethod(
  4545. $core.method({
  4546. selector: "asJavaScriptSource",
  4547. protocol: "converting",
  4548. //>>excludeStart("ide", pragmas.excludeIdeData);
  4549. args: [],
  4550. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  4551. referencedClasses: [],
  4552. //>>excludeEnd("ide");
  4553. pragmas: [],
  4554. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  4555. }, function ($methodClass){ return function (){
  4556. var self=this,$self=this;
  4557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4558. return $core.withContext(function($ctx1) {
  4559. //>>excludeEnd("ctx");
  4560. return [$recv("[".__comma($recv($self._collect_((function(each){
  4561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4562. return $core.withContext(function($ctx2) {
  4563. //>>excludeEnd("ctx");
  4564. return $recv(each)._asJavaScriptSource();
  4565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4566. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4567. //>>excludeEnd("ctx");
  4568. })))._join_(", "))).__comma("]")
  4569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4570. ,$ctx1.sendIdx[","]=1
  4571. //>>excludeEnd("ctx");
  4572. ][0];
  4573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4574. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  4575. //>>excludeEnd("ctx");
  4576. }; }),
  4577. $globals.Array);
  4578. $core.addMethod(
  4579. $core.method({
  4580. selector: "at:put:",
  4581. protocol: "accessing",
  4582. //>>excludeStart("ide", pragmas.excludeIdeData);
  4583. args: ["anIndex", "anObject"],
  4584. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  4585. referencedClasses: [],
  4586. //>>excludeEnd("ide");
  4587. pragmas: [["inlineJS:", ["return self[anIndex - 1] = anObject"]]],
  4588. messageSends: []
  4589. }, function ($methodClass){ return function (anIndex,anObject){
  4590. var self=this,$self=this;
  4591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4592. return $core.withContext(function($ctx1) {
  4593. //>>excludeEnd("ctx");
  4594. return self[anIndex - 1] = anObject;
  4595. return self;
  4596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4597. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  4598. //>>excludeEnd("ctx");
  4599. }; }),
  4600. $globals.Array);
  4601. $core.addMethod(
  4602. $core.method({
  4603. selector: "collect:",
  4604. protocol: "enumerating",
  4605. //>>excludeStart("ide", pragmas.excludeIdeData);
  4606. args: ["aBlock"],
  4607. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  4608. referencedClasses: [],
  4609. //>>excludeEnd("ide");
  4610. pragmas: [["inlineJS:", ["return self.map(function(each) {return aBlock._value_(each)})"]]],
  4611. messageSends: []
  4612. }, function ($methodClass){ return function (aBlock){
  4613. var self=this,$self=this;
  4614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4615. return $core.withContext(function($ctx1) {
  4616. //>>excludeEnd("ctx");
  4617. return self.map(function(each) {return aBlock._value_(each)});
  4618. return self;
  4619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4620. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock})});
  4621. //>>excludeEnd("ctx");
  4622. }; }),
  4623. $globals.Array);
  4624. $core.addMethod(
  4625. $core.method({
  4626. selector: "copyFrom:to:",
  4627. protocol: "copying",
  4628. //>>excludeStart("ide", pragmas.excludeIdeData);
  4629. args: ["anIndex", "anotherIndex"],
  4630. 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'>",
  4631. referencedClasses: [],
  4632. //>>excludeEnd("ide");
  4633. pragmas: [["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}"]]],
  4634. messageSends: []
  4635. }, function ($methodClass){ return function (anIndex,anotherIndex){
  4636. var self=this,$self=this;
  4637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4638. return $core.withContext(function($ctx1) {
  4639. //>>excludeEnd("ctx");
  4640. if (anIndex >= 1 && anotherIndex <= self.length) {
  4641. return self.slice(anIndex - 1, anotherIndex);
  4642. } else {
  4643. self._at_(anIndex);
  4644. self._at_(self.length + 1);
  4645. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4646. };
  4647. return self;
  4648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4649. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  4650. //>>excludeEnd("ctx");
  4651. }; }),
  4652. $globals.Array);
  4653. $core.addMethod(
  4654. $core.method({
  4655. selector: "join:",
  4656. protocol: "enumerating",
  4657. //>>excludeStart("ide", pragmas.excludeIdeData);
  4658. args: ["aString"],
  4659. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  4660. referencedClasses: [],
  4661. //>>excludeEnd("ide");
  4662. pragmas: [["inlineJS:", ["return self.join(aString)"]]],
  4663. messageSends: []
  4664. }, function ($methodClass){ return function (aString){
  4665. var self=this,$self=this;
  4666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4667. return $core.withContext(function($ctx1) {
  4668. //>>excludeEnd("ctx");
  4669. return self.join(aString);
  4670. return self;
  4671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4672. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString})});
  4673. //>>excludeEnd("ctx");
  4674. }; }),
  4675. $globals.Array);
  4676. $core.addMethod(
  4677. $core.method({
  4678. selector: "printOn:",
  4679. protocol: "printing",
  4680. //>>excludeStart("ide", pragmas.excludeIdeData);
  4681. args: ["aStream"],
  4682. 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: ')'",
  4683. referencedClasses: [],
  4684. //>>excludeEnd("ide");
  4685. pragmas: [],
  4686. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4687. }, function ($methodClass){ return function (aStream){
  4688. var self=this,$self=this;
  4689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4690. return $core.withContext(function($ctx1) {
  4691. //>>excludeEnd("ctx");
  4692. [(
  4693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4694. $ctx1.supercall = true,
  4695. //>>excludeEnd("ctx");
  4696. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  4697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4698. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  4699. //>>excludeEnd("ctx");
  4700. ][0];
  4701. [$recv(aStream)._nextPutAll_(" (")
  4702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4703. ,$ctx1.sendIdx["nextPutAll:"]=1
  4704. //>>excludeEnd("ctx");
  4705. ][0];
  4706. $self._do_separatedBy_((function(each){
  4707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4708. return $core.withContext(function($ctx2) {
  4709. //>>excludeEnd("ctx");
  4710. return $recv(each)._printOn_(aStream);
  4711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4712. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4713. //>>excludeEnd("ctx");
  4714. }),(function(){
  4715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4716. return $core.withContext(function($ctx2) {
  4717. //>>excludeEnd("ctx");
  4718. return [$recv(aStream)._nextPutAll_(" ")
  4719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4720. ,$ctx2.sendIdx["nextPutAll:"]=2
  4721. //>>excludeEnd("ctx");
  4722. ][0];
  4723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4724. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4725. //>>excludeEnd("ctx");
  4726. }));
  4727. $recv(aStream)._nextPutAll_(")");
  4728. return self;
  4729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4730. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  4731. //>>excludeEnd("ctx");
  4732. }; }),
  4733. $globals.Array);
  4734. $core.addMethod(
  4735. $core.method({
  4736. selector: "remove:ifAbsent:",
  4737. protocol: "adding/removing",
  4738. //>>excludeStart("ide", pragmas.excludeIdeData);
  4739. args: ["anObject", "aBlock"],
  4740. 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 ]",
  4741. referencedClasses: [],
  4742. //>>excludeEnd("ide");
  4743. pragmas: [],
  4744. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4745. }, function ($methodClass){ return function (anObject,aBlock){
  4746. var self=this,$self=this;
  4747. var index;
  4748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4749. return $core.withContext(function($ctx1) {
  4750. //>>excludeEnd("ctx");
  4751. index=$self._indexOf_ifAbsent_(anObject,(function(){
  4752. return (0);
  4753. }));
  4754. if($core.assert($recv(index).__eq((0)))){
  4755. return $recv(aBlock)._value();
  4756. } else {
  4757. $self._removeIndex_(index);
  4758. return anObject;
  4759. }
  4760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4761. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  4762. //>>excludeEnd("ctx");
  4763. }; }),
  4764. $globals.Array);
  4765. $core.addMethod(
  4766. $core.method({
  4767. selector: "removeAll",
  4768. protocol: "adding/removing",
  4769. //>>excludeStart("ide", pragmas.excludeIdeData);
  4770. args: [],
  4771. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  4772. referencedClasses: [],
  4773. //>>excludeEnd("ide");
  4774. pragmas: [["inlineJS:", ["self.length = 0"]]],
  4775. messageSends: []
  4776. }, function ($methodClass){ return function (){
  4777. var self=this,$self=this;
  4778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4779. return $core.withContext(function($ctx1) {
  4780. //>>excludeEnd("ctx");
  4781. self.length = 0;
  4782. return self;
  4783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4784. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  4785. //>>excludeEnd("ctx");
  4786. }; }),
  4787. $globals.Array);
  4788. $core.addMethod(
  4789. $core.method({
  4790. selector: "removeFrom:to:",
  4791. protocol: "adding/removing",
  4792. //>>excludeStart("ide", pragmas.excludeIdeData);
  4793. args: ["aNumber", "anotherNumber"],
  4794. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  4795. referencedClasses: [],
  4796. //>>excludeEnd("ide");
  4797. pragmas: [["inlineJS:", ["self.splice(aNumber -1, anotherNumber - aNumber + 1)"]]],
  4798. messageSends: []
  4799. }, function ($methodClass){ return function (aNumber,anotherNumber){
  4800. var self=this,$self=this;
  4801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4802. return $core.withContext(function($ctx1) {
  4803. //>>excludeEnd("ctx");
  4804. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4805. return self;
  4806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4807. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber})});
  4808. //>>excludeEnd("ctx");
  4809. }; }),
  4810. $globals.Array);
  4811. $core.addMethod(
  4812. $core.method({
  4813. selector: "removeIndex:",
  4814. protocol: "adding/removing",
  4815. //>>excludeStart("ide", pragmas.excludeIdeData);
  4816. args: ["anInteger"],
  4817. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  4818. referencedClasses: [],
  4819. //>>excludeEnd("ide");
  4820. pragmas: [["inlineJS:", ["self.splice(anInteger - 1, 1)"]]],
  4821. messageSends: []
  4822. }, function ($methodClass){ return function (anInteger){
  4823. var self=this,$self=this;
  4824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4825. return $core.withContext(function($ctx1) {
  4826. //>>excludeEnd("ctx");
  4827. self.splice(anInteger - 1, 1);
  4828. return self;
  4829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4830. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger})});
  4831. //>>excludeEnd("ctx");
  4832. }; }),
  4833. $globals.Array);
  4834. $core.addMethod(
  4835. $core.method({
  4836. selector: "removeLast",
  4837. protocol: "adding/removing",
  4838. //>>excludeStart("ide", pragmas.excludeIdeData);
  4839. args: [],
  4840. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  4841. referencedClasses: [],
  4842. //>>excludeEnd("ide");
  4843. pragmas: [["inlineJS:", ["return self.pop();"]]],
  4844. messageSends: []
  4845. }, function ($methodClass){ return function (){
  4846. var self=this,$self=this;
  4847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4848. return $core.withContext(function($ctx1) {
  4849. //>>excludeEnd("ctx");
  4850. return self.pop();;
  4851. return self;
  4852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4853. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  4854. //>>excludeEnd("ctx");
  4855. }; }),
  4856. $globals.Array);
  4857. $core.addMethod(
  4858. $core.method({
  4859. selector: "reversed",
  4860. protocol: "converting",
  4861. //>>excludeStart("ide", pragmas.excludeIdeData);
  4862. args: [],
  4863. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  4864. referencedClasses: [],
  4865. //>>excludeEnd("ide");
  4866. pragmas: [["inlineJS:", ["return self.slice().reverse()"]]],
  4867. messageSends: []
  4868. }, function ($methodClass){ return function (){
  4869. var self=this,$self=this;
  4870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4871. return $core.withContext(function($ctx1) {
  4872. //>>excludeEnd("ctx");
  4873. return self.slice().reverse();
  4874. return self;
  4875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4876. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  4877. //>>excludeEnd("ctx");
  4878. }; }),
  4879. $globals.Array);
  4880. $core.addMethod(
  4881. $core.method({
  4882. selector: "select:",
  4883. protocol: "enumerating",
  4884. //>>excludeStart("ide", pragmas.excludeIdeData);
  4885. args: ["aBlock"],
  4886. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  4887. referencedClasses: [],
  4888. //>>excludeEnd("ide");
  4889. pragmas: [["inlineJS:", ["return self.filter(function(each) {return aBlock._value_(each)})"]]],
  4890. messageSends: []
  4891. }, function ($methodClass){ return function (aBlock){
  4892. var self=this,$self=this;
  4893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4894. return $core.withContext(function($ctx1) {
  4895. //>>excludeEnd("ctx");
  4896. return self.filter(function(each) {return aBlock._value_(each)});
  4897. return self;
  4898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4899. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock})});
  4900. //>>excludeEnd("ctx");
  4901. }; }),
  4902. $globals.Array);
  4903. $core.addMethod(
  4904. $core.method({
  4905. selector: "shallowCopy",
  4906. protocol: "copying",
  4907. //>>excludeStart("ide", pragmas.excludeIdeData);
  4908. args: [],
  4909. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  4910. referencedClasses: [],
  4911. //>>excludeEnd("ide");
  4912. pragmas: [["inlineJS:", ["return self.slice()"]]],
  4913. messageSends: []
  4914. }, function ($methodClass){ return function (){
  4915. var self=this,$self=this;
  4916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4917. return $core.withContext(function($ctx1) {
  4918. //>>excludeEnd("ctx");
  4919. return self.slice();
  4920. return self;
  4921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4922. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  4923. //>>excludeEnd("ctx");
  4924. }; }),
  4925. $globals.Array);
  4926. $core.addMethod(
  4927. $core.method({
  4928. selector: "sort",
  4929. protocol: "enumerating",
  4930. //>>excludeStart("ide", pragmas.excludeIdeData);
  4931. args: [],
  4932. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  4933. referencedClasses: [],
  4934. //>>excludeEnd("ide");
  4935. pragmas: [],
  4936. messageSends: ["sort:", "<"]
  4937. }, function ($methodClass){ return function (){
  4938. var self=this,$self=this;
  4939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4940. return $core.withContext(function($ctx1) {
  4941. //>>excludeEnd("ctx");
  4942. return $self._sort_((function(a,b){
  4943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4944. return $core.withContext(function($ctx2) {
  4945. //>>excludeEnd("ctx");
  4946. return $recv(a).__lt(b);
  4947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4948. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  4949. //>>excludeEnd("ctx");
  4950. }));
  4951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4952. }, function($ctx1) {$ctx1.fill(self,"sort",{})});
  4953. //>>excludeEnd("ctx");
  4954. }; }),
  4955. $globals.Array);
  4956. $core.addMethod(
  4957. $core.method({
  4958. selector: "sort:",
  4959. protocol: "enumerating",
  4960. //>>excludeStart("ide", pragmas.excludeIdeData);
  4961. args: ["aBlock"],
  4962. 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'>",
  4963. referencedClasses: [],
  4964. //>>excludeEnd("ide");
  4965. pragmas: [["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"]]],
  4966. messageSends: []
  4967. }, function ($methodClass){ return function (aBlock){
  4968. var self=this,$self=this;
  4969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4970. return $core.withContext(function($ctx1) {
  4971. //>>excludeEnd("ctx");
  4972. return self.sort(function(a, b) {
  4973. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  4974. })
  4975. ;
  4976. return self;
  4977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4978. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock})});
  4979. //>>excludeEnd("ctx");
  4980. }; }),
  4981. $globals.Array);
  4982. $core.addMethod(
  4983. $core.method({
  4984. selector: "sorted",
  4985. protocol: "enumerating",
  4986. //>>excludeStart("ide", pragmas.excludeIdeData);
  4987. args: [],
  4988. source: "sorted\x0a\x09^ self copy sort",
  4989. referencedClasses: [],
  4990. //>>excludeEnd("ide");
  4991. pragmas: [],
  4992. messageSends: ["sort", "copy"]
  4993. }, function ($methodClass){ return function (){
  4994. var self=this,$self=this;
  4995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4996. return $core.withContext(function($ctx1) {
  4997. //>>excludeEnd("ctx");
  4998. return $recv($self._copy())._sort();
  4999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5000. }, function($ctx1) {$ctx1.fill(self,"sorted",{})});
  5001. //>>excludeEnd("ctx");
  5002. }; }),
  5003. $globals.Array);
  5004. $core.addMethod(
  5005. $core.method({
  5006. selector: "sorted:",
  5007. protocol: "enumerating",
  5008. //>>excludeStart("ide", pragmas.excludeIdeData);
  5009. args: ["aBlock"],
  5010. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  5011. referencedClasses: [],
  5012. //>>excludeEnd("ide");
  5013. pragmas: [],
  5014. messageSends: ["sort:", "copy"]
  5015. }, function ($methodClass){ return function (aBlock){
  5016. var self=this,$self=this;
  5017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5018. return $core.withContext(function($ctx1) {
  5019. //>>excludeEnd("ctx");
  5020. return $recv($self._copy())._sort_(aBlock);
  5021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5022. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock})});
  5023. //>>excludeEnd("ctx");
  5024. }; }),
  5025. $globals.Array);
  5026. $core.addMethod(
  5027. $core.method({
  5028. selector: "new:",
  5029. protocol: "instance creation",
  5030. //>>excludeStart("ide", pragmas.excludeIdeData);
  5031. args: ["anInteger"],
  5032. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  5033. referencedClasses: [],
  5034. //>>excludeEnd("ide");
  5035. pragmas: [["inlineJS:", ["return new Array(anInteger)"]]],
  5036. messageSends: []
  5037. }, function ($methodClass){ return function (anInteger){
  5038. var self=this,$self=this;
  5039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5040. return $core.withContext(function($ctx1) {
  5041. //>>excludeEnd("ctx");
  5042. return new Array(anInteger);
  5043. return self;
  5044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5045. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  5046. //>>excludeEnd("ctx");
  5047. }; }),
  5048. $globals.Array.a$cls);
  5049. $core.addMethod(
  5050. $core.method({
  5051. selector: "with:",
  5052. protocol: "instance creation",
  5053. //>>excludeStart("ide", pragmas.excludeIdeData);
  5054. args: ["anObject"],
  5055. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  5056. referencedClasses: [],
  5057. //>>excludeEnd("ide");
  5058. pragmas: [],
  5059. messageSends: ["at:put:", "new:", "yourself"]
  5060. }, function ($methodClass){ return function (anObject){
  5061. var self=this,$self=this;
  5062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5063. return $core.withContext(function($ctx1) {
  5064. //>>excludeEnd("ctx");
  5065. var $1;
  5066. $1=$self._new_((1));
  5067. $recv($1)._at_put_((1),anObject);
  5068. return $recv($1)._yourself();
  5069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5070. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  5071. //>>excludeEnd("ctx");
  5072. }; }),
  5073. $globals.Array.a$cls);
  5074. $core.addMethod(
  5075. $core.method({
  5076. selector: "with:with:",
  5077. protocol: "instance creation",
  5078. //>>excludeStart("ide", pragmas.excludeIdeData);
  5079. args: ["anObject", "anObject2"],
  5080. 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",
  5081. referencedClasses: [],
  5082. //>>excludeEnd("ide");
  5083. pragmas: [],
  5084. messageSends: ["at:put:", "new:", "yourself"]
  5085. }, function ($methodClass){ return function (anObject,anObject2){
  5086. var self=this,$self=this;
  5087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5088. return $core.withContext(function($ctx1) {
  5089. //>>excludeEnd("ctx");
  5090. var $1;
  5091. $1=$self._new_((2));
  5092. [$recv($1)._at_put_((1),anObject)
  5093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5094. ,$ctx1.sendIdx["at:put:"]=1
  5095. //>>excludeEnd("ctx");
  5096. ][0];
  5097. $recv($1)._at_put_((2),anObject2);
  5098. return $recv($1)._yourself();
  5099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5100. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2})});
  5101. //>>excludeEnd("ctx");
  5102. }; }),
  5103. $globals.Array.a$cls);
  5104. $core.addMethod(
  5105. $core.method({
  5106. selector: "with:with:with:",
  5107. protocol: "instance creation",
  5108. //>>excludeStart("ide", pragmas.excludeIdeData);
  5109. args: ["anObject", "anObject2", "anObject3"],
  5110. 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",
  5111. referencedClasses: [],
  5112. //>>excludeEnd("ide");
  5113. pragmas: [],
  5114. messageSends: ["at:put:", "new:", "yourself"]
  5115. }, function ($methodClass){ return function (anObject,anObject2,anObject3){
  5116. var self=this,$self=this;
  5117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5118. return $core.withContext(function($ctx1) {
  5119. //>>excludeEnd("ctx");
  5120. var $1;
  5121. $1=$self._new_((3));
  5122. [$recv($1)._at_put_((1),anObject)
  5123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5124. ,$ctx1.sendIdx["at:put:"]=1
  5125. //>>excludeEnd("ctx");
  5126. ][0];
  5127. [$recv($1)._at_put_((2),anObject2)
  5128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5129. ,$ctx1.sendIdx["at:put:"]=2
  5130. //>>excludeEnd("ctx");
  5131. ][0];
  5132. $recv($1)._at_put_((3),anObject3);
  5133. return $recv($1)._yourself();
  5134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5135. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  5136. //>>excludeEnd("ctx");
  5137. }; }),
  5138. $globals.Array.a$cls);
  5139. $core.addMethod(
  5140. $core.method({
  5141. selector: "withAll:",
  5142. protocol: "instance creation",
  5143. //>>excludeStart("ide", pragmas.excludeIdeData);
  5144. args: ["aCollection"],
  5145. 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",
  5146. referencedClasses: [],
  5147. //>>excludeEnd("ide");
  5148. pragmas: [],
  5149. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  5150. }, function ($methodClass){ return function (aCollection){
  5151. var self=this,$self=this;
  5152. var instance,index;
  5153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5154. return $core.withContext(function($ctx1) {
  5155. //>>excludeEnd("ctx");
  5156. index=(1);
  5157. instance=$self._new_($recv(aCollection)._size());
  5158. $recv(aCollection)._do_((function(each){
  5159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5160. return $core.withContext(function($ctx2) {
  5161. //>>excludeEnd("ctx");
  5162. $recv(instance)._at_put_(index,each);
  5163. index=$recv(index).__plus((1));
  5164. return index;
  5165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5166. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5167. //>>excludeEnd("ctx");
  5168. }));
  5169. return instance;
  5170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5171. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index})});
  5172. //>>excludeEnd("ctx");
  5173. }; }),
  5174. $globals.Array.a$cls);
  5175. $core.addClass("String", $globals.SequenceableCollection, "Kernel-Collections");
  5176. //>>excludeStart("ide", pragmas.excludeIdeData);
  5177. $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 >> #,`";
  5178. //>>excludeEnd("ide");
  5179. $core.addMethod(
  5180. $core.method({
  5181. selector: ",",
  5182. protocol: "copying",
  5183. //>>excludeStart("ide", pragmas.excludeIdeData);
  5184. args: ["aString"],
  5185. source: ", aString\x0a\x09<inlineJS: 'return typeof aString === \x22string\x22 ?\x0a\x09\x09String(self) + aString :\x0a\x09\x09$recv(aString)._appendToString_(String(self))'>",
  5186. referencedClasses: [],
  5187. //>>excludeEnd("ide");
  5188. pragmas: [["inlineJS:", ["return typeof aString === \x22string\x22 ?\x0a\x09\x09String(self) + aString :\x0a\x09\x09$recv(aString)._appendToString_(String(self))"]]],
  5189. messageSends: []
  5190. }, function ($methodClass){ return function (aString){
  5191. var self=this,$self=this;
  5192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5193. return $core.withContext(function($ctx1) {
  5194. //>>excludeEnd("ctx");
  5195. return typeof aString === "string" ?
  5196. String(self) + aString :
  5197. $recv(aString)._appendToString_(String(self));
  5198. return self;
  5199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5200. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString})});
  5201. //>>excludeEnd("ctx");
  5202. }; }),
  5203. $globals.String);
  5204. $core.addMethod(
  5205. $core.method({
  5206. selector: "<",
  5207. protocol: "comparing",
  5208. //>>excludeStart("ide", pragmas.excludeIdeData);
  5209. args: ["aString"],
  5210. source: "< aString\x0a<inlineJS: 'return typeof aString === \x22string\x22 ?\x0a\x09String(self) < aString :\x0a\x09$recv(aString)._isStringLessThanSelf_(String(self))'>",
  5211. referencedClasses: [],
  5212. //>>excludeEnd("ide");
  5213. pragmas: [["inlineJS:", ["return typeof aString === \x22string\x22 ?\x0a\x09String(self) < aString :\x0a\x09$recv(aString)._isStringLessThanSelf_(String(self))"]]],
  5214. messageSends: []
  5215. }, function ($methodClass){ return function (aString){
  5216. var self=this,$self=this;
  5217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5218. return $core.withContext(function($ctx1) {
  5219. //>>excludeEnd("ctx");
  5220. return typeof aString === "string" ?
  5221. String(self) < aString :
  5222. $recv(aString)._isStringLessThanSelf_(String(self));
  5223. return self;
  5224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5225. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString})});
  5226. //>>excludeEnd("ctx");
  5227. }; }),
  5228. $globals.String);
  5229. $core.addMethod(
  5230. $core.method({
  5231. selector: "<=",
  5232. protocol: "comparing",
  5233. //>>excludeStart("ide", pragmas.excludeIdeData);
  5234. args: ["aString"],
  5235. source: "<= aString\x0a<inlineJS: 'return typeof aString === \x22string\x22 ?\x0a\x09String(self) <= aString :\x0a\x09$recv(aString)._isStringLessThanOrEqualToSelf_(String(self))'>",
  5236. referencedClasses: [],
  5237. //>>excludeEnd("ide");
  5238. pragmas: [["inlineJS:", ["return typeof aString === \x22string\x22 ?\x0a\x09String(self) <= aString :\x0a\x09$recv(aString)._isStringLessThanOrEqualToSelf_(String(self))"]]],
  5239. messageSends: []
  5240. }, function ($methodClass){ return function (aString){
  5241. var self=this,$self=this;
  5242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5243. return $core.withContext(function($ctx1) {
  5244. //>>excludeEnd("ctx");
  5245. return typeof aString === "string" ?
  5246. String(self) <= aString :
  5247. $recv(aString)._isStringLessThanOrEqualToSelf_(String(self));
  5248. return self;
  5249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5250. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString})});
  5251. //>>excludeEnd("ctx");
  5252. }; }),
  5253. $globals.String);
  5254. $core.addMethod(
  5255. $core.method({
  5256. selector: "=",
  5257. protocol: "comparing",
  5258. //>>excludeStart("ide", pragmas.excludeIdeData);
  5259. args: ["aString"],
  5260. source: "= aString\x0a<inlineJS: 'return typeof aString === \x22string\x22 ?\x0a\x09String(self) === aString :\x0a\x09$recv(aString)._isStringEqualToSelf_(String(self))'>",
  5261. referencedClasses: [],
  5262. //>>excludeEnd("ide");
  5263. pragmas: [["inlineJS:", ["return typeof aString === \x22string\x22 ?\x0a\x09String(self) === aString :\x0a\x09$recv(aString)._isStringEqualToSelf_(String(self))"]]],
  5264. messageSends: []
  5265. }, function ($methodClass){ return function (aString){
  5266. var self=this,$self=this;
  5267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5268. return $core.withContext(function($ctx1) {
  5269. //>>excludeEnd("ctx");
  5270. return typeof aString === "string" ?
  5271. String(self) === aString :
  5272. $recv(aString)._isStringEqualToSelf_(String(self));
  5273. return self;
  5274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5275. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString})});
  5276. //>>excludeEnd("ctx");
  5277. }; }),
  5278. $globals.String);
  5279. $core.addMethod(
  5280. $core.method({
  5281. selector: "==",
  5282. protocol: "comparing",
  5283. //>>excludeStart("ide", pragmas.excludeIdeData);
  5284. args: ["aString"],
  5285. source: "== aString\x0a<inlineJS: 'return typeof aString === \x22string\x22 ?\x0a\x09String(self) === aString :\x0a\x09$recv(aString)._isStringEqualToSelf_(String(self))'>",
  5286. referencedClasses: [],
  5287. //>>excludeEnd("ide");
  5288. pragmas: [["inlineJS:", ["return typeof aString === \x22string\x22 ?\x0a\x09String(self) === aString :\x0a\x09$recv(aString)._isStringEqualToSelf_(String(self))"]]],
  5289. messageSends: []
  5290. }, function ($methodClass){ return function (aString){
  5291. var self=this,$self=this;
  5292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5293. return $core.withContext(function($ctx1) {
  5294. //>>excludeEnd("ctx");
  5295. return typeof aString === "string" ?
  5296. String(self) === aString :
  5297. $recv(aString)._isStringEqualToSelf_(String(self));
  5298. return self;
  5299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5300. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString})});
  5301. //>>excludeEnd("ctx");
  5302. }; }),
  5303. $globals.String);
  5304. $core.addMethod(
  5305. $core.method({
  5306. selector: ">",
  5307. protocol: "comparing",
  5308. //>>excludeStart("ide", pragmas.excludeIdeData);
  5309. args: ["aString"],
  5310. source: "> aString\x0a<inlineJS: 'return typeof aString === \x22string\x22 ?\x0a\x09String(self) > aString :\x0a\x09$recv(aString)._isStringGreaterThanSelf_(String(self))'>",
  5311. referencedClasses: [],
  5312. //>>excludeEnd("ide");
  5313. pragmas: [["inlineJS:", ["return typeof aString === \x22string\x22 ?\x0a\x09String(self) > aString :\x0a\x09$recv(aString)._isStringGreaterThanSelf_(String(self))"]]],
  5314. messageSends: []
  5315. }, function ($methodClass){ return function (aString){
  5316. var self=this,$self=this;
  5317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5318. return $core.withContext(function($ctx1) {
  5319. //>>excludeEnd("ctx");
  5320. return typeof aString === "string" ?
  5321. String(self) > aString :
  5322. $recv(aString)._isStringGreaterThanSelf_(String(self));
  5323. return self;
  5324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5325. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString})});
  5326. //>>excludeEnd("ctx");
  5327. }; }),
  5328. $globals.String);
  5329. $core.addMethod(
  5330. $core.method({
  5331. selector: ">=",
  5332. protocol: "comparing",
  5333. //>>excludeStart("ide", pragmas.excludeIdeData);
  5334. args: ["aString"],
  5335. source: ">= aString\x0a<inlineJS: 'return typeof aString === \x22string\x22 ?\x0a\x09String(self) >= aString :\x0a\x09$recv(aString)._isStringGreaterThanOrEqualSelf_(String(self))'>",
  5336. referencedClasses: [],
  5337. //>>excludeEnd("ide");
  5338. pragmas: [["inlineJS:", ["return typeof aString === \x22string\x22 ?\x0a\x09String(self) >= aString :\x0a\x09$recv(aString)._isStringGreaterThanOrEqualSelf_(String(self))"]]],
  5339. messageSends: []
  5340. }, function ($methodClass){ return function (aString){
  5341. var self=this,$self=this;
  5342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5343. return $core.withContext(function($ctx1) {
  5344. //>>excludeEnd("ctx");
  5345. return typeof aString === "string" ?
  5346. String(self) >= aString :
  5347. $recv(aString)._isStringGreaterThanOrEqualSelf_(String(self));
  5348. return self;
  5349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5350. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString})});
  5351. //>>excludeEnd("ctx");
  5352. }; }),
  5353. $globals.String);
  5354. $core.addMethod(
  5355. $core.method({
  5356. selector: "add:",
  5357. protocol: "adding/removing",
  5358. //>>excludeStart("ide", pragmas.excludeIdeData);
  5359. args: ["anObject"],
  5360. source: "add: anObject\x0a\x09self errorReadOnly",
  5361. referencedClasses: [],
  5362. //>>excludeEnd("ide");
  5363. pragmas: [],
  5364. messageSends: ["errorReadOnly"]
  5365. }, function ($methodClass){ return function (anObject){
  5366. var self=this,$self=this;
  5367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5368. return $core.withContext(function($ctx1) {
  5369. //>>excludeEnd("ctx");
  5370. $self._errorReadOnly();
  5371. return self;
  5372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5373. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  5374. //>>excludeEnd("ctx");
  5375. }; }),
  5376. $globals.String);
  5377. $core.addMethod(
  5378. $core.method({
  5379. selector: "appendToString:",
  5380. protocol: "copying",
  5381. //>>excludeStart("ide", pragmas.excludeIdeData);
  5382. args: ["aString"],
  5383. source: "appendToString: aString\x0a\x09<inlineJS: 'return aString + self'>",
  5384. referencedClasses: [],
  5385. //>>excludeEnd("ide");
  5386. pragmas: [["inlineJS:", ["return aString + self"]]],
  5387. messageSends: []
  5388. }, function ($methodClass){ return function (aString){
  5389. var self=this,$self=this;
  5390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5391. return $core.withContext(function($ctx1) {
  5392. //>>excludeEnd("ctx");
  5393. return aString + self;
  5394. return self;
  5395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5396. }, function($ctx1) {$ctx1.fill(self,"appendToString:",{aString:aString})});
  5397. //>>excludeEnd("ctx");
  5398. }; }),
  5399. $globals.String);
  5400. $core.addMethod(
  5401. $core.method({
  5402. selector: "asJavaScriptMethodName",
  5403. protocol: "converting",
  5404. //>>excludeStart("ide", pragmas.excludeIdeData);
  5405. args: [],
  5406. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  5407. referencedClasses: [],
  5408. //>>excludeEnd("ide");
  5409. pragmas: [["inlineJS:", ["return $core.st2js(self)"]]],
  5410. messageSends: []
  5411. }, function ($methodClass){ return function (){
  5412. var self=this,$self=this;
  5413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5414. return $core.withContext(function($ctx1) {
  5415. //>>excludeEnd("ctx");
  5416. return $core.st2js(self);
  5417. return self;
  5418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5419. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{})});
  5420. //>>excludeEnd("ctx");
  5421. }; }),
  5422. $globals.String);
  5423. $core.addMethod(
  5424. $core.method({
  5425. selector: "asJavaScriptObject",
  5426. protocol: "converting",
  5427. //>>excludeStart("ide", pragmas.excludeIdeData);
  5428. args: [],
  5429. source: "asJavaScriptObject\x0a\x09^ self",
  5430. referencedClasses: [],
  5431. //>>excludeEnd("ide");
  5432. pragmas: [],
  5433. messageSends: []
  5434. }, function ($methodClass){ return function (){
  5435. var self=this,$self=this;
  5436. return self;
  5437. }; }),
  5438. $globals.String);
  5439. $core.addMethod(
  5440. $core.method({
  5441. selector: "asJavaScriptSource",
  5442. protocol: "converting",
  5443. //>>excludeStart("ide", pragmas.excludeIdeData);
  5444. args: [],
  5445. 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'>",
  5446. referencedClasses: [],
  5447. //>>excludeEnd("ide");
  5448. pragmas: [["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"]]],
  5449. messageSends: []
  5450. }, function ($methodClass){ return function (){
  5451. var self=this,$self=this;
  5452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5453. return $core.withContext(function($ctx1) {
  5454. //>>excludeEnd("ctx");
  5455. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5456. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5457. else
  5458. return "\"" + self + "\"";
  5459. ;
  5460. return self;
  5461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5462. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  5463. //>>excludeEnd("ctx");
  5464. }; }),
  5465. $globals.String);
  5466. $core.addMethod(
  5467. $core.method({
  5468. selector: "asLowercase",
  5469. protocol: "converting",
  5470. //>>excludeStart("ide", pragmas.excludeIdeData);
  5471. args: [],
  5472. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  5473. referencedClasses: [],
  5474. //>>excludeEnd("ide");
  5475. pragmas: [["inlineJS:", ["return self.toLowerCase()"]]],
  5476. messageSends: []
  5477. }, function ($methodClass){ return function (){
  5478. var self=this,$self=this;
  5479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5480. return $core.withContext(function($ctx1) {
  5481. //>>excludeEnd("ctx");
  5482. return self.toLowerCase();
  5483. return self;
  5484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5485. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{})});
  5486. //>>excludeEnd("ctx");
  5487. }; }),
  5488. $globals.String);
  5489. $core.addMethod(
  5490. $core.method({
  5491. selector: "asMutator",
  5492. protocol: "converting",
  5493. //>>excludeStart("ide", pragmas.excludeIdeData);
  5494. args: [],
  5495. 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",
  5496. referencedClasses: [],
  5497. //>>excludeEnd("ide");
  5498. pragmas: [],
  5499. messageSends: ["ifFalse:", "=", "last", ","]
  5500. }, function ($methodClass){ return function (){
  5501. var self=this,$self=this;
  5502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5503. return $core.withContext(function($ctx1) {
  5504. //>>excludeEnd("ctx");
  5505. if(!$core.assert($recv($self._last()).__eq(":"))){
  5506. return $self.__comma(":");
  5507. }
  5508. return self;
  5509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5510. }, function($ctx1) {$ctx1.fill(self,"asMutator",{})});
  5511. //>>excludeEnd("ctx");
  5512. }; }),
  5513. $globals.String);
  5514. $core.addMethod(
  5515. $core.method({
  5516. selector: "asNumber",
  5517. protocol: "converting",
  5518. //>>excludeStart("ide", pragmas.excludeIdeData);
  5519. args: [],
  5520. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  5521. referencedClasses: [],
  5522. //>>excludeEnd("ide");
  5523. pragmas: [["inlineJS:", ["return Number(self)"]]],
  5524. messageSends: []
  5525. }, function ($methodClass){ return function (){
  5526. var self=this,$self=this;
  5527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5528. return $core.withContext(function($ctx1) {
  5529. //>>excludeEnd("ctx");
  5530. return Number(self);
  5531. return self;
  5532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5533. }, function($ctx1) {$ctx1.fill(self,"asNumber",{})});
  5534. //>>excludeEnd("ctx");
  5535. }; }),
  5536. $globals.String);
  5537. $core.addMethod(
  5538. $core.method({
  5539. selector: "asRegexp",
  5540. protocol: "converting",
  5541. //>>excludeStart("ide", pragmas.excludeIdeData);
  5542. args: [],
  5543. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  5544. referencedClasses: ["RegularExpression"],
  5545. //>>excludeEnd("ide");
  5546. pragmas: [],
  5547. messageSends: ["fromString:"]
  5548. }, function ($methodClass){ return function (){
  5549. var self=this,$self=this;
  5550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5551. return $core.withContext(function($ctx1) {
  5552. //>>excludeEnd("ctx");
  5553. return $recv($globals.RegularExpression)._fromString_(self);
  5554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5555. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{})});
  5556. //>>excludeEnd("ctx");
  5557. }; }),
  5558. $globals.String);
  5559. $core.addMethod(
  5560. $core.method({
  5561. selector: "asString",
  5562. protocol: "converting",
  5563. //>>excludeStart("ide", pragmas.excludeIdeData);
  5564. args: [],
  5565. source: "asString\x0a\x09^ self",
  5566. referencedClasses: [],
  5567. //>>excludeEnd("ide");
  5568. pragmas: [],
  5569. messageSends: []
  5570. }, function ($methodClass){ return function (){
  5571. var self=this,$self=this;
  5572. return self;
  5573. }; }),
  5574. $globals.String);
  5575. $core.addMethod(
  5576. $core.method({
  5577. selector: "asSymbol",
  5578. protocol: "converting",
  5579. //>>excludeStart("ide", pragmas.excludeIdeData);
  5580. args: [],
  5581. source: "asSymbol\x0a\x09^ self",
  5582. referencedClasses: [],
  5583. //>>excludeEnd("ide");
  5584. pragmas: [],
  5585. messageSends: []
  5586. }, function ($methodClass){ return function (){
  5587. var self=this,$self=this;
  5588. return self;
  5589. }; }),
  5590. $globals.String);
  5591. $core.addMethod(
  5592. $core.method({
  5593. selector: "asSymbolPrintOn:",
  5594. protocol: "printing",
  5595. //>>excludeStart("ide", pragmas.excludeIdeData);
  5596. args: ["aStream"],
  5597. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  5598. referencedClasses: [],
  5599. //>>excludeEnd("ide");
  5600. pragmas: [],
  5601. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  5602. }, function ($methodClass){ return function (aStream){
  5603. var self=this,$self=this;
  5604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5605. return $core.withContext(function($ctx1) {
  5606. //>>excludeEnd("ctx");
  5607. $recv(aStream)._nextPutAll_("#");
  5608. if($core.assert($recv($self._asString())._isSelector())){
  5609. $recv(aStream)._nextPut_(self);
  5610. } else {
  5611. $self._printOn_(aStream);
  5612. }
  5613. return self;
  5614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5615. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream})});
  5616. //>>excludeEnd("ctx");
  5617. }; }),
  5618. $globals.String);
  5619. $core.addMethod(
  5620. $core.method({
  5621. selector: "asUppercase",
  5622. protocol: "converting",
  5623. //>>excludeStart("ide", pragmas.excludeIdeData);
  5624. args: [],
  5625. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  5626. referencedClasses: [],
  5627. //>>excludeEnd("ide");
  5628. pragmas: [["inlineJS:", ["return self.toUpperCase()"]]],
  5629. messageSends: []
  5630. }, function ($methodClass){ return function (){
  5631. var self=this,$self=this;
  5632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5633. return $core.withContext(function($ctx1) {
  5634. //>>excludeEnd("ctx");
  5635. return self.toUpperCase();
  5636. return self;
  5637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5638. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{})});
  5639. //>>excludeEnd("ctx");
  5640. }; }),
  5641. $globals.String);
  5642. $core.addMethod(
  5643. $core.method({
  5644. selector: "asciiValue",
  5645. protocol: "accessing",
  5646. //>>excludeStart("ide", pragmas.excludeIdeData);
  5647. args: [],
  5648. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  5649. referencedClasses: [],
  5650. //>>excludeEnd("ide");
  5651. pragmas: [["inlineJS:", ["return self.charCodeAt(0);"]]],
  5652. messageSends: []
  5653. }, function ($methodClass){ return function (){
  5654. var self=this,$self=this;
  5655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5656. return $core.withContext(function($ctx1) {
  5657. //>>excludeEnd("ctx");
  5658. return self.charCodeAt(0);;
  5659. return self;
  5660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5661. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{})});
  5662. //>>excludeEnd("ctx");
  5663. }; }),
  5664. $globals.String);
  5665. $core.addMethod(
  5666. $core.method({
  5667. selector: "at:ifAbsent:",
  5668. protocol: "accessing",
  5669. //>>excludeStart("ide", pragmas.excludeIdeData);
  5670. args: ["anIndex", "aBlock"],
  5671. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  5672. referencedClasses: [],
  5673. //>>excludeEnd("ide");
  5674. pragmas: [["inlineJS:", ["return String(self)[anIndex - 1] || aBlock._value()"]]],
  5675. messageSends: []
  5676. }, function ($methodClass){ return function (anIndex,aBlock){
  5677. var self=this,$self=this;
  5678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5679. return $core.withContext(function($ctx1) {
  5680. //>>excludeEnd("ctx");
  5681. return String(self)[anIndex - 1] || aBlock._value();
  5682. return self;
  5683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5684. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  5685. //>>excludeEnd("ctx");
  5686. }; }),
  5687. $globals.String);
  5688. $core.addMethod(
  5689. $core.method({
  5690. selector: "at:ifPresent:ifAbsent:",
  5691. protocol: "accessing",
  5692. //>>excludeStart("ide", pragmas.excludeIdeData);
  5693. args: ["anIndex", "aBlock", "anotherBlock"],
  5694. 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'>",
  5695. referencedClasses: [],
  5696. //>>excludeEnd("ide");
  5697. pragmas: [["inlineJS:", ["\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09"]]],
  5698. messageSends: []
  5699. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  5700. var self=this,$self=this;
  5701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5702. return $core.withContext(function($ctx1) {
  5703. //>>excludeEnd("ctx");
  5704. var result = String(self)[anIndex - 1];
  5705. return result ? aBlock._value_(result) : anotherBlock._value();
  5706. ;
  5707. return self;
  5708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5709. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  5710. //>>excludeEnd("ctx");
  5711. }; }),
  5712. $globals.String);
  5713. $core.addMethod(
  5714. $core.method({
  5715. selector: "at:put:",
  5716. protocol: "accessing",
  5717. //>>excludeStart("ide", pragmas.excludeIdeData);
  5718. args: ["anIndex", "anObject"],
  5719. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5720. referencedClasses: [],
  5721. //>>excludeEnd("ide");
  5722. pragmas: [],
  5723. messageSends: ["errorReadOnly"]
  5724. }, function ($methodClass){ return function (anIndex,anObject){
  5725. var self=this,$self=this;
  5726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5727. return $core.withContext(function($ctx1) {
  5728. //>>excludeEnd("ctx");
  5729. $self._errorReadOnly();
  5730. return self;
  5731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5732. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  5733. //>>excludeEnd("ctx");
  5734. }; }),
  5735. $globals.String);
  5736. $core.addMethod(
  5737. $core.method({
  5738. selector: "capitalized",
  5739. protocol: "converting",
  5740. //>>excludeStart("ide", pragmas.excludeIdeData);
  5741. args: [],
  5742. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  5743. referencedClasses: [],
  5744. //>>excludeEnd("ide");
  5745. pragmas: [],
  5746. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  5747. }, function ($methodClass){ return function (){
  5748. var self=this,$self=this;
  5749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5750. return $core.withContext(function($ctx1) {
  5751. //>>excludeEnd("ctx");
  5752. return $self._ifNotEmpty_((function(){
  5753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5754. return $core.withContext(function($ctx2) {
  5755. //>>excludeEnd("ctx");
  5756. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  5757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5758. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5759. //>>excludeEnd("ctx");
  5760. }));
  5761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5762. }, function($ctx1) {$ctx1.fill(self,"capitalized",{})});
  5763. //>>excludeEnd("ctx");
  5764. }; }),
  5765. $globals.String);
  5766. $core.addMethod(
  5767. $core.method({
  5768. selector: "charCodeAt:",
  5769. protocol: "accessing",
  5770. //>>excludeStart("ide", pragmas.excludeIdeData);
  5771. args: ["anInteger"],
  5772. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  5773. referencedClasses: [],
  5774. //>>excludeEnd("ide");
  5775. pragmas: [["inlineJS:", ["return self.charCodeAt(anInteger - 1)"]]],
  5776. messageSends: []
  5777. }, function ($methodClass){ return function (anInteger){
  5778. var self=this,$self=this;
  5779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5780. return $core.withContext(function($ctx1) {
  5781. //>>excludeEnd("ctx");
  5782. return self.charCodeAt(anInteger - 1);
  5783. return self;
  5784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5785. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger})});
  5786. //>>excludeEnd("ctx");
  5787. }; }),
  5788. $globals.String);
  5789. $core.addMethod(
  5790. $core.method({
  5791. selector: "copyFrom:to:",
  5792. protocol: "copying",
  5793. //>>excludeStart("ide", pragmas.excludeIdeData);
  5794. args: ["anIndex", "anotherIndex"],
  5795. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  5796. referencedClasses: [],
  5797. //>>excludeEnd("ide");
  5798. pragmas: [["inlineJS:", ["return self.substring(anIndex - 1, anotherIndex)"]]],
  5799. messageSends: []
  5800. }, function ($methodClass){ return function (anIndex,anotherIndex){
  5801. var self=this,$self=this;
  5802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5803. return $core.withContext(function($ctx1) {
  5804. //>>excludeEnd("ctx");
  5805. return self.substring(anIndex - 1, anotherIndex);
  5806. return self;
  5807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5808. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  5809. //>>excludeEnd("ctx");
  5810. }; }),
  5811. $globals.String);
  5812. $core.addMethod(
  5813. $core.method({
  5814. selector: "copyWithFirst:",
  5815. protocol: "copying",
  5816. //>>excludeStart("ide", pragmas.excludeIdeData);
  5817. args: ["anObject"],
  5818. source: "copyWithFirst: anObject\x0a\x09(anObject isString and: [ anObject size = 1 ]) \x22character is one-char string in JS\x22\x0a\x09\x09ifFalse: [ self error: 'Cannot put ', anObject class name, ' in a String' ].\x0a\x09^ anObject, self",
  5819. referencedClasses: [],
  5820. //>>excludeEnd("ide");
  5821. pragmas: [],
  5822. messageSends: ["ifFalse:", "and:", "isString", "=", "size", "error:", ",", "name", "class"]
  5823. }, function ($methodClass){ return function (anObject){
  5824. var self=this,$self=this;
  5825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5826. return $core.withContext(function($ctx1) {
  5827. //>>excludeEnd("ctx");
  5828. var $1;
  5829. if($core.assert($recv(anObject)._isString())){
  5830. $1=$recv($recv(anObject)._size()).__eq((1));
  5831. } else {
  5832. $1=false;
  5833. }
  5834. if(!$core.assert($1)){
  5835. $self._error_([$recv(["Cannot put ".__comma($recv($recv(anObject)._class())._name())
  5836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5837. ,$ctx1.sendIdx[","]=2
  5838. //>>excludeEnd("ctx");
  5839. ][0]).__comma(" in a String")
  5840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5841. ,$ctx1.sendIdx[","]=1
  5842. //>>excludeEnd("ctx");
  5843. ][0]);
  5844. }
  5845. return $recv(anObject).__comma(self);
  5846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5847. }, function($ctx1) {$ctx1.fill(self,"copyWithFirst:",{anObject:anObject})});
  5848. //>>excludeEnd("ctx");
  5849. }; }),
  5850. $globals.String);
  5851. $core.addMethod(
  5852. $core.method({
  5853. selector: "crlfSanitized",
  5854. protocol: "converting",
  5855. //>>excludeStart("ide", pragmas.excludeIdeData);
  5856. args: [],
  5857. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  5858. referencedClasses: ["String"],
  5859. //>>excludeEnd("ide");
  5860. pragmas: [],
  5861. messageSends: ["join:", "lines", "lf"]
  5862. }, function ($methodClass){ return function (){
  5863. var self=this,$self=this;
  5864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5865. return $core.withContext(function($ctx1) {
  5866. //>>excludeEnd("ctx");
  5867. return $recv($self._lines())._join_($recv($globals.String)._lf());
  5868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5869. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{})});
  5870. //>>excludeEnd("ctx");
  5871. }; }),
  5872. $globals.String);
  5873. $core.addMethod(
  5874. $core.method({
  5875. selector: "deepCopy",
  5876. protocol: "copying",
  5877. //>>excludeStart("ide", pragmas.excludeIdeData);
  5878. args: [],
  5879. source: "deepCopy\x0a\x09^ self shallowCopy",
  5880. referencedClasses: [],
  5881. //>>excludeEnd("ide");
  5882. pragmas: [],
  5883. messageSends: ["shallowCopy"]
  5884. }, function ($methodClass){ return function (){
  5885. var self=this,$self=this;
  5886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5887. return $core.withContext(function($ctx1) {
  5888. //>>excludeEnd("ctx");
  5889. return $self._shallowCopy();
  5890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5891. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  5892. //>>excludeEnd("ctx");
  5893. }; }),
  5894. $globals.String);
  5895. $core.addMethod(
  5896. $core.method({
  5897. selector: "errorReadOnly",
  5898. protocol: "error handling",
  5899. //>>excludeStart("ide", pragmas.excludeIdeData);
  5900. args: [],
  5901. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5902. referencedClasses: [],
  5903. //>>excludeEnd("ide");
  5904. pragmas: [],
  5905. messageSends: ["error:"]
  5906. }, function ($methodClass){ return function (){
  5907. var self=this,$self=this;
  5908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5909. return $core.withContext(function($ctx1) {
  5910. //>>excludeEnd("ctx");
  5911. $self._error_("Object is read-only");
  5912. return self;
  5913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5914. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{})});
  5915. //>>excludeEnd("ctx");
  5916. }; }),
  5917. $globals.String);
  5918. $core.addMethod(
  5919. $core.method({
  5920. selector: "escaped",
  5921. protocol: "converting",
  5922. //>>excludeStart("ide", pragmas.excludeIdeData);
  5923. args: [],
  5924. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  5925. referencedClasses: [],
  5926. //>>excludeEnd("ide");
  5927. pragmas: [["inlineJS:", ["return escape(self)"]]],
  5928. messageSends: []
  5929. }, function ($methodClass){ return function (){
  5930. var self=this,$self=this;
  5931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5932. return $core.withContext(function($ctx1) {
  5933. //>>excludeEnd("ctx");
  5934. return escape(self);
  5935. return self;
  5936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5937. }, function($ctx1) {$ctx1.fill(self,"escaped",{})});
  5938. //>>excludeEnd("ctx");
  5939. }; }),
  5940. $globals.String);
  5941. $core.addMethod(
  5942. $core.method({
  5943. selector: "includesSubString:",
  5944. protocol: "testing",
  5945. //>>excludeStart("ide", pragmas.excludeIdeData);
  5946. args: ["subString"],
  5947. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  5948. referencedClasses: [],
  5949. //>>excludeEnd("ide");
  5950. pragmas: [["inlineJS:", ["return self.indexOf(subString) != -1"]]],
  5951. messageSends: []
  5952. }, function ($methodClass){ return function (subString){
  5953. var self=this,$self=this;
  5954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5955. return $core.withContext(function($ctx1) {
  5956. //>>excludeEnd("ctx");
  5957. return self.indexOf(subString) != -1;
  5958. return self;
  5959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5960. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString})});
  5961. //>>excludeEnd("ctx");
  5962. }; }),
  5963. $globals.String);
  5964. $core.addMethod(
  5965. $core.method({
  5966. selector: "isCapitalized",
  5967. protocol: "testing",
  5968. //>>excludeStart("ide", pragmas.excludeIdeData);
  5969. args: [],
  5970. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  5971. referencedClasses: [],
  5972. //>>excludeEnd("ide");
  5973. pragmas: [],
  5974. messageSends: ["==", "asUppercase", "first"]
  5975. }, function ($methodClass){ return function (){
  5976. var self=this,$self=this;
  5977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5978. return $core.withContext(function($ctx1) {
  5979. //>>excludeEnd("ctx");
  5980. return $recv($recv([$self._first()
  5981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5982. ,$ctx1.sendIdx["first"]=1
  5983. //>>excludeEnd("ctx");
  5984. ][0])._asUppercase()).__eq_eq($self._first());
  5985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5986. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{})});
  5987. //>>excludeEnd("ctx");
  5988. }; }),
  5989. $globals.String);
  5990. $core.addMethod(
  5991. $core.method({
  5992. selector: "isImmutable",
  5993. protocol: "testing",
  5994. //>>excludeStart("ide", pragmas.excludeIdeData);
  5995. args: [],
  5996. source: "isImmutable\x0a\x09^ true",
  5997. referencedClasses: [],
  5998. //>>excludeEnd("ide");
  5999. pragmas: [],
  6000. messageSends: []
  6001. }, function ($methodClass){ return function (){
  6002. var self=this,$self=this;
  6003. return true;
  6004. }; }),
  6005. $globals.String);
  6006. $core.addMethod(
  6007. $core.method({
  6008. selector: "isSelector",
  6009. protocol: "testing",
  6010. //>>excludeStart("ide", pragmas.excludeIdeData);
  6011. args: [],
  6012. 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>",
  6013. referencedClasses: [],
  6014. //>>excludeEnd("ide");
  6015. pragmas: [["inlineJS:", ["return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\x5c\x5c+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\x5c:)+)$/)"]]],
  6016. messageSends: []
  6017. }, function ($methodClass){ return function (){
  6018. var self=this,$self=this;
  6019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6020. return $core.withContext(function($ctx1) {
  6021. //>>excludeEnd("ctx");
  6022. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  6023. return self;
  6024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6025. }, function($ctx1) {$ctx1.fill(self,"isSelector",{})});
  6026. //>>excludeEnd("ctx");
  6027. }; }),
  6028. $globals.String);
  6029. $core.addMethod(
  6030. $core.method({
  6031. selector: "isString",
  6032. protocol: "testing",
  6033. //>>excludeStart("ide", pragmas.excludeIdeData);
  6034. args: [],
  6035. source: "isString\x0a\x09^ true",
  6036. referencedClasses: [],
  6037. //>>excludeEnd("ide");
  6038. pragmas: [],
  6039. messageSends: []
  6040. }, function ($methodClass){ return function (){
  6041. var self=this,$self=this;
  6042. return true;
  6043. }; }),
  6044. $globals.String);
  6045. $core.addMethod(
  6046. $core.method({
  6047. selector: "isStringEqualToSelf:",
  6048. protocol: "comparing",
  6049. //>>excludeStart("ide", pragmas.excludeIdeData);
  6050. args: ["aString"],
  6051. source: "isStringEqualToSelf: aString\x0a\x09<inlineJS: 'return aString === String(self)'>",
  6052. referencedClasses: [],
  6053. //>>excludeEnd("ide");
  6054. pragmas: [["inlineJS:", ["return aString === String(self)"]]],
  6055. messageSends: []
  6056. }, function ($methodClass){ return function (aString){
  6057. var self=this,$self=this;
  6058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6059. return $core.withContext(function($ctx1) {
  6060. //>>excludeEnd("ctx");
  6061. return aString === String(self);
  6062. return self;
  6063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6064. }, function($ctx1) {$ctx1.fill(self,"isStringEqualToSelf:",{aString:aString})});
  6065. //>>excludeEnd("ctx");
  6066. }; }),
  6067. $globals.String);
  6068. $core.addMethod(
  6069. $core.method({
  6070. selector: "isStringGreaterThanOrEqualToSelf:",
  6071. protocol: "comparing",
  6072. //>>excludeStart("ide", pragmas.excludeIdeData);
  6073. args: ["aString"],
  6074. source: "isStringGreaterThanOrEqualToSelf: aString\x0a\x09<inlineJS: 'return aString >= self'>",
  6075. referencedClasses: [],
  6076. //>>excludeEnd("ide");
  6077. pragmas: [["inlineJS:", ["return aString >= self"]]],
  6078. messageSends: []
  6079. }, function ($methodClass){ return function (aString){
  6080. var self=this,$self=this;
  6081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6082. return $core.withContext(function($ctx1) {
  6083. //>>excludeEnd("ctx");
  6084. return aString >= self;
  6085. return self;
  6086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6087. }, function($ctx1) {$ctx1.fill(self,"isStringGreaterThanOrEqualToSelf:",{aString:aString})});
  6088. //>>excludeEnd("ctx");
  6089. }; }),
  6090. $globals.String);
  6091. $core.addMethod(
  6092. $core.method({
  6093. selector: "isStringGreaterThanSelf:",
  6094. protocol: "comparing",
  6095. //>>excludeStart("ide", pragmas.excludeIdeData);
  6096. args: ["aString"],
  6097. source: "isStringGreaterThanSelf: aString\x0a\x09<inlineJS: 'return aString > self'>",
  6098. referencedClasses: [],
  6099. //>>excludeEnd("ide");
  6100. pragmas: [["inlineJS:", ["return aString > self"]]],
  6101. messageSends: []
  6102. }, function ($methodClass){ return function (aString){
  6103. var self=this,$self=this;
  6104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6105. return $core.withContext(function($ctx1) {
  6106. //>>excludeEnd("ctx");
  6107. return aString > self;
  6108. return self;
  6109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6110. }, function($ctx1) {$ctx1.fill(self,"isStringGreaterThanSelf:",{aString:aString})});
  6111. //>>excludeEnd("ctx");
  6112. }; }),
  6113. $globals.String);
  6114. $core.addMethod(
  6115. $core.method({
  6116. selector: "isStringLessThanOrEqualToSelf:",
  6117. protocol: "comparing",
  6118. //>>excludeStart("ide", pragmas.excludeIdeData);
  6119. args: ["aString"],
  6120. source: "isStringLessThanOrEqualToSelf: aString\x0a\x09<inlineJS: 'return aString <= self'>",
  6121. referencedClasses: [],
  6122. //>>excludeEnd("ide");
  6123. pragmas: [["inlineJS:", ["return aString <= self"]]],
  6124. messageSends: []
  6125. }, function ($methodClass){ return function (aString){
  6126. var self=this,$self=this;
  6127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6128. return $core.withContext(function($ctx1) {
  6129. //>>excludeEnd("ctx");
  6130. return aString <= self;
  6131. return self;
  6132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6133. }, function($ctx1) {$ctx1.fill(self,"isStringLessThanOrEqualToSelf:",{aString:aString})});
  6134. //>>excludeEnd("ctx");
  6135. }; }),
  6136. $globals.String);
  6137. $core.addMethod(
  6138. $core.method({
  6139. selector: "isStringLessThanSelf:",
  6140. protocol: "comparing",
  6141. //>>excludeStart("ide", pragmas.excludeIdeData);
  6142. args: ["aString"],
  6143. source: "isStringLessThanSelf: aString\x0a\x09<inlineJS: 'return aString < self'>",
  6144. referencedClasses: [],
  6145. //>>excludeEnd("ide");
  6146. pragmas: [["inlineJS:", ["return aString < self"]]],
  6147. messageSends: []
  6148. }, function ($methodClass){ return function (aString){
  6149. var self=this,$self=this;
  6150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6151. return $core.withContext(function($ctx1) {
  6152. //>>excludeEnd("ctx");
  6153. return aString < self;
  6154. return self;
  6155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6156. }, function($ctx1) {$ctx1.fill(self,"isStringLessThanSelf:",{aString:aString})});
  6157. //>>excludeEnd("ctx");
  6158. }; }),
  6159. $globals.String);
  6160. $core.addMethod(
  6161. $core.method({
  6162. selector: "isVowel",
  6163. protocol: "testing",
  6164. //>>excludeStart("ide", pragmas.excludeIdeData);
  6165. args: [],
  6166. 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 ]",
  6167. referencedClasses: [],
  6168. //>>excludeEnd("ide");
  6169. pragmas: [],
  6170. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  6171. }, function ($methodClass){ return function (){
  6172. var self=this,$self=this;
  6173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6174. return $core.withContext(function($ctx1) {
  6175. //>>excludeEnd("ctx");
  6176. if($core.assert($recv($self._size()).__eq((1)))){
  6177. return "aeiou"._includes_($self._asLowercase());
  6178. } else {
  6179. return false;
  6180. }
  6181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6182. }, function($ctx1) {$ctx1.fill(self,"isVowel",{})});
  6183. //>>excludeEnd("ctx");
  6184. }; }),
  6185. $globals.String);
  6186. $core.addMethod(
  6187. $core.method({
  6188. selector: "join:",
  6189. protocol: "split join",
  6190. //>>excludeStart("ide", pragmas.excludeIdeData);
  6191. args: ["aCollection"],
  6192. 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 ]]",
  6193. referencedClasses: ["String"],
  6194. //>>excludeEnd("ide");
  6195. pragmas: [],
  6196. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  6197. }, function ($methodClass){ return function (aCollection){
  6198. var self=this,$self=this;
  6199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6200. return $core.withContext(function($ctx1) {
  6201. //>>excludeEnd("ctx");
  6202. return $recv($globals.String)._streamContents_((function(stream){
  6203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6204. return $core.withContext(function($ctx2) {
  6205. //>>excludeEnd("ctx");
  6206. return $recv(aCollection)._do_separatedBy_((function(each){
  6207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6208. return $core.withContext(function($ctx3) {
  6209. //>>excludeEnd("ctx");
  6210. return [$recv(stream)._nextPutAll_($recv(each)._asString())
  6211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6212. ,$ctx3.sendIdx["nextPutAll:"]=1
  6213. //>>excludeEnd("ctx");
  6214. ][0];
  6215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6216. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6217. //>>excludeEnd("ctx");
  6218. }),(function(){
  6219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6220. return $core.withContext(function($ctx3) {
  6221. //>>excludeEnd("ctx");
  6222. return $recv(stream)._nextPutAll_(self);
  6223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6224. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6225. //>>excludeEnd("ctx");
  6226. }));
  6227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6228. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6229. //>>excludeEnd("ctx");
  6230. }));
  6231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6232. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection})});
  6233. //>>excludeEnd("ctx");
  6234. }; }),
  6235. $globals.String);
  6236. $core.addMethod(
  6237. $core.method({
  6238. selector: "lineIndicesDo:",
  6239. protocol: "split join",
  6240. //>>excludeStart("ide", pragmas.excludeIdeData);
  6241. args: ["aBlock"],
  6242. 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 ] ]]",
  6243. referencedClasses: ["String"],
  6244. //>>excludeEnd("ide");
  6245. pragmas: [],
  6246. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  6247. }, function ($methodClass){ return function (aBlock){
  6248. var self=this,$self=this;
  6249. var cr,lf,start,sz,nextLF,nextCR;
  6250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6251. return $core.withContext(function($ctx1) {
  6252. //>>excludeEnd("ctx");
  6253. var $1,$2;
  6254. var $early={};
  6255. try {
  6256. start=(1);
  6257. sz=$self._size();
  6258. cr=$recv($globals.String)._cr();
  6259. nextCR=[$self._indexOf_startingAt_(cr,(1))
  6260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6261. ,$ctx1.sendIdx["indexOf:startingAt:"]=1
  6262. //>>excludeEnd("ctx");
  6263. ][0];
  6264. lf=$recv($globals.String)._lf();
  6265. nextLF=[$self._indexOf_startingAt_(lf,(1))
  6266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6267. ,$ctx1.sendIdx["indexOf:startingAt:"]=2
  6268. //>>excludeEnd("ctx");
  6269. ][0];
  6270. $recv((function(){
  6271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6272. return $core.withContext(function($ctx2) {
  6273. //>>excludeEnd("ctx");
  6274. return $recv(start).__lt_eq(sz);
  6275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6276. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6277. //>>excludeEnd("ctx");
  6278. }))._whileTrue_((function(){
  6279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6280. return $core.withContext(function($ctx2) {
  6281. //>>excludeEnd("ctx");
  6282. if($core.assert([$recv(nextLF).__eq((0))
  6283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6284. ,$ctx2.sendIdx["="]=1
  6285. //>>excludeEnd("ctx");
  6286. ][0])){
  6287. $1=[$recv(nextCR).__eq((0))
  6288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6289. ,$ctx2.sendIdx["="]=2
  6290. //>>excludeEnd("ctx");
  6291. ][0];
  6292. } else {
  6293. $1=false;
  6294. }
  6295. if($core.assert($1)){
  6296. [$recv(aBlock)._value_value_value_(start,sz,sz)
  6297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6298. ,$ctx2.sendIdx["value:value:value:"]=1
  6299. //>>excludeEnd("ctx");
  6300. ][0];
  6301. throw $early=[self];
  6302. }
  6303. if($core.assert([$recv(nextCR).__eq((0))
  6304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6305. ,$ctx2.sendIdx["="]=3
  6306. //>>excludeEnd("ctx");
  6307. ][0])){
  6308. $2=true;
  6309. } else {
  6310. if($core.assert([(0).__lt(nextLF)
  6311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6312. ,$ctx2.sendIdx["<"]=1
  6313. //>>excludeEnd("ctx");
  6314. ][0])){
  6315. $2=$recv(nextLF).__lt(nextCR);
  6316. } else {
  6317. $2=false;
  6318. }
  6319. }
  6320. if($core.assert($2)){
  6321. [$recv(aBlock)._value_value_value_(start,[$recv(nextLF).__minus((1))
  6322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6323. ,$ctx2.sendIdx["-"]=1
  6324. //>>excludeEnd("ctx");
  6325. ][0],nextLF)
  6326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6327. ,$ctx2.sendIdx["value:value:value:"]=2
  6328. //>>excludeEnd("ctx");
  6329. ][0];
  6330. start=[(1).__plus(nextLF)
  6331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6332. ,$ctx2.sendIdx["+"]=1
  6333. //>>excludeEnd("ctx");
  6334. ][0];
  6335. nextLF=[$self._indexOf_startingAt_(lf,start)
  6336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6337. ,$ctx2.sendIdx["indexOf:startingAt:"]=3
  6338. //>>excludeEnd("ctx");
  6339. ][0];
  6340. return nextLF;
  6341. } else {
  6342. if($core.assert($recv([(1).__plus(nextCR)
  6343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6344. ,$ctx2.sendIdx["+"]=2
  6345. //>>excludeEnd("ctx");
  6346. ][0]).__eq(nextLF))){
  6347. [$recv(aBlock)._value_value_value_(start,[$recv(nextCR).__minus((1))
  6348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6349. ,$ctx2.sendIdx["-"]=2
  6350. //>>excludeEnd("ctx");
  6351. ][0],nextLF)
  6352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6353. ,$ctx2.sendIdx["value:value:value:"]=3
  6354. //>>excludeEnd("ctx");
  6355. ][0];
  6356. start=[(1).__plus(nextLF)
  6357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6358. ,$ctx2.sendIdx["+"]=3
  6359. //>>excludeEnd("ctx");
  6360. ][0];
  6361. nextCR=[$self._indexOf_startingAt_(cr,start)
  6362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6363. ,$ctx2.sendIdx["indexOf:startingAt:"]=4
  6364. //>>excludeEnd("ctx");
  6365. ][0];
  6366. nextLF=[$self._indexOf_startingAt_(lf,start)
  6367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6368. ,$ctx2.sendIdx["indexOf:startingAt:"]=5
  6369. //>>excludeEnd("ctx");
  6370. ][0];
  6371. return nextLF;
  6372. } else {
  6373. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  6374. start=(1).__plus(nextCR);
  6375. nextCR=$self._indexOf_startingAt_(cr,start);
  6376. return nextCR;
  6377. }
  6378. }
  6379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6381. //>>excludeEnd("ctx");
  6382. }));
  6383. return self;
  6384. }
  6385. catch(e) {if(e===$early)return e[0]; throw e}
  6386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6387. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR})});
  6388. //>>excludeEnd("ctx");
  6389. }; }),
  6390. $globals.String);
  6391. $core.addMethod(
  6392. $core.method({
  6393. selector: "lineNumber:",
  6394. protocol: "split join",
  6395. //>>excludeStart("ide", pragmas.excludeIdeData);
  6396. args: ["anIndex"],
  6397. 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",
  6398. referencedClasses: [],
  6399. //>>excludeEnd("ide");
  6400. pragmas: [],
  6401. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  6402. }, function ($methodClass){ return function (anIndex){
  6403. var self=this,$self=this;
  6404. var lineCount;
  6405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6406. return $core.withContext(function($ctx1) {
  6407. //>>excludeEnd("ctx");
  6408. var $early={};
  6409. try {
  6410. lineCount=(0);
  6411. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  6412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6413. return $core.withContext(function($ctx2) {
  6414. //>>excludeEnd("ctx");
  6415. lineCount=$recv(lineCount).__plus((1));
  6416. if($core.assert($recv(lineCount).__eq(anIndex))){
  6417. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  6418. }
  6419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6420. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  6421. //>>excludeEnd("ctx");
  6422. }));
  6423. return nil;
  6424. }
  6425. catch(e) {if(e===$early)return e[0]; throw e}
  6426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6427. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount})});
  6428. //>>excludeEnd("ctx");
  6429. }; }),
  6430. $globals.String);
  6431. $core.addMethod(
  6432. $core.method({
  6433. selector: "lines",
  6434. protocol: "split join",
  6435. //>>excludeStart("ide", pragmas.excludeIdeData);
  6436. args: [],
  6437. 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'>",
  6438. referencedClasses: [],
  6439. //>>excludeEnd("ide");
  6440. pragmas: [["inlineJS:", ["\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;"]]],
  6441. messageSends: []
  6442. }, function ($methodClass){ return function (){
  6443. var self=this,$self=this;
  6444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6445. return $core.withContext(function($ctx1) {
  6446. //>>excludeEnd("ctx");
  6447. var result = self.split(/\r\n|\r|\n/);
  6448. if (!result[result.length-1]) result.pop();
  6449. return result;;
  6450. return self;
  6451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6452. }, function($ctx1) {$ctx1.fill(self,"lines",{})});
  6453. //>>excludeEnd("ctx");
  6454. }; }),
  6455. $globals.String);
  6456. $core.addMethod(
  6457. $core.method({
  6458. selector: "linesDo:",
  6459. protocol: "split join",
  6460. //>>excludeStart("ide", pragmas.excludeIdeData);
  6461. args: ["aBlock"],
  6462. 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",
  6463. referencedClasses: [],
  6464. //>>excludeEnd("ide");
  6465. pragmas: [],
  6466. messageSends: ["do:", "lines"]
  6467. }, function ($methodClass){ return function (aBlock){
  6468. var self=this,$self=this;
  6469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6470. return $core.withContext(function($ctx1) {
  6471. //>>excludeEnd("ctx");
  6472. $recv($self._lines())._do_(aBlock);
  6473. return self;
  6474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6475. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock})});
  6476. //>>excludeEnd("ctx");
  6477. }; }),
  6478. $globals.String);
  6479. $core.addMethod(
  6480. $core.method({
  6481. selector: "match:",
  6482. protocol: "regular expressions",
  6483. //>>excludeStart("ide", pragmas.excludeIdeData);
  6484. args: ["aRegexp"],
  6485. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  6486. referencedClasses: [],
  6487. //>>excludeEnd("ide");
  6488. pragmas: [["inlineJS:", ["return self.search(aRegexp) != -1"]]],
  6489. messageSends: []
  6490. }, function ($methodClass){ return function (aRegexp){
  6491. var self=this,$self=this;
  6492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6493. return $core.withContext(function($ctx1) {
  6494. //>>excludeEnd("ctx");
  6495. return self.search(aRegexp) != -1;
  6496. return self;
  6497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6498. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp})});
  6499. //>>excludeEnd("ctx");
  6500. }; }),
  6501. $globals.String);
  6502. $core.addMethod(
  6503. $core.method({
  6504. selector: "matchesOf:",
  6505. protocol: "regular expressions",
  6506. //>>excludeStart("ide", pragmas.excludeIdeData);
  6507. args: ["aRegularExpression"],
  6508. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  6509. referencedClasses: [],
  6510. //>>excludeEnd("ide");
  6511. pragmas: [["inlineJS:", ["return self.match(aRegularExpression)"]]],
  6512. messageSends: []
  6513. }, function ($methodClass){ return function (aRegularExpression){
  6514. var self=this,$self=this;
  6515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6516. return $core.withContext(function($ctx1) {
  6517. //>>excludeEnd("ctx");
  6518. return self.match(aRegularExpression);
  6519. return self;
  6520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6521. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression})});
  6522. //>>excludeEnd("ctx");
  6523. }; }),
  6524. $globals.String);
  6525. $core.addMethod(
  6526. $core.method({
  6527. selector: "printNl",
  6528. protocol: "printing",
  6529. //>>excludeStart("ide", pragmas.excludeIdeData);
  6530. args: [],
  6531. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  6532. referencedClasses: [],
  6533. //>>excludeEnd("ide");
  6534. pragmas: [["inlineJS:", ["console.log(self)"]]],
  6535. messageSends: []
  6536. }, function ($methodClass){ return function (){
  6537. var self=this,$self=this;
  6538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6539. return $core.withContext(function($ctx1) {
  6540. //>>excludeEnd("ctx");
  6541. console.log(self);
  6542. return self;
  6543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6544. }, function($ctx1) {$ctx1.fill(self,"printNl",{})});
  6545. //>>excludeEnd("ctx");
  6546. }; }),
  6547. $globals.String);
  6548. $core.addMethod(
  6549. $core.method({
  6550. selector: "printOn:",
  6551. protocol: "printing",
  6552. //>>excludeStart("ide", pragmas.excludeIdeData);
  6553. args: ["aStream"],
  6554. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  6555. referencedClasses: [],
  6556. //>>excludeEnd("ide");
  6557. pragmas: [],
  6558. messageSends: ["nextPutAll:", "replace:with:"]
  6559. }, function ($methodClass){ return function (aStream){
  6560. var self=this,$self=this;
  6561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6562. return $core.withContext(function($ctx1) {
  6563. //>>excludeEnd("ctx");
  6564. [$recv(aStream)._nextPutAll_("'")
  6565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6566. ,$ctx1.sendIdx["nextPutAll:"]=1
  6567. //>>excludeEnd("ctx");
  6568. ][0];
  6569. [$recv(aStream)._nextPutAll_($self._replace_with_("'","''"))
  6570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6571. ,$ctx1.sendIdx["nextPutAll:"]=2
  6572. //>>excludeEnd("ctx");
  6573. ][0];
  6574. $recv(aStream)._nextPutAll_("'");
  6575. return self;
  6576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6577. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  6578. //>>excludeEnd("ctx");
  6579. }; }),
  6580. $globals.String);
  6581. $core.addMethod(
  6582. $core.method({
  6583. selector: "putOn:",
  6584. protocol: "streaming",
  6585. //>>excludeStart("ide", pragmas.excludeIdeData);
  6586. args: ["aStream"],
  6587. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  6588. referencedClasses: [],
  6589. //>>excludeEnd("ide");
  6590. pragmas: [],
  6591. messageSends: ["nextPutString:"]
  6592. }, function ($methodClass){ return function (aStream){
  6593. var self=this,$self=this;
  6594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6595. return $core.withContext(function($ctx1) {
  6596. //>>excludeEnd("ctx");
  6597. $recv(aStream)._nextPutString_(self);
  6598. return self;
  6599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6600. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  6601. //>>excludeEnd("ctx");
  6602. }; }),
  6603. $globals.String);
  6604. $core.addMethod(
  6605. $core.method({
  6606. selector: "remove:",
  6607. protocol: "adding/removing",
  6608. //>>excludeStart("ide", pragmas.excludeIdeData);
  6609. args: ["anObject"],
  6610. source: "remove: anObject\x0a\x09self errorReadOnly",
  6611. referencedClasses: [],
  6612. //>>excludeEnd("ide");
  6613. pragmas: [],
  6614. messageSends: ["errorReadOnly"]
  6615. }, function ($methodClass){ return function (anObject){
  6616. var self=this,$self=this;
  6617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6618. return $core.withContext(function($ctx1) {
  6619. //>>excludeEnd("ctx");
  6620. $self._errorReadOnly();
  6621. return self;
  6622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6623. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  6624. //>>excludeEnd("ctx");
  6625. }; }),
  6626. $globals.String);
  6627. $core.addMethod(
  6628. $core.method({
  6629. selector: "remove:ifAbsent:",
  6630. protocol: "adding/removing",
  6631. //>>excludeStart("ide", pragmas.excludeIdeData);
  6632. args: ["anObject", "aBlock"],
  6633. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  6634. referencedClasses: [],
  6635. //>>excludeEnd("ide");
  6636. pragmas: [],
  6637. messageSends: ["errorReadOnly"]
  6638. }, function ($methodClass){ return function (anObject,aBlock){
  6639. var self=this,$self=this;
  6640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6641. return $core.withContext(function($ctx1) {
  6642. //>>excludeEnd("ctx");
  6643. $self._errorReadOnly();
  6644. return self;
  6645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6646. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  6647. //>>excludeEnd("ctx");
  6648. }; }),
  6649. $globals.String);
  6650. $core.addMethod(
  6651. $core.method({
  6652. selector: "replace:with:",
  6653. protocol: "regular expressions",
  6654. //>>excludeStart("ide", pragmas.excludeIdeData);
  6655. args: ["aString", "anotherString"],
  6656. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6657. referencedClasses: ["RegularExpression"],
  6658. //>>excludeEnd("ide");
  6659. pragmas: [],
  6660. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6661. }, function ($methodClass){ return function (aString,anotherString){
  6662. var self=this,$self=this;
  6663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6664. return $core.withContext(function($ctx1) {
  6665. //>>excludeEnd("ctx");
  6666. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6668. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString})});
  6669. //>>excludeEnd("ctx");
  6670. }; }),
  6671. $globals.String);
  6672. $core.addMethod(
  6673. $core.method({
  6674. selector: "replaceRegexp:with:",
  6675. protocol: "regular expressions",
  6676. //>>excludeStart("ide", pragmas.excludeIdeData);
  6677. args: ["aRegexp", "aString"],
  6678. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  6679. referencedClasses: [],
  6680. //>>excludeEnd("ide");
  6681. pragmas: [["inlineJS:", ["return self.replace(aRegexp, aString)"]]],
  6682. messageSends: []
  6683. }, function ($methodClass){ return function (aRegexp,aString){
  6684. var self=this,$self=this;
  6685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6686. return $core.withContext(function($ctx1) {
  6687. //>>excludeEnd("ctx");
  6688. return self.replace(aRegexp, aString);
  6689. return self;
  6690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6691. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString})});
  6692. //>>excludeEnd("ctx");
  6693. }; }),
  6694. $globals.String);
  6695. $core.addMethod(
  6696. $core.method({
  6697. selector: "reversed",
  6698. protocol: "converting",
  6699. //>>excludeStart("ide", pragmas.excludeIdeData);
  6700. args: [],
  6701. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  6702. referencedClasses: [],
  6703. //>>excludeEnd("ide");
  6704. pragmas: [["inlineJS:", ["return self.split(\x22\x22).reverse().join(\x22\x22)"]]],
  6705. messageSends: []
  6706. }, function ($methodClass){ return function (){
  6707. var self=this,$self=this;
  6708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6709. return $core.withContext(function($ctx1) {
  6710. //>>excludeEnd("ctx");
  6711. return self.split("").reverse().join("");
  6712. return self;
  6713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6714. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  6715. //>>excludeEnd("ctx");
  6716. }; }),
  6717. $globals.String);
  6718. $core.addMethod(
  6719. $core.method({
  6720. selector: "shallowCopy",
  6721. protocol: "copying",
  6722. //>>excludeStart("ide", pragmas.excludeIdeData);
  6723. args: [],
  6724. source: "shallowCopy\x0a\x09^ self",
  6725. referencedClasses: [],
  6726. //>>excludeEnd("ide");
  6727. pragmas: [],
  6728. messageSends: []
  6729. }, function ($methodClass){ return function (){
  6730. var self=this,$self=this;
  6731. return self;
  6732. }; }),
  6733. $globals.String);
  6734. $core.addMethod(
  6735. $core.method({
  6736. selector: "shortenedPrintString",
  6737. protocol: "printing",
  6738. //>>excludeStart("ide", pragmas.excludeIdeData);
  6739. args: [],
  6740. source: "shortenedPrintString\x0a\x09^ self printString size > 30\x0a\x09\x09ifTrue: [ (self printString copyFrom: 1 to: 30), '...''' ]\x0a\x09\x09ifFalse: [ self printString ]",
  6741. referencedClasses: [],
  6742. //>>excludeEnd("ide");
  6743. pragmas: [],
  6744. messageSends: ["ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:"]
  6745. }, function ($methodClass){ return function (){
  6746. var self=this,$self=this;
  6747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6748. return $core.withContext(function($ctx1) {
  6749. //>>excludeEnd("ctx");
  6750. if($core.assert($recv($recv([$self._printString()
  6751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6752. ,$ctx1.sendIdx["printString"]=1
  6753. //>>excludeEnd("ctx");
  6754. ][0])._size()).__gt((30)))){
  6755. return $recv($recv([$self._printString()
  6756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6757. ,$ctx1.sendIdx["printString"]=2
  6758. //>>excludeEnd("ctx");
  6759. ][0])._copyFrom_to_((1),(30))).__comma("...'");
  6760. } else {
  6761. return $self._printString();
  6762. }
  6763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6764. }, function($ctx1) {$ctx1.fill(self,"shortenedPrintString",{})});
  6765. //>>excludeEnd("ctx");
  6766. }; }),
  6767. $globals.String);
  6768. $core.addMethod(
  6769. $core.method({
  6770. selector: "subStrings:",
  6771. protocol: "split join",
  6772. //>>excludeStart("ide", pragmas.excludeIdeData);
  6773. args: ["aString"],
  6774. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6775. referencedClasses: [],
  6776. //>>excludeEnd("ide");
  6777. pragmas: [],
  6778. messageSends: ["tokenize:"]
  6779. }, function ($methodClass){ return function (aString){
  6780. var self=this,$self=this;
  6781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6782. return $core.withContext(function($ctx1) {
  6783. //>>excludeEnd("ctx");
  6784. return $self._tokenize_(aString);
  6785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6786. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString})});
  6787. //>>excludeEnd("ctx");
  6788. }; }),
  6789. $globals.String);
  6790. $core.addMethod(
  6791. $core.method({
  6792. selector: "symbolPrintString",
  6793. protocol: "printing",
  6794. //>>excludeStart("ide", pragmas.excludeIdeData);
  6795. args: [],
  6796. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  6797. referencedClasses: ["String"],
  6798. //>>excludeEnd("ide");
  6799. pragmas: [],
  6800. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  6801. }, function ($methodClass){ return function (){
  6802. var self=this,$self=this;
  6803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6804. return $core.withContext(function($ctx1) {
  6805. //>>excludeEnd("ctx");
  6806. return $recv($globals.String)._streamContents_((function(str){
  6807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6808. return $core.withContext(function($ctx2) {
  6809. //>>excludeEnd("ctx");
  6810. return $self._asSymbolPrintOn_(str);
  6811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6812. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  6813. //>>excludeEnd("ctx");
  6814. }));
  6815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6816. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{})});
  6817. //>>excludeEnd("ctx");
  6818. }; }),
  6819. $globals.String);
  6820. $core.addMethod(
  6821. $core.method({
  6822. selector: "tokenize:",
  6823. protocol: "split join",
  6824. //>>excludeStart("ide", pragmas.excludeIdeData);
  6825. args: ["aString"],
  6826. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  6827. referencedClasses: [],
  6828. //>>excludeEnd("ide");
  6829. pragmas: [["inlineJS:", ["return self.split(aString)"]]],
  6830. messageSends: []
  6831. }, function ($methodClass){ return function (aString){
  6832. var self=this,$self=this;
  6833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6834. return $core.withContext(function($ctx1) {
  6835. //>>excludeEnd("ctx");
  6836. return self.split(aString);
  6837. return self;
  6838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6839. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString})});
  6840. //>>excludeEnd("ctx");
  6841. }; }),
  6842. $globals.String);
  6843. $core.addMethod(
  6844. $core.method({
  6845. selector: "trimBoth",
  6846. protocol: "regular expressions",
  6847. //>>excludeStart("ide", pragmas.excludeIdeData);
  6848. args: [],
  6849. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  6850. referencedClasses: [],
  6851. //>>excludeEnd("ide");
  6852. pragmas: [],
  6853. messageSends: ["trimBoth:"]
  6854. }, function ($methodClass){ return function (){
  6855. var self=this,$self=this;
  6856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6857. return $core.withContext(function($ctx1) {
  6858. //>>excludeEnd("ctx");
  6859. return $self._trimBoth_("\x5cs");
  6860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6861. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{})});
  6862. //>>excludeEnd("ctx");
  6863. }; }),
  6864. $globals.String);
  6865. $core.addMethod(
  6866. $core.method({
  6867. selector: "trimBoth:",
  6868. protocol: "regular expressions",
  6869. //>>excludeStart("ide", pragmas.excludeIdeData);
  6870. args: ["separators"],
  6871. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  6872. referencedClasses: [],
  6873. //>>excludeEnd("ide");
  6874. pragmas: [],
  6875. messageSends: ["trimRight:", "trimLeft:"]
  6876. }, function ($methodClass){ return function (separators){
  6877. var self=this,$self=this;
  6878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6879. return $core.withContext(function($ctx1) {
  6880. //>>excludeEnd("ctx");
  6881. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  6882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6883. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators})});
  6884. //>>excludeEnd("ctx");
  6885. }; }),
  6886. $globals.String);
  6887. $core.addMethod(
  6888. $core.method({
  6889. selector: "trimLeft",
  6890. protocol: "regular expressions",
  6891. //>>excludeStart("ide", pragmas.excludeIdeData);
  6892. args: [],
  6893. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  6894. referencedClasses: [],
  6895. //>>excludeEnd("ide");
  6896. pragmas: [],
  6897. messageSends: ["trimLeft:"]
  6898. }, function ($methodClass){ return function (){
  6899. var self=this,$self=this;
  6900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6901. return $core.withContext(function($ctx1) {
  6902. //>>excludeEnd("ctx");
  6903. return $self._trimLeft_("\x5cs");
  6904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6905. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{})});
  6906. //>>excludeEnd("ctx");
  6907. }; }),
  6908. $globals.String);
  6909. $core.addMethod(
  6910. $core.method({
  6911. selector: "trimLeft:",
  6912. protocol: "regular expressions",
  6913. //>>excludeStart("ide", pragmas.excludeIdeData);
  6914. args: ["separators"],
  6915. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  6916. referencedClasses: ["RegularExpression"],
  6917. //>>excludeEnd("ide");
  6918. pragmas: [],
  6919. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6920. }, function ($methodClass){ return function (separators){
  6921. var self=this,$self=this;
  6922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6923. return $core.withContext(function($ctx1) {
  6924. //>>excludeEnd("ctx");
  6925. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_([$recv("^[".__comma(separators)).__comma("]+")
  6926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6927. ,$ctx1.sendIdx[","]=1
  6928. //>>excludeEnd("ctx");
  6929. ][0],"g"),"");
  6930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6931. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators})});
  6932. //>>excludeEnd("ctx");
  6933. }; }),
  6934. $globals.String);
  6935. $core.addMethod(
  6936. $core.method({
  6937. selector: "trimRight",
  6938. protocol: "regular expressions",
  6939. //>>excludeStart("ide", pragmas.excludeIdeData);
  6940. args: [],
  6941. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  6942. referencedClasses: [],
  6943. //>>excludeEnd("ide");
  6944. pragmas: [],
  6945. messageSends: ["trimRight:"]
  6946. }, function ($methodClass){ return function (){
  6947. var self=this,$self=this;
  6948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6949. return $core.withContext(function($ctx1) {
  6950. //>>excludeEnd("ctx");
  6951. return $self._trimRight_("\x5cs");
  6952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6953. }, function($ctx1) {$ctx1.fill(self,"trimRight",{})});
  6954. //>>excludeEnd("ctx");
  6955. }; }),
  6956. $globals.String);
  6957. $core.addMethod(
  6958. $core.method({
  6959. selector: "trimRight:",
  6960. protocol: "regular expressions",
  6961. //>>excludeStart("ide", pragmas.excludeIdeData);
  6962. args: ["separators"],
  6963. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  6964. referencedClasses: ["RegularExpression"],
  6965. //>>excludeEnd("ide");
  6966. pragmas: [],
  6967. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6968. }, function ($methodClass){ return function (separators){
  6969. var self=this,$self=this;
  6970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6971. return $core.withContext(function($ctx1) {
  6972. //>>excludeEnd("ctx");
  6973. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_([$recv("[".__comma(separators)).__comma("]+$")
  6974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6975. ,$ctx1.sendIdx[","]=1
  6976. //>>excludeEnd("ctx");
  6977. ][0],"g"),"");
  6978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6979. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators})});
  6980. //>>excludeEnd("ctx");
  6981. }; }),
  6982. $globals.String);
  6983. $core.addMethod(
  6984. $core.method({
  6985. selector: "unescaped",
  6986. protocol: "converting",
  6987. //>>excludeStart("ide", pragmas.excludeIdeData);
  6988. args: [],
  6989. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  6990. referencedClasses: [],
  6991. //>>excludeEnd("ide");
  6992. pragmas: [["inlineJS:", ["return unescape(self)"]]],
  6993. messageSends: []
  6994. }, function ($methodClass){ return function (){
  6995. var self=this,$self=this;
  6996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6997. return $core.withContext(function($ctx1) {
  6998. //>>excludeEnd("ctx");
  6999. return unescape(self);
  7000. return self;
  7001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7002. }, function($ctx1) {$ctx1.fill(self,"unescaped",{})});
  7003. //>>excludeEnd("ctx");
  7004. }; }),
  7005. $globals.String);
  7006. $core.addMethod(
  7007. $core.method({
  7008. selector: "uriComponentDecoded",
  7009. protocol: "converting",
  7010. //>>excludeStart("ide", pragmas.excludeIdeData);
  7011. args: [],
  7012. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  7013. referencedClasses: [],
  7014. //>>excludeEnd("ide");
  7015. pragmas: [["inlineJS:", ["return decodeURIComponent(self)"]]],
  7016. messageSends: []
  7017. }, function ($methodClass){ return function (){
  7018. var self=this,$self=this;
  7019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7020. return $core.withContext(function($ctx1) {
  7021. //>>excludeEnd("ctx");
  7022. return decodeURIComponent(self);
  7023. return self;
  7024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7025. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{})});
  7026. //>>excludeEnd("ctx");
  7027. }; }),
  7028. $globals.String);
  7029. $core.addMethod(
  7030. $core.method({
  7031. selector: "uriComponentEncoded",
  7032. protocol: "converting",
  7033. //>>excludeStart("ide", pragmas.excludeIdeData);
  7034. args: [],
  7035. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  7036. referencedClasses: [],
  7037. //>>excludeEnd("ide");
  7038. pragmas: [["inlineJS:", ["return encodeURIComponent(self)"]]],
  7039. messageSends: []
  7040. }, function ($methodClass){ return function (){
  7041. var self=this,$self=this;
  7042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7043. return $core.withContext(function($ctx1) {
  7044. //>>excludeEnd("ctx");
  7045. return encodeURIComponent(self);
  7046. return self;
  7047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7048. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{})});
  7049. //>>excludeEnd("ctx");
  7050. }; }),
  7051. $globals.String);
  7052. $core.addMethod(
  7053. $core.method({
  7054. selector: "uriDecoded",
  7055. protocol: "converting",
  7056. //>>excludeStart("ide", pragmas.excludeIdeData);
  7057. args: [],
  7058. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  7059. referencedClasses: [],
  7060. //>>excludeEnd("ide");
  7061. pragmas: [["inlineJS:", ["return decodeURI(self)"]]],
  7062. messageSends: []
  7063. }, function ($methodClass){ return function (){
  7064. var self=this,$self=this;
  7065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7066. return $core.withContext(function($ctx1) {
  7067. //>>excludeEnd("ctx");
  7068. return decodeURI(self);
  7069. return self;
  7070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7071. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{})});
  7072. //>>excludeEnd("ctx");
  7073. }; }),
  7074. $globals.String);
  7075. $core.addMethod(
  7076. $core.method({
  7077. selector: "uriEncoded",
  7078. protocol: "converting",
  7079. //>>excludeStart("ide", pragmas.excludeIdeData);
  7080. args: [],
  7081. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  7082. referencedClasses: [],
  7083. //>>excludeEnd("ide");
  7084. pragmas: [["inlineJS:", ["return encodeURI(self)"]]],
  7085. messageSends: []
  7086. }, function ($methodClass){ return function (){
  7087. var self=this,$self=this;
  7088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7089. return $core.withContext(function($ctx1) {
  7090. //>>excludeEnd("ctx");
  7091. return encodeURI(self);
  7092. return self;
  7093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7094. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{})});
  7095. //>>excludeEnd("ctx");
  7096. }; }),
  7097. $globals.String);
  7098. $core.addMethod(
  7099. $core.method({
  7100. selector: "value:",
  7101. protocol: "evaluating",
  7102. //>>excludeStart("ide", pragmas.excludeIdeData);
  7103. args: ["anObject"],
  7104. source: "value: anObject \x0a\x09^ anObject perform: self",
  7105. referencedClasses: [],
  7106. //>>excludeEnd("ide");
  7107. pragmas: [],
  7108. messageSends: ["perform:"]
  7109. }, function ($methodClass){ return function (anObject){
  7110. var self=this,$self=this;
  7111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7112. return $core.withContext(function($ctx1) {
  7113. //>>excludeEnd("ctx");
  7114. return $recv(anObject)._perform_(self);
  7115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7116. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  7117. //>>excludeEnd("ctx");
  7118. }; }),
  7119. $globals.String);
  7120. $core.addMethod(
  7121. $core.method({
  7122. selector: "cr",
  7123. protocol: "accessing",
  7124. //>>excludeStart("ide", pragmas.excludeIdeData);
  7125. args: [],
  7126. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  7127. referencedClasses: [],
  7128. //>>excludeEnd("ide");
  7129. pragmas: [["inlineJS:", ["return \x22\x5cr\x22"]]],
  7130. messageSends: []
  7131. }, function ($methodClass){ return function (){
  7132. var self=this,$self=this;
  7133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7134. return $core.withContext(function($ctx1) {
  7135. //>>excludeEnd("ctx");
  7136. return "\r";
  7137. return self;
  7138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7139. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  7140. //>>excludeEnd("ctx");
  7141. }; }),
  7142. $globals.String.a$cls);
  7143. $core.addMethod(
  7144. $core.method({
  7145. selector: "crlf",
  7146. protocol: "accessing",
  7147. //>>excludeStart("ide", pragmas.excludeIdeData);
  7148. args: [],
  7149. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  7150. referencedClasses: [],
  7151. //>>excludeEnd("ide");
  7152. pragmas: [["inlineJS:", ["return \x22\x5cr\x5cn\x22"]]],
  7153. messageSends: []
  7154. }, function ($methodClass){ return function (){
  7155. var self=this,$self=this;
  7156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7157. return $core.withContext(function($ctx1) {
  7158. //>>excludeEnd("ctx");
  7159. return "\r\n";
  7160. return self;
  7161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7162. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  7163. //>>excludeEnd("ctx");
  7164. }; }),
  7165. $globals.String.a$cls);
  7166. $core.addMethod(
  7167. $core.method({
  7168. selector: "esc",
  7169. protocol: "accessing",
  7170. //>>excludeStart("ide", pragmas.excludeIdeData);
  7171. args: [],
  7172. source: "esc\x0a\x09^ self fromCharCode: 27",
  7173. referencedClasses: [],
  7174. //>>excludeEnd("ide");
  7175. pragmas: [],
  7176. messageSends: ["fromCharCode:"]
  7177. }, function ($methodClass){ return function (){
  7178. var self=this,$self=this;
  7179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7180. return $core.withContext(function($ctx1) {
  7181. //>>excludeEnd("ctx");
  7182. return $self._fromCharCode_((27));
  7183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7184. }, function($ctx1) {$ctx1.fill(self,"esc",{})});
  7185. //>>excludeEnd("ctx");
  7186. }; }),
  7187. $globals.String.a$cls);
  7188. $core.addMethod(
  7189. $core.method({
  7190. selector: "fromCharCode:",
  7191. protocol: "instance creation",
  7192. //>>excludeStart("ide", pragmas.excludeIdeData);
  7193. args: ["anInteger"],
  7194. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  7195. referencedClasses: [],
  7196. //>>excludeEnd("ide");
  7197. pragmas: [["inlineJS:", ["return String.fromCharCode(anInteger)"]]],
  7198. messageSends: []
  7199. }, function ($methodClass){ return function (anInteger){
  7200. var self=this,$self=this;
  7201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7202. return $core.withContext(function($ctx1) {
  7203. //>>excludeEnd("ctx");
  7204. return String.fromCharCode(anInteger);
  7205. return self;
  7206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7207. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger})});
  7208. //>>excludeEnd("ctx");
  7209. }; }),
  7210. $globals.String.a$cls);
  7211. $core.addMethod(
  7212. $core.method({
  7213. selector: "fromString:",
  7214. protocol: "instance creation",
  7215. //>>excludeStart("ide", pragmas.excludeIdeData);
  7216. args: ["aString"],
  7217. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  7218. referencedClasses: [],
  7219. //>>excludeEnd("ide");
  7220. pragmas: [["inlineJS:", ["return String(aString)"]]],
  7221. messageSends: []
  7222. }, function ($methodClass){ return function (aString){
  7223. var self=this,$self=this;
  7224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7225. return $core.withContext(function($ctx1) {
  7226. //>>excludeEnd("ctx");
  7227. return String(aString);
  7228. return self;
  7229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7230. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  7231. //>>excludeEnd("ctx");
  7232. }; }),
  7233. $globals.String.a$cls);
  7234. $core.addMethod(
  7235. $core.method({
  7236. selector: "lf",
  7237. protocol: "accessing",
  7238. //>>excludeStart("ide", pragmas.excludeIdeData);
  7239. args: [],
  7240. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  7241. referencedClasses: [],
  7242. //>>excludeEnd("ide");
  7243. pragmas: [["inlineJS:", ["return \x22\x5cn\x22"]]],
  7244. messageSends: []
  7245. }, function ($methodClass){ return function (){
  7246. var self=this,$self=this;
  7247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7248. return $core.withContext(function($ctx1) {
  7249. //>>excludeEnd("ctx");
  7250. return "\n";
  7251. return self;
  7252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7253. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  7254. //>>excludeEnd("ctx");
  7255. }; }),
  7256. $globals.String.a$cls);
  7257. $core.addMethod(
  7258. $core.method({
  7259. selector: "random",
  7260. protocol: "random",
  7261. //>>excludeStart("ide", pragmas.excludeIdeData);
  7262. args: [],
  7263. 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);'>",
  7264. referencedClasses: [],
  7265. //>>excludeEnd("ide");
  7266. pragmas: [["inlineJS:", ["return ((10+22*Math.random())/32).toString(32).slice(2);"]]],
  7267. messageSends: []
  7268. }, function ($methodClass){ return function (){
  7269. var self=this,$self=this;
  7270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7271. return $core.withContext(function($ctx1) {
  7272. //>>excludeEnd("ctx");
  7273. return ((10+22*Math.random())/32).toString(32).slice(2);;
  7274. return self;
  7275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7276. }, function($ctx1) {$ctx1.fill(self,"random",{})});
  7277. //>>excludeEnd("ctx");
  7278. }; }),
  7279. $globals.String.a$cls);
  7280. $core.addMethod(
  7281. $core.method({
  7282. selector: "randomNotIn:",
  7283. protocol: "random",
  7284. //>>excludeStart("ide", pragmas.excludeIdeData);
  7285. args: ["aString"],
  7286. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  7287. referencedClasses: [],
  7288. //>>excludeEnd("ide");
  7289. pragmas: [],
  7290. messageSends: ["whileTrue", "random", "includesSubString:"]
  7291. }, function ($methodClass){ return function (aString){
  7292. var self=this,$self=this;
  7293. var result;
  7294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7295. return $core.withContext(function($ctx1) {
  7296. //>>excludeEnd("ctx");
  7297. $recv((function(){
  7298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7299. return $core.withContext(function($ctx2) {
  7300. //>>excludeEnd("ctx");
  7301. result=$self._random();
  7302. return $recv(aString)._includesSubString_(result);
  7303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7305. //>>excludeEnd("ctx");
  7306. }))._whileTrue();
  7307. return result;
  7308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7309. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result})});
  7310. //>>excludeEnd("ctx");
  7311. }; }),
  7312. $globals.String.a$cls);
  7313. $core.addMethod(
  7314. $core.method({
  7315. selector: "space",
  7316. protocol: "accessing",
  7317. //>>excludeStart("ide", pragmas.excludeIdeData);
  7318. args: [],
  7319. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  7320. referencedClasses: [],
  7321. //>>excludeEnd("ide");
  7322. pragmas: [["inlineJS:", ["return \x22 \x22"]]],
  7323. messageSends: []
  7324. }, function ($methodClass){ return function (){
  7325. var self=this,$self=this;
  7326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7327. return $core.withContext(function($ctx1) {
  7328. //>>excludeEnd("ctx");
  7329. return " ";
  7330. return self;
  7331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7332. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  7333. //>>excludeEnd("ctx");
  7334. }; }),
  7335. $globals.String.a$cls);
  7336. $core.addMethod(
  7337. $core.method({
  7338. selector: "streamClass",
  7339. protocol: "accessing",
  7340. //>>excludeStart("ide", pragmas.excludeIdeData);
  7341. args: [],
  7342. source: "streamClass\x0a\x09\x09^ StringStream",
  7343. referencedClasses: ["StringStream"],
  7344. //>>excludeEnd("ide");
  7345. pragmas: [],
  7346. messageSends: []
  7347. }, function ($methodClass){ return function (){
  7348. var self=this,$self=this;
  7349. return $globals.StringStream;
  7350. }; }),
  7351. $globals.String.a$cls);
  7352. $core.addMethod(
  7353. $core.method({
  7354. selector: "tab",
  7355. protocol: "accessing",
  7356. //>>excludeStart("ide", pragmas.excludeIdeData);
  7357. args: [],
  7358. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  7359. referencedClasses: [],
  7360. //>>excludeEnd("ide");
  7361. pragmas: [["inlineJS:", ["return \x22\x5ct\x22"]]],
  7362. messageSends: []
  7363. }, function ($methodClass){ return function (){
  7364. var self=this,$self=this;
  7365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7366. return $core.withContext(function($ctx1) {
  7367. //>>excludeEnd("ctx");
  7368. return "\t";
  7369. return self;
  7370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7371. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  7372. //>>excludeEnd("ctx");
  7373. }; }),
  7374. $globals.String.a$cls);
  7375. $core.addMethod(
  7376. $core.method({
  7377. selector: "value:",
  7378. protocol: "instance creation",
  7379. //>>excludeStart("ide", pragmas.excludeIdeData);
  7380. args: ["aUTFCharCode"],
  7381. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  7382. referencedClasses: [],
  7383. //>>excludeEnd("ide");
  7384. pragmas: [["inlineJS:", ["return String.fromCharCode(aUTFCharCode);"]]],
  7385. messageSends: []
  7386. }, function ($methodClass){ return function (aUTFCharCode){
  7387. var self=this,$self=this;
  7388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7389. return $core.withContext(function($ctx1) {
  7390. //>>excludeEnd("ctx");
  7391. return String.fromCharCode(aUTFCharCode);;
  7392. return self;
  7393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7394. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode})});
  7395. //>>excludeEnd("ctx");
  7396. }; }),
  7397. $globals.String.a$cls);
  7398. $core.addClass("Set", $globals.Collection, "Kernel-Collections");
  7399. $core.setSlots($globals.Set, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"]);
  7400. //>>excludeStart("ide", pragmas.excludeIdeData);
  7401. $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`.";
  7402. //>>excludeEnd("ide");
  7403. $core.addMethod(
  7404. $core.method({
  7405. selector: "=",
  7406. protocol: "comparing",
  7407. //>>excludeStart("ide", pragmas.excludeIdeData);
  7408. args: ["aCollection"],
  7409. source: "= aCollection\x0a\x09^ self class = aCollection class and: [\x0a\x09\x09self size = aCollection size and: [\x0a\x09\x09\x09self allSatisfy: [ :each | aCollection includes: each ] ] ]",
  7410. referencedClasses: [],
  7411. //>>excludeEnd("ide");
  7412. pragmas: [],
  7413. messageSends: ["and:", "=", "class", "size", "allSatisfy:", "includes:"]
  7414. }, function ($methodClass){ return function (aCollection){
  7415. var self=this,$self=this;
  7416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7417. return $core.withContext(function($ctx1) {
  7418. //>>excludeEnd("ctx");
  7419. if($core.assert([$recv([$self._class()
  7420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7421. ,$ctx1.sendIdx["class"]=1
  7422. //>>excludeEnd("ctx");
  7423. ][0]).__eq($recv(aCollection)._class())
  7424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7425. ,$ctx1.sendIdx["="]=1
  7426. //>>excludeEnd("ctx");
  7427. ][0])){
  7428. if($core.assert($recv([$self._size()
  7429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7430. ,$ctx1.sendIdx["size"]=1
  7431. //>>excludeEnd("ctx");
  7432. ][0]).__eq($recv(aCollection)._size()))){
  7433. return $self._allSatisfy_((function(each){
  7434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7435. return $core.withContext(function($ctx2) {
  7436. //>>excludeEnd("ctx");
  7437. return $recv(aCollection)._includes_(each);
  7438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7439. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7440. //>>excludeEnd("ctx");
  7441. }));
  7442. } else {
  7443. return false;
  7444. }
  7445. } else {
  7446. return false;
  7447. }
  7448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7449. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  7450. //>>excludeEnd("ctx");
  7451. }; }),
  7452. $globals.Set);
  7453. $core.addMethod(
  7454. $core.method({
  7455. selector: "add:",
  7456. protocol: "adding/removing",
  7457. //>>excludeStart("ide", pragmas.excludeIdeData);
  7458. args: ["anObject"],
  7459. 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 ]",
  7460. referencedClasses: [],
  7461. //>>excludeEnd("ide");
  7462. pragmas: [],
  7463. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  7464. }, function ($methodClass){ return function (anObject){
  7465. var self=this,$self=this;
  7466. var bucket;
  7467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7468. return $core.withContext(function($ctx1) {
  7469. //>>excludeEnd("ctx");
  7470. var $1;
  7471. bucket=$self._bucketsOfElement_(anObject);
  7472. $1=$recv(bucket)._second();
  7473. if($1 == null || $1.a$nil){
  7474. var object,slowBucket;
  7475. object=[$recv(bucket)._first()
  7476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7477. ,$ctx1.sendIdx["first"]=1
  7478. //>>excludeEnd("ctx");
  7479. ][0];
  7480. slowBucket=$recv(bucket)._third();
  7481. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  7482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7483. return $core.withContext(function($ctx2) {
  7484. //>>excludeEnd("ctx");
  7485. $recv(slowBucket)._add_(object);
  7486. $self.size=$recv($self.size).__plus((1));
  7487. return $self.size;
  7488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7490. //>>excludeEnd("ctx");
  7491. }));
  7492. return object;
  7493. } else {
  7494. var primitiveBucket;
  7495. primitiveBucket=$1;
  7496. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  7497. }
  7498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7499. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket})});
  7500. //>>excludeEnd("ctx");
  7501. }; }),
  7502. $globals.Set);
  7503. $core.addMethod(
  7504. $core.method({
  7505. selector: "add:in:",
  7506. protocol: "private",
  7507. //>>excludeStart("ide", pragmas.excludeIdeData);
  7508. args: ["anObject", "anotherObject"],
  7509. 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'>",
  7510. referencedClasses: [],
  7511. //>>excludeEnd("ide");
  7512. pragmas: [["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"]]],
  7513. messageSends: []
  7514. }, function ($methodClass){ return function (anObject,anotherObject){
  7515. var self=this,$self=this;
  7516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7517. return $core.withContext(function($ctx1) {
  7518. //>>excludeEnd("ctx");
  7519. if (anObject in anotherObject.store) { return anObject; }
  7520. $self.size++;
  7521. anotherObject.store[anObject] = true;
  7522. return anObject;
  7523. ;
  7524. return self;
  7525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7526. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject})});
  7527. //>>excludeEnd("ctx");
  7528. }; }),
  7529. $globals.Set);
  7530. $core.addMethod(
  7531. $core.method({
  7532. selector: "bucketsOfElement:",
  7533. protocol: "private",
  7534. //>>excludeStart("ide", pragmas.excludeIdeData);
  7535. args: ["anObject"],
  7536. 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'>",
  7537. referencedClasses: [],
  7538. //>>excludeEnd("ide");
  7539. pragmas: [["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"]]],
  7540. messageSends: []
  7541. }, function ($methodClass){ return function (anObject){
  7542. var self=this,$self=this;
  7543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7544. return $core.withContext(function($ctx1) {
  7545. //>>excludeEnd("ctx");
  7546. // include nil to well-known objects under "boolean" fastBucket
  7547. if (anObject == null || anObject.a$nil) return [ null, $self.fastBuckets.boolean ];
  7548. var prim = anObject.valueOf();
  7549. if (typeof prim === "object" || typeof prim === "function" || !$self.fastBuckets[typeof prim]) {
  7550. var bucket = null;
  7551. $self.slowBucketStores.some(function (store) {
  7552. return bucket = store._bucketOfElement_(anObject);
  7553. });
  7554. return [ anObject, null, bucket || $self.defaultBucket ];
  7555. }
  7556. return [ prim, $self.fastBuckets[typeof prim] ];
  7557. ;
  7558. return self;
  7559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7560. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject})});
  7561. //>>excludeEnd("ctx");
  7562. }; }),
  7563. $globals.Set);
  7564. $core.addMethod(
  7565. $core.method({
  7566. selector: "classNameOf:",
  7567. protocol: "private",
  7568. //>>excludeStart("ide", pragmas.excludeIdeData);
  7569. args: ["anObject"],
  7570. 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'>",
  7571. referencedClasses: [],
  7572. //>>excludeEnd("ide");
  7573. pragmas: [["inlineJS:", ["return anObject.a$cls != null && anObject.a$cls.name"]]],
  7574. messageSends: []
  7575. }, function ($methodClass){ return function (anObject){
  7576. var self=this,$self=this;
  7577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7578. return $core.withContext(function($ctx1) {
  7579. //>>excludeEnd("ctx");
  7580. return anObject.a$cls != null && anObject.a$cls.name;
  7581. return self;
  7582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7583. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject})});
  7584. //>>excludeEnd("ctx");
  7585. }; }),
  7586. $globals.Set);
  7587. $core.addMethod(
  7588. $core.method({
  7589. selector: "collect:",
  7590. protocol: "enumerating",
  7591. //>>excludeStart("ide", pragmas.excludeIdeData);
  7592. args: ["aBlock"],
  7593. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7594. referencedClasses: [],
  7595. //>>excludeEnd("ide");
  7596. pragmas: [],
  7597. messageSends: ["new", "class", "do:", "add:", "value:"]
  7598. }, function ($methodClass){ return function (aBlock){
  7599. var self=this,$self=this;
  7600. var collection;
  7601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7602. return $core.withContext(function($ctx1) {
  7603. //>>excludeEnd("ctx");
  7604. collection=$recv($self._class())._new();
  7605. $self._do_((function(each){
  7606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7607. return $core.withContext(function($ctx2) {
  7608. //>>excludeEnd("ctx");
  7609. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7611. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7612. //>>excludeEnd("ctx");
  7613. }));
  7614. return collection;
  7615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7616. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection})});
  7617. //>>excludeEnd("ctx");
  7618. }; }),
  7619. $globals.Set);
  7620. $core.addMethod(
  7621. $core.method({
  7622. selector: "do:",
  7623. protocol: "enumerating",
  7624. //>>excludeStart("ide", pragmas.excludeIdeData);
  7625. args: ["aBlock"],
  7626. 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'>",
  7627. referencedClasses: [],
  7628. //>>excludeEnd("ide");
  7629. pragmas: [["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"]]],
  7630. messageSends: []
  7631. }, function ($methodClass){ return function (aBlock){
  7632. var self=this,$self=this;
  7633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7634. return $core.withContext(function($ctx1) {
  7635. //>>excludeEnd("ctx");
  7636. var el, keys, i;
  7637. el = $self.fastBuckets;
  7638. keys = Object.keys(el);
  7639. for (i = 0; i < keys.length; ++i) {
  7640. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7641. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7642. else { store._do_(aBlock); }
  7643. }
  7644. el = $self.slowBucketStores;
  7645. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7646. $self.defaultBucket._do_(aBlock);
  7647. ;
  7648. return self;
  7649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7650. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7651. //>>excludeEnd("ctx");
  7652. }; }),
  7653. $globals.Set);
  7654. $core.addMethod(
  7655. $core.method({
  7656. selector: "includes:",
  7657. protocol: "testing",
  7658. //>>excludeStart("ide", pragmas.excludeIdeData);
  7659. args: ["anObject"],
  7660. 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 ]",
  7661. referencedClasses: [],
  7662. //>>excludeEnd("ide");
  7663. pragmas: [],
  7664. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7665. }, function ($methodClass){ return function (anObject){
  7666. var self=this,$self=this;
  7667. var bucket;
  7668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7669. return $core.withContext(function($ctx1) {
  7670. //>>excludeEnd("ctx");
  7671. var $1;
  7672. bucket=$self._bucketsOfElement_(anObject);
  7673. $1=$recv(bucket)._second();
  7674. if($1 == null || $1.a$nil){
  7675. return $recv($recv(bucket)._third())._includes_([$recv(bucket)._first()
  7676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7677. ,$ctx1.sendIdx["first"]=1
  7678. //>>excludeEnd("ctx");
  7679. ][0]);
  7680. } else {
  7681. var primitiveBucket;
  7682. primitiveBucket=$1;
  7683. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7684. }
  7685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7686. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket})});
  7687. //>>excludeEnd("ctx");
  7688. }; }),
  7689. $globals.Set);
  7690. $core.addMethod(
  7691. $core.method({
  7692. selector: "includes:in:",
  7693. protocol: "private",
  7694. //>>excludeStart("ide", pragmas.excludeIdeData);
  7695. args: ["anObject", "anotherObject"],
  7696. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  7697. referencedClasses: [],
  7698. //>>excludeEnd("ide");
  7699. pragmas: [["inlineJS:", ["return anObject in anotherObject.store"]]],
  7700. messageSends: []
  7701. }, function ($methodClass){ return function (anObject,anotherObject){
  7702. var self=this,$self=this;
  7703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7704. return $core.withContext(function($ctx1) {
  7705. //>>excludeEnd("ctx");
  7706. return anObject in anotherObject.store;
  7707. return self;
  7708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7709. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject})});
  7710. //>>excludeEnd("ctx");
  7711. }; }),
  7712. $globals.Set);
  7713. $core.addMethod(
  7714. $core.method({
  7715. selector: "initialize",
  7716. protocol: "initialization",
  7717. //>>excludeStart("ide", pragmas.excludeIdeData);
  7718. args: [],
  7719. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7720. referencedClasses: [],
  7721. //>>excludeEnd("ide");
  7722. pragmas: [],
  7723. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7724. }, function ($methodClass){ return function (){
  7725. var self=this,$self=this;
  7726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7727. return $core.withContext(function($ctx1) {
  7728. //>>excludeEnd("ctx");
  7729. [(
  7730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7731. $ctx1.supercall = true,
  7732. //>>excludeEnd("ctx");
  7733. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  7734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7735. ,$ctx1.supercall = false
  7736. //>>excludeEnd("ctx");
  7737. ][0];
  7738. $self.defaultBucket=[];
  7739. $self._initializeSlowBucketStores();
  7740. $self._removeAll();
  7741. return self;
  7742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7743. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  7744. //>>excludeEnd("ctx");
  7745. }; }),
  7746. $globals.Set);
  7747. $core.addMethod(
  7748. $core.method({
  7749. selector: "initializeSlowBucketStores",
  7750. protocol: "initialization",
  7751. //>>excludeStart("ide", pragmas.excludeIdeData);
  7752. args: [],
  7753. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7754. referencedClasses: ["ArrayBucketStore"],
  7755. //>>excludeEnd("ide");
  7756. pragmas: [],
  7757. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  7758. }, function ($methodClass){ return function (){
  7759. var self=this,$self=this;
  7760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7761. return $core.withContext(function($ctx1) {
  7762. //>>excludeEnd("ctx");
  7763. $self.slowBucketStores=[[$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7765. return $core.withContext(function($ctx2) {
  7766. //>>excludeEnd("ctx");
  7767. return $self._classNameOf_(x);
  7768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7769. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7770. //>>excludeEnd("ctx");
  7771. }))
  7772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7773. ,$ctx1.sendIdx["hashBlock:"]=1
  7774. //>>excludeEnd("ctx");
  7775. ][0],$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7777. return $core.withContext(function($ctx2) {
  7778. //>>excludeEnd("ctx");
  7779. return $self._jsConstructorNameOf_(x);
  7780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7781. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7782. //>>excludeEnd("ctx");
  7783. }))];
  7784. return self;
  7785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7786. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{})});
  7787. //>>excludeEnd("ctx");
  7788. }; }),
  7789. $globals.Set);
  7790. $core.addMethod(
  7791. $core.method({
  7792. selector: "jsConstructorNameOf:",
  7793. protocol: "private",
  7794. //>>excludeStart("ide", pragmas.excludeIdeData);
  7795. args: ["anObject"],
  7796. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  7797. referencedClasses: [],
  7798. //>>excludeEnd("ide");
  7799. pragmas: [["inlineJS:", ["return anObject.constructor && anObject.constructor.name"]]],
  7800. messageSends: []
  7801. }, function ($methodClass){ return function (anObject){
  7802. var self=this,$self=this;
  7803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7804. return $core.withContext(function($ctx1) {
  7805. //>>excludeEnd("ctx");
  7806. return anObject.constructor && anObject.constructor.name;
  7807. return self;
  7808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7809. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject})});
  7810. //>>excludeEnd("ctx");
  7811. }; }),
  7812. $globals.Set);
  7813. $core.addMethod(
  7814. $core.method({
  7815. selector: "printOn:",
  7816. protocol: "printing",
  7817. //>>excludeStart("ide", pragmas.excludeIdeData);
  7818. args: ["aStream"],
  7819. 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: ')'",
  7820. referencedClasses: [],
  7821. //>>excludeEnd("ide");
  7822. pragmas: [],
  7823. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  7824. }, function ($methodClass){ return function (aStream){
  7825. var self=this,$self=this;
  7826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7827. return $core.withContext(function($ctx1) {
  7828. //>>excludeEnd("ctx");
  7829. [(
  7830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7831. $ctx1.supercall = true,
  7832. //>>excludeEnd("ctx");
  7833. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  7834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7835. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  7836. //>>excludeEnd("ctx");
  7837. ][0];
  7838. [$recv(aStream)._nextPutAll_(" (")
  7839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7840. ,$ctx1.sendIdx["nextPutAll:"]=1
  7841. //>>excludeEnd("ctx");
  7842. ][0];
  7843. $self._do_separatedBy_((function(each){
  7844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7845. return $core.withContext(function($ctx2) {
  7846. //>>excludeEnd("ctx");
  7847. return $recv(each)._printOn_(aStream);
  7848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7849. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7850. //>>excludeEnd("ctx");
  7851. }),(function(){
  7852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7853. return $core.withContext(function($ctx2) {
  7854. //>>excludeEnd("ctx");
  7855. return [$recv(aStream)._nextPutAll_(" ")
  7856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7857. ,$ctx2.sendIdx["nextPutAll:"]=2
  7858. //>>excludeEnd("ctx");
  7859. ][0];
  7860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7861. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7862. //>>excludeEnd("ctx");
  7863. }));
  7864. $recv(aStream)._nextPutAll_(")");
  7865. return self;
  7866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7867. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  7868. //>>excludeEnd("ctx");
  7869. }; }),
  7870. $globals.Set);
  7871. $core.addMethod(
  7872. $core.method({
  7873. selector: "remove:ifAbsent:",
  7874. protocol: "adding/removing",
  7875. //>>excludeStart("ide", pragmas.excludeIdeData);
  7876. args: ["anObject", "aBlock"],
  7877. source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ | obj | obj := bucket first. bucket third remove: obj ifAbsent: [ ^aBlock value ]. size := size - 1. obj ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ifAbsent: aBlock ]",
  7878. referencedClasses: [],
  7879. //>>excludeEnd("ide");
  7880. pragmas: [],
  7881. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "remove:ifAbsent:", "third", "value", "-", "remove:in:ifAbsent:"]
  7882. }, function ($methodClass){ return function (anObject,aBlock){
  7883. var self=this,$self=this;
  7884. var bucket;
  7885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7886. return $core.withContext(function($ctx1) {
  7887. //>>excludeEnd("ctx");
  7888. var $1;
  7889. var $early={};
  7890. try {
  7891. bucket=$self._bucketsOfElement_(anObject);
  7892. $1=$recv(bucket)._second();
  7893. if($1 == null || $1.a$nil){
  7894. var obj;
  7895. obj=[$recv(bucket)._first()
  7896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7897. ,$ctx1.sendIdx["first"]=1
  7898. //>>excludeEnd("ctx");
  7899. ][0];
  7900. $recv($recv(bucket)._third())._remove_ifAbsent_(obj,(function(){
  7901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7902. return $core.withContext(function($ctx2) {
  7903. //>>excludeEnd("ctx");
  7904. throw $early=[$recv(aBlock)._value()];
  7905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7907. //>>excludeEnd("ctx");
  7908. }));
  7909. $self.size=$recv($self.size).__minus((1));
  7910. return obj;
  7911. } else {
  7912. var primitiveBucket;
  7913. primitiveBucket=$1;
  7914. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  7915. }
  7916. }
  7917. catch(e) {if(e===$early)return e[0]; throw e}
  7918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7919. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket})});
  7920. //>>excludeEnd("ctx");
  7921. }; }),
  7922. $globals.Set);
  7923. $core.addMethod(
  7924. $core.method({
  7925. selector: "remove:in:ifAbsent:",
  7926. protocol: "private",
  7927. //>>excludeStart("ide", pragmas.excludeIdeData);
  7928. args: ["anObject", "anotherObject", "aBlock"],
  7929. 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}'>",
  7930. referencedClasses: [],
  7931. //>>excludeEnd("ide");
  7932. pragmas: [["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}"]]],
  7933. messageSends: []
  7934. }, function ($methodClass){ return function (anObject,anotherObject,aBlock){
  7935. var self=this,$self=this;
  7936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7937. return $core.withContext(function($ctx1) {
  7938. //>>excludeEnd("ctx");
  7939. if (anObject in anotherObject.store) {
  7940. delete anotherObject.store[anObject];
  7941. $self.size--;
  7942. return anObject;
  7943. } else {
  7944. return aBlock._value();
  7945. };
  7946. return self;
  7947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7948. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock})});
  7949. //>>excludeEnd("ctx");
  7950. }; }),
  7951. $globals.Set);
  7952. $core.addMethod(
  7953. $core.method({
  7954. selector: "removeAll",
  7955. protocol: "adding/removing",
  7956. //>>excludeStart("ide", pragmas.excludeIdeData);
  7957. args: [],
  7958. 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'>",
  7959. referencedClasses: [],
  7960. //>>excludeEnd("ide");
  7961. pragmas: [["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"]]],
  7962. messageSends: []
  7963. }, function ($methodClass){ return function (){
  7964. var self=this,$self=this;
  7965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7966. return $core.withContext(function($ctx1) {
  7967. //>>excludeEnd("ctx");
  7968. $self.fastBuckets = {
  7969. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  7970. "number": { store: Object.create(null), fn: Number },
  7971. "string": { store: Object.create(null) }
  7972. };
  7973. $self.slowBucketStores.forEach(function (x) { x._removeAll(); });
  7974. $self.defaultBucket._removeAll();
  7975. $self.size = 0;
  7976. ;
  7977. return self;
  7978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7979. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  7980. //>>excludeEnd("ctx");
  7981. }; }),
  7982. $globals.Set);
  7983. $core.addMethod(
  7984. $core.method({
  7985. selector: "select:",
  7986. protocol: "enumerating",
  7987. //>>excludeStart("ide", pragmas.excludeIdeData);
  7988. args: ["aBlock"],
  7989. 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",
  7990. referencedClasses: [],
  7991. //>>excludeEnd("ide");
  7992. pragmas: [],
  7993. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7994. }, function ($methodClass){ return function (aBlock){
  7995. var self=this,$self=this;
  7996. var collection;
  7997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7998. return $core.withContext(function($ctx1) {
  7999. //>>excludeEnd("ctx");
  8000. collection=$recv($self._class())._new();
  8001. $self._do_((function(each){
  8002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8003. return $core.withContext(function($ctx2) {
  8004. //>>excludeEnd("ctx");
  8005. if($core.assert($recv(aBlock)._value_(each))){
  8006. return $recv(collection)._add_(each);
  8007. }
  8008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8009. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8010. //>>excludeEnd("ctx");
  8011. }));
  8012. return collection;
  8013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8014. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection})});
  8015. //>>excludeEnd("ctx");
  8016. }; }),
  8017. $globals.Set);
  8018. $core.addMethod(
  8019. $core.method({
  8020. selector: "select:thenCollect:",
  8021. protocol: "enumerating",
  8022. //>>excludeStart("ide", pragmas.excludeIdeData);
  8023. args: ["selectBlock", "collectBlock"],
  8024. 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",
  8025. referencedClasses: [],
  8026. //>>excludeEnd("ide");
  8027. pragmas: [],
  8028. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  8029. }, function ($methodClass){ return function (selectBlock,collectBlock){
  8030. var self=this,$self=this;
  8031. var collection;
  8032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8033. return $core.withContext(function($ctx1) {
  8034. //>>excludeEnd("ctx");
  8035. collection=$recv($self._class())._new();
  8036. $self._do_((function(each){
  8037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8038. return $core.withContext(function($ctx2) {
  8039. //>>excludeEnd("ctx");
  8040. if($core.assert([$recv(selectBlock)._value_(each)
  8041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8042. ,$ctx2.sendIdx["value:"]=1
  8043. //>>excludeEnd("ctx");
  8044. ][0])){
  8045. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  8046. }
  8047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8048. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8049. //>>excludeEnd("ctx");
  8050. }));
  8051. return collection;
  8052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8053. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection})});
  8054. //>>excludeEnd("ctx");
  8055. }; }),
  8056. $globals.Set);
  8057. $core.addMethod(
  8058. $core.method({
  8059. selector: "size",
  8060. protocol: "accessing",
  8061. //>>excludeStart("ide", pragmas.excludeIdeData);
  8062. args: [],
  8063. source: "size\x0a\x09^ size",
  8064. referencedClasses: [],
  8065. //>>excludeEnd("ide");
  8066. pragmas: [],
  8067. messageSends: []
  8068. }, function ($methodClass){ return function (){
  8069. var self=this,$self=this;
  8070. return $self.size;
  8071. }; }),
  8072. $globals.Set);
  8073. $core.addClass("ProtoStream", $globals.Object, "Kernel-Collections");
  8074. //>>excludeStart("ide", pragmas.excludeIdeData);
  8075. $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.";
  8076. //>>excludeEnd("ide");
  8077. $core.addMethod(
  8078. $core.method({
  8079. selector: "<<",
  8080. protocol: "writing",
  8081. //>>excludeStart("ide", pragmas.excludeIdeData);
  8082. args: ["anObject"],
  8083. source: "<< anObject\x0a\x09self write: anObject",
  8084. referencedClasses: [],
  8085. //>>excludeEnd("ide");
  8086. pragmas: [],
  8087. messageSends: ["write:"]
  8088. }, function ($methodClass){ return function (anObject){
  8089. var self=this,$self=this;
  8090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8091. return $core.withContext(function($ctx1) {
  8092. //>>excludeEnd("ctx");
  8093. $self._write_(anObject);
  8094. return self;
  8095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8096. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject})});
  8097. //>>excludeEnd("ctx");
  8098. }; }),
  8099. $globals.ProtoStream);
  8100. $core.addMethod(
  8101. $core.method({
  8102. selector: "atEnd",
  8103. protocol: "testing",
  8104. //>>excludeStart("ide", pragmas.excludeIdeData);
  8105. args: [],
  8106. source: "atEnd\x0a\x09self subclassResponsibility",
  8107. referencedClasses: [],
  8108. //>>excludeEnd("ide");
  8109. pragmas: [],
  8110. messageSends: ["subclassResponsibility"]
  8111. }, function ($methodClass){ return function (){
  8112. var self=this,$self=this;
  8113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8114. return $core.withContext(function($ctx1) {
  8115. //>>excludeEnd("ctx");
  8116. $self._subclassResponsibility();
  8117. return self;
  8118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8119. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  8120. //>>excludeEnd("ctx");
  8121. }; }),
  8122. $globals.ProtoStream);
  8123. $core.addMethod(
  8124. $core.method({
  8125. selector: "atStart",
  8126. protocol: "testing",
  8127. //>>excludeStart("ide", pragmas.excludeIdeData);
  8128. args: [],
  8129. source: "atStart\x0a\x09self subclassResponsibility",
  8130. referencedClasses: [],
  8131. //>>excludeEnd("ide");
  8132. pragmas: [],
  8133. messageSends: ["subclassResponsibility"]
  8134. }, function ($methodClass){ return function (){
  8135. var self=this,$self=this;
  8136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8137. return $core.withContext(function($ctx1) {
  8138. //>>excludeEnd("ctx");
  8139. $self._subclassResponsibility();
  8140. return self;
  8141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8142. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  8143. //>>excludeEnd("ctx");
  8144. }; }),
  8145. $globals.ProtoStream);
  8146. $core.addMethod(
  8147. $core.method({
  8148. selector: "contents",
  8149. protocol: "accessing",
  8150. //>>excludeStart("ide", pragmas.excludeIdeData);
  8151. args: [],
  8152. source: "contents\x0a\x09self subclassResponsibility",
  8153. referencedClasses: [],
  8154. //>>excludeEnd("ide");
  8155. pragmas: [],
  8156. messageSends: ["subclassResponsibility"]
  8157. }, function ($methodClass){ return function (){
  8158. var self=this,$self=this;
  8159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8160. return $core.withContext(function($ctx1) {
  8161. //>>excludeEnd("ctx");
  8162. $self._subclassResponsibility();
  8163. return self;
  8164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8165. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  8166. //>>excludeEnd("ctx");
  8167. }; }),
  8168. $globals.ProtoStream);
  8169. $core.addMethod(
  8170. $core.method({
  8171. selector: "do:",
  8172. protocol: "enumerating",
  8173. //>>excludeStart("ide", pragmas.excludeIdeData);
  8174. args: ["aBlock"],
  8175. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  8176. referencedClasses: [],
  8177. //>>excludeEnd("ide");
  8178. pragmas: [],
  8179. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  8180. }, function ($methodClass){ return function (aBlock){
  8181. var self=this,$self=this;
  8182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8183. return $core.withContext(function($ctx1) {
  8184. //>>excludeEnd("ctx");
  8185. $recv((function(){
  8186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8187. return $core.withContext(function($ctx2) {
  8188. //>>excludeEnd("ctx");
  8189. return $self._atEnd();
  8190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8191. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8192. //>>excludeEnd("ctx");
  8193. }))._whileFalse_((function(){
  8194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8195. return $core.withContext(function($ctx2) {
  8196. //>>excludeEnd("ctx");
  8197. return $recv(aBlock)._value_($self._next());
  8198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8199. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8200. //>>excludeEnd("ctx");
  8201. }));
  8202. return self;
  8203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8204. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  8205. //>>excludeEnd("ctx");
  8206. }; }),
  8207. $globals.ProtoStream);
  8208. $core.addMethod(
  8209. $core.method({
  8210. selector: "isEmpty",
  8211. protocol: "testing",
  8212. //>>excludeStart("ide", pragmas.excludeIdeData);
  8213. args: [],
  8214. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  8215. referencedClasses: [],
  8216. //>>excludeEnd("ide");
  8217. pragmas: [],
  8218. messageSends: ["and:", "atStart", "atEnd"]
  8219. }, function ($methodClass){ return function (){
  8220. var self=this,$self=this;
  8221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8222. return $core.withContext(function($ctx1) {
  8223. //>>excludeEnd("ctx");
  8224. if($core.assert($self._atStart())){
  8225. return $self._atEnd();
  8226. } else {
  8227. return false;
  8228. }
  8229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8230. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  8231. //>>excludeEnd("ctx");
  8232. }; }),
  8233. $globals.ProtoStream);
  8234. $core.addMethod(
  8235. $core.method({
  8236. selector: "next",
  8237. protocol: "reading",
  8238. //>>excludeStart("ide", pragmas.excludeIdeData);
  8239. args: [],
  8240. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8241. referencedClasses: [],
  8242. //>>excludeEnd("ide");
  8243. pragmas: [],
  8244. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8245. }, function ($methodClass){ return function (){
  8246. var self=this,$self=this;
  8247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8248. return $core.withContext(function($ctx1) {
  8249. //>>excludeEnd("ctx");
  8250. if($core.assert($self._atEnd())){
  8251. return nil;
  8252. } else {
  8253. return $self._subclassResponsibility();
  8254. }
  8255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8256. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  8257. //>>excludeEnd("ctx");
  8258. }; }),
  8259. $globals.ProtoStream);
  8260. $core.addMethod(
  8261. $core.method({
  8262. selector: "nextPut:",
  8263. protocol: "writing",
  8264. //>>excludeStart("ide", pragmas.excludeIdeData);
  8265. args: ["anObject"],
  8266. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  8267. referencedClasses: [],
  8268. //>>excludeEnd("ide");
  8269. pragmas: [],
  8270. messageSends: ["subclassResponsibility"]
  8271. }, function ($methodClass){ return function (anObject){
  8272. var self=this,$self=this;
  8273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8274. return $core.withContext(function($ctx1) {
  8275. //>>excludeEnd("ctx");
  8276. $self._subclassResponsibility();
  8277. return self;
  8278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8279. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  8280. //>>excludeEnd("ctx");
  8281. }; }),
  8282. $globals.ProtoStream);
  8283. $core.addMethod(
  8284. $core.method({
  8285. selector: "nextPutAll:",
  8286. protocol: "writing",
  8287. //>>excludeStart("ide", pragmas.excludeIdeData);
  8288. args: ["aCollection"],
  8289. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  8290. referencedClasses: [],
  8291. //>>excludeEnd("ide");
  8292. pragmas: [],
  8293. messageSends: ["do:", "nextPut:"]
  8294. }, function ($methodClass){ return function (aCollection){
  8295. var self=this,$self=this;
  8296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8297. return $core.withContext(function($ctx1) {
  8298. //>>excludeEnd("ctx");
  8299. $recv(aCollection)._do_((function(each){
  8300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8301. return $core.withContext(function($ctx2) {
  8302. //>>excludeEnd("ctx");
  8303. return $self._nextPut_(each);
  8304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8305. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8306. //>>excludeEnd("ctx");
  8307. }));
  8308. return self;
  8309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8310. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection})});
  8311. //>>excludeEnd("ctx");
  8312. }; }),
  8313. $globals.ProtoStream);
  8314. $core.addMethod(
  8315. $core.method({
  8316. selector: "nextPutString:",
  8317. protocol: "writing",
  8318. //>>excludeStart("ide", pragmas.excludeIdeData);
  8319. args: ["aString"],
  8320. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  8321. referencedClasses: [],
  8322. //>>excludeEnd("ide");
  8323. pragmas: [],
  8324. messageSends: ["nextPut:"]
  8325. }, function ($methodClass){ return function (aString){
  8326. var self=this,$self=this;
  8327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8328. return $core.withContext(function($ctx1) {
  8329. //>>excludeEnd("ctx");
  8330. $self._nextPut_(aString);
  8331. return self;
  8332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8333. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  8334. //>>excludeEnd("ctx");
  8335. }; }),
  8336. $globals.ProtoStream);
  8337. $core.addMethod(
  8338. $core.method({
  8339. selector: "peek",
  8340. protocol: "reading",
  8341. //>>excludeStart("ide", pragmas.excludeIdeData);
  8342. args: [],
  8343. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8344. referencedClasses: [],
  8345. //>>excludeEnd("ide");
  8346. pragmas: [],
  8347. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8348. }, function ($methodClass){ return function (){
  8349. var self=this,$self=this;
  8350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8351. return $core.withContext(function($ctx1) {
  8352. //>>excludeEnd("ctx");
  8353. if($core.assert($self._atEnd())){
  8354. return nil;
  8355. } else {
  8356. return $self._subclassResponsibility();
  8357. }
  8358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8359. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  8360. //>>excludeEnd("ctx");
  8361. }; }),
  8362. $globals.ProtoStream);
  8363. $core.addMethod(
  8364. $core.method({
  8365. selector: "reset",
  8366. protocol: "actions",
  8367. //>>excludeStart("ide", pragmas.excludeIdeData);
  8368. args: [],
  8369. source: "reset\x0a\x09self subclassResponsibility",
  8370. referencedClasses: [],
  8371. //>>excludeEnd("ide");
  8372. pragmas: [],
  8373. messageSends: ["subclassResponsibility"]
  8374. }, function ($methodClass){ return function (){
  8375. var self=this,$self=this;
  8376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8377. return $core.withContext(function($ctx1) {
  8378. //>>excludeEnd("ctx");
  8379. $self._subclassResponsibility();
  8380. return self;
  8381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8382. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  8383. //>>excludeEnd("ctx");
  8384. }; }),
  8385. $globals.ProtoStream);
  8386. $core.addMethod(
  8387. $core.method({
  8388. selector: "resetContents",
  8389. protocol: "actions",
  8390. //>>excludeStart("ide", pragmas.excludeIdeData);
  8391. args: [],
  8392. source: "resetContents\x0a\x09self subclassResponsibility",
  8393. referencedClasses: [],
  8394. //>>excludeEnd("ide");
  8395. pragmas: [],
  8396. messageSends: ["subclassResponsibility"]
  8397. }, function ($methodClass){ return function (){
  8398. var self=this,$self=this;
  8399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8400. return $core.withContext(function($ctx1) {
  8401. //>>excludeEnd("ctx");
  8402. $self._subclassResponsibility();
  8403. return self;
  8404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8405. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  8406. //>>excludeEnd("ctx");
  8407. }; }),
  8408. $globals.ProtoStream);
  8409. $core.addMethod(
  8410. $core.method({
  8411. selector: "setToEnd",
  8412. protocol: "positioning",
  8413. //>>excludeStart("ide", pragmas.excludeIdeData);
  8414. args: [],
  8415. source: "setToEnd\x0a\x09self subclassResponsibility",
  8416. referencedClasses: [],
  8417. //>>excludeEnd("ide");
  8418. pragmas: [],
  8419. messageSends: ["subclassResponsibility"]
  8420. }, function ($methodClass){ return function (){
  8421. var self=this,$self=this;
  8422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8423. return $core.withContext(function($ctx1) {
  8424. //>>excludeEnd("ctx");
  8425. $self._subclassResponsibility();
  8426. return self;
  8427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8428. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  8429. //>>excludeEnd("ctx");
  8430. }; }),
  8431. $globals.ProtoStream);
  8432. $core.addMethod(
  8433. $core.method({
  8434. selector: "setToStart",
  8435. protocol: "positioning",
  8436. //>>excludeStart("ide", pragmas.excludeIdeData);
  8437. args: [],
  8438. source: "setToStart\x0a\x09self reset",
  8439. referencedClasses: [],
  8440. //>>excludeEnd("ide");
  8441. pragmas: [],
  8442. messageSends: ["reset"]
  8443. }, function ($methodClass){ return function (){
  8444. var self=this,$self=this;
  8445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8446. return $core.withContext(function($ctx1) {
  8447. //>>excludeEnd("ctx");
  8448. $self._reset();
  8449. return self;
  8450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8451. }, function($ctx1) {$ctx1.fill(self,"setToStart",{})});
  8452. //>>excludeEnd("ctx");
  8453. }; }),
  8454. $globals.ProtoStream);
  8455. $core.addMethod(
  8456. $core.method({
  8457. selector: "write:",
  8458. protocol: "writing",
  8459. //>>excludeStart("ide", pragmas.excludeIdeData);
  8460. args: ["anObject"],
  8461. source: "write: anObject\x0a\x09anObject putOn: self",
  8462. referencedClasses: [],
  8463. //>>excludeEnd("ide");
  8464. pragmas: [],
  8465. messageSends: ["putOn:"]
  8466. }, function ($methodClass){ return function (anObject){
  8467. var self=this,$self=this;
  8468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8469. return $core.withContext(function($ctx1) {
  8470. //>>excludeEnd("ctx");
  8471. $recv(anObject)._putOn_(self);
  8472. return self;
  8473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8474. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject})});
  8475. //>>excludeEnd("ctx");
  8476. }; }),
  8477. $globals.ProtoStream);
  8478. $core.addMethod(
  8479. $core.method({
  8480. selector: "on:",
  8481. protocol: "instance creation",
  8482. //>>excludeStart("ide", pragmas.excludeIdeData);
  8483. args: ["aCollection"],
  8484. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8485. referencedClasses: [],
  8486. //>>excludeEnd("ide");
  8487. pragmas: [],
  8488. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8489. }, function ($methodClass){ return function (aCollection){
  8490. var self=this,$self=this;
  8491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8492. return $core.withContext(function($ctx1) {
  8493. //>>excludeEnd("ctx");
  8494. var $1;
  8495. $1=$self._new();
  8496. $recv($1)._setCollection_(aCollection);
  8497. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8498. return $recv($1)._yourself();
  8499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8500. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  8501. //>>excludeEnd("ctx");
  8502. }; }),
  8503. $globals.ProtoStream.a$cls);
  8504. $core.addClass("Stream", $globals.ProtoStream, "Kernel-Collections");
  8505. $core.setSlots($globals.Stream, ["collection", "position", "streamSize"]);
  8506. //>>excludeStart("ide", pragmas.excludeIdeData);
  8507. $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.";
  8508. //>>excludeEnd("ide");
  8509. $core.addMethod(
  8510. $core.method({
  8511. selector: "atEnd",
  8512. protocol: "testing",
  8513. //>>excludeStart("ide", pragmas.excludeIdeData);
  8514. args: [],
  8515. source: "atEnd\x0a\x09^ self position = self size",
  8516. referencedClasses: [],
  8517. //>>excludeEnd("ide");
  8518. pragmas: [],
  8519. messageSends: ["=", "position", "size"]
  8520. }, function ($methodClass){ return function (){
  8521. var self=this,$self=this;
  8522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8523. return $core.withContext(function($ctx1) {
  8524. //>>excludeEnd("ctx");
  8525. return $recv($self._position()).__eq($self._size());
  8526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8527. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  8528. //>>excludeEnd("ctx");
  8529. }; }),
  8530. $globals.Stream);
  8531. $core.addMethod(
  8532. $core.method({
  8533. selector: "atStart",
  8534. protocol: "testing",
  8535. //>>excludeStart("ide", pragmas.excludeIdeData);
  8536. args: [],
  8537. source: "atStart\x0a\x09^ self position = 0",
  8538. referencedClasses: [],
  8539. //>>excludeEnd("ide");
  8540. pragmas: [],
  8541. messageSends: ["=", "position"]
  8542. }, function ($methodClass){ return function (){
  8543. var self=this,$self=this;
  8544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8545. return $core.withContext(function($ctx1) {
  8546. //>>excludeEnd("ctx");
  8547. return $recv($self._position()).__eq((0));
  8548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8549. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  8550. //>>excludeEnd("ctx");
  8551. }; }),
  8552. $globals.Stream);
  8553. $core.addMethod(
  8554. $core.method({
  8555. selector: "close",
  8556. protocol: "actions",
  8557. //>>excludeStart("ide", pragmas.excludeIdeData);
  8558. args: [],
  8559. source: "close",
  8560. referencedClasses: [],
  8561. //>>excludeEnd("ide");
  8562. pragmas: [],
  8563. messageSends: []
  8564. }, function ($methodClass){ return function (){
  8565. var self=this,$self=this;
  8566. return self;
  8567. }; }),
  8568. $globals.Stream);
  8569. $core.addMethod(
  8570. $core.method({
  8571. selector: "collection",
  8572. protocol: "accessing",
  8573. //>>excludeStart("ide", pragmas.excludeIdeData);
  8574. args: [],
  8575. source: "collection\x0a\x09^ collection",
  8576. referencedClasses: [],
  8577. //>>excludeEnd("ide");
  8578. pragmas: [],
  8579. messageSends: []
  8580. }, function ($methodClass){ return function (){
  8581. var self=this,$self=this;
  8582. return $self.collection;
  8583. }; }),
  8584. $globals.Stream);
  8585. $core.addMethod(
  8586. $core.method({
  8587. selector: "contents",
  8588. protocol: "accessing",
  8589. //>>excludeStart("ide", pragmas.excludeIdeData);
  8590. args: [],
  8591. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8592. referencedClasses: [],
  8593. //>>excludeEnd("ide");
  8594. pragmas: [],
  8595. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8596. }, function ($methodClass){ return function (){
  8597. var self=this,$self=this;
  8598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8599. return $core.withContext(function($ctx1) {
  8600. //>>excludeEnd("ctx");
  8601. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  8602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8603. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  8604. //>>excludeEnd("ctx");
  8605. }; }),
  8606. $globals.Stream);
  8607. $core.addMethod(
  8608. $core.method({
  8609. selector: "flush",
  8610. protocol: "actions",
  8611. //>>excludeStart("ide", pragmas.excludeIdeData);
  8612. args: [],
  8613. source: "flush",
  8614. referencedClasses: [],
  8615. //>>excludeEnd("ide");
  8616. pragmas: [],
  8617. messageSends: []
  8618. }, function ($methodClass){ return function (){
  8619. var self=this,$self=this;
  8620. return self;
  8621. }; }),
  8622. $globals.Stream);
  8623. $core.addMethod(
  8624. $core.method({
  8625. selector: "isEmpty",
  8626. protocol: "testing",
  8627. //>>excludeStart("ide", pragmas.excludeIdeData);
  8628. args: [],
  8629. source: "isEmpty\x0a\x09^ self size = 0",
  8630. referencedClasses: [],
  8631. //>>excludeEnd("ide");
  8632. pragmas: [],
  8633. messageSends: ["=", "size"]
  8634. }, function ($methodClass){ return function (){
  8635. var self=this,$self=this;
  8636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8637. return $core.withContext(function($ctx1) {
  8638. //>>excludeEnd("ctx");
  8639. return $recv($self._size()).__eq((0));
  8640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8641. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  8642. //>>excludeEnd("ctx");
  8643. }; }),
  8644. $globals.Stream);
  8645. $core.addMethod(
  8646. $core.method({
  8647. selector: "next",
  8648. protocol: "reading",
  8649. //>>excludeStart("ide", pragmas.excludeIdeData);
  8650. args: [],
  8651. 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 ]",
  8652. referencedClasses: [],
  8653. //>>excludeEnd("ide");
  8654. pragmas: [],
  8655. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8656. }, function ($methodClass){ return function (){
  8657. var self=this,$self=this;
  8658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8659. return $core.withContext(function($ctx1) {
  8660. //>>excludeEnd("ctx");
  8661. if($core.assert($self._atEnd())){
  8662. return nil;
  8663. } else {
  8664. $self._position_($recv([$self._position()
  8665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8666. ,$ctx1.sendIdx["position"]=1
  8667. //>>excludeEnd("ctx");
  8668. ][0]).__plus((1)));
  8669. return $recv($self.collection)._at_($self._position());
  8670. }
  8671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8672. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  8673. //>>excludeEnd("ctx");
  8674. }; }),
  8675. $globals.Stream);
  8676. $core.addMethod(
  8677. $core.method({
  8678. selector: "next:",
  8679. protocol: "reading",
  8680. //>>excludeStart("ide", pragmas.excludeIdeData);
  8681. args: ["anInteger"],
  8682. 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",
  8683. referencedClasses: [],
  8684. //>>excludeEnd("ide");
  8685. pragmas: [],
  8686. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8687. }, function ($methodClass){ return function (anInteger){
  8688. var self=this,$self=this;
  8689. var tempCollection;
  8690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8691. return $core.withContext(function($ctx1) {
  8692. //>>excludeEnd("ctx");
  8693. tempCollection=$recv($recv($self._collection())._class())._new();
  8694. $recv(anInteger)._timesRepeat_((function(){
  8695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8696. return $core.withContext(function($ctx2) {
  8697. //>>excludeEnd("ctx");
  8698. if(!$core.assert($self._atEnd())){
  8699. return $recv(tempCollection)._add_($self._next());
  8700. }
  8701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8702. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8703. //>>excludeEnd("ctx");
  8704. }));
  8705. return tempCollection;
  8706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8707. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8708. //>>excludeEnd("ctx");
  8709. }; }),
  8710. $globals.Stream);
  8711. $core.addMethod(
  8712. $core.method({
  8713. selector: "nextPut:",
  8714. protocol: "writing",
  8715. //>>excludeStart("ide", pragmas.excludeIdeData);
  8716. args: ["anObject"],
  8717. 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)",
  8718. referencedClasses: [],
  8719. //>>excludeEnd("ide");
  8720. pragmas: [],
  8721. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8722. }, function ($methodClass){ return function (anObject){
  8723. var self=this,$self=this;
  8724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8725. return $core.withContext(function($ctx1) {
  8726. //>>excludeEnd("ctx");
  8727. $self._position_($recv([$self._position()
  8728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8729. ,$ctx1.sendIdx["position"]=1
  8730. //>>excludeEnd("ctx");
  8731. ][0]).__plus((1)));
  8732. $recv($self._collection())._at_put_([$self._position()
  8733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8734. ,$ctx1.sendIdx["position"]=2
  8735. //>>excludeEnd("ctx");
  8736. ][0],anObject);
  8737. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8738. return self;
  8739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8740. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  8741. //>>excludeEnd("ctx");
  8742. }; }),
  8743. $globals.Stream);
  8744. $core.addMethod(
  8745. $core.method({
  8746. selector: "peek",
  8747. protocol: "reading",
  8748. //>>excludeStart("ide", pragmas.excludeIdeData);
  8749. args: [],
  8750. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8751. referencedClasses: [],
  8752. //>>excludeEnd("ide");
  8753. pragmas: [],
  8754. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8755. }, function ($methodClass){ return function (){
  8756. var self=this,$self=this;
  8757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8758. return $core.withContext(function($ctx1) {
  8759. //>>excludeEnd("ctx");
  8760. if(!$core.assert($self._atEnd())){
  8761. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  8762. }
  8763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8764. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  8765. //>>excludeEnd("ctx");
  8766. }; }),
  8767. $globals.Stream);
  8768. $core.addMethod(
  8769. $core.method({
  8770. selector: "position",
  8771. protocol: "accessing",
  8772. //>>excludeStart("ide", pragmas.excludeIdeData);
  8773. args: [],
  8774. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  8775. referencedClasses: [],
  8776. //>>excludeEnd("ide");
  8777. pragmas: [],
  8778. messageSends: ["ifNil:"]
  8779. }, function ($methodClass){ return function (){
  8780. var self=this,$self=this;
  8781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8782. return $core.withContext(function($ctx1) {
  8783. //>>excludeEnd("ctx");
  8784. var $1;
  8785. $1=$self.position;
  8786. if($1 == null || $1.a$nil){
  8787. $self.position=(0);
  8788. return $self.position;
  8789. } else {
  8790. return $1;
  8791. }
  8792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8793. }, function($ctx1) {$ctx1.fill(self,"position",{})});
  8794. //>>excludeEnd("ctx");
  8795. }; }),
  8796. $globals.Stream);
  8797. $core.addMethod(
  8798. $core.method({
  8799. selector: "position:",
  8800. protocol: "accessing",
  8801. //>>excludeStart("ide", pragmas.excludeIdeData);
  8802. args: ["anInteger"],
  8803. source: "position: anInteger\x0a\x09position := anInteger",
  8804. referencedClasses: [],
  8805. //>>excludeEnd("ide");
  8806. pragmas: [],
  8807. messageSends: []
  8808. }, function ($methodClass){ return function (anInteger){
  8809. var self=this,$self=this;
  8810. $self.position=anInteger;
  8811. return self;
  8812. }; }),
  8813. $globals.Stream);
  8814. $core.addMethod(
  8815. $core.method({
  8816. selector: "reset",
  8817. protocol: "actions",
  8818. //>>excludeStart("ide", pragmas.excludeIdeData);
  8819. args: [],
  8820. source: "reset\x0a\x09self position: 0",
  8821. referencedClasses: [],
  8822. //>>excludeEnd("ide");
  8823. pragmas: [],
  8824. messageSends: ["position:"]
  8825. }, function ($methodClass){ return function (){
  8826. var self=this,$self=this;
  8827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8828. return $core.withContext(function($ctx1) {
  8829. //>>excludeEnd("ctx");
  8830. $self._position_((0));
  8831. return self;
  8832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8833. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  8834. //>>excludeEnd("ctx");
  8835. }; }),
  8836. $globals.Stream);
  8837. $core.addMethod(
  8838. $core.method({
  8839. selector: "resetContents",
  8840. protocol: "actions",
  8841. //>>excludeStart("ide", pragmas.excludeIdeData);
  8842. args: [],
  8843. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  8844. referencedClasses: [],
  8845. //>>excludeEnd("ide");
  8846. pragmas: [],
  8847. messageSends: ["reset", "setStreamSize:"]
  8848. }, function ($methodClass){ return function (){
  8849. var self=this,$self=this;
  8850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8851. return $core.withContext(function($ctx1) {
  8852. //>>excludeEnd("ctx");
  8853. $self._reset();
  8854. $self._setStreamSize_((0));
  8855. return self;
  8856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8857. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  8858. //>>excludeEnd("ctx");
  8859. }; }),
  8860. $globals.Stream);
  8861. $core.addMethod(
  8862. $core.method({
  8863. selector: "setCollection:",
  8864. protocol: "accessing",
  8865. //>>excludeStart("ide", pragmas.excludeIdeData);
  8866. args: ["aCollection"],
  8867. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  8868. referencedClasses: [],
  8869. //>>excludeEnd("ide");
  8870. pragmas: [],
  8871. messageSends: []
  8872. }, function ($methodClass){ return function (aCollection){
  8873. var self=this,$self=this;
  8874. $self.collection=aCollection;
  8875. return self;
  8876. }; }),
  8877. $globals.Stream);
  8878. $core.addMethod(
  8879. $core.method({
  8880. selector: "setStreamSize:",
  8881. protocol: "accessing",
  8882. //>>excludeStart("ide", pragmas.excludeIdeData);
  8883. args: ["anInteger"],
  8884. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  8885. referencedClasses: [],
  8886. //>>excludeEnd("ide");
  8887. pragmas: [],
  8888. messageSends: []
  8889. }, function ($methodClass){ return function (anInteger){
  8890. var self=this,$self=this;
  8891. $self.streamSize=anInteger;
  8892. return self;
  8893. }; }),
  8894. $globals.Stream);
  8895. $core.addMethod(
  8896. $core.method({
  8897. selector: "setToEnd",
  8898. protocol: "positioning",
  8899. //>>excludeStart("ide", pragmas.excludeIdeData);
  8900. args: [],
  8901. source: "setToEnd\x0a\x09self position: self size",
  8902. referencedClasses: [],
  8903. //>>excludeEnd("ide");
  8904. pragmas: [],
  8905. messageSends: ["position:", "size"]
  8906. }, function ($methodClass){ return function (){
  8907. var self=this,$self=this;
  8908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8909. return $core.withContext(function($ctx1) {
  8910. //>>excludeEnd("ctx");
  8911. $self._position_($self._size());
  8912. return self;
  8913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8914. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  8915. //>>excludeEnd("ctx");
  8916. }; }),
  8917. $globals.Stream);
  8918. $core.addMethod(
  8919. $core.method({
  8920. selector: "size",
  8921. protocol: "accessing",
  8922. //>>excludeStart("ide", pragmas.excludeIdeData);
  8923. args: [],
  8924. source: "size\x0a\x09^ self streamSize",
  8925. referencedClasses: [],
  8926. //>>excludeEnd("ide");
  8927. pragmas: [],
  8928. messageSends: ["streamSize"]
  8929. }, function ($methodClass){ return function (){
  8930. var self=this,$self=this;
  8931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8932. return $core.withContext(function($ctx1) {
  8933. //>>excludeEnd("ctx");
  8934. return $self._streamSize();
  8935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8936. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  8937. //>>excludeEnd("ctx");
  8938. }; }),
  8939. $globals.Stream);
  8940. $core.addMethod(
  8941. $core.method({
  8942. selector: "skip:",
  8943. protocol: "positioning",
  8944. //>>excludeStart("ide", pragmas.excludeIdeData);
  8945. args: ["anInteger"],
  8946. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  8947. referencedClasses: [],
  8948. //>>excludeEnd("ide");
  8949. pragmas: [],
  8950. messageSends: ["position:", "min:max:", "+", "position", "size"]
  8951. }, function ($methodClass){ return function (anInteger){
  8952. var self=this,$self=this;
  8953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8954. return $core.withContext(function($ctx1) {
  8955. //>>excludeEnd("ctx");
  8956. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  8957. return self;
  8958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8959. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger})});
  8960. //>>excludeEnd("ctx");
  8961. }; }),
  8962. $globals.Stream);
  8963. $core.addMethod(
  8964. $core.method({
  8965. selector: "streamSize",
  8966. protocol: "accessing",
  8967. //>>excludeStart("ide", pragmas.excludeIdeData);
  8968. args: [],
  8969. source: "streamSize\x0a\x09^ streamSize",
  8970. referencedClasses: [],
  8971. //>>excludeEnd("ide");
  8972. pragmas: [],
  8973. messageSends: []
  8974. }, function ($methodClass){ return function (){
  8975. var self=this,$self=this;
  8976. return $self.streamSize;
  8977. }; }),
  8978. $globals.Stream);
  8979. $core.addMethod(
  8980. $core.method({
  8981. selector: "on:",
  8982. protocol: "instance creation",
  8983. //>>excludeStart("ide", pragmas.excludeIdeData);
  8984. args: ["aCollection"],
  8985. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8986. referencedClasses: [],
  8987. //>>excludeEnd("ide");
  8988. pragmas: [],
  8989. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8990. }, function ($methodClass){ return function (aCollection){
  8991. var self=this,$self=this;
  8992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8993. return $core.withContext(function($ctx1) {
  8994. //>>excludeEnd("ctx");
  8995. var $1;
  8996. $1=$self._new();
  8997. $recv($1)._setCollection_(aCollection);
  8998. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8999. return $recv($1)._yourself();
  9000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9001. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  9002. //>>excludeEnd("ctx");
  9003. }; }),
  9004. $globals.Stream.a$cls);
  9005. $core.addClass("StringStream", $globals.Stream, "Kernel-Collections");
  9006. //>>excludeStart("ide", pragmas.excludeIdeData);
  9007. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  9008. //>>excludeEnd("ide");
  9009. $core.addMethod(
  9010. $core.method({
  9011. selector: "cr",
  9012. protocol: "writing",
  9013. //>>excludeStart("ide", pragmas.excludeIdeData);
  9014. args: [],
  9015. source: "cr\x0a\x09^ self nextPutAll: String cr",
  9016. referencedClasses: ["String"],
  9017. //>>excludeEnd("ide");
  9018. pragmas: [],
  9019. messageSends: ["nextPutAll:", "cr"]
  9020. }, function ($methodClass){ return function (){
  9021. var self=this,$self=this;
  9022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9023. return $core.withContext(function($ctx1) {
  9024. //>>excludeEnd("ctx");
  9025. return $self._nextPutAll_($recv($globals.String)._cr());
  9026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9027. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  9028. //>>excludeEnd("ctx");
  9029. }; }),
  9030. $globals.StringStream);
  9031. $core.addMethod(
  9032. $core.method({
  9033. selector: "crlf",
  9034. protocol: "writing",
  9035. //>>excludeStart("ide", pragmas.excludeIdeData);
  9036. args: [],
  9037. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  9038. referencedClasses: ["String"],
  9039. //>>excludeEnd("ide");
  9040. pragmas: [],
  9041. messageSends: ["nextPutAll:", "crlf"]
  9042. }, function ($methodClass){ return function (){
  9043. var self=this,$self=this;
  9044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9045. return $core.withContext(function($ctx1) {
  9046. //>>excludeEnd("ctx");
  9047. return $self._nextPutAll_($recv($globals.String)._crlf());
  9048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9049. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  9050. //>>excludeEnd("ctx");
  9051. }; }),
  9052. $globals.StringStream);
  9053. $core.addMethod(
  9054. $core.method({
  9055. selector: "lf",
  9056. protocol: "writing",
  9057. //>>excludeStart("ide", pragmas.excludeIdeData);
  9058. args: [],
  9059. source: "lf\x0a\x09^ self nextPutAll: String lf",
  9060. referencedClasses: ["String"],
  9061. //>>excludeEnd("ide");
  9062. pragmas: [],
  9063. messageSends: ["nextPutAll:", "lf"]
  9064. }, function ($methodClass){ return function (){
  9065. var self=this,$self=this;
  9066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9067. return $core.withContext(function($ctx1) {
  9068. //>>excludeEnd("ctx");
  9069. return $self._nextPutAll_($recv($globals.String)._lf());
  9070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9071. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  9072. //>>excludeEnd("ctx");
  9073. }; }),
  9074. $globals.StringStream);
  9075. $core.addMethod(
  9076. $core.method({
  9077. selector: "next:",
  9078. protocol: "reading",
  9079. //>>excludeStart("ide", pragmas.excludeIdeData);
  9080. args: ["anInteger"],
  9081. 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",
  9082. referencedClasses: [],
  9083. //>>excludeEnd("ide");
  9084. pragmas: [],
  9085. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  9086. }, function ($methodClass){ return function (anInteger){
  9087. var self=this,$self=this;
  9088. var tempCollection;
  9089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9090. return $core.withContext(function($ctx1) {
  9091. //>>excludeEnd("ctx");
  9092. tempCollection=$recv($recv($self._collection())._class())._new();
  9093. $recv(anInteger)._timesRepeat_((function(){
  9094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9095. return $core.withContext(function($ctx2) {
  9096. //>>excludeEnd("ctx");
  9097. if(!$core.assert($self._atEnd())){
  9098. tempCollection=$recv(tempCollection).__comma($self._next());
  9099. return tempCollection;
  9100. }
  9101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9103. //>>excludeEnd("ctx");
  9104. }));
  9105. return tempCollection;
  9106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9107. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  9108. //>>excludeEnd("ctx");
  9109. }; }),
  9110. $globals.StringStream);
  9111. $core.addMethod(
  9112. $core.method({
  9113. selector: "nextPut:",
  9114. protocol: "writing",
  9115. //>>excludeStart("ide", pragmas.excludeIdeData);
  9116. args: ["aString"],
  9117. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  9118. referencedClasses: [],
  9119. //>>excludeEnd("ide");
  9120. pragmas: [],
  9121. messageSends: ["nextPutAll:"]
  9122. }, function ($methodClass){ return function (aString){
  9123. var self=this,$self=this;
  9124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9125. return $core.withContext(function($ctx1) {
  9126. //>>excludeEnd("ctx");
  9127. $self._nextPutAll_(aString);
  9128. return self;
  9129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9130. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString})});
  9131. //>>excludeEnd("ctx");
  9132. }; }),
  9133. $globals.StringStream);
  9134. $core.addMethod(
  9135. $core.method({
  9136. selector: "nextPutAll:",
  9137. protocol: "writing",
  9138. //>>excludeStart("ide", pragmas.excludeIdeData);
  9139. args: ["aString"],
  9140. source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self position = self collection size 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)",
  9141. referencedClasses: [],
  9142. //>>excludeEnd("ide");
  9143. pragmas: [],
  9144. messageSends: ["ifTrue:ifFalse:", "=", "position", "size", "collection", "setCollection:", ",", "copyFrom:to:", "+", "position:", "setStreamSize:", "max:", "streamSize"]
  9145. }, function ($methodClass){ return function (aString){
  9146. var self=this,$self=this;
  9147. var pre,post;
  9148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9149. return $core.withContext(function($ctx1) {
  9150. //>>excludeEnd("ctx");
  9151. if($core.assert($recv([$self._position()
  9152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9153. ,$ctx1.sendIdx["position"]=1
  9154. //>>excludeEnd("ctx");
  9155. ][0]).__eq([$recv([$self._collection()
  9156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9157. ,$ctx1.sendIdx["collection"]=1
  9158. //>>excludeEnd("ctx");
  9159. ][0])._size()
  9160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9161. ,$ctx1.sendIdx["size"]=1
  9162. //>>excludeEnd("ctx");
  9163. ][0]))){
  9164. [$self._setCollection_([$recv([$self._collection()
  9165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9166. ,$ctx1.sendIdx["collection"]=2
  9167. //>>excludeEnd("ctx");
  9168. ][0]).__comma(aString)
  9169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9170. ,$ctx1.sendIdx[","]=1
  9171. //>>excludeEnd("ctx");
  9172. ][0])
  9173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9174. ,$ctx1.sendIdx["setCollection:"]=1
  9175. //>>excludeEnd("ctx");
  9176. ][0];
  9177. } else {
  9178. pre=[$recv([$self._collection()
  9179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9180. ,$ctx1.sendIdx["collection"]=3
  9181. //>>excludeEnd("ctx");
  9182. ][0])._copyFrom_to_((1),[$self._position()
  9183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9184. ,$ctx1.sendIdx["position"]=2
  9185. //>>excludeEnd("ctx");
  9186. ][0])
  9187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9188. ,$ctx1.sendIdx["copyFrom:to:"]=1
  9189. //>>excludeEnd("ctx");
  9190. ][0];
  9191. post=$recv([$self._collection()
  9192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9193. ,$ctx1.sendIdx["collection"]=4
  9194. //>>excludeEnd("ctx");
  9195. ][0])._copyFrom_to_([$recv([$recv([$self._position()
  9196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9197. ,$ctx1.sendIdx["position"]=3
  9198. //>>excludeEnd("ctx");
  9199. ][0]).__plus((1))
  9200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9201. ,$ctx1.sendIdx["+"]=2
  9202. //>>excludeEnd("ctx");
  9203. ][0]).__plus([$recv(aString)._size()
  9204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9205. ,$ctx1.sendIdx["size"]=2
  9206. //>>excludeEnd("ctx");
  9207. ][0])
  9208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9209. ,$ctx1.sendIdx["+"]=1
  9210. //>>excludeEnd("ctx");
  9211. ][0],[$recv($self._collection())._size()
  9212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9213. ,$ctx1.sendIdx["size"]=3
  9214. //>>excludeEnd("ctx");
  9215. ][0]);
  9216. $self._setCollection_([$recv($recv(pre).__comma(aString)).__comma(post)
  9217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9218. ,$ctx1.sendIdx[","]=2
  9219. //>>excludeEnd("ctx");
  9220. ][0]);
  9221. }
  9222. $self._position_($recv([$self._position()
  9223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9224. ,$ctx1.sendIdx["position"]=4
  9225. //>>excludeEnd("ctx");
  9226. ][0]).__plus($recv(aString)._size()));
  9227. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  9228. return self;
  9229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9230. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post})});
  9231. //>>excludeEnd("ctx");
  9232. }; }),
  9233. $globals.StringStream);
  9234. $core.addMethod(
  9235. $core.method({
  9236. selector: "nextPutString:",
  9237. protocol: "writing",
  9238. //>>excludeStart("ide", pragmas.excludeIdeData);
  9239. args: ["aString"],
  9240. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  9241. referencedClasses: [],
  9242. //>>excludeEnd("ide");
  9243. pragmas: [],
  9244. messageSends: ["nextPutAll:"]
  9245. }, function ($methodClass){ return function (aString){
  9246. var self=this,$self=this;
  9247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9248. return $core.withContext(function($ctx1) {
  9249. //>>excludeEnd("ctx");
  9250. $self._nextPutAll_(aString);
  9251. return self;
  9252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9253. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  9254. //>>excludeEnd("ctx");
  9255. }; }),
  9256. $globals.StringStream);
  9257. $core.addMethod(
  9258. $core.method({
  9259. selector: "print:",
  9260. protocol: "writing",
  9261. //>>excludeStart("ide", pragmas.excludeIdeData);
  9262. args: ["anObject"],
  9263. source: "print: anObject\x0a\x09anObject printOn: self",
  9264. referencedClasses: [],
  9265. //>>excludeEnd("ide");
  9266. pragmas: [],
  9267. messageSends: ["printOn:"]
  9268. }, function ($methodClass){ return function (anObject){
  9269. var self=this,$self=this;
  9270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9271. return $core.withContext(function($ctx1) {
  9272. //>>excludeEnd("ctx");
  9273. $recv(anObject)._printOn_(self);
  9274. return self;
  9275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9276. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject})});
  9277. //>>excludeEnd("ctx");
  9278. }; }),
  9279. $globals.StringStream);
  9280. $core.addMethod(
  9281. $core.method({
  9282. selector: "printSymbol:",
  9283. protocol: "writing",
  9284. //>>excludeStart("ide", pragmas.excludeIdeData);
  9285. args: ["anObject"],
  9286. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  9287. referencedClasses: [],
  9288. //>>excludeEnd("ide");
  9289. pragmas: [],
  9290. messageSends: ["asSymbolPrintOn:"]
  9291. }, function ($methodClass){ return function (anObject){
  9292. var self=this,$self=this;
  9293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9294. return $core.withContext(function($ctx1) {
  9295. //>>excludeEnd("ctx");
  9296. $recv(anObject)._asSymbolPrintOn_(self);
  9297. return self;
  9298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9299. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject})});
  9300. //>>excludeEnd("ctx");
  9301. }; }),
  9302. $globals.StringStream);
  9303. $core.addMethod(
  9304. $core.method({
  9305. selector: "space",
  9306. protocol: "writing",
  9307. //>>excludeStart("ide", pragmas.excludeIdeData);
  9308. args: [],
  9309. source: "space\x0a\x09self nextPut: ' '",
  9310. referencedClasses: [],
  9311. //>>excludeEnd("ide");
  9312. pragmas: [],
  9313. messageSends: ["nextPut:"]
  9314. }, function ($methodClass){ return function (){
  9315. var self=this,$self=this;
  9316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9317. return $core.withContext(function($ctx1) {
  9318. //>>excludeEnd("ctx");
  9319. $self._nextPut_(" ");
  9320. return self;
  9321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9322. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  9323. //>>excludeEnd("ctx");
  9324. }; }),
  9325. $globals.StringStream);
  9326. $core.addMethod(
  9327. $core.method({
  9328. selector: "tab",
  9329. protocol: "writing",
  9330. //>>excludeStart("ide", pragmas.excludeIdeData);
  9331. args: [],
  9332. source: "tab\x0a\x09^ self nextPutAll: String tab",
  9333. referencedClasses: ["String"],
  9334. //>>excludeEnd("ide");
  9335. pragmas: [],
  9336. messageSends: ["nextPutAll:", "tab"]
  9337. }, function ($methodClass){ return function (){
  9338. var self=this,$self=this;
  9339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9340. return $core.withContext(function($ctx1) {
  9341. //>>excludeEnd("ctx");
  9342. return $self._nextPutAll_($recv($globals.String)._tab());
  9343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9344. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  9345. //>>excludeEnd("ctx");
  9346. }; }),
  9347. $globals.StringStream);
  9348. $core.addClass("Queue", $globals.Object, "Kernel-Collections");
  9349. $core.setSlots($globals.Queue, ["read", "readIndex", "write"]);
  9350. //>>excludeStart("ide", pragmas.excludeIdeData);
  9351. $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.";
  9352. //>>excludeEnd("ide");
  9353. $core.addMethod(
  9354. $core.method({
  9355. selector: "initialize",
  9356. protocol: "initialization",
  9357. //>>excludeStart("ide", pragmas.excludeIdeData);
  9358. args: [],
  9359. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  9360. referencedClasses: ["OrderedCollection"],
  9361. //>>excludeEnd("ide");
  9362. pragmas: [],
  9363. messageSends: ["initialize", "new"]
  9364. }, function ($methodClass){ return function (){
  9365. var self=this,$self=this;
  9366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9367. return $core.withContext(function($ctx1) {
  9368. //>>excludeEnd("ctx");
  9369. [(
  9370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9371. $ctx1.supercall = true,
  9372. //>>excludeEnd("ctx");
  9373. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  9374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9375. ,$ctx1.supercall = false
  9376. //>>excludeEnd("ctx");
  9377. ][0];
  9378. $self.read=[$recv($globals.OrderedCollection)._new()
  9379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9380. ,$ctx1.sendIdx["new"]=1
  9381. //>>excludeEnd("ctx");
  9382. ][0];
  9383. $self.write=$recv($globals.OrderedCollection)._new();
  9384. $self.readIndex=(1);
  9385. return self;
  9386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9387. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  9388. //>>excludeEnd("ctx");
  9389. }; }),
  9390. $globals.Queue);
  9391. $core.addMethod(
  9392. $core.method({
  9393. selector: "next",
  9394. protocol: "accessing",
  9395. //>>excludeStart("ide", pragmas.excludeIdeData);
  9396. args: [],
  9397. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  9398. referencedClasses: [],
  9399. //>>excludeEnd("ide");
  9400. pragmas: [],
  9401. messageSends: ["nextIfAbsent:", "error:"]
  9402. }, function ($methodClass){ return function (){
  9403. var self=this,$self=this;
  9404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9405. return $core.withContext(function($ctx1) {
  9406. //>>excludeEnd("ctx");
  9407. return $self._nextIfAbsent_((function(){
  9408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9409. return $core.withContext(function($ctx2) {
  9410. //>>excludeEnd("ctx");
  9411. return $self._error_("Cannot read from empty Queue.");
  9412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9413. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9414. //>>excludeEnd("ctx");
  9415. }));
  9416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9417. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  9418. //>>excludeEnd("ctx");
  9419. }; }),
  9420. $globals.Queue);
  9421. $core.addMethod(
  9422. $core.method({
  9423. selector: "nextIfAbsent:",
  9424. protocol: "accessing",
  9425. //>>excludeStart("ide", pragmas.excludeIdeData);
  9426. args: ["aBlock"],
  9427. 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",
  9428. referencedClasses: ["OrderedCollection"],
  9429. //>>excludeEnd("ide");
  9430. pragmas: [],
  9431. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  9432. }, function ($methodClass){ return function (aBlock){
  9433. var self=this,$self=this;
  9434. var result;
  9435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9436. return $core.withContext(function($ctx1) {
  9437. //>>excludeEnd("ctx");
  9438. var $early={};
  9439. try {
  9440. result=$recv($self.read)._at_ifAbsent_($self.readIndex,(function(){
  9441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9442. return $core.withContext(function($ctx2) {
  9443. //>>excludeEnd("ctx");
  9444. $recv($self.write)._ifEmpty_((function(){
  9445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9446. return $core.withContext(function($ctx3) {
  9447. //>>excludeEnd("ctx");
  9448. if($core.assert($recv($self.readIndex).__gt((1)))){
  9449. $self.read=[];
  9450. $self.readIndex=(1);
  9451. $self.readIndex;
  9452. }
  9453. throw $early=[$recv(aBlock)._value()];
  9454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9455. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  9456. //>>excludeEnd("ctx");
  9457. }));
  9458. $self.read=$self.write;
  9459. $self.readIndex=(1);
  9460. $self.write=$recv($globals.OrderedCollection)._new();
  9461. return $recv($self.read)._first();
  9462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9463. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9464. //>>excludeEnd("ctx");
  9465. }));
  9466. $recv($self.read)._at_put_($self.readIndex,nil);
  9467. $self.readIndex=$recv($self.readIndex).__plus((1));
  9468. return result;
  9469. }
  9470. catch(e) {if(e===$early)return e[0]; throw e}
  9471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9472. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result})});
  9473. //>>excludeEnd("ctx");
  9474. }; }),
  9475. $globals.Queue);
  9476. $core.addMethod(
  9477. $core.method({
  9478. selector: "nextPut:",
  9479. protocol: "accessing",
  9480. //>>excludeStart("ide", pragmas.excludeIdeData);
  9481. args: ["anObject"],
  9482. source: "nextPut: anObject\x0a\x09write add: anObject",
  9483. referencedClasses: [],
  9484. //>>excludeEnd("ide");
  9485. pragmas: [],
  9486. messageSends: ["add:"]
  9487. }, function ($methodClass){ return function (anObject){
  9488. var self=this,$self=this;
  9489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9490. return $core.withContext(function($ctx1) {
  9491. //>>excludeEnd("ctx");
  9492. $recv($self.write)._add_(anObject);
  9493. return self;
  9494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9495. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  9496. //>>excludeEnd("ctx");
  9497. }; }),
  9498. $globals.Queue);
  9499. $core.addClass("RegularExpression", $globals.Object, "Kernel-Collections");
  9500. //>>excludeStart("ide", pragmas.excludeIdeData);
  9501. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9502. //>>excludeEnd("ide");
  9503. $core.addMethod(
  9504. $core.method({
  9505. selector: "compile:",
  9506. protocol: "evaluating",
  9507. //>>excludeStart("ide", pragmas.excludeIdeData);
  9508. args: ["aString"],
  9509. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  9510. referencedClasses: [],
  9511. //>>excludeEnd("ide");
  9512. pragmas: [["inlineJS:", ["return self.compile(aString)"]]],
  9513. messageSends: []
  9514. }, function ($methodClass){ return function (aString){
  9515. var self=this,$self=this;
  9516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9517. return $core.withContext(function($ctx1) {
  9518. //>>excludeEnd("ctx");
  9519. return self.compile(aString);
  9520. return self;
  9521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9522. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString})});
  9523. //>>excludeEnd("ctx");
  9524. }; }),
  9525. $globals.RegularExpression);
  9526. $core.addMethod(
  9527. $core.method({
  9528. selector: "exec:",
  9529. protocol: "evaluating",
  9530. //>>excludeStart("ide", pragmas.excludeIdeData);
  9531. args: ["aString"],
  9532. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  9533. referencedClasses: [],
  9534. //>>excludeEnd("ide");
  9535. pragmas: [["inlineJS:", ["return self.exec(aString) || nil"]]],
  9536. messageSends: []
  9537. }, function ($methodClass){ return function (aString){
  9538. var self=this,$self=this;
  9539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9540. return $core.withContext(function($ctx1) {
  9541. //>>excludeEnd("ctx");
  9542. return self.exec(aString) || nil;
  9543. return self;
  9544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9545. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString})});
  9546. //>>excludeEnd("ctx");
  9547. }; }),
  9548. $globals.RegularExpression);
  9549. $core.addMethod(
  9550. $core.method({
  9551. selector: "test:",
  9552. protocol: "evaluating",
  9553. //>>excludeStart("ide", pragmas.excludeIdeData);
  9554. args: ["aString"],
  9555. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  9556. referencedClasses: [],
  9557. //>>excludeEnd("ide");
  9558. pragmas: [["inlineJS:", ["return self.test(aString)"]]],
  9559. messageSends: []
  9560. }, function ($methodClass){ return function (aString){
  9561. var self=this,$self=this;
  9562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9563. return $core.withContext(function($ctx1) {
  9564. //>>excludeEnd("ctx");
  9565. return self.test(aString);
  9566. return self;
  9567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9568. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString})});
  9569. //>>excludeEnd("ctx");
  9570. }; }),
  9571. $globals.RegularExpression);
  9572. $core.addMethod(
  9573. $core.method({
  9574. selector: "fromString:",
  9575. protocol: "instance creation",
  9576. //>>excludeStart("ide", pragmas.excludeIdeData);
  9577. args: ["aString"],
  9578. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9579. referencedClasses: [],
  9580. //>>excludeEnd("ide");
  9581. pragmas: [],
  9582. messageSends: ["fromString:flag:"]
  9583. }, function ($methodClass){ return function (aString){
  9584. var self=this,$self=this;
  9585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9586. return $core.withContext(function($ctx1) {
  9587. //>>excludeEnd("ctx");
  9588. return $self._fromString_flag_(aString,"");
  9589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9590. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  9591. //>>excludeEnd("ctx");
  9592. }; }),
  9593. $globals.RegularExpression.a$cls);
  9594. $core.addMethod(
  9595. $core.method({
  9596. selector: "fromString:flag:",
  9597. protocol: "instance creation",
  9598. //>>excludeStart("ide", pragmas.excludeIdeData);
  9599. args: ["aString", "anotherString"],
  9600. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  9601. referencedClasses: [],
  9602. //>>excludeEnd("ide");
  9603. pragmas: [["inlineJS:", ["return new RegExp(aString, anotherString)"]]],
  9604. messageSends: []
  9605. }, function ($methodClass){ return function (aString,anotherString){
  9606. var self=this,$self=this;
  9607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9608. return $core.withContext(function($ctx1) {
  9609. //>>excludeEnd("ctx");
  9610. return new RegExp(aString, anotherString);
  9611. return self;
  9612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9613. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString})});
  9614. //>>excludeEnd("ctx");
  9615. }; }),
  9616. $globals.RegularExpression.a$cls);
  9617. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  9618. $core.addMethod(
  9619. $core.method({
  9620. selector: "at:",
  9621. protocol: "accessing",
  9622. //>>excludeStart("ide", pragmas.excludeIdeData);
  9623. args: ["anIndex"],
  9624. 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 ]",
  9625. referencedClasses: [],
  9626. //>>excludeEnd("ide");
  9627. pragmas: [],
  9628. messageSends: ["at:ifAbsent:", "errorNotFound"]
  9629. }, function ($methodClass){ return function (anIndex){
  9630. var self=this,$self=this;
  9631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9632. return $core.withContext(function($ctx1) {
  9633. //>>excludeEnd("ctx");
  9634. return $self._at_ifAbsent_(anIndex,(function(){
  9635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9636. return $core.withContext(function($ctx2) {
  9637. //>>excludeEnd("ctx");
  9638. return $self._errorNotFound();
  9639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9640. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9641. //>>excludeEnd("ctx");
  9642. }));
  9643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9644. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex})});
  9645. //>>excludeEnd("ctx");
  9646. }; }),
  9647. $globals.TKeyValueCollection);
  9648. $core.addMethod(
  9649. $core.method({
  9650. selector: "at:ifAbsent:",
  9651. protocol: "accessing",
  9652. //>>excludeStart("ide", pragmas.excludeIdeData);
  9653. args: ["anIndex", "aBlock"],
  9654. 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",
  9655. referencedClasses: [],
  9656. //>>excludeEnd("ide");
  9657. pragmas: [],
  9658. messageSends: ["subclassResponsibility"]
  9659. }, function ($methodClass){ return function (anIndex,aBlock){
  9660. var self=this,$self=this;
  9661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9662. return $core.withContext(function($ctx1) {
  9663. //>>excludeEnd("ctx");
  9664. $self._subclassResponsibility();
  9665. return self;
  9666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9667. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9668. //>>excludeEnd("ctx");
  9669. }; }),
  9670. $globals.TKeyValueCollection);
  9671. $core.addMethod(
  9672. $core.method({
  9673. selector: "at:ifAbsentPut:",
  9674. protocol: "accessing",
  9675. //>>excludeStart("ide", pragmas.excludeIdeData);
  9676. args: ["aKey", "aBlock"],
  9677. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  9678. referencedClasses: [],
  9679. //>>excludeEnd("ide");
  9680. pragmas: [],
  9681. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  9682. }, function ($methodClass){ return function (aKey,aBlock){
  9683. var self=this,$self=this;
  9684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9685. return $core.withContext(function($ctx1) {
  9686. //>>excludeEnd("ctx");
  9687. return $self._at_ifAbsent_(aKey,(function(){
  9688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9689. return $core.withContext(function($ctx2) {
  9690. //>>excludeEnd("ctx");
  9691. return $self._at_put_(aKey,$recv(aBlock)._value());
  9692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9693. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9694. //>>excludeEnd("ctx");
  9695. }));
  9696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9697. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock})});
  9698. //>>excludeEnd("ctx");
  9699. }; }),
  9700. $globals.TKeyValueCollection);
  9701. $core.addMethod(
  9702. $core.method({
  9703. selector: "at:ifPresent:",
  9704. protocol: "accessing",
  9705. //>>excludeStart("ide", pragmas.excludeIdeData);
  9706. args: ["anIndex", "aBlock"],
  9707. 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 ]",
  9708. referencedClasses: [],
  9709. //>>excludeEnd("ide");
  9710. pragmas: [],
  9711. messageSends: ["at:ifPresent:ifAbsent:"]
  9712. }, function ($methodClass){ return function (anIndex,aBlock){
  9713. var self=this,$self=this;
  9714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9715. return $core.withContext(function($ctx1) {
  9716. //>>excludeEnd("ctx");
  9717. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  9718. return nil;
  9719. }));
  9720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9721. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock})});
  9722. //>>excludeEnd("ctx");
  9723. }; }),
  9724. $globals.TKeyValueCollection);
  9725. $core.addMethod(
  9726. $core.method({
  9727. selector: "at:ifPresent:ifAbsent:",
  9728. protocol: "accessing",
  9729. //>>excludeStart("ide", pragmas.excludeIdeData);
  9730. args: ["anIndex", "aBlock", "anotherBlock"],
  9731. 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",
  9732. referencedClasses: [],
  9733. //>>excludeEnd("ide");
  9734. pragmas: [],
  9735. messageSends: ["subclassResponsibility"]
  9736. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  9737. var self=this,$self=this;
  9738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9739. return $core.withContext(function($ctx1) {
  9740. //>>excludeEnd("ctx");
  9741. $self._subclassResponsibility();
  9742. return self;
  9743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9744. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9745. //>>excludeEnd("ctx");
  9746. }; }),
  9747. $globals.TKeyValueCollection);
  9748. $core.addMethod(
  9749. $core.method({
  9750. selector: "at:put:",
  9751. protocol: "accessing",
  9752. //>>excludeStart("ide", pragmas.excludeIdeData);
  9753. args: ["anIndex", "anObject"],
  9754. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  9755. referencedClasses: [],
  9756. //>>excludeEnd("ide");
  9757. pragmas: [],
  9758. messageSends: ["subclassResponsibility"]
  9759. }, function ($methodClass){ return function (anIndex,anObject){
  9760. var self=this,$self=this;
  9761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9762. return $core.withContext(function($ctx1) {
  9763. //>>excludeEnd("ctx");
  9764. $self._subclassResponsibility();
  9765. return self;
  9766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9767. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  9768. //>>excludeEnd("ctx");
  9769. }; }),
  9770. $globals.TKeyValueCollection);
  9771. $core.addMethod(
  9772. $core.method({
  9773. selector: "indexOf:",
  9774. protocol: "accessing",
  9775. //>>excludeStart("ide", pragmas.excludeIdeData);
  9776. args: ["anObject"],
  9777. 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 ]",
  9778. referencedClasses: [],
  9779. //>>excludeEnd("ide");
  9780. pragmas: [],
  9781. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  9782. }, function ($methodClass){ return function (anObject){
  9783. var self=this,$self=this;
  9784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9785. return $core.withContext(function($ctx1) {
  9786. //>>excludeEnd("ctx");
  9787. return $self._indexOf_ifAbsent_(anObject,(function(){
  9788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9789. return $core.withContext(function($ctx2) {
  9790. //>>excludeEnd("ctx");
  9791. return $self._errorNotFound();
  9792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9794. //>>excludeEnd("ctx");
  9795. }));
  9796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9797. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject})});
  9798. //>>excludeEnd("ctx");
  9799. }; }),
  9800. $globals.TKeyValueCollection);
  9801. $core.addMethod(
  9802. $core.method({
  9803. selector: "indexOf:ifAbsent:",
  9804. protocol: "accessing",
  9805. //>>excludeStart("ide", pragmas.excludeIdeData);
  9806. args: ["anObject", "aBlock"],
  9807. 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",
  9808. referencedClasses: [],
  9809. //>>excludeEnd("ide");
  9810. pragmas: [],
  9811. messageSends: ["subclassResponsibility"]
  9812. }, function ($methodClass){ return function (anObject,aBlock){
  9813. var self=this,$self=this;
  9814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9815. return $core.withContext(function($ctx1) {
  9816. //>>excludeEnd("ctx");
  9817. $self._subclassResponsibility();
  9818. return self;
  9819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9820. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9821. //>>excludeEnd("ctx");
  9822. }; }),
  9823. $globals.TKeyValueCollection);
  9824. $core.addMethod(
  9825. $core.method({
  9826. selector: "with:do:",
  9827. protocol: "enumerating",
  9828. //>>excludeStart("ide", pragmas.excludeIdeData);
  9829. args: ["anotherCollection", "aBlock"],
  9830. 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) ]",
  9831. referencedClasses: [],
  9832. //>>excludeEnd("ide");
  9833. pragmas: [],
  9834. messageSends: ["withIndexDo:", "value:value:", "at:"]
  9835. }, function ($methodClass){ return function (anotherCollection,aBlock){
  9836. var self=this,$self=this;
  9837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9838. return $core.withContext(function($ctx1) {
  9839. //>>excludeEnd("ctx");
  9840. $self._withIndexDo_((function(each,index){
  9841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9842. return $core.withContext(function($ctx2) {
  9843. //>>excludeEnd("ctx");
  9844. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  9845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9846. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  9847. //>>excludeEnd("ctx");
  9848. }));
  9849. return self;
  9850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9851. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9852. //>>excludeEnd("ctx");
  9853. }; }),
  9854. $globals.TKeyValueCollection);
  9855. $core.addMethod(
  9856. $core.method({
  9857. selector: "withIndexDo:",
  9858. protocol: "enumerating",
  9859. //>>excludeStart("ide", pragmas.excludeIdeData);
  9860. args: ["aBlock"],
  9861. 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",
  9862. referencedClasses: [],
  9863. //>>excludeEnd("ide");
  9864. pragmas: [],
  9865. messageSends: ["subclassResponsibility"]
  9866. }, function ($methodClass){ return function (aBlock){
  9867. var self=this,$self=this;
  9868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9869. return $core.withContext(function($ctx1) {
  9870. //>>excludeEnd("ctx");
  9871. $self._subclassResponsibility();
  9872. return self;
  9873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9874. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9875. //>>excludeEnd("ctx");
  9876. }; }),
  9877. $globals.TKeyValueCollection);
  9878. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  9879. $core.addMethod(
  9880. $core.method({
  9881. selector: "at:ifAbsent:",
  9882. protocol: "accessing",
  9883. //>>excludeStart("ide", pragmas.excludeIdeData);
  9884. args: ["anIndex", "aBlock"],
  9885. 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'>",
  9886. referencedClasses: [],
  9887. //>>excludeEnd("ide");
  9888. pragmas: [["inlineJS:", ["\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09"]]],
  9889. messageSends: []
  9890. }, function ($methodClass){ return function (anIndex,aBlock){
  9891. var self=this,$self=this;
  9892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9893. return $core.withContext(function($ctx1) {
  9894. //>>excludeEnd("ctx");
  9895. return anIndex >= 1 && anIndex <= self.length
  9896. ? self[anIndex - 1]
  9897. : aBlock._value()
  9898. ;
  9899. return self;
  9900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9901. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9902. //>>excludeEnd("ctx");
  9903. }; }),
  9904. $globals.TNativeZeroBasedCollection);
  9905. $core.addMethod(
  9906. $core.method({
  9907. selector: "at:ifPresent:ifAbsent:",
  9908. protocol: "accessing",
  9909. //>>excludeStart("ide", pragmas.excludeIdeData);
  9910. args: ["anIndex", "aBlock", "anotherBlock"],
  9911. 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'>",
  9912. referencedClasses: [],
  9913. //>>excludeEnd("ide");
  9914. pragmas: [["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"]]],
  9915. messageSends: []
  9916. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  9917. var self=this,$self=this;
  9918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9919. return $core.withContext(function($ctx1) {
  9920. //>>excludeEnd("ctx");
  9921. return anIndex >= 1 && anIndex <= self.length
  9922. ? aBlock._value_(self[anIndex - 1])
  9923. : anotherBlock._value()
  9924. ;
  9925. return self;
  9926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9927. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9928. //>>excludeEnd("ctx");
  9929. }; }),
  9930. $globals.TNativeZeroBasedCollection);
  9931. $core.addMethod(
  9932. $core.method({
  9933. selector: "detect:ifNone:",
  9934. protocol: "enumerating",
  9935. //>>excludeStart("ide", pragmas.excludeIdeData);
  9936. args: ["aBlock", "anotherBlock"],
  9937. 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'>",
  9938. referencedClasses: [],
  9939. //>>excludeEnd("ide");
  9940. pragmas: [["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"]]],
  9941. messageSends: []
  9942. }, function ($methodClass){ return function (aBlock,anotherBlock){
  9943. var self=this,$self=this;
  9944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9945. return $core.withContext(function($ctx1) {
  9946. //>>excludeEnd("ctx");
  9947. for(var i = 0; i < self.length; i++)
  9948. if(aBlock._value_(self[i]))
  9949. return self[i];
  9950. return anotherBlock._value();
  9951. ;
  9952. return self;
  9953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9954. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  9955. //>>excludeEnd("ctx");
  9956. }; }),
  9957. $globals.TNativeZeroBasedCollection);
  9958. $core.addMethod(
  9959. $core.method({
  9960. selector: "do:",
  9961. protocol: "enumerating",
  9962. //>>excludeStart("ide", pragmas.excludeIdeData);
  9963. args: ["aBlock"],
  9964. 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'>",
  9965. referencedClasses: [],
  9966. //>>excludeEnd("ide");
  9967. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09"]]],
  9968. messageSends: []
  9969. }, function ($methodClass){ return function (aBlock){
  9970. var self=this,$self=this;
  9971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9972. return $core.withContext(function($ctx1) {
  9973. //>>excludeEnd("ctx");
  9974. for(var i=0; i < self.length; i++) {
  9975. aBlock._value_(self[i]);
  9976. }
  9977. ;
  9978. return self;
  9979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9980. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  9981. //>>excludeEnd("ctx");
  9982. }; }),
  9983. $globals.TNativeZeroBasedCollection);
  9984. $core.addMethod(
  9985. $core.method({
  9986. selector: "indexOf:ifAbsent:",
  9987. protocol: "accessing",
  9988. //>>excludeStart("ide", pragmas.excludeIdeData);
  9989. args: ["anObject", "aBlock"],
  9990. 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'>",
  9991. referencedClasses: [],
  9992. //>>excludeEnd("ide");
  9993. pragmas: [["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"]]],
  9994. messageSends: []
  9995. }, function ($methodClass){ return function (anObject,aBlock){
  9996. var self=this,$self=this;
  9997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9998. return $core.withContext(function($ctx1) {
  9999. //>>excludeEnd("ctx");
  10000. for(var i=0; i < self.length; i++) {
  10001. if($recv(self[i]).__eq(anObject)) {return i+1}
  10002. };
  10003. return aBlock._value();
  10004. ;
  10005. return self;
  10006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10007. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  10008. //>>excludeEnd("ctx");
  10009. }; }),
  10010. $globals.TNativeZeroBasedCollection);
  10011. $core.addMethod(
  10012. $core.method({
  10013. selector: "indexOf:startingAt:ifAbsent:",
  10014. protocol: "accessing",
  10015. //>>excludeStart("ide", pragmas.excludeIdeData);
  10016. args: ["anObject", "start", "aBlock"],
  10017. 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'>",
  10018. referencedClasses: [],
  10019. //>>excludeEnd("ide");
  10020. pragmas: [["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"]]],
  10021. messageSends: []
  10022. }, function ($methodClass){ return function (anObject,start,aBlock){
  10023. var self=this,$self=this;
  10024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10025. return $core.withContext(function($ctx1) {
  10026. //>>excludeEnd("ctx");
  10027. for(var i=start - 1; i < self.length; i++){
  10028. if($recv(self[i]).__eq(anObject)) {return i+1}
  10029. }
  10030. return aBlock._value();
  10031. ;
  10032. return self;
  10033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10034. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  10035. //>>excludeEnd("ctx");
  10036. }; }),
  10037. $globals.TNativeZeroBasedCollection);
  10038. $core.addMethod(
  10039. $core.method({
  10040. selector: "single",
  10041. protocol: "accessing",
  10042. //>>excludeStart("ide", pragmas.excludeIdeData);
  10043. args: [],
  10044. 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'>",
  10045. referencedClasses: [],
  10046. //>>excludeEnd("ide");
  10047. pragmas: [["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];"]]],
  10048. messageSends: []
  10049. }, function ($methodClass){ return function (){
  10050. var self=this,$self=this;
  10051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10052. return $core.withContext(function($ctx1) {
  10053. //>>excludeEnd("ctx");
  10054. if (self.length == 0) throw new Error("Collection is empty");
  10055. if (self.length > 1) throw new Error("Collection holds more than one element.");
  10056. return self[0];;
  10057. return self;
  10058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10059. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  10060. //>>excludeEnd("ctx");
  10061. }; }),
  10062. $globals.TNativeZeroBasedCollection);
  10063. $core.addMethod(
  10064. $core.method({
  10065. selector: "size",
  10066. protocol: "accessing",
  10067. //>>excludeStart("ide", pragmas.excludeIdeData);
  10068. args: [],
  10069. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  10070. referencedClasses: [],
  10071. //>>excludeEnd("ide");
  10072. pragmas: [["inlineJS:", ["return self.length"]]],
  10073. messageSends: []
  10074. }, function ($methodClass){ return function (){
  10075. var self=this,$self=this;
  10076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10077. return $core.withContext(function($ctx1) {
  10078. //>>excludeEnd("ctx");
  10079. return self.length;
  10080. return self;
  10081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10082. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  10083. //>>excludeEnd("ctx");
  10084. }; }),
  10085. $globals.TNativeZeroBasedCollection);
  10086. $core.addMethod(
  10087. $core.method({
  10088. selector: "with:do:",
  10089. protocol: "enumerating",
  10090. //>>excludeStart("ide", pragmas.excludeIdeData);
  10091. args: ["anotherCollection", "aBlock"],
  10092. 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'>",
  10093. referencedClasses: [],
  10094. //>>excludeEnd("ide");
  10095. pragmas: [["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"]]],
  10096. messageSends: []
  10097. }, function ($methodClass){ return function (anotherCollection,aBlock){
  10098. var self=this,$self=this;
  10099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10100. return $core.withContext(function($ctx1) {
  10101. //>>excludeEnd("ctx");
  10102. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  10103. for(var i=0; i<self.length; i++) {
  10104. aBlock._value_value_(self[i], anotherCollection[i]);
  10105. }
  10106. ;
  10107. return self;
  10108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10109. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  10110. //>>excludeEnd("ctx");
  10111. }; }),
  10112. $globals.TNativeZeroBasedCollection);
  10113. $core.addMethod(
  10114. $core.method({
  10115. selector: "withIndexDo:",
  10116. protocol: "enumerating",
  10117. //>>excludeStart("ide", pragmas.excludeIdeData);
  10118. args: ["aBlock"],
  10119. 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'>",
  10120. referencedClasses: [],
  10121. //>>excludeEnd("ide");
  10122. pragmas: [["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"]]],
  10123. messageSends: []
  10124. }, function ($methodClass){ return function (aBlock){
  10125. var self=this,$self=this;
  10126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10127. return $core.withContext(function($ctx1) {
  10128. //>>excludeEnd("ctx");
  10129. for(var i=0; i < self.length; i++) {
  10130. aBlock._value_value_(self[i], i+1);
  10131. }
  10132. ;
  10133. return self;
  10134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10135. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  10136. //>>excludeEnd("ctx");
  10137. }; }),
  10138. $globals.TNativeZeroBasedCollection);
  10139. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  10140. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  10141. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  10142. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  10143. });