Kernel-Collections.js 337 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389
  1. define(["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  2. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  3. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  4. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  5. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  6. $core.addPackage("Kernel-Collections");
  7. $core.packages["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  8. $core.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  9. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  10. //>>excludeStart("ide", pragmas.excludeIdeData);
  11. $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:`";
  12. //>>excludeEnd("ide");
  13. $core.addMethod(
  14. $core.method({
  15. selector: "=",
  16. protocol: "comparing",
  17. fn: function (anAssociation){
  18. var self=this,$self=this;
  19. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20. return $core.withContext(function($ctx1) {
  21. //>>excludeEnd("ctx");
  22. var $3,$2,$5,$4,$6,$1;
  23. $3=$self._class();
  24. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25. $ctx1.sendIdx["class"]=1;
  26. //>>excludeEnd("ctx");
  27. $2=$recv($3).__eq($recv(anAssociation)._class());
  28. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29. $ctx1.sendIdx["="]=1;
  30. //>>excludeEnd("ctx");
  31. $1=$recv($2)._and_((function(){
  32. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33. return $core.withContext(function($ctx2) {
  34. //>>excludeEnd("ctx");
  35. $5=$self._key();
  36. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37. $ctx2.sendIdx["key"]=1;
  38. //>>excludeEnd("ctx");
  39. $4=$recv($5).__eq($recv(anAssociation)._key());
  40. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41. $ctx2.sendIdx["="]=2;
  42. //>>excludeEnd("ctx");
  43. return $recv($4)._and_((function(){
  44. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45. return $core.withContext(function($ctx3) {
  46. //>>excludeEnd("ctx");
  47. $6=$self._value();
  48. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49. $ctx3.sendIdx["value"]=1;
  50. //>>excludeEnd("ctx");
  51. return $recv($6).__eq($recv(anAssociation)._value());
  52. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54. //>>excludeEnd("ctx");
  55. }));
  56. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58. //>>excludeEnd("ctx");
  59. }));
  60. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61. $ctx1.sendIdx["and:"]=1;
  62. //>>excludeEnd("ctx");
  63. return $1;
  64. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  66. //>>excludeEnd("ctx");
  67. },
  68. //>>excludeStart("ide", pragmas.excludeIdeData);
  69. args: ["anAssociation"],
  70. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  71. referencedClasses: [],
  72. //>>excludeEnd("ide");
  73. messageSends: ["and:", "=", "class", "key", "value"]
  74. }),
  75. $globals.Association);
  76. $core.addMethod(
  77. $core.method({
  78. selector: "key",
  79. protocol: "accessing",
  80. fn: function (){
  81. var self=this,$self=this;
  82. return $self["@key"];
  83. },
  84. //>>excludeStart("ide", pragmas.excludeIdeData);
  85. args: [],
  86. source: "key\x0a\x09^ key",
  87. referencedClasses: [],
  88. //>>excludeEnd("ide");
  89. messageSends: []
  90. }),
  91. $globals.Association);
  92. $core.addMethod(
  93. $core.method({
  94. selector: "key:",
  95. protocol: "accessing",
  96. fn: function (aKey){
  97. var self=this,$self=this;
  98. $self["@key"]=aKey;
  99. return self;
  100. },
  101. //>>excludeStart("ide", pragmas.excludeIdeData);
  102. args: ["aKey"],
  103. source: "key: aKey\x0a\x09key := aKey",
  104. referencedClasses: [],
  105. //>>excludeEnd("ide");
  106. messageSends: []
  107. }),
  108. $globals.Association);
  109. $core.addMethod(
  110. $core.method({
  111. selector: "printOn:",
  112. protocol: "printing",
  113. fn: function (aStream){
  114. var self=this,$self=this;
  115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  116. return $core.withContext(function($ctx1) {
  117. //>>excludeEnd("ctx");
  118. $recv($self._key())._printOn_(aStream);
  119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  120. $ctx1.sendIdx["printOn:"]=1;
  121. //>>excludeEnd("ctx");
  122. $recv(aStream)._nextPutAll_(" -> ");
  123. $recv($self._value())._printOn_(aStream);
  124. return self;
  125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  126. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  127. //>>excludeEnd("ctx");
  128. },
  129. //>>excludeStart("ide", pragmas.excludeIdeData);
  130. args: ["aStream"],
  131. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  132. referencedClasses: [],
  133. //>>excludeEnd("ide");
  134. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  135. }),
  136. $globals.Association);
  137. $core.addMethod(
  138. $core.method({
  139. selector: "value",
  140. protocol: "accessing",
  141. fn: function (){
  142. var self=this,$self=this;
  143. return $self["@value"];
  144. },
  145. //>>excludeStart("ide", pragmas.excludeIdeData);
  146. args: [],
  147. source: "value\x0a\x09^ value",
  148. referencedClasses: [],
  149. //>>excludeEnd("ide");
  150. messageSends: []
  151. }),
  152. $globals.Association);
  153. $core.addMethod(
  154. $core.method({
  155. selector: "value:",
  156. protocol: "accessing",
  157. fn: function (aValue){
  158. var self=this,$self=this;
  159. $self["@value"]=aValue;
  160. return self;
  161. },
  162. //>>excludeStart("ide", pragmas.excludeIdeData);
  163. args: ["aValue"],
  164. source: "value: aValue\x0a\x09value := aValue",
  165. referencedClasses: [],
  166. //>>excludeEnd("ide");
  167. messageSends: []
  168. }),
  169. $globals.Association);
  170. $core.addMethod(
  171. $core.method({
  172. selector: "key:value:",
  173. protocol: "instance creation",
  174. fn: function (aKey,aValue){
  175. var self=this,$self=this;
  176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  177. return $core.withContext(function($ctx1) {
  178. //>>excludeEnd("ctx");
  179. var $1;
  180. $1=$self._new();
  181. $recv($1)._key_(aKey);
  182. $recv($1)._value_(aValue);
  183. return $recv($1)._yourself();
  184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  185. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.a$cls)});
  186. //>>excludeEnd("ctx");
  187. },
  188. //>>excludeStart("ide", pragmas.excludeIdeData);
  189. args: ["aKey", "aValue"],
  190. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  191. referencedClasses: [],
  192. //>>excludeEnd("ide");
  193. messageSends: ["key:", "new", "value:", "yourself"]
  194. }),
  195. $globals.Association.a$cls);
  196. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  197. //>>excludeStart("ide", pragmas.excludeIdeData);
  198. $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`.";
  199. //>>excludeEnd("ide");
  200. $core.addMethod(
  201. $core.method({
  202. selector: "bucketOfElement:",
  203. protocol: "accessing",
  204. fn: function (anObject){
  205. var self=this,$self=this;
  206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  207. return $core.withContext(function($ctx1) {
  208. //>>excludeEnd("ctx");
  209. var hash = $self['@hashBlock'](anObject);
  210. if (!hash) return null;
  211. var buckets = $self['@buckets'],
  212. bucket = buckets[hash];
  213. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  214. return bucket;
  215. ;
  216. return self;
  217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  218. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  219. //>>excludeEnd("ctx");
  220. },
  221. //>>excludeStart("ide", pragmas.excludeIdeData);
  222. args: ["anObject"],
  223. 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'>",
  224. referencedClasses: [],
  225. //>>excludeEnd("ide");
  226. messageSends: []
  227. }),
  228. $globals.BucketStore);
  229. $core.addMethod(
  230. $core.method({
  231. selector: "do:",
  232. protocol: "enumerating",
  233. fn: function (aBlock){
  234. var self=this,$self=this;
  235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  236. return $core.withContext(function($ctx1) {
  237. //>>excludeEnd("ctx");
  238. var buckets = $self['@buckets'];
  239. var keys = Object.keys(buckets);
  240. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  241. ;
  242. return self;
  243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  244. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  245. //>>excludeEnd("ctx");
  246. },
  247. //>>excludeStart("ide", pragmas.excludeIdeData);
  248. args: ["aBlock"],
  249. 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'>",
  250. referencedClasses: [],
  251. //>>excludeEnd("ide");
  252. messageSends: []
  253. }),
  254. $globals.BucketStore);
  255. $core.addMethod(
  256. $core.method({
  257. selector: "hashBlock:",
  258. protocol: "accessing",
  259. fn: function (aBlock){
  260. var self=this,$self=this;
  261. $self["@hashBlock"]=aBlock;
  262. return self;
  263. },
  264. //>>excludeStart("ide", pragmas.excludeIdeData);
  265. args: ["aBlock"],
  266. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  267. referencedClasses: [],
  268. //>>excludeEnd("ide");
  269. messageSends: []
  270. }),
  271. $globals.BucketStore);
  272. $core.addMethod(
  273. $core.method({
  274. selector: "initialize",
  275. protocol: "initialization",
  276. fn: function (){
  277. var self=this,$self=this;
  278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  279. return $core.withContext(function($ctx1) {
  280. //>>excludeEnd("ctx");
  281. (
  282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  283. $ctx1.supercall = true,
  284. //>>excludeEnd("ctx");
  285. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  287. $ctx1.supercall = false;
  288. //>>excludeEnd("ctx");;
  289. $self._removeAll();
  290. return self;
  291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  292. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  293. //>>excludeEnd("ctx");
  294. },
  295. //>>excludeStart("ide", pragmas.excludeIdeData);
  296. args: [],
  297. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  298. referencedClasses: [],
  299. //>>excludeEnd("ide");
  300. messageSends: ["initialize", "removeAll"]
  301. }),
  302. $globals.BucketStore);
  303. $core.addMethod(
  304. $core.method({
  305. selector: "newBucket",
  306. protocol: "private",
  307. fn: function (){
  308. var self=this,$self=this;
  309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  310. return $core.withContext(function($ctx1) {
  311. //>>excludeEnd("ctx");
  312. $self._subclassResponsibility();
  313. return self;
  314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  315. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  316. //>>excludeEnd("ctx");
  317. },
  318. //>>excludeStart("ide", pragmas.excludeIdeData);
  319. args: [],
  320. source: "newBucket\x0a\x09self subclassResponsibility",
  321. referencedClasses: [],
  322. //>>excludeEnd("ide");
  323. messageSends: ["subclassResponsibility"]
  324. }),
  325. $globals.BucketStore);
  326. $core.addMethod(
  327. $core.method({
  328. selector: "removeAll",
  329. protocol: "adding/removing",
  330. fn: function (){
  331. var self=this,$self=this;
  332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  333. return $core.withContext(function($ctx1) {
  334. //>>excludeEnd("ctx");
  335. $self['@buckets'] = Object.create(null);;
  336. return self;
  337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  338. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  339. //>>excludeEnd("ctx");
  340. },
  341. //>>excludeStart("ide", pragmas.excludeIdeData);
  342. args: [],
  343. source: "removeAll\x0a\x09<inlineJS: '$self[''@buckets''] = Object.create(null);'>",
  344. referencedClasses: [],
  345. //>>excludeEnd("ide");
  346. messageSends: []
  347. }),
  348. $globals.BucketStore);
  349. $core.addMethod(
  350. $core.method({
  351. selector: "hashBlock:",
  352. protocol: "instance creation",
  353. fn: function (aBlock){
  354. var self=this,$self=this;
  355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  356. return $core.withContext(function($ctx1) {
  357. //>>excludeEnd("ctx");
  358. var $1;
  359. $1=$self._new();
  360. $recv($1)._hashBlock_(aBlock);
  361. return $recv($1)._yourself();
  362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  363. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.a$cls)});
  364. //>>excludeEnd("ctx");
  365. },
  366. //>>excludeStart("ide", pragmas.excludeIdeData);
  367. args: ["aBlock"],
  368. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  369. referencedClasses: [],
  370. //>>excludeEnd("ide");
  371. messageSends: ["hashBlock:", "new", "yourself"]
  372. }),
  373. $globals.BucketStore.a$cls);
  374. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  375. //>>excludeStart("ide", pragmas.excludeIdeData);
  376. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  377. //>>excludeEnd("ide");
  378. $core.addMethod(
  379. $core.method({
  380. selector: "newBucket",
  381. protocol: "private",
  382. fn: function (){
  383. var self=this,$self=this;
  384. return [];
  385. },
  386. //>>excludeStart("ide", pragmas.excludeIdeData);
  387. args: [],
  388. source: "newBucket\x0a\x09^ #()",
  389. referencedClasses: [],
  390. //>>excludeEnd("ide");
  391. messageSends: []
  392. }),
  393. $globals.ArrayBucketStore);
  394. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  395. //>>excludeStart("ide", pragmas.excludeIdeData);
  396. $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.";
  397. //>>excludeEnd("ide");
  398. $core.addMethod(
  399. $core.method({
  400. selector: ",",
  401. protocol: "copying",
  402. fn: function (aCollection){
  403. var self=this,$self=this;
  404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  405. return $core.withContext(function($ctx1) {
  406. //>>excludeEnd("ctx");
  407. var $1;
  408. $1=$self._copy();
  409. $recv($1)._addAll_(aCollection);
  410. return $recv($1)._yourself();
  411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  412. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  413. //>>excludeEnd("ctx");
  414. },
  415. //>>excludeStart("ide", pragmas.excludeIdeData);
  416. args: ["aCollection"],
  417. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  418. referencedClasses: [],
  419. //>>excludeEnd("ide");
  420. messageSends: ["addAll:", "copy", "yourself"]
  421. }),
  422. $globals.Collection);
  423. $core.addMethod(
  424. $core.method({
  425. selector: "add:",
  426. protocol: "adding/removing",
  427. fn: function (anObject){
  428. var self=this,$self=this;
  429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  430. return $core.withContext(function($ctx1) {
  431. //>>excludeEnd("ctx");
  432. $self._subclassResponsibility();
  433. return self;
  434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  435. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  436. //>>excludeEnd("ctx");
  437. },
  438. //>>excludeStart("ide", pragmas.excludeIdeData);
  439. args: ["anObject"],
  440. source: "add: anObject\x0a\x09self subclassResponsibility",
  441. referencedClasses: [],
  442. //>>excludeEnd("ide");
  443. messageSends: ["subclassResponsibility"]
  444. }),
  445. $globals.Collection);
  446. $core.addMethod(
  447. $core.method({
  448. selector: "addAll:",
  449. protocol: "adding/removing",
  450. fn: function (aCollection){
  451. var self=this,$self=this;
  452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  453. return $core.withContext(function($ctx1) {
  454. //>>excludeEnd("ctx");
  455. $recv(aCollection)._do_((function(each){
  456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  457. return $core.withContext(function($ctx2) {
  458. //>>excludeEnd("ctx");
  459. return $self._add_(each);
  460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  461. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  462. //>>excludeEnd("ctx");
  463. }));
  464. return aCollection;
  465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  466. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  467. //>>excludeEnd("ctx");
  468. },
  469. //>>excludeStart("ide", pragmas.excludeIdeData);
  470. args: ["aCollection"],
  471. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  472. referencedClasses: [],
  473. //>>excludeEnd("ide");
  474. messageSends: ["do:", "add:"]
  475. }),
  476. $globals.Collection);
  477. $core.addMethod(
  478. $core.method({
  479. selector: "allSatisfy:",
  480. protocol: "enumerating",
  481. fn: function (aBlock){
  482. var self=this,$self=this;
  483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  484. return $core.withContext(function($ctx1) {
  485. //>>excludeEnd("ctx");
  486. var $1;
  487. var $early={};
  488. try {
  489. $self._do_((function(each){
  490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  491. return $core.withContext(function($ctx2) {
  492. //>>excludeEnd("ctx");
  493. $1=$recv(aBlock)._value_(each);
  494. if(!$core.assert($1)){
  495. throw $early=[false];
  496. }
  497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  498. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  499. //>>excludeEnd("ctx");
  500. }));
  501. return true;
  502. }
  503. catch(e) {if(e===$early)return e[0]; throw e}
  504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  505. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  506. //>>excludeEnd("ctx");
  507. },
  508. //>>excludeStart("ide", pragmas.excludeIdeData);
  509. args: ["aBlock"],
  510. 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",
  511. referencedClasses: [],
  512. //>>excludeEnd("ide");
  513. messageSends: ["do:", "ifFalse:", "value:"]
  514. }),
  515. $globals.Collection);
  516. $core.addMethod(
  517. $core.method({
  518. selector: "anyOne",
  519. protocol: "accessing",
  520. fn: function (){
  521. var self=this,$self=this;
  522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  523. return $core.withContext(function($ctx1) {
  524. //>>excludeEnd("ctx");
  525. var $early={};
  526. try {
  527. $self._ifEmpty_((function(){
  528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  529. return $core.withContext(function($ctx2) {
  530. //>>excludeEnd("ctx");
  531. return $self._error_("Collection is empty");
  532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  533. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  534. //>>excludeEnd("ctx");
  535. }));
  536. $self._do_((function(each){
  537. throw $early=[each];
  538. }));
  539. return self;
  540. }
  541. catch(e) {if(e===$early)return e[0]; throw e}
  542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  543. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  544. //>>excludeEnd("ctx");
  545. },
  546. //>>excludeStart("ide", pragmas.excludeIdeData);
  547. args: [],
  548. 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 ]",
  549. referencedClasses: [],
  550. //>>excludeEnd("ide");
  551. messageSends: ["ifEmpty:", "error:", "do:"]
  552. }),
  553. $globals.Collection);
  554. $core.addMethod(
  555. $core.method({
  556. selector: "anySatisfy:",
  557. protocol: "enumerating",
  558. fn: function (aBlock){
  559. var self=this,$self=this;
  560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  561. return $core.withContext(function($ctx1) {
  562. //>>excludeEnd("ctx");
  563. var $1;
  564. var $early={};
  565. try {
  566. $self._do_((function(each){
  567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  568. return $core.withContext(function($ctx2) {
  569. //>>excludeEnd("ctx");
  570. $1=$recv(aBlock)._value_(each);
  571. if($core.assert($1)){
  572. throw $early=[true];
  573. }
  574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  575. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  576. //>>excludeEnd("ctx");
  577. }));
  578. return false;
  579. }
  580. catch(e) {if(e===$early)return e[0]; throw e}
  581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  582. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  583. //>>excludeEnd("ctx");
  584. },
  585. //>>excludeStart("ide", pragmas.excludeIdeData);
  586. args: ["aBlock"],
  587. 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",
  588. referencedClasses: [],
  589. //>>excludeEnd("ide");
  590. messageSends: ["do:", "ifTrue:", "value:"]
  591. }),
  592. $globals.Collection);
  593. $core.addMethod(
  594. $core.method({
  595. selector: "asArray",
  596. protocol: "converting",
  597. fn: function (){
  598. var self=this,$self=this;
  599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  600. return $core.withContext(function($ctx1) {
  601. //>>excludeEnd("ctx");
  602. return $recv($globals.Array)._withAll_(self);
  603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  604. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  605. //>>excludeEnd("ctx");
  606. },
  607. //>>excludeStart("ide", pragmas.excludeIdeData);
  608. args: [],
  609. source: "asArray\x0a\x09^ Array withAll: self",
  610. referencedClasses: ["Array"],
  611. //>>excludeEnd("ide");
  612. messageSends: ["withAll:"]
  613. }),
  614. $globals.Collection);
  615. $core.addMethod(
  616. $core.method({
  617. selector: "asJavaScriptObject",
  618. protocol: "converting",
  619. fn: function (){
  620. var self=this,$self=this;
  621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  622. return $core.withContext(function($ctx1) {
  623. //>>excludeEnd("ctx");
  624. return $recv($self._asArray())._collect_((function(each){
  625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  626. return $core.withContext(function($ctx2) {
  627. //>>excludeEnd("ctx");
  628. return $recv(each)._asJavaScriptObject();
  629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  630. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  631. //>>excludeEnd("ctx");
  632. }));
  633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  634. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.Collection)});
  635. //>>excludeEnd("ctx");
  636. },
  637. //>>excludeStart("ide", pragmas.excludeIdeData);
  638. args: [],
  639. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  640. referencedClasses: [],
  641. //>>excludeEnd("ide");
  642. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  643. }),
  644. $globals.Collection);
  645. $core.addMethod(
  646. $core.method({
  647. selector: "asOrderedCollection",
  648. protocol: "converting",
  649. fn: function (){
  650. var self=this,$self=this;
  651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  652. return $core.withContext(function($ctx1) {
  653. //>>excludeEnd("ctx");
  654. return $self._asArray();
  655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  656. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  657. //>>excludeEnd("ctx");
  658. },
  659. //>>excludeStart("ide", pragmas.excludeIdeData);
  660. args: [],
  661. source: "asOrderedCollection\x0a\x09^ self asArray",
  662. referencedClasses: [],
  663. //>>excludeEnd("ide");
  664. messageSends: ["asArray"]
  665. }),
  666. $globals.Collection);
  667. $core.addMethod(
  668. $core.method({
  669. selector: "asSet",
  670. protocol: "converting",
  671. fn: function (){
  672. var self=this,$self=this;
  673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  674. return $core.withContext(function($ctx1) {
  675. //>>excludeEnd("ctx");
  676. return $recv($globals.Set)._withAll_(self);
  677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  678. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  679. //>>excludeEnd("ctx");
  680. },
  681. //>>excludeStart("ide", pragmas.excludeIdeData);
  682. args: [],
  683. source: "asSet\x0a\x09^ Set withAll: self",
  684. referencedClasses: ["Set"],
  685. //>>excludeEnd("ide");
  686. messageSends: ["withAll:"]
  687. }),
  688. $globals.Collection);
  689. $core.addMethod(
  690. $core.method({
  691. selector: "collect:",
  692. protocol: "enumerating",
  693. fn: function (aBlock){
  694. var self=this,$self=this;
  695. var stream;
  696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  697. return $core.withContext(function($ctx1) {
  698. //>>excludeEnd("ctx");
  699. stream=$recv($recv($self._class())._new())._writeStream();
  700. $self._do_((function(each){
  701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  702. return $core.withContext(function($ctx2) {
  703. //>>excludeEnd("ctx");
  704. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  706. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  707. //>>excludeEnd("ctx");
  708. }));
  709. return $recv(stream)._contents();
  710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  711. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  712. //>>excludeEnd("ctx");
  713. },
  714. //>>excludeStart("ide", pragmas.excludeIdeData);
  715. args: ["aBlock"],
  716. 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",
  717. referencedClasses: [],
  718. //>>excludeEnd("ide");
  719. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  720. }),
  721. $globals.Collection);
  722. $core.addMethod(
  723. $core.method({
  724. selector: "copyWith:",
  725. protocol: "copying",
  726. fn: function (anObject){
  727. var self=this,$self=this;
  728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  729. return $core.withContext(function($ctx1) {
  730. //>>excludeEnd("ctx");
  731. var $1;
  732. $1=$self._copy();
  733. $recv($1)._add_(anObject);
  734. return $recv($1)._yourself();
  735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  736. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  737. //>>excludeEnd("ctx");
  738. },
  739. //>>excludeStart("ide", pragmas.excludeIdeData);
  740. args: ["anObject"],
  741. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  742. referencedClasses: [],
  743. //>>excludeEnd("ide");
  744. messageSends: ["add:", "copy", "yourself"]
  745. }),
  746. $globals.Collection);
  747. $core.addMethod(
  748. $core.method({
  749. selector: "copyWithAll:",
  750. protocol: "copying",
  751. fn: function (aCollection){
  752. var self=this,$self=this;
  753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  754. return $core.withContext(function($ctx1) {
  755. //>>excludeEnd("ctx");
  756. var $1;
  757. $1=$self._copy();
  758. $recv($1)._addAll_(aCollection);
  759. return $recv($1)._yourself();
  760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  761. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  762. //>>excludeEnd("ctx");
  763. },
  764. //>>excludeStart("ide", pragmas.excludeIdeData);
  765. args: ["aCollection"],
  766. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  767. referencedClasses: [],
  768. //>>excludeEnd("ide");
  769. messageSends: ["addAll:", "copy", "yourself"]
  770. }),
  771. $globals.Collection);
  772. $core.addMethod(
  773. $core.method({
  774. selector: "copyWithout:",
  775. protocol: "copying",
  776. fn: function (anObject){
  777. var self=this,$self=this;
  778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  779. return $core.withContext(function($ctx1) {
  780. //>>excludeEnd("ctx");
  781. return $self._reject_((function(each){
  782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  783. return $core.withContext(function($ctx2) {
  784. //>>excludeEnd("ctx");
  785. return $recv(each).__eq(anObject);
  786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  787. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  788. //>>excludeEnd("ctx");
  789. }));
  790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  791. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject},$globals.Collection)});
  792. //>>excludeEnd("ctx");
  793. },
  794. //>>excludeStart("ide", pragmas.excludeIdeData);
  795. args: ["anObject"],
  796. 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 ]",
  797. referencedClasses: [],
  798. //>>excludeEnd("ide");
  799. messageSends: ["reject:", "="]
  800. }),
  801. $globals.Collection);
  802. $core.addMethod(
  803. $core.method({
  804. selector: "copyWithoutAll:",
  805. protocol: "copying",
  806. fn: function (aCollection){
  807. var self=this,$self=this;
  808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  809. return $core.withContext(function($ctx1) {
  810. //>>excludeEnd("ctx");
  811. return $self._reject_((function(each){
  812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  813. return $core.withContext(function($ctx2) {
  814. //>>excludeEnd("ctx");
  815. return $recv(aCollection)._includes_(each);
  816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  817. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  818. //>>excludeEnd("ctx");
  819. }));
  820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  821. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  822. //>>excludeEnd("ctx");
  823. },
  824. //>>excludeStart("ide", pragmas.excludeIdeData);
  825. args: ["aCollection"],
  826. 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 ]",
  827. referencedClasses: [],
  828. //>>excludeEnd("ide");
  829. messageSends: ["reject:", "includes:"]
  830. }),
  831. $globals.Collection);
  832. $core.addMethod(
  833. $core.method({
  834. selector: "deepCopy",
  835. protocol: "copying",
  836. fn: function (){
  837. var self=this,$self=this;
  838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  839. return $core.withContext(function($ctx1) {
  840. //>>excludeEnd("ctx");
  841. return $self._collect_((function(each){
  842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  843. return $core.withContext(function($ctx2) {
  844. //>>excludeEnd("ctx");
  845. return $recv(each)._deepCopy();
  846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  847. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  848. //>>excludeEnd("ctx");
  849. }));
  850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  851. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  852. //>>excludeEnd("ctx");
  853. },
  854. //>>excludeStart("ide", pragmas.excludeIdeData);
  855. args: [],
  856. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  857. referencedClasses: [],
  858. //>>excludeEnd("ide");
  859. messageSends: ["collect:", "deepCopy"]
  860. }),
  861. $globals.Collection);
  862. $core.addMethod(
  863. $core.method({
  864. selector: "detect:",
  865. protocol: "enumerating",
  866. fn: function (aBlock){
  867. var self=this,$self=this;
  868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  869. return $core.withContext(function($ctx1) {
  870. //>>excludeEnd("ctx");
  871. return $self._detect_ifNone_(aBlock,(function(){
  872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  873. return $core.withContext(function($ctx2) {
  874. //>>excludeEnd("ctx");
  875. return $self._errorNotFound();
  876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  878. //>>excludeEnd("ctx");
  879. }));
  880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  881. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  882. //>>excludeEnd("ctx");
  883. },
  884. //>>excludeStart("ide", pragmas.excludeIdeData);
  885. args: ["aBlock"],
  886. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  887. referencedClasses: [],
  888. //>>excludeEnd("ide");
  889. messageSends: ["detect:ifNone:", "errorNotFound"]
  890. }),
  891. $globals.Collection);
  892. $core.addMethod(
  893. $core.method({
  894. selector: "detect:ifNone:",
  895. protocol: "enumerating",
  896. fn: function (aBlock,anotherBlock){
  897. var self=this,$self=this;
  898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  899. return $core.withContext(function($ctx1) {
  900. //>>excludeEnd("ctx");
  901. $self._subclassResponsibility();
  902. return self;
  903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  904. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  905. //>>excludeEnd("ctx");
  906. },
  907. //>>excludeStart("ide", pragmas.excludeIdeData);
  908. args: ["aBlock", "anotherBlock"],
  909. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  910. referencedClasses: [],
  911. //>>excludeEnd("ide");
  912. messageSends: ["subclassResponsibility"]
  913. }),
  914. $globals.Collection);
  915. $core.addMethod(
  916. $core.method({
  917. selector: "do:",
  918. protocol: "enumerating",
  919. fn: function (aBlock){
  920. var self=this,$self=this;
  921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  922. return $core.withContext(function($ctx1) {
  923. //>>excludeEnd("ctx");
  924. $self._subclassResponsibility();
  925. return self;
  926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  927. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  928. //>>excludeEnd("ctx");
  929. },
  930. //>>excludeStart("ide", pragmas.excludeIdeData);
  931. args: ["aBlock"],
  932. source: "do: aBlock\x0a\x09self subclassResponsibility",
  933. referencedClasses: [],
  934. //>>excludeEnd("ide");
  935. messageSends: ["subclassResponsibility"]
  936. }),
  937. $globals.Collection);
  938. $core.addMethod(
  939. $core.method({
  940. selector: "do:separatedBy:",
  941. protocol: "enumerating",
  942. fn: function (aBlock,anotherBlock){
  943. var self=this,$self=this;
  944. var actionBeforeElement;
  945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  946. return $core.withContext(function($ctx1) {
  947. //>>excludeEnd("ctx");
  948. actionBeforeElement=(function(){
  949. actionBeforeElement=anotherBlock;
  950. return actionBeforeElement;
  951. });
  952. $self._do_((function(each){
  953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  954. return $core.withContext(function($ctx2) {
  955. //>>excludeEnd("ctx");
  956. $recv(actionBeforeElement)._value();
  957. return $recv(aBlock)._value_(each);
  958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  959. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  960. //>>excludeEnd("ctx");
  961. }));
  962. return self;
  963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  964. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  965. //>>excludeEnd("ctx");
  966. },
  967. //>>excludeStart("ide", pragmas.excludeIdeData);
  968. args: ["aBlock", "anotherBlock"],
  969. 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 ]",
  970. referencedClasses: [],
  971. //>>excludeEnd("ide");
  972. messageSends: ["do:", "value", "value:"]
  973. }),
  974. $globals.Collection);
  975. $core.addMethod(
  976. $core.method({
  977. selector: "errorNotFound",
  978. protocol: "error handling",
  979. fn: function (){
  980. var self=this,$self=this;
  981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  982. return $core.withContext(function($ctx1) {
  983. //>>excludeEnd("ctx");
  984. $self._error_("Object is not in the collection");
  985. return self;
  986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  987. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  988. //>>excludeEnd("ctx");
  989. },
  990. //>>excludeStart("ide", pragmas.excludeIdeData);
  991. args: [],
  992. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  993. referencedClasses: [],
  994. //>>excludeEnd("ide");
  995. messageSends: ["error:"]
  996. }),
  997. $globals.Collection);
  998. $core.addMethod(
  999. $core.method({
  1000. selector: "ifEmpty:",
  1001. protocol: "testing",
  1002. fn: function (aBlock){
  1003. var self=this,$self=this;
  1004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1005. return $core.withContext(function($ctx1) {
  1006. //>>excludeEnd("ctx");
  1007. var $1;
  1008. $1=$self._isEmpty();
  1009. if($core.assert($1)){
  1010. return $recv(aBlock)._value();
  1011. } else {
  1012. return self;
  1013. }
  1014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1015. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  1016. //>>excludeEnd("ctx");
  1017. },
  1018. //>>excludeStart("ide", pragmas.excludeIdeData);
  1019. args: ["aBlock"],
  1020. 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 ]",
  1021. referencedClasses: [],
  1022. //>>excludeEnd("ide");
  1023. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  1024. }),
  1025. $globals.Collection);
  1026. $core.addMethod(
  1027. $core.method({
  1028. selector: "ifEmpty:ifNotEmpty:",
  1029. protocol: "testing",
  1030. fn: function (aBlock,anotherBlock){
  1031. var self=this,$self=this;
  1032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1033. return $core.withContext(function($ctx1) {
  1034. //>>excludeEnd("ctx");
  1035. var $1;
  1036. $1=$self._isEmpty();
  1037. if($core.assert($1)){
  1038. return $recv(aBlock)._value();
  1039. } else {
  1040. return $recv(anotherBlock)._value_(self);
  1041. }
  1042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1043. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  1044. //>>excludeEnd("ctx");
  1045. },
  1046. //>>excludeStart("ide", pragmas.excludeIdeData);
  1047. args: ["aBlock", "anotherBlock"],
  1048. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  1049. referencedClasses: [],
  1050. //>>excludeEnd("ide");
  1051. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  1052. }),
  1053. $globals.Collection);
  1054. $core.addMethod(
  1055. $core.method({
  1056. selector: "ifNotEmpty:",
  1057. protocol: "testing",
  1058. fn: function (aBlock){
  1059. var self=this,$self=this;
  1060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1061. return $core.withContext(function($ctx1) {
  1062. //>>excludeEnd("ctx");
  1063. var $1;
  1064. $1=$self._notEmpty();
  1065. if($core.assert($1)){
  1066. return $recv(aBlock)._value_(self);
  1067. } else {
  1068. return self;
  1069. }
  1070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1071. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  1072. //>>excludeEnd("ctx");
  1073. },
  1074. //>>excludeStart("ide", pragmas.excludeIdeData);
  1075. args: ["aBlock"],
  1076. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  1077. referencedClasses: [],
  1078. //>>excludeEnd("ide");
  1079. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1080. }),
  1081. $globals.Collection);
  1082. $core.addMethod(
  1083. $core.method({
  1084. selector: "ifNotEmpty:ifEmpty:",
  1085. protocol: "testing",
  1086. fn: function (aBlock,anotherBlock){
  1087. var self=this,$self=this;
  1088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1089. return $core.withContext(function($ctx1) {
  1090. //>>excludeEnd("ctx");
  1091. var $1;
  1092. $1=$self._notEmpty();
  1093. if($core.assert($1)){
  1094. return $recv(aBlock)._value_(self);
  1095. } else {
  1096. return $recv(anotherBlock)._value();
  1097. }
  1098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1099. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  1100. //>>excludeEnd("ctx");
  1101. },
  1102. //>>excludeStart("ide", pragmas.excludeIdeData);
  1103. args: ["aBlock", "anotherBlock"],
  1104. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  1105. referencedClasses: [],
  1106. //>>excludeEnd("ide");
  1107. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  1108. }),
  1109. $globals.Collection);
  1110. $core.addMethod(
  1111. $core.method({
  1112. selector: "includes:",
  1113. protocol: "testing",
  1114. fn: function (anObject){
  1115. var self=this,$self=this;
  1116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1117. return $core.withContext(function($ctx1) {
  1118. //>>excludeEnd("ctx");
  1119. return $self._anySatisfy_((function(each){
  1120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1121. return $core.withContext(function($ctx2) {
  1122. //>>excludeEnd("ctx");
  1123. return $recv(each).__eq(anObject);
  1124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1125. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1126. //>>excludeEnd("ctx");
  1127. }));
  1128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1129. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  1130. //>>excludeEnd("ctx");
  1131. },
  1132. //>>excludeStart("ide", pragmas.excludeIdeData);
  1133. args: ["anObject"],
  1134. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  1135. referencedClasses: [],
  1136. //>>excludeEnd("ide");
  1137. messageSends: ["anySatisfy:", "="]
  1138. }),
  1139. $globals.Collection);
  1140. $core.addMethod(
  1141. $core.method({
  1142. selector: "inject:into:",
  1143. protocol: "enumerating",
  1144. fn: function (anObject,aBlock){
  1145. var self=this,$self=this;
  1146. var result;
  1147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1148. return $core.withContext(function($ctx1) {
  1149. //>>excludeEnd("ctx");
  1150. result=anObject;
  1151. $self._do_((function(each){
  1152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1153. return $core.withContext(function($ctx2) {
  1154. //>>excludeEnd("ctx");
  1155. result=$recv(aBlock)._value_value_(result,each);
  1156. return result;
  1157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1158. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1159. //>>excludeEnd("ctx");
  1160. }));
  1161. return result;
  1162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1163. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  1164. //>>excludeEnd("ctx");
  1165. },
  1166. //>>excludeStart("ide", pragmas.excludeIdeData);
  1167. args: ["anObject", "aBlock"],
  1168. 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",
  1169. referencedClasses: [],
  1170. //>>excludeEnd("ide");
  1171. messageSends: ["do:", "value:value:"]
  1172. }),
  1173. $globals.Collection);
  1174. $core.addMethod(
  1175. $core.method({
  1176. selector: "intersection:",
  1177. protocol: "enumerating",
  1178. fn: function (aCollection){
  1179. var self=this,$self=this;
  1180. var set,outputSet;
  1181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1182. return $core.withContext(function($ctx1) {
  1183. //>>excludeEnd("ctx");
  1184. var $2,$1;
  1185. set=$self._asSet();
  1186. outputSet=$recv($globals.Set)._new();
  1187. $recv(aCollection)._do_((function(each){
  1188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1189. return $core.withContext(function($ctx2) {
  1190. //>>excludeEnd("ctx");
  1191. $2=$recv(set)._includes_(each);
  1192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1193. $ctx2.sendIdx["includes:"]=1;
  1194. //>>excludeEnd("ctx");
  1195. $1=$recv($2)._and_((function(){
  1196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1197. return $core.withContext(function($ctx3) {
  1198. //>>excludeEnd("ctx");
  1199. return $recv($recv(outputSet)._includes_(each))._not();
  1200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1201. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1202. //>>excludeEnd("ctx");
  1203. }));
  1204. if($core.assert($1)){
  1205. return $recv(outputSet)._add_(each);
  1206. }
  1207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1208. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1209. //>>excludeEnd("ctx");
  1210. }));
  1211. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  1212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1213. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  1214. //>>excludeEnd("ctx");
  1215. },
  1216. //>>excludeStart("ide", pragmas.excludeIdeData);
  1217. args: ["aCollection"],
  1218. 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",
  1219. referencedClasses: ["Set"],
  1220. //>>excludeEnd("ide");
  1221. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  1222. }),
  1223. $globals.Collection);
  1224. $core.addMethod(
  1225. $core.method({
  1226. selector: "isEmpty",
  1227. protocol: "testing",
  1228. fn: function (){
  1229. var self=this,$self=this;
  1230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1231. return $core.withContext(function($ctx1) {
  1232. //>>excludeEnd("ctx");
  1233. return $recv($self._size()).__eq((0));
  1234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1235. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  1236. //>>excludeEnd("ctx");
  1237. },
  1238. //>>excludeStart("ide", pragmas.excludeIdeData);
  1239. args: [],
  1240. source: "isEmpty\x0a\x09^ self size = 0",
  1241. referencedClasses: [],
  1242. //>>excludeEnd("ide");
  1243. messageSends: ["=", "size"]
  1244. }),
  1245. $globals.Collection);
  1246. $core.addMethod(
  1247. $core.method({
  1248. selector: "noneSatisfy:",
  1249. protocol: "enumerating",
  1250. fn: function (aBlock){
  1251. var self=this,$self=this;
  1252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1253. return $core.withContext(function($ctx1) {
  1254. //>>excludeEnd("ctx");
  1255. var $1;
  1256. var $early={};
  1257. try {
  1258. $self._do_((function(item){
  1259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1260. return $core.withContext(function($ctx2) {
  1261. //>>excludeEnd("ctx");
  1262. $1=$recv(aBlock)._value_(item);
  1263. if($core.assert($1)){
  1264. throw $early=[false];
  1265. }
  1266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1267. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  1268. //>>excludeEnd("ctx");
  1269. }));
  1270. return true;
  1271. }
  1272. catch(e) {if(e===$early)return e[0]; throw e}
  1273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1274. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  1275. //>>excludeEnd("ctx");
  1276. },
  1277. //>>excludeStart("ide", pragmas.excludeIdeData);
  1278. args: ["aBlock"],
  1279. 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",
  1280. referencedClasses: [],
  1281. //>>excludeEnd("ide");
  1282. messageSends: ["do:", "ifTrue:", "value:"]
  1283. }),
  1284. $globals.Collection);
  1285. $core.addMethod(
  1286. $core.method({
  1287. selector: "notEmpty",
  1288. protocol: "testing",
  1289. fn: function (){
  1290. var self=this,$self=this;
  1291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1292. return $core.withContext(function($ctx1) {
  1293. //>>excludeEnd("ctx");
  1294. return $recv($self._isEmpty())._not();
  1295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1296. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  1297. //>>excludeEnd("ctx");
  1298. },
  1299. //>>excludeStart("ide", pragmas.excludeIdeData);
  1300. args: [],
  1301. source: "notEmpty\x0a\x09^ self isEmpty not",
  1302. referencedClasses: [],
  1303. //>>excludeEnd("ide");
  1304. messageSends: ["not", "isEmpty"]
  1305. }),
  1306. $globals.Collection);
  1307. $core.addMethod(
  1308. $core.method({
  1309. selector: "occurrencesOf:",
  1310. protocol: "accessing",
  1311. fn: function (anObject){
  1312. var self=this,$self=this;
  1313. var tally;
  1314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1315. return $core.withContext(function($ctx1) {
  1316. //>>excludeEnd("ctx");
  1317. var $1;
  1318. tally=(0);
  1319. $self._do_((function(each){
  1320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1321. return $core.withContext(function($ctx2) {
  1322. //>>excludeEnd("ctx");
  1323. $1=$recv(anObject).__eq(each);
  1324. if($core.assert($1)){
  1325. tally=$recv(tally).__plus((1));
  1326. return tally;
  1327. }
  1328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1329. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1330. //>>excludeEnd("ctx");
  1331. }));
  1332. return tally;
  1333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1334. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  1335. //>>excludeEnd("ctx");
  1336. },
  1337. //>>excludeStart("ide", pragmas.excludeIdeData);
  1338. args: ["anObject"],
  1339. 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",
  1340. referencedClasses: [],
  1341. //>>excludeEnd("ide");
  1342. messageSends: ["do:", "ifTrue:", "=", "+"]
  1343. }),
  1344. $globals.Collection);
  1345. $core.addMethod(
  1346. $core.method({
  1347. selector: "putOn:",
  1348. protocol: "streaming",
  1349. fn: function (aStream){
  1350. var self=this,$self=this;
  1351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1352. return $core.withContext(function($ctx1) {
  1353. //>>excludeEnd("ctx");
  1354. $self._do_((function(each){
  1355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1356. return $core.withContext(function($ctx2) {
  1357. //>>excludeEnd("ctx");
  1358. return $recv(each)._putOn_(aStream);
  1359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1360. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1361. //>>excludeEnd("ctx");
  1362. }));
  1363. return self;
  1364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1365. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  1366. //>>excludeEnd("ctx");
  1367. },
  1368. //>>excludeStart("ide", pragmas.excludeIdeData);
  1369. args: ["aStream"],
  1370. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  1371. referencedClasses: [],
  1372. //>>excludeEnd("ide");
  1373. messageSends: ["do:", "putOn:"]
  1374. }),
  1375. $globals.Collection);
  1376. $core.addMethod(
  1377. $core.method({
  1378. selector: "reject:",
  1379. protocol: "enumerating",
  1380. fn: function (aBlock){
  1381. var self=this,$self=this;
  1382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1383. return $core.withContext(function($ctx1) {
  1384. //>>excludeEnd("ctx");
  1385. return $self._select_((function(each){
  1386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1387. return $core.withContext(function($ctx2) {
  1388. //>>excludeEnd("ctx");
  1389. return $recv($recv(aBlock)._value_(each)).__eq(false);
  1390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1391. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1392. //>>excludeEnd("ctx");
  1393. }));
  1394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1395. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  1396. //>>excludeEnd("ctx");
  1397. },
  1398. //>>excludeStart("ide", pragmas.excludeIdeData);
  1399. args: ["aBlock"],
  1400. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  1401. referencedClasses: [],
  1402. //>>excludeEnd("ide");
  1403. messageSends: ["select:", "=", "value:"]
  1404. }),
  1405. $globals.Collection);
  1406. $core.addMethod(
  1407. $core.method({
  1408. selector: "remove:",
  1409. protocol: "adding/removing",
  1410. fn: function (anObject){
  1411. var self=this,$self=this;
  1412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1413. return $core.withContext(function($ctx1) {
  1414. //>>excludeEnd("ctx");
  1415. return $self._remove_ifAbsent_(anObject,(function(){
  1416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1417. return $core.withContext(function($ctx2) {
  1418. //>>excludeEnd("ctx");
  1419. return $self._errorNotFound();
  1420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1421. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1422. //>>excludeEnd("ctx");
  1423. }));
  1424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1425. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  1426. //>>excludeEnd("ctx");
  1427. },
  1428. //>>excludeStart("ide", pragmas.excludeIdeData);
  1429. args: ["anObject"],
  1430. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  1431. referencedClasses: [],
  1432. //>>excludeEnd("ide");
  1433. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  1434. }),
  1435. $globals.Collection);
  1436. $core.addMethod(
  1437. $core.method({
  1438. selector: "remove:ifAbsent:",
  1439. protocol: "adding/removing",
  1440. fn: function (anObject,aBlock){
  1441. var self=this,$self=this;
  1442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1443. return $core.withContext(function($ctx1) {
  1444. //>>excludeEnd("ctx");
  1445. $self._subclassResponsibility();
  1446. return self;
  1447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1448. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  1449. //>>excludeEnd("ctx");
  1450. },
  1451. //>>excludeStart("ide", pragmas.excludeIdeData);
  1452. args: ["anObject", "aBlock"],
  1453. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1454. referencedClasses: [],
  1455. //>>excludeEnd("ide");
  1456. messageSends: ["subclassResponsibility"]
  1457. }),
  1458. $globals.Collection);
  1459. $core.addMethod(
  1460. $core.method({
  1461. selector: "removeAll",
  1462. protocol: "adding/removing",
  1463. fn: function (){
  1464. var self=this,$self=this;
  1465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1466. return $core.withContext(function($ctx1) {
  1467. //>>excludeEnd("ctx");
  1468. $self._subclassResponsibility();
  1469. return self;
  1470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1471. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  1472. //>>excludeEnd("ctx");
  1473. },
  1474. //>>excludeStart("ide", pragmas.excludeIdeData);
  1475. args: [],
  1476. source: "removeAll\x0a\x09self subclassResponsibility",
  1477. referencedClasses: [],
  1478. //>>excludeEnd("ide");
  1479. messageSends: ["subclassResponsibility"]
  1480. }),
  1481. $globals.Collection);
  1482. $core.addMethod(
  1483. $core.method({
  1484. selector: "select:",
  1485. protocol: "enumerating",
  1486. fn: function (aBlock){
  1487. var self=this,$self=this;
  1488. var stream;
  1489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1490. return $core.withContext(function($ctx1) {
  1491. //>>excludeEnd("ctx");
  1492. var $1;
  1493. stream=$recv($recv($self._class())._new())._writeStream();
  1494. $self._do_((function(each){
  1495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1496. return $core.withContext(function($ctx2) {
  1497. //>>excludeEnd("ctx");
  1498. $1=$recv(aBlock)._value_(each);
  1499. if($core.assert($1)){
  1500. return $recv(stream)._nextPut_(each);
  1501. }
  1502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1503. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1504. //>>excludeEnd("ctx");
  1505. }));
  1506. return $recv(stream)._contents();
  1507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1508. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  1509. //>>excludeEnd("ctx");
  1510. },
  1511. //>>excludeStart("ide", pragmas.excludeIdeData);
  1512. args: ["aBlock"],
  1513. 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",
  1514. referencedClasses: [],
  1515. //>>excludeEnd("ide");
  1516. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1517. }),
  1518. $globals.Collection);
  1519. $core.addMethod(
  1520. $core.method({
  1521. selector: "select:thenCollect:",
  1522. protocol: "enumerating",
  1523. fn: function (selectBlock,collectBlock){
  1524. var self=this,$self=this;
  1525. var stream;
  1526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1527. return $core.withContext(function($ctx1) {
  1528. //>>excludeEnd("ctx");
  1529. var $1;
  1530. stream=$recv($recv($self._class())._new())._writeStream();
  1531. $self._do_((function(each){
  1532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1533. return $core.withContext(function($ctx2) {
  1534. //>>excludeEnd("ctx");
  1535. $1=$recv(selectBlock)._value_(each);
  1536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1537. $ctx2.sendIdx["value:"]=1;
  1538. //>>excludeEnd("ctx");
  1539. if($core.assert($1)){
  1540. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  1541. }
  1542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1543. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1544. //>>excludeEnd("ctx");
  1545. }));
  1546. return $recv(stream)._contents();
  1547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1548. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  1549. //>>excludeEnd("ctx");
  1550. },
  1551. //>>excludeStart("ide", pragmas.excludeIdeData);
  1552. args: ["selectBlock", "collectBlock"],
  1553. 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",
  1554. referencedClasses: [],
  1555. //>>excludeEnd("ide");
  1556. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1557. }),
  1558. $globals.Collection);
  1559. $core.addMethod(
  1560. $core.method({
  1561. selector: "shallowCopy",
  1562. protocol: "copying",
  1563. fn: function (){
  1564. var self=this,$self=this;
  1565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1566. return $core.withContext(function($ctx1) {
  1567. //>>excludeEnd("ctx");
  1568. return $self._collect_((function(each){
  1569. return each;
  1570. }));
  1571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1572. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  1573. //>>excludeEnd("ctx");
  1574. },
  1575. //>>excludeStart("ide", pragmas.excludeIdeData);
  1576. args: [],
  1577. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  1578. referencedClasses: [],
  1579. //>>excludeEnd("ide");
  1580. messageSends: ["collect:"]
  1581. }),
  1582. $globals.Collection);
  1583. $core.addMethod(
  1584. $core.method({
  1585. selector: "single",
  1586. protocol: "accessing",
  1587. fn: function (){
  1588. var self=this,$self=this;
  1589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1590. return $core.withContext(function($ctx1) {
  1591. //>>excludeEnd("ctx");
  1592. var $1;
  1593. $self._ifEmpty_((function(){
  1594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1595. return $core.withContext(function($ctx2) {
  1596. //>>excludeEnd("ctx");
  1597. return $self._error_("Collection is empty");
  1598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1599. $ctx2.sendIdx["error:"]=1;
  1600. //>>excludeEnd("ctx");
  1601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1602. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1603. //>>excludeEnd("ctx");
  1604. }));
  1605. $1=$recv($self._size()).__gt((1));
  1606. if($core.assert($1)){
  1607. $self._error_("Collection holds more than one element");
  1608. }
  1609. return $self._anyOne();
  1610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1611. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  1612. //>>excludeEnd("ctx");
  1613. },
  1614. //>>excludeStart("ide", pragmas.excludeIdeData);
  1615. args: [],
  1616. 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",
  1617. referencedClasses: [],
  1618. //>>excludeEnd("ide");
  1619. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  1620. }),
  1621. $globals.Collection);
  1622. $core.addMethod(
  1623. $core.method({
  1624. selector: "size",
  1625. protocol: "accessing",
  1626. fn: function (){
  1627. var self=this,$self=this;
  1628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1629. return $core.withContext(function($ctx1) {
  1630. //>>excludeEnd("ctx");
  1631. $self._subclassResponsibility();
  1632. return self;
  1633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1634. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  1635. //>>excludeEnd("ctx");
  1636. },
  1637. //>>excludeStart("ide", pragmas.excludeIdeData);
  1638. args: [],
  1639. source: "size\x0a\x09self subclassResponsibility",
  1640. referencedClasses: [],
  1641. //>>excludeEnd("ide");
  1642. messageSends: ["subclassResponsibility"]
  1643. }),
  1644. $globals.Collection);
  1645. $core.addMethod(
  1646. $core.method({
  1647. selector: "classTag",
  1648. protocol: "accessing",
  1649. fn: function (){
  1650. var self=this,$self=this;
  1651. return "collection";
  1652. },
  1653. //>>excludeStart("ide", pragmas.excludeIdeData);
  1654. args: [],
  1655. 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'",
  1656. referencedClasses: [],
  1657. //>>excludeEnd("ide");
  1658. messageSends: []
  1659. }),
  1660. $globals.Collection.a$cls);
  1661. $core.addMethod(
  1662. $core.method({
  1663. selector: "new:",
  1664. protocol: "instance creation",
  1665. fn: function (anInteger){
  1666. var self=this,$self=this;
  1667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1668. return $core.withContext(function($ctx1) {
  1669. //>>excludeEnd("ctx");
  1670. return $self._new();
  1671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1672. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.a$cls)});
  1673. //>>excludeEnd("ctx");
  1674. },
  1675. //>>excludeStart("ide", pragmas.excludeIdeData);
  1676. args: ["anInteger"],
  1677. source: "new: anInteger\x0a\x09^ self new",
  1678. referencedClasses: [],
  1679. //>>excludeEnd("ide");
  1680. messageSends: ["new"]
  1681. }),
  1682. $globals.Collection.a$cls);
  1683. $core.addMethod(
  1684. $core.method({
  1685. selector: "with:",
  1686. protocol: "instance creation",
  1687. fn: function (anObject){
  1688. var self=this,$self=this;
  1689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1690. return $core.withContext(function($ctx1) {
  1691. //>>excludeEnd("ctx");
  1692. var $1;
  1693. $1=$self._new();
  1694. $recv($1)._add_(anObject);
  1695. return $recv($1)._yourself();
  1696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1697. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.a$cls)});
  1698. //>>excludeEnd("ctx");
  1699. },
  1700. //>>excludeStart("ide", pragmas.excludeIdeData);
  1701. args: ["anObject"],
  1702. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1703. referencedClasses: [],
  1704. //>>excludeEnd("ide");
  1705. messageSends: ["add:", "new", "yourself"]
  1706. }),
  1707. $globals.Collection.a$cls);
  1708. $core.addMethod(
  1709. $core.method({
  1710. selector: "with:with:",
  1711. protocol: "instance creation",
  1712. fn: function (anObject,anotherObject){
  1713. var self=this,$self=this;
  1714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1715. return $core.withContext(function($ctx1) {
  1716. //>>excludeEnd("ctx");
  1717. var $1;
  1718. $1=$self._new();
  1719. $recv($1)._add_(anObject);
  1720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1721. $ctx1.sendIdx["add:"]=1;
  1722. //>>excludeEnd("ctx");
  1723. $recv($1)._add_(anotherObject);
  1724. return $recv($1)._yourself();
  1725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1726. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.a$cls)});
  1727. //>>excludeEnd("ctx");
  1728. },
  1729. //>>excludeStart("ide", pragmas.excludeIdeData);
  1730. args: ["anObject", "anotherObject"],
  1731. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1732. referencedClasses: [],
  1733. //>>excludeEnd("ide");
  1734. messageSends: ["add:", "new", "yourself"]
  1735. }),
  1736. $globals.Collection.a$cls);
  1737. $core.addMethod(
  1738. $core.method({
  1739. selector: "with:with:with:",
  1740. protocol: "instance creation",
  1741. fn: function (firstObject,secondObject,thirdObject){
  1742. var self=this,$self=this;
  1743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1744. return $core.withContext(function($ctx1) {
  1745. //>>excludeEnd("ctx");
  1746. var $1;
  1747. $1=$self._new();
  1748. $recv($1)._add_(firstObject);
  1749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1750. $ctx1.sendIdx["add:"]=1;
  1751. //>>excludeEnd("ctx");
  1752. $recv($1)._add_(secondObject);
  1753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1754. $ctx1.sendIdx["add:"]=2;
  1755. //>>excludeEnd("ctx");
  1756. $recv($1)._add_(thirdObject);
  1757. return $recv($1)._yourself();
  1758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1759. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.a$cls)});
  1760. //>>excludeEnd("ctx");
  1761. },
  1762. //>>excludeStart("ide", pragmas.excludeIdeData);
  1763. args: ["firstObject", "secondObject", "thirdObject"],
  1764. 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",
  1765. referencedClasses: [],
  1766. //>>excludeEnd("ide");
  1767. messageSends: ["add:", "new", "yourself"]
  1768. }),
  1769. $globals.Collection.a$cls);
  1770. $core.addMethod(
  1771. $core.method({
  1772. selector: "withAll:",
  1773. protocol: "instance creation",
  1774. fn: function (aCollection){
  1775. var self=this,$self=this;
  1776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1777. return $core.withContext(function($ctx1) {
  1778. //>>excludeEnd("ctx");
  1779. var $1;
  1780. $1=$self._new();
  1781. $recv($1)._addAll_(aCollection);
  1782. return $recv($1)._yourself();
  1783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1784. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.a$cls)});
  1785. //>>excludeEnd("ctx");
  1786. },
  1787. //>>excludeStart("ide", pragmas.excludeIdeData);
  1788. args: ["aCollection"],
  1789. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1790. referencedClasses: [],
  1791. //>>excludeEnd("ide");
  1792. messageSends: ["addAll:", "new", "yourself"]
  1793. }),
  1794. $globals.Collection.a$cls);
  1795. $core.addClass("IndexableCollection", $globals.Collection, [], "Kernel-Collections");
  1796. //>>excludeStart("ide", pragmas.excludeIdeData);
  1797. $globals.IndexableCollection.comment="I am a key-value store collection, that is,\x0aI store values under indexes.\x0a\x0aAs a rule of thumb, if a collection has `#at:` and `#at:put:`,\x0ait is an IndexableCollection.";
  1798. //>>excludeEnd("ide");
  1799. $core.addMethod(
  1800. $core.method({
  1801. selector: "at:",
  1802. protocol: "accessing",
  1803. fn: function (anIndex){
  1804. var self=this,$self=this;
  1805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1806. return $core.withContext(function($ctx1) {
  1807. //>>excludeEnd("ctx");
  1808. return $self._at_ifAbsent_(anIndex,(function(){
  1809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1810. return $core.withContext(function($ctx2) {
  1811. //>>excludeEnd("ctx");
  1812. return $self._errorNotFound();
  1813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1814. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1815. //>>excludeEnd("ctx");
  1816. }));
  1817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1818. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  1819. //>>excludeEnd("ctx");
  1820. },
  1821. //>>excludeStart("ide", pragmas.excludeIdeData);
  1822. args: ["anIndex"],
  1823. 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 ]",
  1824. referencedClasses: [],
  1825. //>>excludeEnd("ide");
  1826. messageSends: ["at:ifAbsent:", "errorNotFound"]
  1827. }),
  1828. $globals.IndexableCollection);
  1829. $core.addMethod(
  1830. $core.method({
  1831. selector: "at:ifAbsent:",
  1832. protocol: "accessing",
  1833. fn: function (anIndex,aBlock){
  1834. var self=this,$self=this;
  1835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1836. return $core.withContext(function($ctx1) {
  1837. //>>excludeEnd("ctx");
  1838. $self._subclassResponsibility();
  1839. return self;
  1840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1841. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  1842. //>>excludeEnd("ctx");
  1843. },
  1844. //>>excludeStart("ide", pragmas.excludeIdeData);
  1845. args: ["anIndex", "aBlock"],
  1846. 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",
  1847. referencedClasses: [],
  1848. //>>excludeEnd("ide");
  1849. messageSends: ["subclassResponsibility"]
  1850. }),
  1851. $globals.IndexableCollection);
  1852. $core.addMethod(
  1853. $core.method({
  1854. selector: "at:ifAbsentPut:",
  1855. protocol: "accessing",
  1856. fn: function (aKey,aBlock){
  1857. var self=this,$self=this;
  1858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1859. return $core.withContext(function($ctx1) {
  1860. //>>excludeEnd("ctx");
  1861. return $self._at_ifAbsent_(aKey,(function(){
  1862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1863. return $core.withContext(function($ctx2) {
  1864. //>>excludeEnd("ctx");
  1865. return $self._at_put_(aKey,$recv(aBlock)._value());
  1866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1868. //>>excludeEnd("ctx");
  1869. }));
  1870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1871. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  1872. //>>excludeEnd("ctx");
  1873. },
  1874. //>>excludeStart("ide", pragmas.excludeIdeData);
  1875. args: ["aKey", "aBlock"],
  1876. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  1877. referencedClasses: [],
  1878. //>>excludeEnd("ide");
  1879. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  1880. }),
  1881. $globals.IndexableCollection);
  1882. $core.addMethod(
  1883. $core.method({
  1884. selector: "at:ifPresent:",
  1885. protocol: "accessing",
  1886. fn: function (anIndex,aBlock){
  1887. var self=this,$self=this;
  1888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1889. return $core.withContext(function($ctx1) {
  1890. //>>excludeEnd("ctx");
  1891. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  1892. return nil;
  1893. }));
  1894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1895. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  1896. //>>excludeEnd("ctx");
  1897. },
  1898. //>>excludeStart("ide", pragmas.excludeIdeData);
  1899. args: ["anIndex", "aBlock"],
  1900. 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 ]",
  1901. referencedClasses: [],
  1902. //>>excludeEnd("ide");
  1903. messageSends: ["at:ifPresent:ifAbsent:"]
  1904. }),
  1905. $globals.IndexableCollection);
  1906. $core.addMethod(
  1907. $core.method({
  1908. selector: "at:ifPresent:ifAbsent:",
  1909. protocol: "accessing",
  1910. fn: function (anIndex,aBlock,anotherBlock){
  1911. var self=this,$self=this;
  1912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1913. return $core.withContext(function($ctx1) {
  1914. //>>excludeEnd("ctx");
  1915. $self._subclassResponsibility();
  1916. return self;
  1917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1918. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  1919. //>>excludeEnd("ctx");
  1920. },
  1921. //>>excludeStart("ide", pragmas.excludeIdeData);
  1922. args: ["anIndex", "aBlock", "anotherBlock"],
  1923. 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",
  1924. referencedClasses: [],
  1925. //>>excludeEnd("ide");
  1926. messageSends: ["subclassResponsibility"]
  1927. }),
  1928. $globals.IndexableCollection);
  1929. $core.addMethod(
  1930. $core.method({
  1931. selector: "at:put:",
  1932. protocol: "accessing",
  1933. fn: function (anIndex,anObject){
  1934. var self=this,$self=this;
  1935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1936. return $core.withContext(function($ctx1) {
  1937. //>>excludeEnd("ctx");
  1938. $self._subclassResponsibility();
  1939. return self;
  1940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1941. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  1942. //>>excludeEnd("ctx");
  1943. },
  1944. //>>excludeStart("ide", pragmas.excludeIdeData);
  1945. args: ["anIndex", "anObject"],
  1946. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  1947. referencedClasses: [],
  1948. //>>excludeEnd("ide");
  1949. messageSends: ["subclassResponsibility"]
  1950. }),
  1951. $globals.IndexableCollection);
  1952. $core.addMethod(
  1953. $core.method({
  1954. selector: "indexOf:",
  1955. protocol: "accessing",
  1956. fn: function (anObject){
  1957. var self=this,$self=this;
  1958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1959. return $core.withContext(function($ctx1) {
  1960. //>>excludeEnd("ctx");
  1961. return $self._indexOf_ifAbsent_(anObject,(function(){
  1962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1963. return $core.withContext(function($ctx2) {
  1964. //>>excludeEnd("ctx");
  1965. return $self._errorNotFound();
  1966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1968. //>>excludeEnd("ctx");
  1969. }));
  1970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1971. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  1972. //>>excludeEnd("ctx");
  1973. },
  1974. //>>excludeStart("ide", pragmas.excludeIdeData);
  1975. args: ["anObject"],
  1976. 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 ]",
  1977. referencedClasses: [],
  1978. //>>excludeEnd("ide");
  1979. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  1980. }),
  1981. $globals.IndexableCollection);
  1982. $core.addMethod(
  1983. $core.method({
  1984. selector: "indexOf:ifAbsent:",
  1985. protocol: "accessing",
  1986. fn: function (anObject,aBlock){
  1987. var self=this,$self=this;
  1988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1989. return $core.withContext(function($ctx1) {
  1990. //>>excludeEnd("ctx");
  1991. $self._subclassResponsibility();
  1992. return self;
  1993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1994. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  1995. //>>excludeEnd("ctx");
  1996. },
  1997. //>>excludeStart("ide", pragmas.excludeIdeData);
  1998. args: ["anObject", "aBlock"],
  1999. 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",
  2000. referencedClasses: [],
  2001. //>>excludeEnd("ide");
  2002. messageSends: ["subclassResponsibility"]
  2003. }),
  2004. $globals.IndexableCollection);
  2005. $core.addMethod(
  2006. $core.method({
  2007. selector: "with:do:",
  2008. protocol: "enumerating",
  2009. fn: function (anotherCollection,aBlock){
  2010. var self=this,$self=this;
  2011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2012. return $core.withContext(function($ctx1) {
  2013. //>>excludeEnd("ctx");
  2014. $self._withIndexDo_((function(each,index){
  2015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2016. return $core.withContext(function($ctx2) {
  2017. //>>excludeEnd("ctx");
  2018. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  2019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2020. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  2021. //>>excludeEnd("ctx");
  2022. }));
  2023. return self;
  2024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2025. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  2026. //>>excludeEnd("ctx");
  2027. },
  2028. //>>excludeStart("ide", pragmas.excludeIdeData);
  2029. args: ["anotherCollection", "aBlock"],
  2030. 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) ]",
  2031. referencedClasses: [],
  2032. //>>excludeEnd("ide");
  2033. messageSends: ["withIndexDo:", "value:value:", "at:"]
  2034. }),
  2035. $globals.IndexableCollection);
  2036. $core.addMethod(
  2037. $core.method({
  2038. selector: "withIndexDo:",
  2039. protocol: "enumerating",
  2040. fn: function (aBlock){
  2041. var self=this,$self=this;
  2042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2043. return $core.withContext(function($ctx1) {
  2044. //>>excludeEnd("ctx");
  2045. $self._subclassResponsibility();
  2046. return self;
  2047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2048. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  2049. //>>excludeEnd("ctx");
  2050. },
  2051. //>>excludeStart("ide", pragmas.excludeIdeData);
  2052. args: ["aBlock"],
  2053. 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",
  2054. referencedClasses: [],
  2055. //>>excludeEnd("ide");
  2056. messageSends: ["subclassResponsibility"]
  2057. }),
  2058. $globals.IndexableCollection);
  2059. $core.addClass("AssociativeCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  2060. //>>excludeStart("ide", pragmas.excludeIdeData);
  2061. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  2062. //>>excludeEnd("ide");
  2063. $core.addMethod(
  2064. $core.method({
  2065. selector: "=",
  2066. protocol: "comparing",
  2067. fn: function (anAssocitativeCollection){
  2068. var self=this,$self=this;
  2069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2070. return $core.withContext(function($ctx1) {
  2071. //>>excludeEnd("ctx");
  2072. var $2,$1,$4,$3,$5;
  2073. $2=$self._class();
  2074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2075. $ctx1.sendIdx["class"]=1;
  2076. //>>excludeEnd("ctx");
  2077. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  2078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2079. $ctx1.sendIdx["="]=1;
  2080. //>>excludeEnd("ctx");
  2081. if(!$core.assert($1)){
  2082. return false;
  2083. }
  2084. $4=$self._size();
  2085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2086. $ctx1.sendIdx["size"]=1;
  2087. //>>excludeEnd("ctx");
  2088. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  2089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2090. $ctx1.sendIdx["="]=2;
  2091. //>>excludeEnd("ctx");
  2092. if(!$core.assert($3)){
  2093. return false;
  2094. }
  2095. $5=$self._associations();
  2096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2097. $ctx1.sendIdx["associations"]=1;
  2098. //>>excludeEnd("ctx");
  2099. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  2100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2101. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  2102. //>>excludeEnd("ctx");
  2103. },
  2104. //>>excludeStart("ide", pragmas.excludeIdeData);
  2105. args: ["anAssocitativeCollection"],
  2106. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  2107. referencedClasses: [],
  2108. //>>excludeEnd("ide");
  2109. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  2110. }),
  2111. $globals.AssociativeCollection);
  2112. $core.addMethod(
  2113. $core.method({
  2114. selector: "add:",
  2115. protocol: "adding/removing",
  2116. fn: function (anAssociation){
  2117. var self=this,$self=this;
  2118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2119. return $core.withContext(function($ctx1) {
  2120. //>>excludeEnd("ctx");
  2121. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  2122. return self;
  2123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2124. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  2125. //>>excludeEnd("ctx");
  2126. },
  2127. //>>excludeStart("ide", pragmas.excludeIdeData);
  2128. args: ["anAssociation"],
  2129. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  2130. referencedClasses: [],
  2131. //>>excludeEnd("ide");
  2132. messageSends: ["at:put:", "key", "value"]
  2133. }),
  2134. $globals.AssociativeCollection);
  2135. $core.addMethod(
  2136. $core.method({
  2137. selector: "addAll:",
  2138. protocol: "adding/removing",
  2139. fn: function (anAssociativeCollection){
  2140. var self=this,$self=this;
  2141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2142. return $core.withContext(function($ctx1) {
  2143. //>>excludeEnd("ctx");
  2144. (
  2145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2146. $ctx1.supercall = true,
  2147. //>>excludeEnd("ctx");
  2148. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  2149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2150. $ctx1.supercall = false;
  2151. //>>excludeEnd("ctx");;
  2152. return anAssociativeCollection;
  2153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2154. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  2155. //>>excludeEnd("ctx");
  2156. },
  2157. //>>excludeStart("ide", pragmas.excludeIdeData);
  2158. args: ["anAssociativeCollection"],
  2159. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  2160. referencedClasses: [],
  2161. //>>excludeEnd("ide");
  2162. messageSends: ["addAll:", "associations"]
  2163. }),
  2164. $globals.AssociativeCollection);
  2165. $core.addMethod(
  2166. $core.method({
  2167. selector: "asDictionary",
  2168. protocol: "converting",
  2169. fn: function (){
  2170. var self=this,$self=this;
  2171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2172. return $core.withContext(function($ctx1) {
  2173. //>>excludeEnd("ctx");
  2174. return $recv($globals.Dictionary)._from_($self._associations());
  2175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2176. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  2177. //>>excludeEnd("ctx");
  2178. },
  2179. //>>excludeStart("ide", pragmas.excludeIdeData);
  2180. args: [],
  2181. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  2182. referencedClasses: ["Dictionary"],
  2183. //>>excludeEnd("ide");
  2184. messageSends: ["from:", "associations"]
  2185. }),
  2186. $globals.AssociativeCollection);
  2187. $core.addMethod(
  2188. $core.method({
  2189. selector: "asHashedCollection",
  2190. protocol: "converting",
  2191. fn: function (){
  2192. var self=this,$self=this;
  2193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2194. return $core.withContext(function($ctx1) {
  2195. //>>excludeEnd("ctx");
  2196. return $recv($globals.HashedCollection)._from_($self._associations());
  2197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2198. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  2199. //>>excludeEnd("ctx");
  2200. },
  2201. //>>excludeStart("ide", pragmas.excludeIdeData);
  2202. args: [],
  2203. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  2204. referencedClasses: ["HashedCollection"],
  2205. //>>excludeEnd("ide");
  2206. messageSends: ["from:", "associations"]
  2207. }),
  2208. $globals.AssociativeCollection);
  2209. $core.addMethod(
  2210. $core.method({
  2211. selector: "asJavaScriptObject",
  2212. protocol: "converting",
  2213. fn: function (){
  2214. var self=this,$self=this;
  2215. var hash;
  2216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2217. return $core.withContext(function($ctx1) {
  2218. //>>excludeEnd("ctx");
  2219. hash=$recv($globals.HashedCollection)._new();
  2220. $self._keysAndValuesDo_((function(key,value){
  2221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2222. return $core.withContext(function($ctx2) {
  2223. //>>excludeEnd("ctx");
  2224. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  2225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2226. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2227. //>>excludeEnd("ctx");
  2228. }));
  2229. return hash;
  2230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2231. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash},$globals.AssociativeCollection)});
  2232. //>>excludeEnd("ctx");
  2233. },
  2234. //>>excludeStart("ide", pragmas.excludeIdeData);
  2235. args: [],
  2236. 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",
  2237. referencedClasses: ["HashedCollection"],
  2238. //>>excludeEnd("ide");
  2239. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  2240. }),
  2241. $globals.AssociativeCollection);
  2242. $core.addMethod(
  2243. $core.method({
  2244. selector: "associations",
  2245. protocol: "accessing",
  2246. fn: function (){
  2247. var self=this,$self=this;
  2248. var associations;
  2249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2250. return $core.withContext(function($ctx1) {
  2251. //>>excludeEnd("ctx");
  2252. associations=[];
  2253. $self._associationsDo_((function(each){
  2254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2255. return $core.withContext(function($ctx2) {
  2256. //>>excludeEnd("ctx");
  2257. return $recv(associations)._add_(each);
  2258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2259. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2260. //>>excludeEnd("ctx");
  2261. }));
  2262. return associations;
  2263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2264. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  2265. //>>excludeEnd("ctx");
  2266. },
  2267. //>>excludeStart("ide", pragmas.excludeIdeData);
  2268. args: [],
  2269. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  2270. referencedClasses: [],
  2271. //>>excludeEnd("ide");
  2272. messageSends: ["associationsDo:", "add:"]
  2273. }),
  2274. $globals.AssociativeCollection);
  2275. $core.addMethod(
  2276. $core.method({
  2277. selector: "associationsDo:",
  2278. protocol: "enumerating",
  2279. fn: function (aBlock){
  2280. var self=this,$self=this;
  2281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2282. return $core.withContext(function($ctx1) {
  2283. //>>excludeEnd("ctx");
  2284. $self._keysAndValuesDo_((function(key,value){
  2285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2286. return $core.withContext(function($ctx2) {
  2287. //>>excludeEnd("ctx");
  2288. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  2289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2290. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2291. //>>excludeEnd("ctx");
  2292. }));
  2293. return self;
  2294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2295. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2296. //>>excludeEnd("ctx");
  2297. },
  2298. //>>excludeStart("ide", pragmas.excludeIdeData);
  2299. args: ["aBlock"],
  2300. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2301. referencedClasses: ["Association"],
  2302. //>>excludeEnd("ide");
  2303. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2304. }),
  2305. $globals.AssociativeCollection);
  2306. $core.addMethod(
  2307. $core.method({
  2308. selector: "at:ifPresent:ifAbsent:",
  2309. protocol: "accessing",
  2310. fn: function (aKey,aBlock,anotherBlock){
  2311. var self=this,$self=this;
  2312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2313. return $core.withContext(function($ctx1) {
  2314. //>>excludeEnd("ctx");
  2315. var $1;
  2316. $1=$self._includesKey_(aKey);
  2317. if($core.assert($1)){
  2318. return $recv(aBlock)._value_($self._at_(aKey));
  2319. } else {
  2320. return $recv(anotherBlock)._value();
  2321. }
  2322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2323. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  2324. //>>excludeEnd("ctx");
  2325. },
  2326. //>>excludeStart("ide", pragmas.excludeIdeData);
  2327. args: ["aKey", "aBlock", "anotherBlock"],
  2328. 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 ]",
  2329. referencedClasses: [],
  2330. //>>excludeEnd("ide");
  2331. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2332. }),
  2333. $globals.AssociativeCollection);
  2334. $core.addMethod(
  2335. $core.method({
  2336. selector: "collect:",
  2337. protocol: "enumerating",
  2338. fn: function (aBlock){
  2339. var self=this,$self=this;
  2340. var newDict;
  2341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2342. return $core.withContext(function($ctx1) {
  2343. //>>excludeEnd("ctx");
  2344. newDict=$recv($self._class())._new();
  2345. $self._keysAndValuesDo_((function(key,value){
  2346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2347. return $core.withContext(function($ctx2) {
  2348. //>>excludeEnd("ctx");
  2349. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  2350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2351. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2352. //>>excludeEnd("ctx");
  2353. }));
  2354. return newDict;
  2355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2356. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  2357. //>>excludeEnd("ctx");
  2358. },
  2359. //>>excludeStart("ide", pragmas.excludeIdeData);
  2360. args: ["aBlock"],
  2361. 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",
  2362. referencedClasses: [],
  2363. //>>excludeEnd("ide");
  2364. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  2365. }),
  2366. $globals.AssociativeCollection);
  2367. $core.addMethod(
  2368. $core.method({
  2369. selector: "deepCopy",
  2370. protocol: "copying",
  2371. fn: function (){
  2372. var self=this,$self=this;
  2373. var copy;
  2374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2375. return $core.withContext(function($ctx1) {
  2376. //>>excludeEnd("ctx");
  2377. copy=$recv($self._class())._new();
  2378. $self._keysAndValuesDo_((function(key,value){
  2379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2380. return $core.withContext(function($ctx2) {
  2381. //>>excludeEnd("ctx");
  2382. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  2383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2384. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2385. //>>excludeEnd("ctx");
  2386. }));
  2387. return copy;
  2388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2389. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  2390. //>>excludeEnd("ctx");
  2391. },
  2392. //>>excludeStart("ide", pragmas.excludeIdeData);
  2393. args: [],
  2394. 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",
  2395. referencedClasses: [],
  2396. //>>excludeEnd("ide");
  2397. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  2398. }),
  2399. $globals.AssociativeCollection);
  2400. $core.addMethod(
  2401. $core.method({
  2402. selector: "detect:ifNone:",
  2403. protocol: "enumerating",
  2404. fn: function (aBlock,anotherBlock){
  2405. var self=this,$self=this;
  2406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2407. return $core.withContext(function($ctx1) {
  2408. //>>excludeEnd("ctx");
  2409. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  2410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2411. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  2412. //>>excludeEnd("ctx");
  2413. },
  2414. //>>excludeStart("ide", pragmas.excludeIdeData);
  2415. args: ["aBlock", "anotherBlock"],
  2416. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  2417. referencedClasses: [],
  2418. //>>excludeEnd("ide");
  2419. messageSends: ["detect:ifNone:", "values"]
  2420. }),
  2421. $globals.AssociativeCollection);
  2422. $core.addMethod(
  2423. $core.method({
  2424. selector: "do:",
  2425. protocol: "enumerating",
  2426. fn: function (aBlock){
  2427. var self=this,$self=this;
  2428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2429. return $core.withContext(function($ctx1) {
  2430. //>>excludeEnd("ctx");
  2431. $self._valuesDo_(aBlock);
  2432. return self;
  2433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2434. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2435. //>>excludeEnd("ctx");
  2436. },
  2437. //>>excludeStart("ide", pragmas.excludeIdeData);
  2438. args: ["aBlock"],
  2439. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  2440. referencedClasses: [],
  2441. //>>excludeEnd("ide");
  2442. messageSends: ["valuesDo:"]
  2443. }),
  2444. $globals.AssociativeCollection);
  2445. $core.addMethod(
  2446. $core.method({
  2447. selector: "includes:",
  2448. protocol: "enumerating",
  2449. fn: function (anObject){
  2450. var self=this,$self=this;
  2451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2452. return $core.withContext(function($ctx1) {
  2453. //>>excludeEnd("ctx");
  2454. return $recv($self._values())._includes_(anObject);
  2455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2456. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  2457. //>>excludeEnd("ctx");
  2458. },
  2459. //>>excludeStart("ide", pragmas.excludeIdeData);
  2460. args: ["anObject"],
  2461. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  2462. referencedClasses: [],
  2463. //>>excludeEnd("ide");
  2464. messageSends: ["includes:", "values"]
  2465. }),
  2466. $globals.AssociativeCollection);
  2467. $core.addMethod(
  2468. $core.method({
  2469. selector: "includesKey:",
  2470. protocol: "testing",
  2471. fn: function (aKey){
  2472. var self=this,$self=this;
  2473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2474. return $core.withContext(function($ctx1) {
  2475. //>>excludeEnd("ctx");
  2476. $self._subclassResponsibility();
  2477. return self;
  2478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2479. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  2480. //>>excludeEnd("ctx");
  2481. },
  2482. //>>excludeStart("ide", pragmas.excludeIdeData);
  2483. args: ["aKey"],
  2484. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  2485. referencedClasses: [],
  2486. //>>excludeEnd("ide");
  2487. messageSends: ["subclassResponsibility"]
  2488. }),
  2489. $globals.AssociativeCollection);
  2490. $core.addMethod(
  2491. $core.method({
  2492. selector: "indexOf:ifAbsent:",
  2493. protocol: "accessing",
  2494. fn: function (anObject,aBlock){
  2495. var self=this,$self=this;
  2496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2497. return $core.withContext(function($ctx1) {
  2498. //>>excludeEnd("ctx");
  2499. return $recv($self._keys())._detect_ifNone_((function(each){
  2500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2501. return $core.withContext(function($ctx2) {
  2502. //>>excludeEnd("ctx");
  2503. return $recv($self._at_(each)).__eq(anObject);
  2504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2505. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2506. //>>excludeEnd("ctx");
  2507. }),aBlock);
  2508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2509. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  2510. //>>excludeEnd("ctx");
  2511. },
  2512. //>>excludeStart("ide", pragmas.excludeIdeData);
  2513. args: ["anObject", "aBlock"],
  2514. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  2515. referencedClasses: [],
  2516. //>>excludeEnd("ide");
  2517. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  2518. }),
  2519. $globals.AssociativeCollection);
  2520. $core.addMethod(
  2521. $core.method({
  2522. selector: "keyAtValue:",
  2523. protocol: "accessing",
  2524. fn: function (anObject){
  2525. var self=this,$self=this;
  2526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2527. return $core.withContext(function($ctx1) {
  2528. //>>excludeEnd("ctx");
  2529. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  2530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2531. return $core.withContext(function($ctx2) {
  2532. //>>excludeEnd("ctx");
  2533. return $self._errorNotFound();
  2534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2535. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2536. //>>excludeEnd("ctx");
  2537. }));
  2538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2539. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  2540. //>>excludeEnd("ctx");
  2541. },
  2542. //>>excludeStart("ide", pragmas.excludeIdeData);
  2543. args: ["anObject"],
  2544. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  2545. referencedClasses: [],
  2546. //>>excludeEnd("ide");
  2547. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  2548. }),
  2549. $globals.AssociativeCollection);
  2550. $core.addMethod(
  2551. $core.method({
  2552. selector: "keyAtValue:ifAbsent:",
  2553. protocol: "accessing",
  2554. fn: function (anObject,aBlock){
  2555. var self=this,$self=this;
  2556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2557. return $core.withContext(function($ctx1) {
  2558. //>>excludeEnd("ctx");
  2559. return $self._indexOf_ifAbsent_(anObject,aBlock);
  2560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2561. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  2562. //>>excludeEnd("ctx");
  2563. },
  2564. //>>excludeStart("ide", pragmas.excludeIdeData);
  2565. args: ["anObject", "aBlock"],
  2566. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  2567. referencedClasses: [],
  2568. //>>excludeEnd("ide");
  2569. messageSends: ["indexOf:ifAbsent:"]
  2570. }),
  2571. $globals.AssociativeCollection);
  2572. $core.addMethod(
  2573. $core.method({
  2574. selector: "keys",
  2575. protocol: "accessing",
  2576. fn: function (){
  2577. var self=this,$self=this;
  2578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2579. return $core.withContext(function($ctx1) {
  2580. //>>excludeEnd("ctx");
  2581. $self._subclassResponsibility();
  2582. return self;
  2583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2584. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  2585. //>>excludeEnd("ctx");
  2586. },
  2587. //>>excludeStart("ide", pragmas.excludeIdeData);
  2588. args: [],
  2589. source: "keys\x0a\x09self subclassResponsibility",
  2590. referencedClasses: [],
  2591. //>>excludeEnd("ide");
  2592. messageSends: ["subclassResponsibility"]
  2593. }),
  2594. $globals.AssociativeCollection);
  2595. $core.addMethod(
  2596. $core.method({
  2597. selector: "keysAndValuesDo:",
  2598. protocol: "enumerating",
  2599. fn: function (aBlock){
  2600. var self=this,$self=this;
  2601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2602. return $core.withContext(function($ctx1) {
  2603. //>>excludeEnd("ctx");
  2604. $self._keysDo_((function(each){
  2605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2606. return $core.withContext(function($ctx2) {
  2607. //>>excludeEnd("ctx");
  2608. return $recv(aBlock)._value_value_(each,$self._at_(each));
  2609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2610. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2611. //>>excludeEnd("ctx");
  2612. }));
  2613. return self;
  2614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2615. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2616. //>>excludeEnd("ctx");
  2617. },
  2618. //>>excludeStart("ide", pragmas.excludeIdeData);
  2619. args: ["aBlock"],
  2620. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  2621. referencedClasses: [],
  2622. //>>excludeEnd("ide");
  2623. messageSends: ["keysDo:", "value:value:", "at:"]
  2624. }),
  2625. $globals.AssociativeCollection);
  2626. $core.addMethod(
  2627. $core.method({
  2628. selector: "keysDo:",
  2629. protocol: "enumerating",
  2630. fn: function (aBlock){
  2631. var self=this,$self=this;
  2632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2633. return $core.withContext(function($ctx1) {
  2634. //>>excludeEnd("ctx");
  2635. $self._subclassResponsibility();
  2636. return self;
  2637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2638. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2639. //>>excludeEnd("ctx");
  2640. },
  2641. //>>excludeStart("ide", pragmas.excludeIdeData);
  2642. args: ["aBlock"],
  2643. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  2644. referencedClasses: [],
  2645. //>>excludeEnd("ide");
  2646. messageSends: ["subclassResponsibility"]
  2647. }),
  2648. $globals.AssociativeCollection);
  2649. $core.addMethod(
  2650. $core.method({
  2651. selector: "printOn:",
  2652. protocol: "printing",
  2653. fn: function (aStream){
  2654. var self=this,$self=this;
  2655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2656. return $core.withContext(function($ctx1) {
  2657. //>>excludeEnd("ctx");
  2658. (
  2659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2660. $ctx1.supercall = true,
  2661. //>>excludeEnd("ctx");
  2662. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  2663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2664. $ctx1.supercall = false;
  2665. //>>excludeEnd("ctx");;
  2666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2667. $ctx1.sendIdx["printOn:"]=1;
  2668. //>>excludeEnd("ctx");
  2669. $recv(aStream)._nextPutAll_(" (");
  2670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2671. $ctx1.sendIdx["nextPutAll:"]=1;
  2672. //>>excludeEnd("ctx");
  2673. $recv($self._associations())._do_separatedBy_((function(each){
  2674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2675. return $core.withContext(function($ctx2) {
  2676. //>>excludeEnd("ctx");
  2677. return $recv(each)._printOn_(aStream);
  2678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2679. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2680. //>>excludeEnd("ctx");
  2681. }),(function(){
  2682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2683. return $core.withContext(function($ctx2) {
  2684. //>>excludeEnd("ctx");
  2685. return $recv(aStream)._nextPutAll_(" , ");
  2686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2687. $ctx2.sendIdx["nextPutAll:"]=2;
  2688. //>>excludeEnd("ctx");
  2689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2690. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2691. //>>excludeEnd("ctx");
  2692. }));
  2693. $recv(aStream)._nextPutAll_(")");
  2694. return self;
  2695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2696. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  2697. //>>excludeEnd("ctx");
  2698. },
  2699. //>>excludeStart("ide", pragmas.excludeIdeData);
  2700. args: ["aStream"],
  2701. 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: ')'",
  2702. referencedClasses: [],
  2703. //>>excludeEnd("ide");
  2704. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  2705. }),
  2706. $globals.AssociativeCollection);
  2707. $core.addMethod(
  2708. $core.method({
  2709. selector: "remove:ifAbsent:",
  2710. protocol: "adding/removing",
  2711. fn: function (aKey,aBlock){
  2712. var self=this,$self=this;
  2713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2714. return $core.withContext(function($ctx1) {
  2715. //>>excludeEnd("ctx");
  2716. return $self._removeKey_ifAbsent_(aKey,aBlock);
  2717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2718. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  2719. //>>excludeEnd("ctx");
  2720. },
  2721. //>>excludeStart("ide", pragmas.excludeIdeData);
  2722. args: ["aKey", "aBlock"],
  2723. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  2724. referencedClasses: [],
  2725. //>>excludeEnd("ide");
  2726. messageSends: ["removeKey:ifAbsent:"]
  2727. }),
  2728. $globals.AssociativeCollection);
  2729. $core.addMethod(
  2730. $core.method({
  2731. selector: "removeAll",
  2732. protocol: "adding/removing",
  2733. fn: function (){
  2734. var self=this,$self=this;
  2735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2736. return $core.withContext(function($ctx1) {
  2737. //>>excludeEnd("ctx");
  2738. return $recv($self._keys())._do_((function(each){
  2739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2740. return $core.withContext(function($ctx2) {
  2741. //>>excludeEnd("ctx");
  2742. return $self._removeKey_(each);
  2743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2744. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2745. //>>excludeEnd("ctx");
  2746. }));
  2747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2748. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  2749. //>>excludeEnd("ctx");
  2750. },
  2751. //>>excludeStart("ide", pragmas.excludeIdeData);
  2752. args: [],
  2753. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  2754. referencedClasses: [],
  2755. //>>excludeEnd("ide");
  2756. messageSends: ["do:", "keys", "removeKey:"]
  2757. }),
  2758. $globals.AssociativeCollection);
  2759. $core.addMethod(
  2760. $core.method({
  2761. selector: "removeKey:",
  2762. protocol: "adding/removing",
  2763. fn: function (aKey){
  2764. var self=this,$self=this;
  2765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2766. return $core.withContext(function($ctx1) {
  2767. //>>excludeEnd("ctx");
  2768. return $self._remove_(aKey);
  2769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2770. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  2771. //>>excludeEnd("ctx");
  2772. },
  2773. //>>excludeStart("ide", pragmas.excludeIdeData);
  2774. args: ["aKey"],
  2775. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  2776. referencedClasses: [],
  2777. //>>excludeEnd("ide");
  2778. messageSends: ["remove:"]
  2779. }),
  2780. $globals.AssociativeCollection);
  2781. $core.addMethod(
  2782. $core.method({
  2783. selector: "removeKey:ifAbsent:",
  2784. protocol: "adding/removing",
  2785. fn: function (aKey,aBlock){
  2786. var self=this,$self=this;
  2787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2788. return $core.withContext(function($ctx1) {
  2789. //>>excludeEnd("ctx");
  2790. $self._subclassResponsibility();
  2791. return self;
  2792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2793. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  2794. //>>excludeEnd("ctx");
  2795. },
  2796. //>>excludeStart("ide", pragmas.excludeIdeData);
  2797. args: ["aKey", "aBlock"],
  2798. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2799. referencedClasses: [],
  2800. //>>excludeEnd("ide");
  2801. messageSends: ["subclassResponsibility"]
  2802. }),
  2803. $globals.AssociativeCollection);
  2804. $core.addMethod(
  2805. $core.method({
  2806. selector: "select:",
  2807. protocol: "enumerating",
  2808. fn: function (aBlock){
  2809. var self=this,$self=this;
  2810. var newDict;
  2811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2812. return $core.withContext(function($ctx1) {
  2813. //>>excludeEnd("ctx");
  2814. var $1;
  2815. newDict=$recv($self._class())._new();
  2816. $self._keysAndValuesDo_((function(key,value){
  2817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2818. return $core.withContext(function($ctx2) {
  2819. //>>excludeEnd("ctx");
  2820. $1=$recv(aBlock)._value_(value);
  2821. if($core.assert($1)){
  2822. return $recv(newDict)._at_put_(key,value);
  2823. }
  2824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2825. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2826. //>>excludeEnd("ctx");
  2827. }));
  2828. return newDict;
  2829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2830. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  2831. //>>excludeEnd("ctx");
  2832. },
  2833. //>>excludeStart("ide", pragmas.excludeIdeData);
  2834. args: ["aBlock"],
  2835. 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",
  2836. referencedClasses: [],
  2837. //>>excludeEnd("ide");
  2838. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2839. }),
  2840. $globals.AssociativeCollection);
  2841. $core.addMethod(
  2842. $core.method({
  2843. selector: "select:thenCollect:",
  2844. protocol: "enumerating",
  2845. fn: function (selectBlock,collectBlock){
  2846. var self=this,$self=this;
  2847. var newDict;
  2848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2849. return $core.withContext(function($ctx1) {
  2850. //>>excludeEnd("ctx");
  2851. var $1;
  2852. newDict=$recv($self._class())._new();
  2853. $self._keysAndValuesDo_((function(key,value){
  2854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2855. return $core.withContext(function($ctx2) {
  2856. //>>excludeEnd("ctx");
  2857. $1=$recv(selectBlock)._value_(value);
  2858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2859. $ctx2.sendIdx["value:"]=1;
  2860. //>>excludeEnd("ctx");
  2861. if($core.assert($1)){
  2862. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  2863. }
  2864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2865. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2866. //>>excludeEnd("ctx");
  2867. }));
  2868. return newDict;
  2869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2870. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict},$globals.AssociativeCollection)});
  2871. //>>excludeEnd("ctx");
  2872. },
  2873. //>>excludeStart("ide", pragmas.excludeIdeData);
  2874. args: ["selectBlock", "collectBlock"],
  2875. 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",
  2876. referencedClasses: [],
  2877. //>>excludeEnd("ide");
  2878. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2879. }),
  2880. $globals.AssociativeCollection);
  2881. $core.addMethod(
  2882. $core.method({
  2883. selector: "shallowCopy",
  2884. protocol: "copying",
  2885. fn: function (){
  2886. var self=this,$self=this;
  2887. var copy;
  2888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2889. return $core.withContext(function($ctx1) {
  2890. //>>excludeEnd("ctx");
  2891. copy=$recv($self._class())._new();
  2892. $self._keysAndValuesDo_((function(key,value){
  2893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2894. return $core.withContext(function($ctx2) {
  2895. //>>excludeEnd("ctx");
  2896. return $recv(copy)._at_put_(key,value);
  2897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2898. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2899. //>>excludeEnd("ctx");
  2900. }));
  2901. return copy;
  2902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2903. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  2904. //>>excludeEnd("ctx");
  2905. },
  2906. //>>excludeStart("ide", pragmas.excludeIdeData);
  2907. args: [],
  2908. 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",
  2909. referencedClasses: [],
  2910. //>>excludeEnd("ide");
  2911. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2912. }),
  2913. $globals.AssociativeCollection);
  2914. $core.addMethod(
  2915. $core.method({
  2916. selector: "size",
  2917. protocol: "accessing",
  2918. fn: function (){
  2919. var self=this,$self=this;
  2920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2921. return $core.withContext(function($ctx1) {
  2922. //>>excludeEnd("ctx");
  2923. return $recv($self._keys())._size();
  2924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2925. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  2926. //>>excludeEnd("ctx");
  2927. },
  2928. //>>excludeStart("ide", pragmas.excludeIdeData);
  2929. args: [],
  2930. source: "size\x0a\x09^ self keys size",
  2931. referencedClasses: [],
  2932. //>>excludeEnd("ide");
  2933. messageSends: ["size", "keys"]
  2934. }),
  2935. $globals.AssociativeCollection);
  2936. $core.addMethod(
  2937. $core.method({
  2938. selector: "values",
  2939. protocol: "accessing",
  2940. fn: function (){
  2941. var self=this,$self=this;
  2942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2943. return $core.withContext(function($ctx1) {
  2944. //>>excludeEnd("ctx");
  2945. $self._subclassResponsibility();
  2946. return self;
  2947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2948. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  2949. //>>excludeEnd("ctx");
  2950. },
  2951. //>>excludeStart("ide", pragmas.excludeIdeData);
  2952. args: [],
  2953. source: "values\x0a\x09self subclassResponsibility",
  2954. referencedClasses: [],
  2955. //>>excludeEnd("ide");
  2956. messageSends: ["subclassResponsibility"]
  2957. }),
  2958. $globals.AssociativeCollection);
  2959. $core.addMethod(
  2960. $core.method({
  2961. selector: "valuesDo:",
  2962. protocol: "enumerating",
  2963. fn: function (aBlock){
  2964. var self=this,$self=this;
  2965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2966. return $core.withContext(function($ctx1) {
  2967. //>>excludeEnd("ctx");
  2968. $self._subclassResponsibility();
  2969. return self;
  2970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2971. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2972. //>>excludeEnd("ctx");
  2973. },
  2974. //>>excludeStart("ide", pragmas.excludeIdeData);
  2975. args: ["aBlock"],
  2976. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2977. referencedClasses: [],
  2978. //>>excludeEnd("ide");
  2979. messageSends: ["subclassResponsibility"]
  2980. }),
  2981. $globals.AssociativeCollection);
  2982. $core.addMethod(
  2983. $core.method({
  2984. selector: "withIndexDo:",
  2985. protocol: "enumerating",
  2986. fn: function (aBlock){
  2987. var self=this,$self=this;
  2988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2989. return $core.withContext(function($ctx1) {
  2990. //>>excludeEnd("ctx");
  2991. $self._keysAndValuesDo_((function(key,value){
  2992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2993. return $core.withContext(function($ctx2) {
  2994. //>>excludeEnd("ctx");
  2995. return $recv(aBlock)._value_value_(value,key);
  2996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2997. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2998. //>>excludeEnd("ctx");
  2999. }));
  3000. return self;
  3001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3002. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  3003. //>>excludeEnd("ctx");
  3004. },
  3005. //>>excludeStart("ide", pragmas.excludeIdeData);
  3006. args: ["aBlock"],
  3007. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  3008. referencedClasses: [],
  3009. //>>excludeEnd("ide");
  3010. messageSends: ["keysAndValuesDo:", "value:value:"]
  3011. }),
  3012. $globals.AssociativeCollection);
  3013. $core.addMethod(
  3014. $core.method({
  3015. selector: "from:",
  3016. protocol: "instance creation",
  3017. fn: function (aCollection){
  3018. var self=this,$self=this;
  3019. var newCollection;
  3020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3021. return $core.withContext(function($ctx1) {
  3022. //>>excludeEnd("ctx");
  3023. newCollection=$self._new();
  3024. $recv(aCollection)._do_((function(each){
  3025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3026. return $core.withContext(function($ctx2) {
  3027. //>>excludeEnd("ctx");
  3028. return $recv(newCollection)._add_(each);
  3029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3030. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3031. //>>excludeEnd("ctx");
  3032. }));
  3033. return newCollection;
  3034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3035. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  3036. //>>excludeEnd("ctx");
  3037. },
  3038. //>>excludeStart("ide", pragmas.excludeIdeData);
  3039. args: ["aCollection"],
  3040. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  3041. referencedClasses: [],
  3042. //>>excludeEnd("ide");
  3043. messageSends: ["new", "do:", "add:"]
  3044. }),
  3045. $globals.AssociativeCollection.a$cls);
  3046. $core.addMethod(
  3047. $core.method({
  3048. selector: "fromPairs:",
  3049. protocol: "instance creation",
  3050. fn: function (aCollection){
  3051. var self=this,$self=this;
  3052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3053. return $core.withContext(function($ctx1) {
  3054. //>>excludeEnd("ctx");
  3055. return $self._from_(aCollection);
  3056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3057. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.a$cls)});
  3058. //>>excludeEnd("ctx");
  3059. },
  3060. //>>excludeStart("ide", pragmas.excludeIdeData);
  3061. args: ["aCollection"],
  3062. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  3063. referencedClasses: [],
  3064. //>>excludeEnd("ide");
  3065. messageSends: ["from:"]
  3066. }),
  3067. $globals.AssociativeCollection.a$cls);
  3068. $core.addMethod(
  3069. $core.method({
  3070. selector: "newFromPairs:",
  3071. protocol: "instance creation",
  3072. fn: function (aCollection){
  3073. var self=this,$self=this;
  3074. var newCollection;
  3075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3076. return $core.withContext(function($ctx1) {
  3077. //>>excludeEnd("ctx");
  3078. var $2,$1,$3,$4;
  3079. $2=$recv(aCollection)._size();
  3080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3081. $ctx1.sendIdx["size"]=1;
  3082. //>>excludeEnd("ctx");
  3083. $1=$recv($2)._even();
  3084. if(!$core.assert($1)){
  3085. $self._error_("#newFromPairs only accepts arrays of an even length");
  3086. }
  3087. newCollection=$self._new();
  3088. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  3089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3090. return $core.withContext(function($ctx2) {
  3091. //>>excludeEnd("ctx");
  3092. $3=newCollection;
  3093. $4=$recv(aCollection)._at_(each);
  3094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3095. $ctx2.sendIdx["at:"]=1;
  3096. //>>excludeEnd("ctx");
  3097. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  3098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3099. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  3100. //>>excludeEnd("ctx");
  3101. }));
  3102. return newCollection;
  3103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3104. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  3105. //>>excludeEnd("ctx");
  3106. },
  3107. //>>excludeStart("ide", pragmas.excludeIdeData);
  3108. args: ["aCollection"],
  3109. 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",
  3110. referencedClasses: [],
  3111. //>>excludeEnd("ide");
  3112. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  3113. }),
  3114. $globals.AssociativeCollection.a$cls);
  3115. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  3116. //>>excludeStart("ide", pragmas.excludeIdeData);
  3117. $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.";
  3118. //>>excludeEnd("ide");
  3119. $core.addMethod(
  3120. $core.method({
  3121. selector: "at:ifAbsent:",
  3122. protocol: "accessing",
  3123. fn: function (aKey,aBlock){
  3124. var self=this,$self=this;
  3125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3126. return $core.withContext(function($ctx1) {
  3127. //>>excludeEnd("ctx");
  3128. var index = $self._positionOfKey_(aKey);
  3129. return index >=0 ? $self['@values'][index] : aBlock._value();
  3130. ;
  3131. return self;
  3132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3133. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  3134. //>>excludeEnd("ctx");
  3135. },
  3136. //>>excludeStart("ide", pragmas.excludeIdeData);
  3137. args: ["aKey", "aBlock"],
  3138. 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'>",
  3139. referencedClasses: [],
  3140. //>>excludeEnd("ide");
  3141. messageSends: []
  3142. }),
  3143. $globals.Dictionary);
  3144. $core.addMethod(
  3145. $core.method({
  3146. selector: "at:put:",
  3147. protocol: "accessing",
  3148. fn: function (aKey,aValue){
  3149. var self=this,$self=this;
  3150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3151. return $core.withContext(function($ctx1) {
  3152. //>>excludeEnd("ctx");
  3153. var index = $self._positionOfKey_(aKey);
  3154. if(index === -1) {
  3155. var keys = $self['@keys'];
  3156. index = keys.length;
  3157. keys.push(aKey);
  3158. }
  3159. return $self['@values'][index] = aValue;
  3160. ;
  3161. return self;
  3162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3163. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  3164. //>>excludeEnd("ctx");
  3165. },
  3166. //>>excludeStart("ide", pragmas.excludeIdeData);
  3167. args: ["aKey", "aValue"],
  3168. 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'>",
  3169. referencedClasses: [],
  3170. //>>excludeEnd("ide");
  3171. messageSends: []
  3172. }),
  3173. $globals.Dictionary);
  3174. $core.addMethod(
  3175. $core.method({
  3176. selector: "includesKey:",
  3177. protocol: "testing",
  3178. fn: function (aKey){
  3179. var self=this,$self=this;
  3180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3181. return $core.withContext(function($ctx1) {
  3182. //>>excludeEnd("ctx");
  3183. return $self._positionOfKey_(aKey) >= 0;;
  3184. return self;
  3185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3186. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  3187. //>>excludeEnd("ctx");
  3188. },
  3189. //>>excludeStart("ide", pragmas.excludeIdeData);
  3190. args: ["aKey"],
  3191. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  3192. referencedClasses: [],
  3193. //>>excludeEnd("ide");
  3194. messageSends: []
  3195. }),
  3196. $globals.Dictionary);
  3197. $core.addMethod(
  3198. $core.method({
  3199. selector: "indexOf:ifAbsent:",
  3200. protocol: "accessing",
  3201. fn: function (anObject,aBlock){
  3202. var self=this,$self=this;
  3203. var index;
  3204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3205. return $core.withContext(function($ctx1) {
  3206. //>>excludeEnd("ctx");
  3207. var $1;
  3208. index=$recv($self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  3209. return (0);
  3210. }));
  3211. $1=$recv(index).__eq((0));
  3212. if($core.assert($1)){
  3213. return $recv(aBlock)._value();
  3214. } else {
  3215. return $recv($self["@keys"])._at_(index);
  3216. }
  3217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3218. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  3219. //>>excludeEnd("ctx");
  3220. },
  3221. //>>excludeStart("ide", pragmas.excludeIdeData);
  3222. args: ["anObject", "aBlock"],
  3223. 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 ]",
  3224. referencedClasses: [],
  3225. //>>excludeEnd("ide");
  3226. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  3227. }),
  3228. $globals.Dictionary);
  3229. $core.addMethod(
  3230. $core.method({
  3231. selector: "initialize",
  3232. protocol: "initialization",
  3233. fn: function (){
  3234. var self=this,$self=this;
  3235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3236. return $core.withContext(function($ctx1) {
  3237. //>>excludeEnd("ctx");
  3238. (
  3239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3240. $ctx1.supercall = true,
  3241. //>>excludeEnd("ctx");
  3242. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  3243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3244. $ctx1.supercall = false;
  3245. //>>excludeEnd("ctx");;
  3246. $self["@keys"]=[];
  3247. $self["@values"]=[];
  3248. return self;
  3249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3250. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  3251. //>>excludeEnd("ctx");
  3252. },
  3253. //>>excludeStart("ide", pragmas.excludeIdeData);
  3254. args: [],
  3255. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  3256. referencedClasses: [],
  3257. //>>excludeEnd("ide");
  3258. messageSends: ["initialize"]
  3259. }),
  3260. $globals.Dictionary);
  3261. $core.addMethod(
  3262. $core.method({
  3263. selector: "keys",
  3264. protocol: "accessing",
  3265. fn: function (){
  3266. var self=this,$self=this;
  3267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3268. return $core.withContext(function($ctx1) {
  3269. //>>excludeEnd("ctx");
  3270. return $recv($self["@keys"])._copy();
  3271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3272. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  3273. //>>excludeEnd("ctx");
  3274. },
  3275. //>>excludeStart("ide", pragmas.excludeIdeData);
  3276. args: [],
  3277. source: "keys\x0a\x09^ keys copy",
  3278. referencedClasses: [],
  3279. //>>excludeEnd("ide");
  3280. messageSends: ["copy"]
  3281. }),
  3282. $globals.Dictionary);
  3283. $core.addMethod(
  3284. $core.method({
  3285. selector: "keysAndValuesDo:",
  3286. protocol: "enumerating",
  3287. fn: function (aBlock){
  3288. var self=this,$self=this;
  3289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3290. return $core.withContext(function($ctx1) {
  3291. //>>excludeEnd("ctx");
  3292. return $recv($self["@keys"])._with_do_($self["@values"],aBlock);
  3293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3294. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  3295. //>>excludeEnd("ctx");
  3296. },
  3297. //>>excludeStart("ide", pragmas.excludeIdeData);
  3298. args: ["aBlock"],
  3299. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3300. referencedClasses: [],
  3301. //>>excludeEnd("ide");
  3302. messageSends: ["with:do:"]
  3303. }),
  3304. $globals.Dictionary);
  3305. $core.addMethod(
  3306. $core.method({
  3307. selector: "keysDo:",
  3308. protocol: "enumerating",
  3309. fn: function (aBlock){
  3310. var self=this,$self=this;
  3311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3312. return $core.withContext(function($ctx1) {
  3313. //>>excludeEnd("ctx");
  3314. return $recv($self["@keys"])._do_(aBlock);
  3315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3316. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  3317. //>>excludeEnd("ctx");
  3318. },
  3319. //>>excludeStart("ide", pragmas.excludeIdeData);
  3320. args: ["aBlock"],
  3321. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3322. referencedClasses: [],
  3323. //>>excludeEnd("ide");
  3324. messageSends: ["do:"]
  3325. }),
  3326. $globals.Dictionary);
  3327. $core.addMethod(
  3328. $core.method({
  3329. selector: "positionOfKey:",
  3330. protocol: "private",
  3331. fn: function (anObject){
  3332. var self=this,$self=this;
  3333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3334. return $core.withContext(function($ctx1) {
  3335. //>>excludeEnd("ctx");
  3336. var keys = $self['@keys'];
  3337. for(var i=0;i<keys.length;i++){
  3338. if(keys[i].__eq(anObject)) { return i;}
  3339. }
  3340. return -1;
  3341. ;
  3342. return self;
  3343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3344. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  3345. //>>excludeEnd("ctx");
  3346. },
  3347. //>>excludeStart("ide", pragmas.excludeIdeData);
  3348. args: ["anObject"],
  3349. 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'>",
  3350. referencedClasses: [],
  3351. //>>excludeEnd("ide");
  3352. messageSends: []
  3353. }),
  3354. $globals.Dictionary);
  3355. $core.addMethod(
  3356. $core.method({
  3357. selector: "removeAll",
  3358. protocol: "adding/removing",
  3359. fn: function (){
  3360. var self=this,$self=this;
  3361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3362. return $core.withContext(function($ctx1) {
  3363. //>>excludeEnd("ctx");
  3364. $recv($self["@keys"])._removeAll();
  3365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3366. $ctx1.sendIdx["removeAll"]=1;
  3367. //>>excludeEnd("ctx");
  3368. $recv($self["@values"])._removeAll();
  3369. return self;
  3370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3371. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  3372. //>>excludeEnd("ctx");
  3373. },
  3374. //>>excludeStart("ide", pragmas.excludeIdeData);
  3375. args: [],
  3376. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3377. referencedClasses: [],
  3378. //>>excludeEnd("ide");
  3379. messageSends: ["removeAll"]
  3380. }),
  3381. $globals.Dictionary);
  3382. $core.addMethod(
  3383. $core.method({
  3384. selector: "removeKey:ifAbsent:",
  3385. protocol: "adding/removing",
  3386. fn: function (aKey,aBlock){
  3387. var self=this,$self=this;
  3388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3389. return $core.withContext(function($ctx1) {
  3390. //>>excludeEnd("ctx");
  3391. var index = $self._positionOfKey_(aKey);
  3392. if(index === -1) {
  3393. return aBlock._value()
  3394. } else {
  3395. var keys = $self['@keys'], values = $self['@values'];
  3396. var value = values[index], l = keys.length;
  3397. keys[index] = keys[l-1];
  3398. keys.pop();
  3399. values[index] = values[l-1];
  3400. values.pop();
  3401. return value;
  3402. }
  3403. ;
  3404. return self;
  3405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3406. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  3407. //>>excludeEnd("ctx");
  3408. },
  3409. //>>excludeStart("ide", pragmas.excludeIdeData);
  3410. args: ["aKey", "aBlock"],
  3411. 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'>",
  3412. referencedClasses: [],
  3413. //>>excludeEnd("ide");
  3414. messageSends: []
  3415. }),
  3416. $globals.Dictionary);
  3417. $core.addMethod(
  3418. $core.method({
  3419. selector: "values",
  3420. protocol: "accessing",
  3421. fn: function (){
  3422. var self=this,$self=this;
  3423. return $self["@values"];
  3424. },
  3425. //>>excludeStart("ide", pragmas.excludeIdeData);
  3426. args: [],
  3427. source: "values\x0a\x09^ values",
  3428. referencedClasses: [],
  3429. //>>excludeEnd("ide");
  3430. messageSends: []
  3431. }),
  3432. $globals.Dictionary);
  3433. $core.addMethod(
  3434. $core.method({
  3435. selector: "valuesDo:",
  3436. protocol: "enumerating",
  3437. fn: function (aBlock){
  3438. var self=this,$self=this;
  3439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3440. return $core.withContext(function($ctx1) {
  3441. //>>excludeEnd("ctx");
  3442. return $recv($self["@values"])._do_(aBlock);
  3443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3444. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  3445. //>>excludeEnd("ctx");
  3446. },
  3447. //>>excludeStart("ide", pragmas.excludeIdeData);
  3448. args: ["aBlock"],
  3449. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3450. referencedClasses: [],
  3451. //>>excludeEnd("ide");
  3452. messageSends: ["do:"]
  3453. }),
  3454. $globals.Dictionary);
  3455. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  3456. //>>excludeStart("ide", pragmas.excludeIdeData);
  3457. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3458. //>>excludeEnd("ide");
  3459. $core.addMethod(
  3460. $core.method({
  3461. selector: "at:ifAbsent:",
  3462. protocol: "accessing",
  3463. fn: function (aKey,aBlock){
  3464. var self=this,$self=this;
  3465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3466. return $core.withContext(function($ctx1) {
  3467. //>>excludeEnd("ctx");
  3468. var $1;
  3469. $1=$self._includesKey_(aKey);
  3470. if($core.assert($1)){
  3471. return $self._basicAt_(aKey);
  3472. } else {
  3473. return $recv(aBlock)._value();
  3474. }
  3475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3476. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  3477. //>>excludeEnd("ctx");
  3478. },
  3479. //>>excludeStart("ide", pragmas.excludeIdeData);
  3480. args: ["aKey", "aBlock"],
  3481. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3482. referencedClasses: [],
  3483. //>>excludeEnd("ide");
  3484. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3485. }),
  3486. $globals.HashedCollection);
  3487. $core.addMethod(
  3488. $core.method({
  3489. selector: "at:put:",
  3490. protocol: "accessing",
  3491. fn: function (aKey,aValue){
  3492. var self=this,$self=this;
  3493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3494. return $core.withContext(function($ctx1) {
  3495. //>>excludeEnd("ctx");
  3496. return $self._basicAt_put_(aKey,aValue);
  3497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3498. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  3499. //>>excludeEnd("ctx");
  3500. },
  3501. //>>excludeStart("ide", pragmas.excludeIdeData);
  3502. args: ["aKey", "aValue"],
  3503. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3504. referencedClasses: [],
  3505. //>>excludeEnd("ide");
  3506. messageSends: ["basicAt:put:"]
  3507. }),
  3508. $globals.HashedCollection);
  3509. $core.addMethod(
  3510. $core.method({
  3511. selector: "includesKey:",
  3512. protocol: "testing",
  3513. fn: function (aKey){
  3514. var self=this,$self=this;
  3515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3516. return $core.withContext(function($ctx1) {
  3517. //>>excludeEnd("ctx");
  3518. return self.hasOwnProperty(aKey);
  3519. return self;
  3520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3521. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  3522. //>>excludeEnd("ctx");
  3523. },
  3524. //>>excludeStart("ide", pragmas.excludeIdeData);
  3525. args: ["aKey"],
  3526. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  3527. referencedClasses: [],
  3528. //>>excludeEnd("ide");
  3529. messageSends: []
  3530. }),
  3531. $globals.HashedCollection);
  3532. $core.addMethod(
  3533. $core.method({
  3534. selector: "keys",
  3535. protocol: "accessing",
  3536. fn: function (){
  3537. var self=this,$self=this;
  3538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3539. return $core.withContext(function($ctx1) {
  3540. //>>excludeEnd("ctx");
  3541. return Object.keys(self);
  3542. return self;
  3543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3544. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  3545. //>>excludeEnd("ctx");
  3546. },
  3547. //>>excludeStart("ide", pragmas.excludeIdeData);
  3548. args: [],
  3549. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  3550. referencedClasses: [],
  3551. //>>excludeEnd("ide");
  3552. messageSends: []
  3553. }),
  3554. $globals.HashedCollection);
  3555. $core.addMethod(
  3556. $core.method({
  3557. selector: "keysDo:",
  3558. protocol: "enumerating",
  3559. fn: function (aBlock){
  3560. var self=this,$self=this;
  3561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3562. return $core.withContext(function($ctx1) {
  3563. //>>excludeEnd("ctx");
  3564. $recv($self._keys())._do_(aBlock);
  3565. return self;
  3566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3567. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  3568. //>>excludeEnd("ctx");
  3569. },
  3570. //>>excludeStart("ide", pragmas.excludeIdeData);
  3571. args: ["aBlock"],
  3572. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3573. referencedClasses: [],
  3574. //>>excludeEnd("ide");
  3575. messageSends: ["do:", "keys"]
  3576. }),
  3577. $globals.HashedCollection);
  3578. $core.addMethod(
  3579. $core.method({
  3580. selector: "removeKey:ifAbsent:",
  3581. protocol: "adding/removing",
  3582. fn: function (aKey,aBlock){
  3583. var self=this,$self=this;
  3584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3585. return $core.withContext(function($ctx1) {
  3586. //>>excludeEnd("ctx");
  3587. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3589. return $core.withContext(function($ctx2) {
  3590. //>>excludeEnd("ctx");
  3591. $self._basicDelete_(aKey);
  3592. return removed;
  3593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3594. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3595. //>>excludeEnd("ctx");
  3596. }),(function(){
  3597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3598. return $core.withContext(function($ctx2) {
  3599. //>>excludeEnd("ctx");
  3600. return $recv(aBlock)._value();
  3601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3602. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3603. //>>excludeEnd("ctx");
  3604. }));
  3605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3606. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  3607. //>>excludeEnd("ctx");
  3608. },
  3609. //>>excludeStart("ide", pragmas.excludeIdeData);
  3610. args: ["aKey", "aBlock"],
  3611. 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 ]",
  3612. referencedClasses: [],
  3613. //>>excludeEnd("ide");
  3614. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3615. }),
  3616. $globals.HashedCollection);
  3617. $core.addMethod(
  3618. $core.method({
  3619. selector: "values",
  3620. protocol: "accessing",
  3621. fn: function (){
  3622. var self=this,$self=this;
  3623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3624. return $core.withContext(function($ctx1) {
  3625. //>>excludeEnd("ctx");
  3626. return $self._keys().map(function(key){
  3627. return $self._at_(key);
  3628. });
  3629. ;
  3630. return self;
  3631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3632. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  3633. //>>excludeEnd("ctx");
  3634. },
  3635. //>>excludeStart("ide", pragmas.excludeIdeData);
  3636. args: [],
  3637. 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'>",
  3638. referencedClasses: [],
  3639. //>>excludeEnd("ide");
  3640. messageSends: []
  3641. }),
  3642. $globals.HashedCollection);
  3643. $core.addMethod(
  3644. $core.method({
  3645. selector: "valuesDo:",
  3646. protocol: "enumerating",
  3647. fn: function (aBlock){
  3648. var self=this,$self=this;
  3649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3650. return $core.withContext(function($ctx1) {
  3651. //>>excludeEnd("ctx");
  3652. $recv($self._values())._do_(aBlock);
  3653. return self;
  3654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3655. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  3656. //>>excludeEnd("ctx");
  3657. },
  3658. //>>excludeStart("ide", pragmas.excludeIdeData);
  3659. args: ["aBlock"],
  3660. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3661. referencedClasses: [],
  3662. //>>excludeEnd("ide");
  3663. messageSends: ["do:", "values"]
  3664. }),
  3665. $globals.HashedCollection);
  3666. $core.addClass("SequenceableCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  3667. //>>excludeStart("ide", pragmas.excludeIdeData);
  3668. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3669. //>>excludeEnd("ide");
  3670. $core.addMethod(
  3671. $core.method({
  3672. selector: "=",
  3673. protocol: "comparing",
  3674. fn: function (aCollection){
  3675. var self=this,$self=this;
  3676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3677. return $core.withContext(function($ctx1) {
  3678. //>>excludeEnd("ctx");
  3679. var $3,$2,$4,$1,$5;
  3680. var $early={};
  3681. try {
  3682. $3=$self._class();
  3683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3684. $ctx1.sendIdx["class"]=1;
  3685. //>>excludeEnd("ctx");
  3686. $2=$recv($3).__eq($recv(aCollection)._class());
  3687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3688. $ctx1.sendIdx["="]=1;
  3689. //>>excludeEnd("ctx");
  3690. $1=$recv($2)._and_((function(){
  3691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3692. return $core.withContext(function($ctx2) {
  3693. //>>excludeEnd("ctx");
  3694. $4=$self._size();
  3695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3696. $ctx2.sendIdx["size"]=1;
  3697. //>>excludeEnd("ctx");
  3698. return $recv($4).__eq($recv(aCollection)._size());
  3699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3700. $ctx2.sendIdx["="]=2;
  3701. //>>excludeEnd("ctx");
  3702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3703. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3704. //>>excludeEnd("ctx");
  3705. }));
  3706. if(!$core.assert($1)){
  3707. return false;
  3708. }
  3709. $self._withIndexDo_((function(each,i){
  3710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3711. return $core.withContext(function($ctx2) {
  3712. //>>excludeEnd("ctx");
  3713. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  3714. if(!$core.assert($5)){
  3715. throw $early=[false];
  3716. }
  3717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3718. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3719. //>>excludeEnd("ctx");
  3720. }));
  3721. return true;
  3722. }
  3723. catch(e) {if(e===$early)return e[0]; throw e}
  3724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3725. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  3726. //>>excludeEnd("ctx");
  3727. },
  3728. //>>excludeStart("ide", pragmas.excludeIdeData);
  3729. args: ["aCollection"],
  3730. 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",
  3731. referencedClasses: [],
  3732. //>>excludeEnd("ide");
  3733. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3734. }),
  3735. $globals.SequenceableCollection);
  3736. $core.addMethod(
  3737. $core.method({
  3738. selector: "addLast:",
  3739. protocol: "adding/removing",
  3740. fn: function (anObject){
  3741. var self=this,$self=this;
  3742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3743. return $core.withContext(function($ctx1) {
  3744. //>>excludeEnd("ctx");
  3745. $self._add_(anObject);
  3746. return self;
  3747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3748. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  3749. //>>excludeEnd("ctx");
  3750. },
  3751. //>>excludeStart("ide", pragmas.excludeIdeData);
  3752. args: ["anObject"],
  3753. source: "addLast: anObject\x0a\x09self add: anObject",
  3754. referencedClasses: [],
  3755. //>>excludeEnd("ide");
  3756. messageSends: ["add:"]
  3757. }),
  3758. $globals.SequenceableCollection);
  3759. $core.addMethod(
  3760. $core.method({
  3761. selector: "allButFirst",
  3762. protocol: "accessing",
  3763. fn: function (){
  3764. var self=this,$self=this;
  3765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3766. return $core.withContext(function($ctx1) {
  3767. //>>excludeEnd("ctx");
  3768. return $self._copyFrom_to_((2),$self._size());
  3769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3770. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  3771. //>>excludeEnd("ctx");
  3772. },
  3773. //>>excludeStart("ide", pragmas.excludeIdeData);
  3774. args: [],
  3775. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3776. referencedClasses: [],
  3777. //>>excludeEnd("ide");
  3778. messageSends: ["copyFrom:to:", "size"]
  3779. }),
  3780. $globals.SequenceableCollection);
  3781. $core.addMethod(
  3782. $core.method({
  3783. selector: "allButLast",
  3784. protocol: "accessing",
  3785. fn: function (){
  3786. var self=this,$self=this;
  3787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3788. return $core.withContext(function($ctx1) {
  3789. //>>excludeEnd("ctx");
  3790. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  3791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3792. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  3793. //>>excludeEnd("ctx");
  3794. },
  3795. //>>excludeStart("ide", pragmas.excludeIdeData);
  3796. args: [],
  3797. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  3798. referencedClasses: [],
  3799. //>>excludeEnd("ide");
  3800. messageSends: ["copyFrom:to:", "-", "size"]
  3801. }),
  3802. $globals.SequenceableCollection);
  3803. $core.addMethod(
  3804. $core.method({
  3805. selector: "anyOne",
  3806. protocol: "accessing",
  3807. fn: function (){
  3808. var self=this,$self=this;
  3809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3810. return $core.withContext(function($ctx1) {
  3811. //>>excludeEnd("ctx");
  3812. return $self._at_((1));
  3813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3814. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  3815. //>>excludeEnd("ctx");
  3816. },
  3817. //>>excludeStart("ide", pragmas.excludeIdeData);
  3818. args: [],
  3819. source: "anyOne\x0a\x09^ self at: 1",
  3820. referencedClasses: [],
  3821. //>>excludeEnd("ide");
  3822. messageSends: ["at:"]
  3823. }),
  3824. $globals.SequenceableCollection);
  3825. $core.addMethod(
  3826. $core.method({
  3827. selector: "atRandom",
  3828. protocol: "accessing",
  3829. fn: function (){
  3830. var self=this,$self=this;
  3831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3832. return $core.withContext(function($ctx1) {
  3833. //>>excludeEnd("ctx");
  3834. return $self._at_($recv($self._size())._atRandom());
  3835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3836. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  3837. //>>excludeEnd("ctx");
  3838. },
  3839. //>>excludeStart("ide", pragmas.excludeIdeData);
  3840. args: [],
  3841. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3842. referencedClasses: [],
  3843. //>>excludeEnd("ide");
  3844. messageSends: ["at:", "atRandom", "size"]
  3845. }),
  3846. $globals.SequenceableCollection);
  3847. $core.addMethod(
  3848. $core.method({
  3849. selector: "beginsWith:",
  3850. protocol: "testing",
  3851. fn: function (prefix){
  3852. var self=this,$self=this;
  3853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3854. return $core.withContext(function($ctx1) {
  3855. //>>excludeEnd("ctx");
  3856. var $2,$3,$1;
  3857. $2=$self._size();
  3858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3859. $ctx1.sendIdx["size"]=1;
  3860. //>>excludeEnd("ctx");
  3861. $3=$recv(prefix)._size();
  3862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3863. $ctx1.sendIdx["size"]=2;
  3864. //>>excludeEnd("ctx");
  3865. $1=$recv($2).__lt($3);
  3866. if($core.assert($1)){
  3867. return false;
  3868. }
  3869. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  3870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3871. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  3872. //>>excludeEnd("ctx");
  3873. },
  3874. //>>excludeStart("ide", pragmas.excludeIdeData);
  3875. args: ["prefix"],
  3876. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3877. referencedClasses: [],
  3878. //>>excludeEnd("ide");
  3879. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3880. }),
  3881. $globals.SequenceableCollection);
  3882. $core.addMethod(
  3883. $core.method({
  3884. selector: "copyFrom:to:",
  3885. protocol: "copying",
  3886. fn: function (anIndex,anotherIndex){
  3887. var self=this,$self=this;
  3888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3889. return $core.withContext(function($ctx1) {
  3890. //>>excludeEnd("ctx");
  3891. $self._subclassResponsibility();
  3892. return self;
  3893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3894. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  3895. //>>excludeEnd("ctx");
  3896. },
  3897. //>>excludeStart("ide", pragmas.excludeIdeData);
  3898. args: ["anIndex", "anotherIndex"],
  3899. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  3900. referencedClasses: [],
  3901. //>>excludeEnd("ide");
  3902. messageSends: ["subclassResponsibility"]
  3903. }),
  3904. $globals.SequenceableCollection);
  3905. $core.addMethod(
  3906. $core.method({
  3907. selector: "detect:ifNone:",
  3908. protocol: "enumerating",
  3909. fn: function (aBlock,anotherBlock){
  3910. var self=this,$self=this;
  3911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3912. return $core.withContext(function($ctx1) {
  3913. //>>excludeEnd("ctx");
  3914. var nself = $self._numericallyIndexable();
  3915. for(var i = 0; i < nself.length; i++)
  3916. if(aBlock._value_(nself[i]))
  3917. return nself[i];
  3918. return anotherBlock._value();
  3919. ;
  3920. return self;
  3921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3922. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  3923. //>>excludeEnd("ctx");
  3924. },
  3925. //>>excludeStart("ide", pragmas.excludeIdeData);
  3926. args: ["aBlock", "anotherBlock"],
  3927. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i = 0; i < nself.length; i++)\x0a\x09\x09\x09if(aBlock._value_(nself[i]))\x0a\x09\x09\x09\x09return nself[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09'>",
  3928. referencedClasses: [],
  3929. //>>excludeEnd("ide");
  3930. messageSends: []
  3931. }),
  3932. $globals.SequenceableCollection);
  3933. $core.addMethod(
  3934. $core.method({
  3935. selector: "do:",
  3936. protocol: "enumerating",
  3937. fn: function (aBlock){
  3938. var self=this,$self=this;
  3939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3940. return $core.withContext(function($ctx1) {
  3941. //>>excludeEnd("ctx");
  3942. var nself = $self._numericallyIndexable();
  3943. for(var i=0; i < nself.length; i++) {
  3944. aBlock._value_(nself[i]);
  3945. }
  3946. ;
  3947. return self;
  3948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3949. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  3950. //>>excludeEnd("ctx");
  3951. },
  3952. //>>excludeStart("ide", pragmas.excludeIdeData);
  3953. args: ["aBlock"],
  3954. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < nself.length; i++) {\x0a\x09\x09\x09aBlock._value_(nself[i]);\x0a\x09\x09}\x0a\x09'>",
  3955. referencedClasses: [],
  3956. //>>excludeEnd("ide");
  3957. messageSends: []
  3958. }),
  3959. $globals.SequenceableCollection);
  3960. $core.addMethod(
  3961. $core.method({
  3962. selector: "endsWith:",
  3963. protocol: "testing",
  3964. fn: function (suffix){
  3965. var self=this,$self=this;
  3966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3967. return $core.withContext(function($ctx1) {
  3968. //>>excludeEnd("ctx");
  3969. var $2,$3,$1;
  3970. $2=$self._size();
  3971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3972. $ctx1.sendIdx["size"]=1;
  3973. //>>excludeEnd("ctx");
  3974. $3=$recv(suffix)._size();
  3975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3976. $ctx1.sendIdx["size"]=2;
  3977. //>>excludeEnd("ctx");
  3978. $1=$recv($2).__lt($3);
  3979. if($core.assert($1)){
  3980. return false;
  3981. }
  3982. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  3983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3984. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  3985. //>>excludeEnd("ctx");
  3986. },
  3987. //>>excludeStart("ide", pragmas.excludeIdeData);
  3988. args: ["suffix"],
  3989. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  3990. referencedClasses: [],
  3991. //>>excludeEnd("ide");
  3992. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  3993. }),
  3994. $globals.SequenceableCollection);
  3995. $core.addMethod(
  3996. $core.method({
  3997. selector: "first",
  3998. protocol: "accessing",
  3999. fn: function (){
  4000. var self=this,$self=this;
  4001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4002. return $core.withContext(function($ctx1) {
  4003. //>>excludeEnd("ctx");
  4004. return $self._at_((1));
  4005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4006. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  4007. //>>excludeEnd("ctx");
  4008. },
  4009. //>>excludeStart("ide", pragmas.excludeIdeData);
  4010. args: [],
  4011. source: "first\x0a\x09^ self at: 1",
  4012. referencedClasses: [],
  4013. //>>excludeEnd("ide");
  4014. messageSends: ["at:"]
  4015. }),
  4016. $globals.SequenceableCollection);
  4017. $core.addMethod(
  4018. $core.method({
  4019. selector: "first:",
  4020. protocol: "accessing",
  4021. fn: function (aNumber){
  4022. var self=this,$self=this;
  4023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4024. return $core.withContext(function($ctx1) {
  4025. //>>excludeEnd("ctx");
  4026. var $1;
  4027. $1=$recv($self._size()).__lt(aNumber);
  4028. if($core.assert($1)){
  4029. $self._error_("Invalid number of elements");
  4030. }
  4031. return $self._copyFrom_to_((1),aNumber);
  4032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4033. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  4034. //>>excludeEnd("ctx");
  4035. },
  4036. //>>excludeStart("ide", pragmas.excludeIdeData);
  4037. args: ["aNumber"],
  4038. 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",
  4039. referencedClasses: [],
  4040. //>>excludeEnd("ide");
  4041. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  4042. }),
  4043. $globals.SequenceableCollection);
  4044. $core.addMethod(
  4045. $core.method({
  4046. selector: "fourth",
  4047. protocol: "accessing",
  4048. fn: function (){
  4049. var self=this,$self=this;
  4050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4051. return $core.withContext(function($ctx1) {
  4052. //>>excludeEnd("ctx");
  4053. return $self._at_((4));
  4054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4055. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  4056. //>>excludeEnd("ctx");
  4057. },
  4058. //>>excludeStart("ide", pragmas.excludeIdeData);
  4059. args: [],
  4060. source: "fourth\x0a\x09^ self at: 4",
  4061. referencedClasses: [],
  4062. //>>excludeEnd("ide");
  4063. messageSends: ["at:"]
  4064. }),
  4065. $globals.SequenceableCollection);
  4066. $core.addMethod(
  4067. $core.method({
  4068. selector: "includes:",
  4069. protocol: "testing",
  4070. fn: function (anObject){
  4071. var self=this,$self=this;
  4072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4073. return $core.withContext(function($ctx1) {
  4074. //>>excludeEnd("ctx");
  4075. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  4076. return nil;
  4077. })))._notNil();
  4078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4079. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  4080. //>>excludeEnd("ctx");
  4081. },
  4082. //>>excludeStart("ide", pragmas.excludeIdeData);
  4083. args: ["anObject"],
  4084. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  4085. referencedClasses: [],
  4086. //>>excludeEnd("ide");
  4087. messageSends: ["notNil", "indexOf:ifAbsent:"]
  4088. }),
  4089. $globals.SequenceableCollection);
  4090. $core.addMethod(
  4091. $core.method({
  4092. selector: "indexOf:ifAbsent:",
  4093. protocol: "accessing",
  4094. fn: function (anObject,aBlock){
  4095. var self=this,$self=this;
  4096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4097. return $core.withContext(function($ctx1) {
  4098. //>>excludeEnd("ctx");
  4099. var nself = $self._numericallyIndexable();
  4100. for(var i=0; i < nself.length; i++) {
  4101. if($recv(nself[i]).__eq(anObject)) {return i+1}
  4102. };
  4103. return aBlock._value();
  4104. ;
  4105. return self;
  4106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4107. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  4108. //>>excludeEnd("ctx");
  4109. },
  4110. //>>excludeStart("ide", pragmas.excludeIdeData);
  4111. args: ["anObject", "aBlock"],
  4112. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < nself.length; i++) {\x0a\x09\x09\x09if($recv(nself[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  4113. referencedClasses: [],
  4114. //>>excludeEnd("ide");
  4115. messageSends: []
  4116. }),
  4117. $globals.SequenceableCollection);
  4118. $core.addMethod(
  4119. $core.method({
  4120. selector: "indexOf:startingAt:",
  4121. protocol: "accessing",
  4122. fn: function (anObject,start){
  4123. var self=this,$self=this;
  4124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4125. return $core.withContext(function($ctx1) {
  4126. //>>excludeEnd("ctx");
  4127. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  4128. return (0);
  4129. }));
  4130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4131. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  4132. //>>excludeEnd("ctx");
  4133. },
  4134. //>>excludeStart("ide", pragmas.excludeIdeData);
  4135. args: ["anObject", "start"],
  4136. 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 ]",
  4137. referencedClasses: [],
  4138. //>>excludeEnd("ide");
  4139. messageSends: ["indexOf:startingAt:ifAbsent:"]
  4140. }),
  4141. $globals.SequenceableCollection);
  4142. $core.addMethod(
  4143. $core.method({
  4144. selector: "indexOf:startingAt:ifAbsent:",
  4145. protocol: "accessing",
  4146. fn: function (anObject,start,aBlock){
  4147. var self=this,$self=this;
  4148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4149. return $core.withContext(function($ctx1) {
  4150. //>>excludeEnd("ctx");
  4151. var nself = $self._numericallyIndexable();
  4152. for(var i=start - 1; i < nself.length; i++){
  4153. if($recv(nself[i]).__eq(anObject)) {return i+1}
  4154. }
  4155. return aBlock._value();
  4156. ;
  4157. return self;
  4158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4159. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  4160. //>>excludeEnd("ctx");
  4161. },
  4162. //>>excludeStart("ide", pragmas.excludeIdeData);
  4163. args: ["anObject", "start", "aBlock"],
  4164. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i=start - 1; i < nself.length; i++){\x0a\x09\x09\x09if($recv(nself[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  4165. referencedClasses: [],
  4166. //>>excludeEnd("ide");
  4167. messageSends: []
  4168. }),
  4169. $globals.SequenceableCollection);
  4170. $core.addMethod(
  4171. $core.method({
  4172. selector: "last",
  4173. protocol: "accessing",
  4174. fn: function (){
  4175. var self=this,$self=this;
  4176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4177. return $core.withContext(function($ctx1) {
  4178. //>>excludeEnd("ctx");
  4179. return $self._at_($self._size());
  4180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4181. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  4182. //>>excludeEnd("ctx");
  4183. },
  4184. //>>excludeStart("ide", pragmas.excludeIdeData);
  4185. args: [],
  4186. source: "last\x0a\x09^ self at: self size",
  4187. referencedClasses: [],
  4188. //>>excludeEnd("ide");
  4189. messageSends: ["at:", "size"]
  4190. }),
  4191. $globals.SequenceableCollection);
  4192. $core.addMethod(
  4193. $core.method({
  4194. selector: "last:",
  4195. protocol: "accessing",
  4196. fn: function (aNumber){
  4197. var self=this,$self=this;
  4198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4199. return $core.withContext(function($ctx1) {
  4200. //>>excludeEnd("ctx");
  4201. var $2,$1,$5,$4,$3;
  4202. $2=$self._size();
  4203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4204. $ctx1.sendIdx["size"]=1;
  4205. //>>excludeEnd("ctx");
  4206. $1=$recv($2).__lt(aNumber);
  4207. if($core.assert($1)){
  4208. $self._error_("Invalid number of elements");
  4209. }
  4210. $5=$self._size();
  4211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4212. $ctx1.sendIdx["size"]=2;
  4213. //>>excludeEnd("ctx");
  4214. $4=$recv($5).__minus(aNumber);
  4215. $3=$recv($4).__plus((1));
  4216. return $self._copyFrom_to_($3,$self._size());
  4217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4218. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  4219. //>>excludeEnd("ctx");
  4220. },
  4221. //>>excludeStart("ide", pragmas.excludeIdeData);
  4222. args: ["aNumber"],
  4223. 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",
  4224. referencedClasses: [],
  4225. //>>excludeEnd("ide");
  4226. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  4227. }),
  4228. $globals.SequenceableCollection);
  4229. $core.addMethod(
  4230. $core.method({
  4231. selector: "newStream",
  4232. protocol: "streaming",
  4233. fn: function (){
  4234. var self=this,$self=this;
  4235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4236. return $core.withContext(function($ctx1) {
  4237. //>>excludeEnd("ctx");
  4238. return $recv($self._streamClass())._on_(self);
  4239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4240. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  4241. //>>excludeEnd("ctx");
  4242. },
  4243. //>>excludeStart("ide", pragmas.excludeIdeData);
  4244. args: [],
  4245. source: "newStream\x0a\x09^ self streamClass on: self",
  4246. referencedClasses: [],
  4247. //>>excludeEnd("ide");
  4248. messageSends: ["on:", "streamClass"]
  4249. }),
  4250. $globals.SequenceableCollection);
  4251. $core.addMethod(
  4252. $core.method({
  4253. selector: "numericallyIndexable",
  4254. protocol: "private",
  4255. fn: function (){
  4256. var self=this,$self=this;
  4257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4258. return $core.withContext(function($ctx1) {
  4259. //>>excludeEnd("ctx");
  4260. $self._subclassResponsibility();
  4261. return self;
  4262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4263. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  4264. //>>excludeEnd("ctx");
  4265. },
  4266. //>>excludeStart("ide", pragmas.excludeIdeData);
  4267. args: [],
  4268. source: "numericallyIndexable\x0a\x09\x22This is an internal converting message.\x0a\x09It answeres a representation of the receiver\x0a\x09that can use foo[i] in JavaScript code.\x0a\x09\x0a\x09It fixes IE8, where boxed String is unable\x0a\x09to numerically index its characters,\x0a\x09but primitive string can.\x22\x0a\x09\x0a\x09self subclassResponsibility",
  4269. referencedClasses: [],
  4270. //>>excludeEnd("ide");
  4271. messageSends: ["subclassResponsibility"]
  4272. }),
  4273. $globals.SequenceableCollection);
  4274. $core.addMethod(
  4275. $core.method({
  4276. selector: "readStream",
  4277. protocol: "streaming",
  4278. fn: function (){
  4279. var self=this,$self=this;
  4280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4281. return $core.withContext(function($ctx1) {
  4282. //>>excludeEnd("ctx");
  4283. return $self._stream();
  4284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4285. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  4286. //>>excludeEnd("ctx");
  4287. },
  4288. //>>excludeStart("ide", pragmas.excludeIdeData);
  4289. args: [],
  4290. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4291. referencedClasses: [],
  4292. //>>excludeEnd("ide");
  4293. messageSends: ["stream"]
  4294. }),
  4295. $globals.SequenceableCollection);
  4296. $core.addMethod(
  4297. $core.method({
  4298. selector: "removeLast",
  4299. protocol: "adding/removing",
  4300. fn: function (){
  4301. var self=this,$self=this;
  4302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4303. return $core.withContext(function($ctx1) {
  4304. //>>excludeEnd("ctx");
  4305. return $self._remove_($self._last());
  4306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4307. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  4308. //>>excludeEnd("ctx");
  4309. },
  4310. //>>excludeStart("ide", pragmas.excludeIdeData);
  4311. args: [],
  4312. source: "removeLast\x0a\x09^ self remove: self last",
  4313. referencedClasses: [],
  4314. //>>excludeEnd("ide");
  4315. messageSends: ["remove:", "last"]
  4316. }),
  4317. $globals.SequenceableCollection);
  4318. $core.addMethod(
  4319. $core.method({
  4320. selector: "reverseDo:",
  4321. protocol: "enumerating",
  4322. fn: function (aBlock){
  4323. var self=this,$self=this;
  4324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4325. return $core.withContext(function($ctx1) {
  4326. //>>excludeEnd("ctx");
  4327. $recv($self._reversed())._do_(aBlock);
  4328. return self;
  4329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4330. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  4331. //>>excludeEnd("ctx");
  4332. },
  4333. //>>excludeStart("ide", pragmas.excludeIdeData);
  4334. args: ["aBlock"],
  4335. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  4336. referencedClasses: [],
  4337. //>>excludeEnd("ide");
  4338. messageSends: ["do:", "reversed"]
  4339. }),
  4340. $globals.SequenceableCollection);
  4341. $core.addMethod(
  4342. $core.method({
  4343. selector: "reversed",
  4344. protocol: "converting",
  4345. fn: function (){
  4346. var self=this,$self=this;
  4347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4348. return $core.withContext(function($ctx1) {
  4349. //>>excludeEnd("ctx");
  4350. $self._subclassResponsibility();
  4351. return self;
  4352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4353. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  4354. //>>excludeEnd("ctx");
  4355. },
  4356. //>>excludeStart("ide", pragmas.excludeIdeData);
  4357. args: [],
  4358. source: "reversed\x0a\x09self subclassResponsibility",
  4359. referencedClasses: [],
  4360. //>>excludeEnd("ide");
  4361. messageSends: ["subclassResponsibility"]
  4362. }),
  4363. $globals.SequenceableCollection);
  4364. $core.addMethod(
  4365. $core.method({
  4366. selector: "second",
  4367. protocol: "accessing",
  4368. fn: function (){
  4369. var self=this,$self=this;
  4370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4371. return $core.withContext(function($ctx1) {
  4372. //>>excludeEnd("ctx");
  4373. return $self._at_((2));
  4374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4375. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  4376. //>>excludeEnd("ctx");
  4377. },
  4378. //>>excludeStart("ide", pragmas.excludeIdeData);
  4379. args: [],
  4380. source: "second\x0a\x09^ self at: 2",
  4381. referencedClasses: [],
  4382. //>>excludeEnd("ide");
  4383. messageSends: ["at:"]
  4384. }),
  4385. $globals.SequenceableCollection);
  4386. $core.addMethod(
  4387. $core.method({
  4388. selector: "single",
  4389. protocol: "accessing",
  4390. fn: function (){
  4391. var self=this,$self=this;
  4392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4393. return $core.withContext(function($ctx1) {
  4394. //>>excludeEnd("ctx");
  4395. if (self.length == 0) throw new Error("Collection is empty");
  4396. if (self.length > 1) throw new Error("Collection holds more than one element.");
  4397. return $self._numericallyIndexable()[0];;
  4398. return self;
  4399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4400. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.SequenceableCollection)});
  4401. //>>excludeEnd("ctx");
  4402. },
  4403. //>>excludeStart("ide", pragmas.excludeIdeData);
  4404. args: [],
  4405. source: "single\x0a<inlineJS: '\x0a\x09if (self.length == 0) throw new Error(\x22Collection is empty\x22);\x0a\x09if (self.length > 1) throw new Error(\x22Collection holds more than one element.\x22);\x0a\x09return $self._numericallyIndexable()[0];\x0a'>",
  4406. referencedClasses: [],
  4407. //>>excludeEnd("ide");
  4408. messageSends: []
  4409. }),
  4410. $globals.SequenceableCollection);
  4411. $core.addMethod(
  4412. $core.method({
  4413. selector: "stream",
  4414. protocol: "streaming",
  4415. fn: function (){
  4416. var self=this,$self=this;
  4417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4418. return $core.withContext(function($ctx1) {
  4419. //>>excludeEnd("ctx");
  4420. return $self._newStream();
  4421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4422. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  4423. //>>excludeEnd("ctx");
  4424. },
  4425. //>>excludeStart("ide", pragmas.excludeIdeData);
  4426. args: [],
  4427. source: "stream\x0a\x09^ self newStream",
  4428. referencedClasses: [],
  4429. //>>excludeEnd("ide");
  4430. messageSends: ["newStream"]
  4431. }),
  4432. $globals.SequenceableCollection);
  4433. $core.addMethod(
  4434. $core.method({
  4435. selector: "streamClass",
  4436. protocol: "streaming",
  4437. fn: function (){
  4438. var self=this,$self=this;
  4439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4440. return $core.withContext(function($ctx1) {
  4441. //>>excludeEnd("ctx");
  4442. return $recv($self._class())._streamClass();
  4443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4444. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  4445. //>>excludeEnd("ctx");
  4446. },
  4447. //>>excludeStart("ide", pragmas.excludeIdeData);
  4448. args: [],
  4449. source: "streamClass\x0a\x09^ self class streamClass",
  4450. referencedClasses: [],
  4451. //>>excludeEnd("ide");
  4452. messageSends: ["streamClass", "class"]
  4453. }),
  4454. $globals.SequenceableCollection);
  4455. $core.addMethod(
  4456. $core.method({
  4457. selector: "third",
  4458. protocol: "accessing",
  4459. fn: function (){
  4460. var self=this,$self=this;
  4461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4462. return $core.withContext(function($ctx1) {
  4463. //>>excludeEnd("ctx");
  4464. return $self._at_((3));
  4465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4466. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  4467. //>>excludeEnd("ctx");
  4468. },
  4469. //>>excludeStart("ide", pragmas.excludeIdeData);
  4470. args: [],
  4471. source: "third\x0a\x09^ self at: 3",
  4472. referencedClasses: [],
  4473. //>>excludeEnd("ide");
  4474. messageSends: ["at:"]
  4475. }),
  4476. $globals.SequenceableCollection);
  4477. $core.addMethod(
  4478. $core.method({
  4479. selector: "with:do:",
  4480. protocol: "enumerating",
  4481. fn: function (anotherCollection,aBlock){
  4482. var self=this,$self=this;
  4483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4484. return $core.withContext(function($ctx1) {
  4485. //>>excludeEnd("ctx");
  4486. var nself = $self._numericallyIndexable();
  4487. anotherCollection = anotherCollection._numericallyIndexable();
  4488. for(var i=0; i<nself.length; i++) {
  4489. aBlock._value_value_(nself[i], anotherCollection[i]);
  4490. }
  4491. ;
  4492. return self;
  4493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4494. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  4495. //>>excludeEnd("ctx");
  4496. },
  4497. //>>excludeStart("ide", pragmas.excludeIdeData);
  4498. args: ["anotherCollection", "aBlock"],
  4499. source: "with: anotherCollection do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09anotherCollection = anotherCollection._numericallyIndexable();\x0a\x09\x09for(var i=0; i<nself.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(nself[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09'>",
  4500. referencedClasses: [],
  4501. //>>excludeEnd("ide");
  4502. messageSends: []
  4503. }),
  4504. $globals.SequenceableCollection);
  4505. $core.addMethod(
  4506. $core.method({
  4507. selector: "withIndexDo:",
  4508. protocol: "enumerating",
  4509. fn: function (aBlock){
  4510. var self=this,$self=this;
  4511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4512. return $core.withContext(function($ctx1) {
  4513. //>>excludeEnd("ctx");
  4514. var nself = $self._numericallyIndexable();
  4515. for(var i=0; i < nself.length; i++) {
  4516. aBlock._value_value_(nself[i], i+1);
  4517. }
  4518. ;
  4519. return self;
  4520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4521. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  4522. //>>excludeEnd("ctx");
  4523. },
  4524. //>>excludeStart("ide", pragmas.excludeIdeData);
  4525. args: ["aBlock"],
  4526. source: "withIndexDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < nself.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(nself[i], i+1);\x0a\x09\x09}\x0a\x09'>",
  4527. referencedClasses: [],
  4528. //>>excludeEnd("ide");
  4529. messageSends: []
  4530. }),
  4531. $globals.SequenceableCollection);
  4532. $core.addMethod(
  4533. $core.method({
  4534. selector: "writeStream",
  4535. protocol: "streaming",
  4536. fn: function (){
  4537. var self=this,$self=this;
  4538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4539. return $core.withContext(function($ctx1) {
  4540. //>>excludeEnd("ctx");
  4541. return $self._stream();
  4542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4543. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  4544. //>>excludeEnd("ctx");
  4545. },
  4546. //>>excludeStart("ide", pragmas.excludeIdeData);
  4547. args: [],
  4548. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4549. referencedClasses: [],
  4550. //>>excludeEnd("ide");
  4551. messageSends: ["stream"]
  4552. }),
  4553. $globals.SequenceableCollection);
  4554. $core.addMethod(
  4555. $core.method({
  4556. selector: "streamClass",
  4557. protocol: "accessing",
  4558. fn: function (){
  4559. var self=this,$self=this;
  4560. return $globals.Stream;
  4561. },
  4562. //>>excludeStart("ide", pragmas.excludeIdeData);
  4563. args: [],
  4564. source: "streamClass\x0a\x09\x09^ Stream",
  4565. referencedClasses: ["Stream"],
  4566. //>>excludeEnd("ide");
  4567. messageSends: []
  4568. }),
  4569. $globals.SequenceableCollection.a$cls);
  4570. $core.addMethod(
  4571. $core.method({
  4572. selector: "streamContents:",
  4573. protocol: "streaming",
  4574. fn: function (aBlock){
  4575. var self=this,$self=this;
  4576. var stream;
  4577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4578. return $core.withContext(function($ctx1) {
  4579. //>>excludeEnd("ctx");
  4580. stream=$recv($self._streamClass())._on_($self._new());
  4581. $recv(aBlock)._value_(stream);
  4582. return $recv(stream)._contents();
  4583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4584. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.a$cls)});
  4585. //>>excludeEnd("ctx");
  4586. },
  4587. //>>excludeStart("ide", pragmas.excludeIdeData);
  4588. args: ["aBlock"],
  4589. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4590. referencedClasses: [],
  4591. //>>excludeEnd("ide");
  4592. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4593. }),
  4594. $globals.SequenceableCollection.a$cls);
  4595. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  4596. //>>excludeStart("ide", pragmas.excludeIdeData);
  4597. $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`.";
  4598. //>>excludeEnd("ide");
  4599. $core.addMethod(
  4600. $core.method({
  4601. selector: "add:",
  4602. protocol: "adding/removing",
  4603. fn: function (anObject){
  4604. var self=this,$self=this;
  4605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4606. return $core.withContext(function($ctx1) {
  4607. //>>excludeEnd("ctx");
  4608. self.push(anObject); return anObject;;
  4609. return self;
  4610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4611. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  4612. //>>excludeEnd("ctx");
  4613. },
  4614. //>>excludeStart("ide", pragmas.excludeIdeData);
  4615. args: ["anObject"],
  4616. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  4617. referencedClasses: [],
  4618. //>>excludeEnd("ide");
  4619. messageSends: []
  4620. }),
  4621. $globals.Array);
  4622. $core.addMethod(
  4623. $core.method({
  4624. selector: "addAll:",
  4625. protocol: "adding/removing",
  4626. fn: function (aCollection){
  4627. var self=this,$self=this;
  4628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4629. return $core.withContext(function($ctx1) {
  4630. //>>excludeEnd("ctx");
  4631. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  4632. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  4633. return aCollection;;
  4634. return self;
  4635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4636. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  4637. //>>excludeEnd("ctx");
  4638. },
  4639. //>>excludeStart("ide", pragmas.excludeIdeData);
  4640. args: ["aCollection"],
  4641. 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'>",
  4642. referencedClasses: [],
  4643. //>>excludeEnd("ide");
  4644. messageSends: []
  4645. }),
  4646. $globals.Array);
  4647. $core.addMethod(
  4648. $core.method({
  4649. selector: "addFirst:",
  4650. protocol: "adding/removing",
  4651. fn: function (anObject){
  4652. var self=this,$self=this;
  4653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4654. return $core.withContext(function($ctx1) {
  4655. //>>excludeEnd("ctx");
  4656. self.unshift(anObject); return anObject;;
  4657. return self;
  4658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4659. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  4660. //>>excludeEnd("ctx");
  4661. },
  4662. //>>excludeStart("ide", pragmas.excludeIdeData);
  4663. args: ["anObject"],
  4664. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  4665. referencedClasses: [],
  4666. //>>excludeEnd("ide");
  4667. messageSends: []
  4668. }),
  4669. $globals.Array);
  4670. $core.addMethod(
  4671. $core.method({
  4672. selector: "asJavaScriptSource",
  4673. protocol: "converting",
  4674. fn: function (){
  4675. var self=this,$self=this;
  4676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4677. return $core.withContext(function($ctx1) {
  4678. //>>excludeEnd("ctx");
  4679. var $1;
  4680. $1=$recv("[".__comma($recv($self._collect_((function(each){
  4681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4682. return $core.withContext(function($ctx2) {
  4683. //>>excludeEnd("ctx");
  4684. return $recv(each)._asJavaScriptSource();
  4685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4686. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4687. //>>excludeEnd("ctx");
  4688. })))._join_(", "))).__comma("]");
  4689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4690. $ctx1.sendIdx[","]=1;
  4691. //>>excludeEnd("ctx");
  4692. return $1;
  4693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4694. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Array)});
  4695. //>>excludeEnd("ctx");
  4696. },
  4697. //>>excludeStart("ide", pragmas.excludeIdeData);
  4698. args: [],
  4699. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  4700. referencedClasses: [],
  4701. //>>excludeEnd("ide");
  4702. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  4703. }),
  4704. $globals.Array);
  4705. $core.addMethod(
  4706. $core.method({
  4707. selector: "at:ifAbsent:",
  4708. protocol: "accessing",
  4709. fn: function (anIndex,aBlock){
  4710. var self=this,$self=this;
  4711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4712. return $core.withContext(function($ctx1) {
  4713. //>>excludeEnd("ctx");
  4714. return anIndex >= 1 && anIndex <= self.length
  4715. ? self[anIndex - 1]
  4716. : aBlock._value()
  4717. ;
  4718. return self;
  4719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4720. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  4721. //>>excludeEnd("ctx");
  4722. },
  4723. //>>excludeStart("ide", pragmas.excludeIdeData);
  4724. args: ["anIndex", "aBlock"],
  4725. 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'>",
  4726. referencedClasses: [],
  4727. //>>excludeEnd("ide");
  4728. messageSends: []
  4729. }),
  4730. $globals.Array);
  4731. $core.addMethod(
  4732. $core.method({
  4733. selector: "at:ifPresent:ifAbsent:",
  4734. protocol: "accessing",
  4735. fn: function (anIndex,aBlock,anotherBlock){
  4736. var self=this,$self=this;
  4737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4738. return $core.withContext(function($ctx1) {
  4739. //>>excludeEnd("ctx");
  4740. return anIndex >= 1 && anIndex <= self.length
  4741. ? aBlock._value_(self[anIndex - 1])
  4742. : anotherBlock._value()
  4743. ;
  4744. return self;
  4745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4746. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  4747. //>>excludeEnd("ctx");
  4748. },
  4749. //>>excludeStart("ide", pragmas.excludeIdeData);
  4750. args: ["anIndex", "aBlock", "anotherBlock"],
  4751. 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'>",
  4752. referencedClasses: [],
  4753. //>>excludeEnd("ide");
  4754. messageSends: []
  4755. }),
  4756. $globals.Array);
  4757. $core.addMethod(
  4758. $core.method({
  4759. selector: "at:put:",
  4760. protocol: "accessing",
  4761. fn: function (anIndex,anObject){
  4762. var self=this,$self=this;
  4763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4764. return $core.withContext(function($ctx1) {
  4765. //>>excludeEnd("ctx");
  4766. return self[anIndex - 1] = anObject;
  4767. return self;
  4768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4769. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  4770. //>>excludeEnd("ctx");
  4771. },
  4772. //>>excludeStart("ide", pragmas.excludeIdeData);
  4773. args: ["anIndex", "anObject"],
  4774. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  4775. referencedClasses: [],
  4776. //>>excludeEnd("ide");
  4777. messageSends: []
  4778. }),
  4779. $globals.Array);
  4780. $core.addMethod(
  4781. $core.method({
  4782. selector: "collect:",
  4783. protocol: "enumerating",
  4784. fn: function (aBlock){
  4785. var self=this,$self=this;
  4786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4787. return $core.withContext(function($ctx1) {
  4788. //>>excludeEnd("ctx");
  4789. return self.map(function(each) {return aBlock._value_(each)});
  4790. return self;
  4791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4792. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  4793. //>>excludeEnd("ctx");
  4794. },
  4795. //>>excludeStart("ide", pragmas.excludeIdeData);
  4796. args: ["aBlock"],
  4797. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  4798. referencedClasses: [],
  4799. //>>excludeEnd("ide");
  4800. messageSends: []
  4801. }),
  4802. $globals.Array);
  4803. $core.addMethod(
  4804. $core.method({
  4805. selector: "copyFrom:to:",
  4806. protocol: "copying",
  4807. fn: function (anIndex,anotherIndex){
  4808. var self=this,$self=this;
  4809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4810. return $core.withContext(function($ctx1) {
  4811. //>>excludeEnd("ctx");
  4812. if (anIndex >= 1 && anotherIndex <= self.length) {
  4813. return self.slice(anIndex - 1, anotherIndex);
  4814. } else {
  4815. self._at_(anIndex);
  4816. self._at_(self.length + 1);
  4817. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4818. };
  4819. return self;
  4820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4821. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  4822. //>>excludeEnd("ctx");
  4823. },
  4824. //>>excludeStart("ide", pragmas.excludeIdeData);
  4825. args: ["anIndex", "anotherIndex"],
  4826. 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'>",
  4827. referencedClasses: [],
  4828. //>>excludeEnd("ide");
  4829. messageSends: []
  4830. }),
  4831. $globals.Array);
  4832. $core.addMethod(
  4833. $core.method({
  4834. selector: "join:",
  4835. protocol: "enumerating",
  4836. fn: function (aString){
  4837. var self=this,$self=this;
  4838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4839. return $core.withContext(function($ctx1) {
  4840. //>>excludeEnd("ctx");
  4841. return self.join(aString);
  4842. return self;
  4843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4844. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  4845. //>>excludeEnd("ctx");
  4846. },
  4847. //>>excludeStart("ide", pragmas.excludeIdeData);
  4848. args: ["aString"],
  4849. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  4850. referencedClasses: [],
  4851. //>>excludeEnd("ide");
  4852. messageSends: []
  4853. }),
  4854. $globals.Array);
  4855. $core.addMethod(
  4856. $core.method({
  4857. selector: "numericallyIndexable",
  4858. protocol: "private",
  4859. fn: function (){
  4860. var self=this,$self=this;
  4861. return self;
  4862. },
  4863. //>>excludeStart("ide", pragmas.excludeIdeData);
  4864. args: [],
  4865. source: "numericallyIndexable\x0a\x09^ self",
  4866. referencedClasses: [],
  4867. //>>excludeEnd("ide");
  4868. messageSends: []
  4869. }),
  4870. $globals.Array);
  4871. $core.addMethod(
  4872. $core.method({
  4873. selector: "printOn:",
  4874. protocol: "printing",
  4875. fn: function (aStream){
  4876. var self=this,$self=this;
  4877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4878. return $core.withContext(function($ctx1) {
  4879. //>>excludeEnd("ctx");
  4880. (
  4881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4882. $ctx1.supercall = true,
  4883. //>>excludeEnd("ctx");
  4884. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  4885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4886. $ctx1.supercall = false;
  4887. //>>excludeEnd("ctx");;
  4888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4889. $ctx1.sendIdx["printOn:"]=1;
  4890. //>>excludeEnd("ctx");
  4891. $recv(aStream)._nextPutAll_(" (");
  4892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4893. $ctx1.sendIdx["nextPutAll:"]=1;
  4894. //>>excludeEnd("ctx");
  4895. $self._do_separatedBy_((function(each){
  4896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4897. return $core.withContext(function($ctx2) {
  4898. //>>excludeEnd("ctx");
  4899. return $recv(each)._printOn_(aStream);
  4900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4901. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4902. //>>excludeEnd("ctx");
  4903. }),(function(){
  4904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4905. return $core.withContext(function($ctx2) {
  4906. //>>excludeEnd("ctx");
  4907. return $recv(aStream)._nextPutAll_(" ");
  4908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4909. $ctx2.sendIdx["nextPutAll:"]=2;
  4910. //>>excludeEnd("ctx");
  4911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4913. //>>excludeEnd("ctx");
  4914. }));
  4915. $recv(aStream)._nextPutAll_(")");
  4916. return self;
  4917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4918. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  4919. //>>excludeEnd("ctx");
  4920. },
  4921. //>>excludeStart("ide", pragmas.excludeIdeData);
  4922. args: ["aStream"],
  4923. 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: ')'",
  4924. referencedClasses: [],
  4925. //>>excludeEnd("ide");
  4926. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4927. }),
  4928. $globals.Array);
  4929. $core.addMethod(
  4930. $core.method({
  4931. selector: "remove:ifAbsent:",
  4932. protocol: "adding/removing",
  4933. fn: function (anObject,aBlock){
  4934. var self=this,$self=this;
  4935. var index;
  4936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4937. return $core.withContext(function($ctx1) {
  4938. //>>excludeEnd("ctx");
  4939. var $1;
  4940. index=$self._indexOf_ifAbsent_(anObject,(function(){
  4941. return (0);
  4942. }));
  4943. $1=$recv(index).__eq((0));
  4944. if($core.assert($1)){
  4945. return $recv(aBlock)._value();
  4946. } else {
  4947. $self._removeIndex_(index);
  4948. return anObject;
  4949. }
  4950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4951. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  4952. //>>excludeEnd("ctx");
  4953. },
  4954. //>>excludeStart("ide", pragmas.excludeIdeData);
  4955. args: ["anObject", "aBlock"],
  4956. 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 ]",
  4957. referencedClasses: [],
  4958. //>>excludeEnd("ide");
  4959. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4960. }),
  4961. $globals.Array);
  4962. $core.addMethod(
  4963. $core.method({
  4964. selector: "removeAll",
  4965. protocol: "adding/removing",
  4966. fn: function (){
  4967. var self=this,$self=this;
  4968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4969. return $core.withContext(function($ctx1) {
  4970. //>>excludeEnd("ctx");
  4971. self.length = 0;
  4972. return self;
  4973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4974. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  4975. //>>excludeEnd("ctx");
  4976. },
  4977. //>>excludeStart("ide", pragmas.excludeIdeData);
  4978. args: [],
  4979. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  4980. referencedClasses: [],
  4981. //>>excludeEnd("ide");
  4982. messageSends: []
  4983. }),
  4984. $globals.Array);
  4985. $core.addMethod(
  4986. $core.method({
  4987. selector: "removeFrom:to:",
  4988. protocol: "adding/removing",
  4989. fn: function (aNumber,anotherNumber){
  4990. var self=this,$self=this;
  4991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4992. return $core.withContext(function($ctx1) {
  4993. //>>excludeEnd("ctx");
  4994. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4995. return self;
  4996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4997. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  4998. //>>excludeEnd("ctx");
  4999. },
  5000. //>>excludeStart("ide", pragmas.excludeIdeData);
  5001. args: ["aNumber", "anotherNumber"],
  5002. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  5003. referencedClasses: [],
  5004. //>>excludeEnd("ide");
  5005. messageSends: []
  5006. }),
  5007. $globals.Array);
  5008. $core.addMethod(
  5009. $core.method({
  5010. selector: "removeIndex:",
  5011. protocol: "adding/removing",
  5012. fn: function (anInteger){
  5013. var self=this,$self=this;
  5014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5015. return $core.withContext(function($ctx1) {
  5016. //>>excludeEnd("ctx");
  5017. self.splice(anInteger - 1, 1);
  5018. return self;
  5019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5020. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  5021. //>>excludeEnd("ctx");
  5022. },
  5023. //>>excludeStart("ide", pragmas.excludeIdeData);
  5024. args: ["anInteger"],
  5025. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  5026. referencedClasses: [],
  5027. //>>excludeEnd("ide");
  5028. messageSends: []
  5029. }),
  5030. $globals.Array);
  5031. $core.addMethod(
  5032. $core.method({
  5033. selector: "removeLast",
  5034. protocol: "adding/removing",
  5035. fn: function (){
  5036. var self=this,$self=this;
  5037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5038. return $core.withContext(function($ctx1) {
  5039. //>>excludeEnd("ctx");
  5040. return self.pop();;
  5041. return self;
  5042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5043. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  5044. //>>excludeEnd("ctx");
  5045. },
  5046. //>>excludeStart("ide", pragmas.excludeIdeData);
  5047. args: [],
  5048. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  5049. referencedClasses: [],
  5050. //>>excludeEnd("ide");
  5051. messageSends: []
  5052. }),
  5053. $globals.Array);
  5054. $core.addMethod(
  5055. $core.method({
  5056. selector: "reversed",
  5057. protocol: "converting",
  5058. fn: function (){
  5059. var self=this,$self=this;
  5060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5061. return $core.withContext(function($ctx1) {
  5062. //>>excludeEnd("ctx");
  5063. return self.slice().reverse();
  5064. return self;
  5065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5066. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  5067. //>>excludeEnd("ctx");
  5068. },
  5069. //>>excludeStart("ide", pragmas.excludeIdeData);
  5070. args: [],
  5071. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  5072. referencedClasses: [],
  5073. //>>excludeEnd("ide");
  5074. messageSends: []
  5075. }),
  5076. $globals.Array);
  5077. $core.addMethod(
  5078. $core.method({
  5079. selector: "select:",
  5080. protocol: "enumerating",
  5081. fn: function (aBlock){
  5082. var self=this,$self=this;
  5083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5084. return $core.withContext(function($ctx1) {
  5085. //>>excludeEnd("ctx");
  5086. return self.filter(function(each) {return aBlock._value_(each)});
  5087. return self;
  5088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5089. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  5090. //>>excludeEnd("ctx");
  5091. },
  5092. //>>excludeStart("ide", pragmas.excludeIdeData);
  5093. args: ["aBlock"],
  5094. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  5095. referencedClasses: [],
  5096. //>>excludeEnd("ide");
  5097. messageSends: []
  5098. }),
  5099. $globals.Array);
  5100. $core.addMethod(
  5101. $core.method({
  5102. selector: "shallowCopy",
  5103. protocol: "copying",
  5104. fn: function (){
  5105. var self=this,$self=this;
  5106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5107. return $core.withContext(function($ctx1) {
  5108. //>>excludeEnd("ctx");
  5109. return self.slice();
  5110. return self;
  5111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5112. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  5113. //>>excludeEnd("ctx");
  5114. },
  5115. //>>excludeStart("ide", pragmas.excludeIdeData);
  5116. args: [],
  5117. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  5118. referencedClasses: [],
  5119. //>>excludeEnd("ide");
  5120. messageSends: []
  5121. }),
  5122. $globals.Array);
  5123. $core.addMethod(
  5124. $core.method({
  5125. selector: "size",
  5126. protocol: "accessing",
  5127. fn: function (){
  5128. var self=this,$self=this;
  5129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5130. return $core.withContext(function($ctx1) {
  5131. //>>excludeEnd("ctx");
  5132. return self.length;
  5133. return self;
  5134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5135. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  5136. //>>excludeEnd("ctx");
  5137. },
  5138. //>>excludeStart("ide", pragmas.excludeIdeData);
  5139. args: [],
  5140. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  5141. referencedClasses: [],
  5142. //>>excludeEnd("ide");
  5143. messageSends: []
  5144. }),
  5145. $globals.Array);
  5146. $core.addMethod(
  5147. $core.method({
  5148. selector: "sort",
  5149. protocol: "enumerating",
  5150. fn: function (){
  5151. var self=this,$self=this;
  5152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5153. return $core.withContext(function($ctx1) {
  5154. //>>excludeEnd("ctx");
  5155. return $self._sort_((function(a,b){
  5156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5157. return $core.withContext(function($ctx2) {
  5158. //>>excludeEnd("ctx");
  5159. return $recv(a).__lt(b);
  5160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5161. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  5162. //>>excludeEnd("ctx");
  5163. }));
  5164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5165. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  5166. //>>excludeEnd("ctx");
  5167. },
  5168. //>>excludeStart("ide", pragmas.excludeIdeData);
  5169. args: [],
  5170. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  5171. referencedClasses: [],
  5172. //>>excludeEnd("ide");
  5173. messageSends: ["sort:", "<"]
  5174. }),
  5175. $globals.Array);
  5176. $core.addMethod(
  5177. $core.method({
  5178. selector: "sort:",
  5179. protocol: "enumerating",
  5180. fn: function (aBlock){
  5181. var self=this,$self=this;
  5182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5183. return $core.withContext(function($ctx1) {
  5184. //>>excludeEnd("ctx");
  5185. return self.sort(function(a, b) {
  5186. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  5187. })
  5188. ;
  5189. return self;
  5190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5191. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  5192. //>>excludeEnd("ctx");
  5193. },
  5194. //>>excludeStart("ide", pragmas.excludeIdeData);
  5195. args: ["aBlock"],
  5196. 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'>",
  5197. referencedClasses: [],
  5198. //>>excludeEnd("ide");
  5199. messageSends: []
  5200. }),
  5201. $globals.Array);
  5202. $core.addMethod(
  5203. $core.method({
  5204. selector: "sorted",
  5205. protocol: "enumerating",
  5206. fn: function (){
  5207. var self=this,$self=this;
  5208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5209. return $core.withContext(function($ctx1) {
  5210. //>>excludeEnd("ctx");
  5211. return $recv($self._copy())._sort();
  5212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5213. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  5214. //>>excludeEnd("ctx");
  5215. },
  5216. //>>excludeStart("ide", pragmas.excludeIdeData);
  5217. args: [],
  5218. source: "sorted\x0a\x09^ self copy sort",
  5219. referencedClasses: [],
  5220. //>>excludeEnd("ide");
  5221. messageSends: ["sort", "copy"]
  5222. }),
  5223. $globals.Array);
  5224. $core.addMethod(
  5225. $core.method({
  5226. selector: "sorted:",
  5227. protocol: "enumerating",
  5228. fn: function (aBlock){
  5229. var self=this,$self=this;
  5230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5231. return $core.withContext(function($ctx1) {
  5232. //>>excludeEnd("ctx");
  5233. return $recv($self._copy())._sort_(aBlock);
  5234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5235. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  5236. //>>excludeEnd("ctx");
  5237. },
  5238. //>>excludeStart("ide", pragmas.excludeIdeData);
  5239. args: ["aBlock"],
  5240. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  5241. referencedClasses: [],
  5242. //>>excludeEnd("ide");
  5243. messageSends: ["sort:", "copy"]
  5244. }),
  5245. $globals.Array);
  5246. $core.addMethod(
  5247. $core.method({
  5248. selector: "new:",
  5249. protocol: "instance creation",
  5250. fn: function (anInteger){
  5251. var self=this,$self=this;
  5252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5253. return $core.withContext(function($ctx1) {
  5254. //>>excludeEnd("ctx");
  5255. return new Array(anInteger);
  5256. return self;
  5257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5258. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.a$cls)});
  5259. //>>excludeEnd("ctx");
  5260. },
  5261. //>>excludeStart("ide", pragmas.excludeIdeData);
  5262. args: ["anInteger"],
  5263. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  5264. referencedClasses: [],
  5265. //>>excludeEnd("ide");
  5266. messageSends: []
  5267. }),
  5268. $globals.Array.a$cls);
  5269. $core.addMethod(
  5270. $core.method({
  5271. selector: "with:",
  5272. protocol: "instance creation",
  5273. fn: function (anObject){
  5274. var self=this,$self=this;
  5275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5276. return $core.withContext(function($ctx1) {
  5277. //>>excludeEnd("ctx");
  5278. var $1;
  5279. $1=$self._new_((1));
  5280. $recv($1)._at_put_((1),anObject);
  5281. return $recv($1)._yourself();
  5282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5283. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.a$cls)});
  5284. //>>excludeEnd("ctx");
  5285. },
  5286. //>>excludeStart("ide", pragmas.excludeIdeData);
  5287. args: ["anObject"],
  5288. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  5289. referencedClasses: [],
  5290. //>>excludeEnd("ide");
  5291. messageSends: ["at:put:", "new:", "yourself"]
  5292. }),
  5293. $globals.Array.a$cls);
  5294. $core.addMethod(
  5295. $core.method({
  5296. selector: "with:with:",
  5297. protocol: "instance creation",
  5298. fn: function (anObject,anObject2){
  5299. var self=this,$self=this;
  5300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5301. return $core.withContext(function($ctx1) {
  5302. //>>excludeEnd("ctx");
  5303. var $1;
  5304. $1=$self._new_((2));
  5305. $recv($1)._at_put_((1),anObject);
  5306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5307. $ctx1.sendIdx["at:put:"]=1;
  5308. //>>excludeEnd("ctx");
  5309. $recv($1)._at_put_((2),anObject2);
  5310. return $recv($1)._yourself();
  5311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5312. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.a$cls)});
  5313. //>>excludeEnd("ctx");
  5314. },
  5315. //>>excludeStart("ide", pragmas.excludeIdeData);
  5316. args: ["anObject", "anObject2"],
  5317. 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",
  5318. referencedClasses: [],
  5319. //>>excludeEnd("ide");
  5320. messageSends: ["at:put:", "new:", "yourself"]
  5321. }),
  5322. $globals.Array.a$cls);
  5323. $core.addMethod(
  5324. $core.method({
  5325. selector: "with:with:with:",
  5326. protocol: "instance creation",
  5327. fn: function (anObject,anObject2,anObject3){
  5328. var self=this,$self=this;
  5329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5330. return $core.withContext(function($ctx1) {
  5331. //>>excludeEnd("ctx");
  5332. var $1;
  5333. $1=$self._new_((3));
  5334. $recv($1)._at_put_((1),anObject);
  5335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5336. $ctx1.sendIdx["at:put:"]=1;
  5337. //>>excludeEnd("ctx");
  5338. $recv($1)._at_put_((2),anObject2);
  5339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5340. $ctx1.sendIdx["at:put:"]=2;
  5341. //>>excludeEnd("ctx");
  5342. $recv($1)._at_put_((3),anObject3);
  5343. return $recv($1)._yourself();
  5344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5345. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.a$cls)});
  5346. //>>excludeEnd("ctx");
  5347. },
  5348. //>>excludeStart("ide", pragmas.excludeIdeData);
  5349. args: ["anObject", "anObject2", "anObject3"],
  5350. 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",
  5351. referencedClasses: [],
  5352. //>>excludeEnd("ide");
  5353. messageSends: ["at:put:", "new:", "yourself"]
  5354. }),
  5355. $globals.Array.a$cls);
  5356. $core.addMethod(
  5357. $core.method({
  5358. selector: "withAll:",
  5359. protocol: "instance creation",
  5360. fn: function (aCollection){
  5361. var self=this,$self=this;
  5362. var instance,index;
  5363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5364. return $core.withContext(function($ctx1) {
  5365. //>>excludeEnd("ctx");
  5366. index=(1);
  5367. instance=$self._new_($recv(aCollection)._size());
  5368. $recv(aCollection)._do_((function(each){
  5369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5370. return $core.withContext(function($ctx2) {
  5371. //>>excludeEnd("ctx");
  5372. $recv(instance)._at_put_(index,each);
  5373. index=$recv(index).__plus((1));
  5374. return index;
  5375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5376. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5377. //>>excludeEnd("ctx");
  5378. }));
  5379. return instance;
  5380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5381. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.a$cls)});
  5382. //>>excludeEnd("ctx");
  5383. },
  5384. //>>excludeStart("ide", pragmas.excludeIdeData);
  5385. args: ["aCollection"],
  5386. 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",
  5387. referencedClasses: [],
  5388. //>>excludeEnd("ide");
  5389. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  5390. }),
  5391. $globals.Array.a$cls);
  5392. $core.addClass("CharacterArray", $globals.SequenceableCollection, [], "Kernel-Collections");
  5393. //>>excludeStart("ide", pragmas.excludeIdeData);
  5394. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  5395. //>>excludeEnd("ide");
  5396. $core.addMethod(
  5397. $core.method({
  5398. selector: ",",
  5399. protocol: "copying",
  5400. fn: function (aString){
  5401. var self=this,$self=this;
  5402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5403. return $core.withContext(function($ctx1) {
  5404. //>>excludeEnd("ctx");
  5405. var $1;
  5406. $1=$self._asString();
  5407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5408. $ctx1.sendIdx["asString"]=1;
  5409. //>>excludeEnd("ctx");
  5410. return $recv($1).__comma($recv(aString)._asString());
  5411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5412. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  5413. //>>excludeEnd("ctx");
  5414. },
  5415. //>>excludeStart("ide", pragmas.excludeIdeData);
  5416. args: ["aString"],
  5417. source: ", aString\x0a\x09^ self asString, aString asString",
  5418. referencedClasses: [],
  5419. //>>excludeEnd("ide");
  5420. messageSends: [",", "asString"]
  5421. }),
  5422. $globals.CharacterArray);
  5423. $core.addMethod(
  5424. $core.method({
  5425. selector: "add:",
  5426. protocol: "adding/removing",
  5427. fn: function (anObject){
  5428. var self=this,$self=this;
  5429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5430. return $core.withContext(function($ctx1) {
  5431. //>>excludeEnd("ctx");
  5432. $self._errorReadOnly();
  5433. return self;
  5434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5435. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  5436. //>>excludeEnd("ctx");
  5437. },
  5438. //>>excludeStart("ide", pragmas.excludeIdeData);
  5439. args: ["anObject"],
  5440. source: "add: anObject\x0a\x09self errorReadOnly",
  5441. referencedClasses: [],
  5442. //>>excludeEnd("ide");
  5443. messageSends: ["errorReadOnly"]
  5444. }),
  5445. $globals.CharacterArray);
  5446. $core.addMethod(
  5447. $core.method({
  5448. selector: "asLowercase",
  5449. protocol: "converting",
  5450. fn: function (){
  5451. var self=this,$self=this;
  5452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5453. return $core.withContext(function($ctx1) {
  5454. //>>excludeEnd("ctx");
  5455. return $recv($self._class())._fromString_($recv($self._asString())._asLowercase());
  5456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5457. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  5458. //>>excludeEnd("ctx");
  5459. },
  5460. //>>excludeStart("ide", pragmas.excludeIdeData);
  5461. args: [],
  5462. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  5463. referencedClasses: [],
  5464. //>>excludeEnd("ide");
  5465. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  5466. }),
  5467. $globals.CharacterArray);
  5468. $core.addMethod(
  5469. $core.method({
  5470. selector: "asNumber",
  5471. protocol: "converting",
  5472. fn: function (){
  5473. var self=this,$self=this;
  5474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5475. return $core.withContext(function($ctx1) {
  5476. //>>excludeEnd("ctx");
  5477. return $recv($self._asString())._asNumber();
  5478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5479. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  5480. //>>excludeEnd("ctx");
  5481. },
  5482. //>>excludeStart("ide", pragmas.excludeIdeData);
  5483. args: [],
  5484. source: "asNumber\x0a\x09^ self asString asNumber",
  5485. referencedClasses: [],
  5486. //>>excludeEnd("ide");
  5487. messageSends: ["asNumber", "asString"]
  5488. }),
  5489. $globals.CharacterArray);
  5490. $core.addMethod(
  5491. $core.method({
  5492. selector: "asString",
  5493. protocol: "converting",
  5494. fn: function (){
  5495. var self=this,$self=this;
  5496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5497. return $core.withContext(function($ctx1) {
  5498. //>>excludeEnd("ctx");
  5499. return $self._subclassResponsibility();
  5500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5501. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  5502. //>>excludeEnd("ctx");
  5503. },
  5504. //>>excludeStart("ide", pragmas.excludeIdeData);
  5505. args: [],
  5506. source: "asString\x0a\x09^ self subclassResponsibility",
  5507. referencedClasses: [],
  5508. //>>excludeEnd("ide");
  5509. messageSends: ["subclassResponsibility"]
  5510. }),
  5511. $globals.CharacterArray);
  5512. $core.addMethod(
  5513. $core.method({
  5514. selector: "asSymbol",
  5515. protocol: "converting",
  5516. fn: function (){
  5517. var self=this,$self=this;
  5518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5519. return $core.withContext(function($ctx1) {
  5520. //>>excludeEnd("ctx");
  5521. return $self._asString();
  5522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5523. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  5524. //>>excludeEnd("ctx");
  5525. },
  5526. //>>excludeStart("ide", pragmas.excludeIdeData);
  5527. args: [],
  5528. source: "asSymbol\x0a\x09^ self asString",
  5529. referencedClasses: [],
  5530. //>>excludeEnd("ide");
  5531. messageSends: ["asString"]
  5532. }),
  5533. $globals.CharacterArray);
  5534. $core.addMethod(
  5535. $core.method({
  5536. selector: "asSymbolPrintOn:",
  5537. protocol: "printing",
  5538. fn: function (aStream){
  5539. var self=this,$self=this;
  5540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5541. return $core.withContext(function($ctx1) {
  5542. //>>excludeEnd("ctx");
  5543. var $1;
  5544. $recv(aStream)._nextPutAll_("#");
  5545. $1=$recv($self._asString())._isSelector();
  5546. if($core.assert($1)){
  5547. $recv(aStream)._nextPut_(self);
  5548. } else {
  5549. $self._printOn_(aStream);
  5550. }
  5551. return self;
  5552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5553. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.CharacterArray)});
  5554. //>>excludeEnd("ctx");
  5555. },
  5556. //>>excludeStart("ide", pragmas.excludeIdeData);
  5557. args: ["aStream"],
  5558. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  5559. referencedClasses: [],
  5560. //>>excludeEnd("ide");
  5561. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  5562. }),
  5563. $globals.CharacterArray);
  5564. $core.addMethod(
  5565. $core.method({
  5566. selector: "asUppercase",
  5567. protocol: "converting",
  5568. fn: function (){
  5569. var self=this,$self=this;
  5570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5571. return $core.withContext(function($ctx1) {
  5572. //>>excludeEnd("ctx");
  5573. return $recv($self._class())._fromString_($recv($self._asString())._asUppercase());
  5574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5575. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  5576. //>>excludeEnd("ctx");
  5577. },
  5578. //>>excludeStart("ide", pragmas.excludeIdeData);
  5579. args: [],
  5580. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  5581. referencedClasses: [],
  5582. //>>excludeEnd("ide");
  5583. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  5584. }),
  5585. $globals.CharacterArray);
  5586. $core.addMethod(
  5587. $core.method({
  5588. selector: "at:put:",
  5589. protocol: "accessing",
  5590. fn: function (anIndex,anObject){
  5591. var self=this,$self=this;
  5592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5593. return $core.withContext(function($ctx1) {
  5594. //>>excludeEnd("ctx");
  5595. $self._errorReadOnly();
  5596. return self;
  5597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5598. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  5599. //>>excludeEnd("ctx");
  5600. },
  5601. //>>excludeStart("ide", pragmas.excludeIdeData);
  5602. args: ["anIndex", "anObject"],
  5603. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5604. referencedClasses: [],
  5605. //>>excludeEnd("ide");
  5606. messageSends: ["errorReadOnly"]
  5607. }),
  5608. $globals.CharacterArray);
  5609. $core.addMethod(
  5610. $core.method({
  5611. selector: "errorReadOnly",
  5612. protocol: "error handling",
  5613. fn: function (){
  5614. var self=this,$self=this;
  5615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5616. return $core.withContext(function($ctx1) {
  5617. //>>excludeEnd("ctx");
  5618. $self._error_("Object is read-only");
  5619. return self;
  5620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5621. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  5622. //>>excludeEnd("ctx");
  5623. },
  5624. //>>excludeStart("ide", pragmas.excludeIdeData);
  5625. args: [],
  5626. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5627. referencedClasses: [],
  5628. //>>excludeEnd("ide");
  5629. messageSends: ["error:"]
  5630. }),
  5631. $globals.CharacterArray);
  5632. $core.addMethod(
  5633. $core.method({
  5634. selector: "printOn:",
  5635. protocol: "printing",
  5636. fn: function (aStream){
  5637. var self=this,$self=this;
  5638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5639. return $core.withContext(function($ctx1) {
  5640. //>>excludeEnd("ctx");
  5641. $recv($self._asString())._printOn_(aStream);
  5642. return self;
  5643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5644. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  5645. //>>excludeEnd("ctx");
  5646. },
  5647. //>>excludeStart("ide", pragmas.excludeIdeData);
  5648. args: ["aStream"],
  5649. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  5650. referencedClasses: [],
  5651. //>>excludeEnd("ide");
  5652. messageSends: ["printOn:", "asString"]
  5653. }),
  5654. $globals.CharacterArray);
  5655. $core.addMethod(
  5656. $core.method({
  5657. selector: "putOn:",
  5658. protocol: "streaming",
  5659. fn: function (aStream){
  5660. var self=this,$self=this;
  5661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5662. return $core.withContext(function($ctx1) {
  5663. //>>excludeEnd("ctx");
  5664. $recv(aStream)._nextPutString_(self);
  5665. return self;
  5666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5667. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  5668. //>>excludeEnd("ctx");
  5669. },
  5670. //>>excludeStart("ide", pragmas.excludeIdeData);
  5671. args: ["aStream"],
  5672. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  5673. referencedClasses: [],
  5674. //>>excludeEnd("ide");
  5675. messageSends: ["nextPutString:"]
  5676. }),
  5677. $globals.CharacterArray);
  5678. $core.addMethod(
  5679. $core.method({
  5680. selector: "remove:",
  5681. protocol: "adding/removing",
  5682. fn: function (anObject){
  5683. var self=this,$self=this;
  5684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5685. return $core.withContext(function($ctx1) {
  5686. //>>excludeEnd("ctx");
  5687. $self._errorReadOnly();
  5688. return self;
  5689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5690. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  5691. //>>excludeEnd("ctx");
  5692. },
  5693. //>>excludeStart("ide", pragmas.excludeIdeData);
  5694. args: ["anObject"],
  5695. source: "remove: anObject\x0a\x09self errorReadOnly",
  5696. referencedClasses: [],
  5697. //>>excludeEnd("ide");
  5698. messageSends: ["errorReadOnly"]
  5699. }),
  5700. $globals.CharacterArray);
  5701. $core.addMethod(
  5702. $core.method({
  5703. selector: "remove:ifAbsent:",
  5704. protocol: "adding/removing",
  5705. fn: function (anObject,aBlock){
  5706. var self=this,$self=this;
  5707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5708. return $core.withContext(function($ctx1) {
  5709. //>>excludeEnd("ctx");
  5710. $self._errorReadOnly();
  5711. return self;
  5712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5713. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.CharacterArray)});
  5714. //>>excludeEnd("ctx");
  5715. },
  5716. //>>excludeStart("ide", pragmas.excludeIdeData);
  5717. args: ["anObject", "aBlock"],
  5718. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  5719. referencedClasses: [],
  5720. //>>excludeEnd("ide");
  5721. messageSends: ["errorReadOnly"]
  5722. }),
  5723. $globals.CharacterArray);
  5724. $core.addMethod(
  5725. $core.method({
  5726. selector: "symbolPrintString",
  5727. protocol: "printing",
  5728. fn: function (){
  5729. var self=this,$self=this;
  5730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5731. return $core.withContext(function($ctx1) {
  5732. //>>excludeEnd("ctx");
  5733. return $recv($globals.String)._streamContents_((function(str){
  5734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5735. return $core.withContext(function($ctx2) {
  5736. //>>excludeEnd("ctx");
  5737. return $self._asSymbolPrintOn_(str);
  5738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5739. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  5740. //>>excludeEnd("ctx");
  5741. }));
  5742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5743. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.CharacterArray)});
  5744. //>>excludeEnd("ctx");
  5745. },
  5746. //>>excludeStart("ide", pragmas.excludeIdeData);
  5747. args: [],
  5748. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  5749. referencedClasses: ["String"],
  5750. //>>excludeEnd("ide");
  5751. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  5752. }),
  5753. $globals.CharacterArray);
  5754. $core.addMethod(
  5755. $core.method({
  5756. selector: "fromString:",
  5757. protocol: "instance creation",
  5758. fn: function (aString){
  5759. var self=this,$self=this;
  5760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5761. return $core.withContext(function($ctx1) {
  5762. //>>excludeEnd("ctx");
  5763. $self._subclassResponsibility();
  5764. return self;
  5765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5766. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.a$cls)});
  5767. //>>excludeEnd("ctx");
  5768. },
  5769. //>>excludeStart("ide", pragmas.excludeIdeData);
  5770. args: ["aString"],
  5771. source: "fromString: aString\x0a\x09self subclassResponsibility",
  5772. referencedClasses: [],
  5773. //>>excludeEnd("ide");
  5774. messageSends: ["subclassResponsibility"]
  5775. }),
  5776. $globals.CharacterArray.a$cls);
  5777. $core.addClass("String", $globals.CharacterArray, [], "Kernel-Collections");
  5778. //>>excludeStart("ide", pragmas.excludeIdeData);
  5779. $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 >> #,`";
  5780. //>>excludeEnd("ide");
  5781. $core.addMethod(
  5782. $core.method({
  5783. selector: ",",
  5784. protocol: "copying",
  5785. fn: function (aString){
  5786. var self=this,$self=this;
  5787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5788. return $core.withContext(function($ctx1) {
  5789. //>>excludeEnd("ctx");
  5790. return String(self) + aString;
  5791. return self;
  5792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5793. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  5794. //>>excludeEnd("ctx");
  5795. },
  5796. //>>excludeStart("ide", pragmas.excludeIdeData);
  5797. args: ["aString"],
  5798. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  5799. referencedClasses: [],
  5800. //>>excludeEnd("ide");
  5801. messageSends: []
  5802. }),
  5803. $globals.String);
  5804. $core.addMethod(
  5805. $core.method({
  5806. selector: "<",
  5807. protocol: "comparing",
  5808. fn: function (aString){
  5809. var self=this,$self=this;
  5810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5811. return $core.withContext(function($ctx1) {
  5812. //>>excludeEnd("ctx");
  5813. return String(self) < aString._asString();
  5814. return self;
  5815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5816. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  5817. //>>excludeEnd("ctx");
  5818. },
  5819. //>>excludeStart("ide", pragmas.excludeIdeData);
  5820. args: ["aString"],
  5821. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  5822. referencedClasses: [],
  5823. //>>excludeEnd("ide");
  5824. messageSends: []
  5825. }),
  5826. $globals.String);
  5827. $core.addMethod(
  5828. $core.method({
  5829. selector: "<=",
  5830. protocol: "comparing",
  5831. fn: function (aString){
  5832. var self=this,$self=this;
  5833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5834. return $core.withContext(function($ctx1) {
  5835. //>>excludeEnd("ctx");
  5836. return String(self) <= aString._asString();
  5837. return self;
  5838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5839. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  5840. //>>excludeEnd("ctx");
  5841. },
  5842. //>>excludeStart("ide", pragmas.excludeIdeData);
  5843. args: ["aString"],
  5844. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  5845. referencedClasses: [],
  5846. //>>excludeEnd("ide");
  5847. messageSends: []
  5848. }),
  5849. $globals.String);
  5850. $core.addMethod(
  5851. $core.method({
  5852. selector: "=",
  5853. protocol: "comparing",
  5854. fn: function (aString){
  5855. var self=this,$self=this;
  5856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5857. return $core.withContext(function($ctx1) {
  5858. //>>excludeEnd("ctx");
  5859. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  5860. return self;
  5861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5862. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  5863. //>>excludeEnd("ctx");
  5864. },
  5865. //>>excludeStart("ide", pragmas.excludeIdeData);
  5866. args: ["aString"],
  5867. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  5868. referencedClasses: [],
  5869. //>>excludeEnd("ide");
  5870. messageSends: []
  5871. }),
  5872. $globals.String);
  5873. $core.addMethod(
  5874. $core.method({
  5875. selector: "==",
  5876. protocol: "comparing",
  5877. fn: function (aString){
  5878. var self=this,$self=this;
  5879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5880. return $core.withContext(function($ctx1) {
  5881. //>>excludeEnd("ctx");
  5882. if (typeof aString === "string") return String(self) === aString;
  5883. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  5884. else return false;;
  5885. return self;
  5886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5887. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  5888. //>>excludeEnd("ctx");
  5889. },
  5890. //>>excludeStart("ide", pragmas.excludeIdeData);
  5891. args: ["aString"],
  5892. source: "== aString\x0a<inlineJS: '\x0a\x09if (typeof aString === \x22string\x22) return String(self) === aString;\x0a\x09else if (aString != null && typeof aString === \x22object\x22) return String(self) === aString.valueOf();\x0a\x09else return false;\x0a'>",
  5893. referencedClasses: [],
  5894. //>>excludeEnd("ide");
  5895. messageSends: []
  5896. }),
  5897. $globals.String);
  5898. $core.addMethod(
  5899. $core.method({
  5900. selector: ">",
  5901. protocol: "comparing",
  5902. fn: function (aString){
  5903. var self=this,$self=this;
  5904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5905. return $core.withContext(function($ctx1) {
  5906. //>>excludeEnd("ctx");
  5907. return String(self) > aString._asString();
  5908. return self;
  5909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5910. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  5911. //>>excludeEnd("ctx");
  5912. },
  5913. //>>excludeStart("ide", pragmas.excludeIdeData);
  5914. args: ["aString"],
  5915. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  5916. referencedClasses: [],
  5917. //>>excludeEnd("ide");
  5918. messageSends: []
  5919. }),
  5920. $globals.String);
  5921. $core.addMethod(
  5922. $core.method({
  5923. selector: ">=",
  5924. protocol: "comparing",
  5925. fn: function (aString){
  5926. var self=this,$self=this;
  5927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5928. return $core.withContext(function($ctx1) {
  5929. //>>excludeEnd("ctx");
  5930. return String(self) >= aString._asString();
  5931. return self;
  5932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5933. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  5934. //>>excludeEnd("ctx");
  5935. },
  5936. //>>excludeStart("ide", pragmas.excludeIdeData);
  5937. args: ["aString"],
  5938. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  5939. referencedClasses: [],
  5940. //>>excludeEnd("ide");
  5941. messageSends: []
  5942. }),
  5943. $globals.String);
  5944. $core.addMethod(
  5945. $core.method({
  5946. selector: "asJavaScriptMethodName",
  5947. protocol: "converting",
  5948. fn: function (){
  5949. var self=this,$self=this;
  5950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5951. return $core.withContext(function($ctx1) {
  5952. //>>excludeEnd("ctx");
  5953. return $core.st2js(self);
  5954. return self;
  5955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5956. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  5957. //>>excludeEnd("ctx");
  5958. },
  5959. //>>excludeStart("ide", pragmas.excludeIdeData);
  5960. args: [],
  5961. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  5962. referencedClasses: [],
  5963. //>>excludeEnd("ide");
  5964. messageSends: []
  5965. }),
  5966. $globals.String);
  5967. $core.addMethod(
  5968. $core.method({
  5969. selector: "asJavaScriptObject",
  5970. protocol: "converting",
  5971. fn: function (){
  5972. var self=this,$self=this;
  5973. return self;
  5974. },
  5975. //>>excludeStart("ide", pragmas.excludeIdeData);
  5976. args: [],
  5977. source: "asJavaScriptObject\x0a\x09^ self",
  5978. referencedClasses: [],
  5979. //>>excludeEnd("ide");
  5980. messageSends: []
  5981. }),
  5982. $globals.String);
  5983. $core.addMethod(
  5984. $core.method({
  5985. selector: "asJavaScriptSource",
  5986. protocol: "converting",
  5987. fn: function (){
  5988. var self=this,$self=this;
  5989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5990. return $core.withContext(function($ctx1) {
  5991. //>>excludeEnd("ctx");
  5992. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5993. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5994. else
  5995. return "\"" + self + "\"";
  5996. ;
  5997. return self;
  5998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5999. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  6000. //>>excludeEnd("ctx");
  6001. },
  6002. //>>excludeStart("ide", pragmas.excludeIdeData);
  6003. args: [],
  6004. 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'>",
  6005. referencedClasses: [],
  6006. //>>excludeEnd("ide");
  6007. messageSends: []
  6008. }),
  6009. $globals.String);
  6010. $core.addMethod(
  6011. $core.method({
  6012. selector: "asLowercase",
  6013. protocol: "converting",
  6014. fn: function (){
  6015. var self=this,$self=this;
  6016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6017. return $core.withContext(function($ctx1) {
  6018. //>>excludeEnd("ctx");
  6019. return self.toLowerCase();
  6020. return self;
  6021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6022. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  6023. //>>excludeEnd("ctx");
  6024. },
  6025. //>>excludeStart("ide", pragmas.excludeIdeData);
  6026. args: [],
  6027. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  6028. referencedClasses: [],
  6029. //>>excludeEnd("ide");
  6030. messageSends: []
  6031. }),
  6032. $globals.String);
  6033. $core.addMethod(
  6034. $core.method({
  6035. selector: "asMutator",
  6036. protocol: "converting",
  6037. fn: function (){
  6038. var self=this,$self=this;
  6039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6040. return $core.withContext(function($ctx1) {
  6041. //>>excludeEnd("ctx");
  6042. var $1;
  6043. $1=$recv($self._last()).__eq(":");
  6044. if(!$core.assert($1)){
  6045. return $self.__comma(":");
  6046. }
  6047. return self;
  6048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6049. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  6050. //>>excludeEnd("ctx");
  6051. },
  6052. //>>excludeStart("ide", pragmas.excludeIdeData);
  6053. args: [],
  6054. 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",
  6055. referencedClasses: [],
  6056. //>>excludeEnd("ide");
  6057. messageSends: ["ifFalse:", "=", "last", ","]
  6058. }),
  6059. $globals.String);
  6060. $core.addMethod(
  6061. $core.method({
  6062. selector: "asNumber",
  6063. protocol: "converting",
  6064. fn: function (){
  6065. var self=this,$self=this;
  6066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6067. return $core.withContext(function($ctx1) {
  6068. //>>excludeEnd("ctx");
  6069. return Number(self);
  6070. return self;
  6071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6072. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  6073. //>>excludeEnd("ctx");
  6074. },
  6075. //>>excludeStart("ide", pragmas.excludeIdeData);
  6076. args: [],
  6077. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  6078. referencedClasses: [],
  6079. //>>excludeEnd("ide");
  6080. messageSends: []
  6081. }),
  6082. $globals.String);
  6083. $core.addMethod(
  6084. $core.method({
  6085. selector: "asRegexp",
  6086. protocol: "converting",
  6087. fn: function (){
  6088. var self=this,$self=this;
  6089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6090. return $core.withContext(function($ctx1) {
  6091. //>>excludeEnd("ctx");
  6092. return $recv($globals.RegularExpression)._fromString_(self);
  6093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6094. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  6095. //>>excludeEnd("ctx");
  6096. },
  6097. //>>excludeStart("ide", pragmas.excludeIdeData);
  6098. args: [],
  6099. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  6100. referencedClasses: ["RegularExpression"],
  6101. //>>excludeEnd("ide");
  6102. messageSends: ["fromString:"]
  6103. }),
  6104. $globals.String);
  6105. $core.addMethod(
  6106. $core.method({
  6107. selector: "asString",
  6108. protocol: "converting",
  6109. fn: function (){
  6110. var self=this,$self=this;
  6111. return self;
  6112. },
  6113. //>>excludeStart("ide", pragmas.excludeIdeData);
  6114. args: [],
  6115. source: "asString\x0a\x09^ self",
  6116. referencedClasses: [],
  6117. //>>excludeEnd("ide");
  6118. messageSends: []
  6119. }),
  6120. $globals.String);
  6121. $core.addMethod(
  6122. $core.method({
  6123. selector: "asSymbol",
  6124. protocol: "converting",
  6125. fn: function (){
  6126. var self=this,$self=this;
  6127. return self;
  6128. },
  6129. //>>excludeStart("ide", pragmas.excludeIdeData);
  6130. args: [],
  6131. source: "asSymbol\x0a\x09^ self",
  6132. referencedClasses: [],
  6133. //>>excludeEnd("ide");
  6134. messageSends: []
  6135. }),
  6136. $globals.String);
  6137. $core.addMethod(
  6138. $core.method({
  6139. selector: "asUppercase",
  6140. protocol: "converting",
  6141. fn: function (){
  6142. var self=this,$self=this;
  6143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6144. return $core.withContext(function($ctx1) {
  6145. //>>excludeEnd("ctx");
  6146. return self.toUpperCase();
  6147. return self;
  6148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6149. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  6150. //>>excludeEnd("ctx");
  6151. },
  6152. //>>excludeStart("ide", pragmas.excludeIdeData);
  6153. args: [],
  6154. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  6155. referencedClasses: [],
  6156. //>>excludeEnd("ide");
  6157. messageSends: []
  6158. }),
  6159. $globals.String);
  6160. $core.addMethod(
  6161. $core.method({
  6162. selector: "asciiValue",
  6163. protocol: "accessing",
  6164. fn: function (){
  6165. var self=this,$self=this;
  6166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6167. return $core.withContext(function($ctx1) {
  6168. //>>excludeEnd("ctx");
  6169. return self.charCodeAt(0);;
  6170. return self;
  6171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6172. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  6173. //>>excludeEnd("ctx");
  6174. },
  6175. //>>excludeStart("ide", pragmas.excludeIdeData);
  6176. args: [],
  6177. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  6178. referencedClasses: [],
  6179. //>>excludeEnd("ide");
  6180. messageSends: []
  6181. }),
  6182. $globals.String);
  6183. $core.addMethod(
  6184. $core.method({
  6185. selector: "at:ifAbsent:",
  6186. protocol: "accessing",
  6187. fn: function (anIndex,aBlock){
  6188. var self=this,$self=this;
  6189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6190. return $core.withContext(function($ctx1) {
  6191. //>>excludeEnd("ctx");
  6192. return String(self)[anIndex - 1] || aBlock._value();
  6193. return self;
  6194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6195. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  6196. //>>excludeEnd("ctx");
  6197. },
  6198. //>>excludeStart("ide", pragmas.excludeIdeData);
  6199. args: ["anIndex", "aBlock"],
  6200. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  6201. referencedClasses: [],
  6202. //>>excludeEnd("ide");
  6203. messageSends: []
  6204. }),
  6205. $globals.String);
  6206. $core.addMethod(
  6207. $core.method({
  6208. selector: "at:ifPresent:ifAbsent:",
  6209. protocol: "accessing",
  6210. fn: function (anIndex,aBlock,anotherBlock){
  6211. var self=this,$self=this;
  6212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6213. return $core.withContext(function($ctx1) {
  6214. //>>excludeEnd("ctx");
  6215. var result = String(self)[anIndex - 1];
  6216. return result ? aBlock._value_(result) : anotherBlock._value();
  6217. ;
  6218. return self;
  6219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6220. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  6221. //>>excludeEnd("ctx");
  6222. },
  6223. //>>excludeStart("ide", pragmas.excludeIdeData);
  6224. args: ["anIndex", "aBlock", "anotherBlock"],
  6225. 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'>",
  6226. referencedClasses: [],
  6227. //>>excludeEnd("ide");
  6228. messageSends: []
  6229. }),
  6230. $globals.String);
  6231. $core.addMethod(
  6232. $core.method({
  6233. selector: "capitalized",
  6234. protocol: "converting",
  6235. fn: function (){
  6236. var self=this,$self=this;
  6237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6238. return $core.withContext(function($ctx1) {
  6239. //>>excludeEnd("ctx");
  6240. return $self._ifNotEmpty_((function(){
  6241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6242. return $core.withContext(function($ctx2) {
  6243. //>>excludeEnd("ctx");
  6244. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  6245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6247. //>>excludeEnd("ctx");
  6248. }));
  6249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6250. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  6251. //>>excludeEnd("ctx");
  6252. },
  6253. //>>excludeStart("ide", pragmas.excludeIdeData);
  6254. args: [],
  6255. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  6256. referencedClasses: [],
  6257. //>>excludeEnd("ide");
  6258. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  6259. }),
  6260. $globals.String);
  6261. $core.addMethod(
  6262. $core.method({
  6263. selector: "charCodeAt:",
  6264. protocol: "accessing",
  6265. fn: function (anInteger){
  6266. var self=this,$self=this;
  6267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6268. return $core.withContext(function($ctx1) {
  6269. //>>excludeEnd("ctx");
  6270. return self.charCodeAt(anInteger - 1);
  6271. return self;
  6272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6273. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  6274. //>>excludeEnd("ctx");
  6275. },
  6276. //>>excludeStart("ide", pragmas.excludeIdeData);
  6277. args: ["anInteger"],
  6278. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  6279. referencedClasses: [],
  6280. //>>excludeEnd("ide");
  6281. messageSends: []
  6282. }),
  6283. $globals.String);
  6284. $core.addMethod(
  6285. $core.method({
  6286. selector: "copyFrom:to:",
  6287. protocol: "copying",
  6288. fn: function (anIndex,anotherIndex){
  6289. var self=this,$self=this;
  6290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6291. return $core.withContext(function($ctx1) {
  6292. //>>excludeEnd("ctx");
  6293. return self.substring(anIndex - 1, anotherIndex);
  6294. return self;
  6295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6296. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  6297. //>>excludeEnd("ctx");
  6298. },
  6299. //>>excludeStart("ide", pragmas.excludeIdeData);
  6300. args: ["anIndex", "anotherIndex"],
  6301. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  6302. referencedClasses: [],
  6303. //>>excludeEnd("ide");
  6304. messageSends: []
  6305. }),
  6306. $globals.String);
  6307. $core.addMethod(
  6308. $core.method({
  6309. selector: "crlfSanitized",
  6310. protocol: "converting",
  6311. fn: function (){
  6312. var self=this,$self=this;
  6313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6314. return $core.withContext(function($ctx1) {
  6315. //>>excludeEnd("ctx");
  6316. return $recv($self._lines())._join_($recv($globals.String)._lf());
  6317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6318. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  6319. //>>excludeEnd("ctx");
  6320. },
  6321. //>>excludeStart("ide", pragmas.excludeIdeData);
  6322. args: [],
  6323. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  6324. referencedClasses: ["String"],
  6325. //>>excludeEnd("ide");
  6326. messageSends: ["join:", "lines", "lf"]
  6327. }),
  6328. $globals.String);
  6329. $core.addMethod(
  6330. $core.method({
  6331. selector: "deepCopy",
  6332. protocol: "copying",
  6333. fn: function (){
  6334. var self=this,$self=this;
  6335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6336. return $core.withContext(function($ctx1) {
  6337. //>>excludeEnd("ctx");
  6338. return $self._shallowCopy();
  6339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6340. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  6341. //>>excludeEnd("ctx");
  6342. },
  6343. //>>excludeStart("ide", pragmas.excludeIdeData);
  6344. args: [],
  6345. source: "deepCopy\x0a\x09^ self shallowCopy",
  6346. referencedClasses: [],
  6347. //>>excludeEnd("ide");
  6348. messageSends: ["shallowCopy"]
  6349. }),
  6350. $globals.String);
  6351. $core.addMethod(
  6352. $core.method({
  6353. selector: "escaped",
  6354. protocol: "converting",
  6355. fn: function (){
  6356. var self=this,$self=this;
  6357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6358. return $core.withContext(function($ctx1) {
  6359. //>>excludeEnd("ctx");
  6360. return escape(self);
  6361. return self;
  6362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6363. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  6364. //>>excludeEnd("ctx");
  6365. },
  6366. //>>excludeStart("ide", pragmas.excludeIdeData);
  6367. args: [],
  6368. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  6369. referencedClasses: [],
  6370. //>>excludeEnd("ide");
  6371. messageSends: []
  6372. }),
  6373. $globals.String);
  6374. $core.addMethod(
  6375. $core.method({
  6376. selector: "includesSubString:",
  6377. protocol: "testing",
  6378. fn: function (subString){
  6379. var self=this,$self=this;
  6380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6381. return $core.withContext(function($ctx1) {
  6382. //>>excludeEnd("ctx");
  6383. return self.indexOf(subString) != -1;
  6384. return self;
  6385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6386. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  6387. //>>excludeEnd("ctx");
  6388. },
  6389. //>>excludeStart("ide", pragmas.excludeIdeData);
  6390. args: ["subString"],
  6391. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  6392. referencedClasses: [],
  6393. //>>excludeEnd("ide");
  6394. messageSends: []
  6395. }),
  6396. $globals.String);
  6397. $core.addMethod(
  6398. $core.method({
  6399. selector: "isCapitalized",
  6400. protocol: "testing",
  6401. fn: function (){
  6402. var self=this,$self=this;
  6403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6404. return $core.withContext(function($ctx1) {
  6405. //>>excludeEnd("ctx");
  6406. var $2,$1;
  6407. $2=$self._first();
  6408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6409. $ctx1.sendIdx["first"]=1;
  6410. //>>excludeEnd("ctx");
  6411. $1=$recv($2)._asUppercase();
  6412. return $recv($1).__eq_eq($self._first());
  6413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6414. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  6415. //>>excludeEnd("ctx");
  6416. },
  6417. //>>excludeStart("ide", pragmas.excludeIdeData);
  6418. args: [],
  6419. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  6420. referencedClasses: [],
  6421. //>>excludeEnd("ide");
  6422. messageSends: ["==", "asUppercase", "first"]
  6423. }),
  6424. $globals.String);
  6425. $core.addMethod(
  6426. $core.method({
  6427. selector: "isImmutable",
  6428. protocol: "testing",
  6429. fn: function (){
  6430. var self=this,$self=this;
  6431. return true;
  6432. },
  6433. //>>excludeStart("ide", pragmas.excludeIdeData);
  6434. args: [],
  6435. source: "isImmutable\x0a\x09^ true",
  6436. referencedClasses: [],
  6437. //>>excludeEnd("ide");
  6438. messageSends: []
  6439. }),
  6440. $globals.String);
  6441. $core.addMethod(
  6442. $core.method({
  6443. selector: "isSelector",
  6444. protocol: "testing",
  6445. fn: function (){
  6446. var self=this,$self=this;
  6447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6448. return $core.withContext(function($ctx1) {
  6449. //>>excludeEnd("ctx");
  6450. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  6451. return self;
  6452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6453. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  6454. //>>excludeEnd("ctx");
  6455. },
  6456. //>>excludeStart("ide", pragmas.excludeIdeData);
  6457. args: [],
  6458. 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>",
  6459. referencedClasses: [],
  6460. //>>excludeEnd("ide");
  6461. messageSends: []
  6462. }),
  6463. $globals.String);
  6464. $core.addMethod(
  6465. $core.method({
  6466. selector: "isString",
  6467. protocol: "testing",
  6468. fn: function (){
  6469. var self=this,$self=this;
  6470. return true;
  6471. },
  6472. //>>excludeStart("ide", pragmas.excludeIdeData);
  6473. args: [],
  6474. source: "isString\x0a\x09^ true",
  6475. referencedClasses: [],
  6476. //>>excludeEnd("ide");
  6477. messageSends: []
  6478. }),
  6479. $globals.String);
  6480. $core.addMethod(
  6481. $core.method({
  6482. selector: "isVowel",
  6483. protocol: "testing",
  6484. fn: function (){
  6485. var self=this,$self=this;
  6486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6487. return $core.withContext(function($ctx1) {
  6488. //>>excludeEnd("ctx");
  6489. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  6490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6491. return $core.withContext(function($ctx2) {
  6492. //>>excludeEnd("ctx");
  6493. return "aeiou"._includes_($self._asLowercase());
  6494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6495. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6496. //>>excludeEnd("ctx");
  6497. }));
  6498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6499. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  6500. //>>excludeEnd("ctx");
  6501. },
  6502. //>>excludeStart("ide", pragmas.excludeIdeData);
  6503. args: [],
  6504. 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 ]",
  6505. referencedClasses: [],
  6506. //>>excludeEnd("ide");
  6507. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  6508. }),
  6509. $globals.String);
  6510. $core.addMethod(
  6511. $core.method({
  6512. selector: "join:",
  6513. protocol: "split join",
  6514. fn: function (aCollection){
  6515. var self=this,$self=this;
  6516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6517. return $core.withContext(function($ctx1) {
  6518. //>>excludeEnd("ctx");
  6519. return $recv($globals.String)._streamContents_((function(stream){
  6520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6521. return $core.withContext(function($ctx2) {
  6522. //>>excludeEnd("ctx");
  6523. return $recv(aCollection)._do_separatedBy_((function(each){
  6524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6525. return $core.withContext(function($ctx3) {
  6526. //>>excludeEnd("ctx");
  6527. return $recv(stream)._nextPutAll_($recv(each)._asString());
  6528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6529. $ctx3.sendIdx["nextPutAll:"]=1;
  6530. //>>excludeEnd("ctx");
  6531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6532. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6533. //>>excludeEnd("ctx");
  6534. }),(function(){
  6535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6536. return $core.withContext(function($ctx3) {
  6537. //>>excludeEnd("ctx");
  6538. return $recv(stream)._nextPutAll_(self);
  6539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6540. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6541. //>>excludeEnd("ctx");
  6542. }));
  6543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6544. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6545. //>>excludeEnd("ctx");
  6546. }));
  6547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6548. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  6549. //>>excludeEnd("ctx");
  6550. },
  6551. //>>excludeStart("ide", pragmas.excludeIdeData);
  6552. args: ["aCollection"],
  6553. 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 ]]",
  6554. referencedClasses: ["String"],
  6555. //>>excludeEnd("ide");
  6556. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  6557. }),
  6558. $globals.String);
  6559. $core.addMethod(
  6560. $core.method({
  6561. selector: "lineIndicesDo:",
  6562. protocol: "split join",
  6563. fn: function (aBlock){
  6564. var self=this,$self=this;
  6565. var cr,lf,start,sz,nextLF,nextCR;
  6566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6567. return $core.withContext(function($ctx1) {
  6568. //>>excludeEnd("ctx");
  6569. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  6570. var $early={};
  6571. try {
  6572. start=(1);
  6573. sz=$self._size();
  6574. cr=$recv($globals.String)._cr();
  6575. nextCR=$self._indexOf_startingAt_(cr,(1));
  6576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6577. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  6578. //>>excludeEnd("ctx");
  6579. lf=$recv($globals.String)._lf();
  6580. nextLF=$self._indexOf_startingAt_(lf,(1));
  6581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6582. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  6583. //>>excludeEnd("ctx");
  6584. $recv((function(){
  6585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6586. return $core.withContext(function($ctx2) {
  6587. //>>excludeEnd("ctx");
  6588. return $recv(start).__lt_eq(sz);
  6589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6591. //>>excludeEnd("ctx");
  6592. }))._whileTrue_((function(){
  6593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6594. return $core.withContext(function($ctx2) {
  6595. //>>excludeEnd("ctx");
  6596. $2=$recv(nextLF).__eq((0));
  6597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6598. $ctx2.sendIdx["="]=1;
  6599. //>>excludeEnd("ctx");
  6600. $1=$recv($2)._and_((function(){
  6601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6602. return $core.withContext(function($ctx3) {
  6603. //>>excludeEnd("ctx");
  6604. return $recv(nextCR).__eq((0));
  6605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6606. $ctx3.sendIdx["="]=2;
  6607. //>>excludeEnd("ctx");
  6608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6609. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6610. //>>excludeEnd("ctx");
  6611. }));
  6612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6613. $ctx2.sendIdx["and:"]=1;
  6614. //>>excludeEnd("ctx");
  6615. if($core.assert($1)){
  6616. $recv(aBlock)._value_value_value_(start,sz,sz);
  6617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6618. $ctx2.sendIdx["value:value:value:"]=1;
  6619. //>>excludeEnd("ctx");
  6620. throw $early=[self];
  6621. }
  6622. $4=$recv(nextCR).__eq((0));
  6623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6624. $ctx2.sendIdx["="]=3;
  6625. //>>excludeEnd("ctx");
  6626. $3=$recv($4)._or_((function(){
  6627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6628. return $core.withContext(function($ctx3) {
  6629. //>>excludeEnd("ctx");
  6630. $5=(0).__lt(nextLF);
  6631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6632. $ctx3.sendIdx["<"]=1;
  6633. //>>excludeEnd("ctx");
  6634. return $recv($5)._and_((function(){
  6635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6636. return $core.withContext(function($ctx4) {
  6637. //>>excludeEnd("ctx");
  6638. return $recv(nextLF).__lt(nextCR);
  6639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6640. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  6641. //>>excludeEnd("ctx");
  6642. }));
  6643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6644. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  6645. //>>excludeEnd("ctx");
  6646. }));
  6647. if($core.assert($3)){
  6648. $6=start;
  6649. $7=$recv(nextLF).__minus((1));
  6650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6651. $ctx2.sendIdx["-"]=1;
  6652. //>>excludeEnd("ctx");
  6653. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  6654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6655. $ctx2.sendIdx["value:value:value:"]=2;
  6656. //>>excludeEnd("ctx");
  6657. start=(1).__plus(nextLF);
  6658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6659. $ctx2.sendIdx["+"]=1;
  6660. //>>excludeEnd("ctx");
  6661. start;
  6662. nextLF=$self._indexOf_startingAt_(lf,start);
  6663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6664. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  6665. //>>excludeEnd("ctx");
  6666. return nextLF;
  6667. } else {
  6668. $9=(1).__plus(nextCR);
  6669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6670. $ctx2.sendIdx["+"]=2;
  6671. //>>excludeEnd("ctx");
  6672. $8=$recv($9).__eq(nextLF);
  6673. if($core.assert($8)){
  6674. $10=start;
  6675. $11=$recv(nextCR).__minus((1));
  6676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6677. $ctx2.sendIdx["-"]=2;
  6678. //>>excludeEnd("ctx");
  6679. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  6680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6681. $ctx2.sendIdx["value:value:value:"]=3;
  6682. //>>excludeEnd("ctx");
  6683. start=(1).__plus(nextLF);
  6684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6685. $ctx2.sendIdx["+"]=3;
  6686. //>>excludeEnd("ctx");
  6687. start;
  6688. nextCR=$self._indexOf_startingAt_(cr,start);
  6689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6690. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  6691. //>>excludeEnd("ctx");
  6692. nextCR;
  6693. nextLF=$self._indexOf_startingAt_(lf,start);
  6694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6695. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  6696. //>>excludeEnd("ctx");
  6697. return nextLF;
  6698. } else {
  6699. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  6700. start=(1).__plus(nextCR);
  6701. start;
  6702. nextCR=$self._indexOf_startingAt_(cr,start);
  6703. return nextCR;
  6704. }
  6705. }
  6706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6707. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6708. //>>excludeEnd("ctx");
  6709. }));
  6710. return self;
  6711. }
  6712. catch(e) {if(e===$early)return e[0]; throw e}
  6713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6714. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  6715. //>>excludeEnd("ctx");
  6716. },
  6717. //>>excludeStart("ide", pragmas.excludeIdeData);
  6718. args: ["aBlock"],
  6719. 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 ] ]]",
  6720. referencedClasses: ["String"],
  6721. //>>excludeEnd("ide");
  6722. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  6723. }),
  6724. $globals.String);
  6725. $core.addMethod(
  6726. $core.method({
  6727. selector: "lineNumber:",
  6728. protocol: "split join",
  6729. fn: function (anIndex){
  6730. var self=this,$self=this;
  6731. var lineCount;
  6732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6733. return $core.withContext(function($ctx1) {
  6734. //>>excludeEnd("ctx");
  6735. var $2,$1;
  6736. var $early={};
  6737. try {
  6738. lineCount=(0);
  6739. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  6740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6741. return $core.withContext(function($ctx2) {
  6742. //>>excludeEnd("ctx");
  6743. lineCount=$recv(lineCount).__plus((1));
  6744. $2=lineCount;
  6745. $1=$recv($2).__eq(anIndex);
  6746. if($core.assert($1)){
  6747. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  6748. }
  6749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6750. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  6751. //>>excludeEnd("ctx");
  6752. }));
  6753. return nil;
  6754. }
  6755. catch(e) {if(e===$early)return e[0]; throw e}
  6756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6757. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  6758. //>>excludeEnd("ctx");
  6759. },
  6760. //>>excludeStart("ide", pragmas.excludeIdeData);
  6761. args: ["anIndex"],
  6762. 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",
  6763. referencedClasses: [],
  6764. //>>excludeEnd("ide");
  6765. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  6766. }),
  6767. $globals.String);
  6768. $core.addMethod(
  6769. $core.method({
  6770. selector: "lines",
  6771. protocol: "split join",
  6772. fn: function (){
  6773. var self=this,$self=this;
  6774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6775. return $core.withContext(function($ctx1) {
  6776. //>>excludeEnd("ctx");
  6777. var result = self.split(/\r\n|\r|\n/);
  6778. if (!result[result.length-1]) result.pop();
  6779. return result;;
  6780. return self;
  6781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6782. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  6783. //>>excludeEnd("ctx");
  6784. },
  6785. //>>excludeStart("ide", pragmas.excludeIdeData);
  6786. args: [],
  6787. 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'>",
  6788. referencedClasses: [],
  6789. //>>excludeEnd("ide");
  6790. messageSends: []
  6791. }),
  6792. $globals.String);
  6793. $core.addMethod(
  6794. $core.method({
  6795. selector: "linesDo:",
  6796. protocol: "split join",
  6797. fn: function (aBlock){
  6798. var self=this,$self=this;
  6799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6800. return $core.withContext(function($ctx1) {
  6801. //>>excludeEnd("ctx");
  6802. $recv($self._lines())._do_(aBlock);
  6803. return self;
  6804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6805. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  6806. //>>excludeEnd("ctx");
  6807. },
  6808. //>>excludeStart("ide", pragmas.excludeIdeData);
  6809. args: ["aBlock"],
  6810. 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",
  6811. referencedClasses: [],
  6812. //>>excludeEnd("ide");
  6813. messageSends: ["do:", "lines"]
  6814. }),
  6815. $globals.String);
  6816. $core.addMethod(
  6817. $core.method({
  6818. selector: "match:",
  6819. protocol: "regular expressions",
  6820. fn: function (aRegexp){
  6821. var self=this,$self=this;
  6822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6823. return $core.withContext(function($ctx1) {
  6824. //>>excludeEnd("ctx");
  6825. return self.search(aRegexp) != -1;
  6826. return self;
  6827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6828. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  6829. //>>excludeEnd("ctx");
  6830. },
  6831. //>>excludeStart("ide", pragmas.excludeIdeData);
  6832. args: ["aRegexp"],
  6833. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  6834. referencedClasses: [],
  6835. //>>excludeEnd("ide");
  6836. messageSends: []
  6837. }),
  6838. $globals.String);
  6839. $core.addMethod(
  6840. $core.method({
  6841. selector: "matchesOf:",
  6842. protocol: "regular expressions",
  6843. fn: function (aRegularExpression){
  6844. var self=this,$self=this;
  6845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6846. return $core.withContext(function($ctx1) {
  6847. //>>excludeEnd("ctx");
  6848. return self.match(aRegularExpression);
  6849. return self;
  6850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6851. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  6852. //>>excludeEnd("ctx");
  6853. },
  6854. //>>excludeStart("ide", pragmas.excludeIdeData);
  6855. args: ["aRegularExpression"],
  6856. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  6857. referencedClasses: [],
  6858. //>>excludeEnd("ide");
  6859. messageSends: []
  6860. }),
  6861. $globals.String);
  6862. $core.addMethod(
  6863. $core.method({
  6864. selector: "numericallyIndexable",
  6865. protocol: "private",
  6866. fn: function (){
  6867. var self=this,$self=this;
  6868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6869. return $core.withContext(function($ctx1) {
  6870. //>>excludeEnd("ctx");
  6871. return String(self);
  6872. return self;
  6873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6874. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  6875. //>>excludeEnd("ctx");
  6876. },
  6877. //>>excludeStart("ide", pragmas.excludeIdeData);
  6878. args: [],
  6879. source: "numericallyIndexable\x0a\x09<inlineJS: 'return String(self)'>",
  6880. referencedClasses: [],
  6881. //>>excludeEnd("ide");
  6882. messageSends: []
  6883. }),
  6884. $globals.String);
  6885. $core.addMethod(
  6886. $core.method({
  6887. selector: "printNl",
  6888. protocol: "printing",
  6889. fn: function (){
  6890. var self=this,$self=this;
  6891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6892. return $core.withContext(function($ctx1) {
  6893. //>>excludeEnd("ctx");
  6894. console.log(self);
  6895. return self;
  6896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6897. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  6898. //>>excludeEnd("ctx");
  6899. },
  6900. //>>excludeStart("ide", pragmas.excludeIdeData);
  6901. args: [],
  6902. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  6903. referencedClasses: [],
  6904. //>>excludeEnd("ide");
  6905. messageSends: []
  6906. }),
  6907. $globals.String);
  6908. $core.addMethod(
  6909. $core.method({
  6910. selector: "printOn:",
  6911. protocol: "printing",
  6912. fn: function (aStream){
  6913. var self=this,$self=this;
  6914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6915. return $core.withContext(function($ctx1) {
  6916. //>>excludeEnd("ctx");
  6917. $recv(aStream)._nextPutAll_("'");
  6918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6919. $ctx1.sendIdx["nextPutAll:"]=1;
  6920. //>>excludeEnd("ctx");
  6921. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  6922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6923. $ctx1.sendIdx["nextPutAll:"]=2;
  6924. //>>excludeEnd("ctx");
  6925. $recv(aStream)._nextPutAll_("'");
  6926. return self;
  6927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6928. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  6929. //>>excludeEnd("ctx");
  6930. },
  6931. //>>excludeStart("ide", pragmas.excludeIdeData);
  6932. args: ["aStream"],
  6933. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  6934. referencedClasses: [],
  6935. //>>excludeEnd("ide");
  6936. messageSends: ["nextPutAll:", "replace:with:"]
  6937. }),
  6938. $globals.String);
  6939. $core.addMethod(
  6940. $core.method({
  6941. selector: "replace:with:",
  6942. protocol: "regular expressions",
  6943. fn: function (aString,anotherString){
  6944. var self=this,$self=this;
  6945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6946. return $core.withContext(function($ctx1) {
  6947. //>>excludeEnd("ctx");
  6948. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6950. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  6951. //>>excludeEnd("ctx");
  6952. },
  6953. //>>excludeStart("ide", pragmas.excludeIdeData);
  6954. args: ["aString", "anotherString"],
  6955. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6956. referencedClasses: ["RegularExpression"],
  6957. //>>excludeEnd("ide");
  6958. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6959. }),
  6960. $globals.String);
  6961. $core.addMethod(
  6962. $core.method({
  6963. selector: "replaceRegexp:with:",
  6964. protocol: "regular expressions",
  6965. fn: function (aRegexp,aString){
  6966. var self=this,$self=this;
  6967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6968. return $core.withContext(function($ctx1) {
  6969. //>>excludeEnd("ctx");
  6970. return self.replace(aRegexp, aString);
  6971. return self;
  6972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6973. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  6974. //>>excludeEnd("ctx");
  6975. },
  6976. //>>excludeStart("ide", pragmas.excludeIdeData);
  6977. args: ["aRegexp", "aString"],
  6978. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  6979. referencedClasses: [],
  6980. //>>excludeEnd("ide");
  6981. messageSends: []
  6982. }),
  6983. $globals.String);
  6984. $core.addMethod(
  6985. $core.method({
  6986. selector: "reversed",
  6987. protocol: "converting",
  6988. fn: function (){
  6989. var self=this,$self=this;
  6990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6991. return $core.withContext(function($ctx1) {
  6992. //>>excludeEnd("ctx");
  6993. return self.split("").reverse().join("");
  6994. return self;
  6995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6996. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  6997. //>>excludeEnd("ctx");
  6998. },
  6999. //>>excludeStart("ide", pragmas.excludeIdeData);
  7000. args: [],
  7001. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  7002. referencedClasses: [],
  7003. //>>excludeEnd("ide");
  7004. messageSends: []
  7005. }),
  7006. $globals.String);
  7007. $core.addMethod(
  7008. $core.method({
  7009. selector: "shallowCopy",
  7010. protocol: "copying",
  7011. fn: function (){
  7012. var self=this,$self=this;
  7013. return self;
  7014. },
  7015. //>>excludeStart("ide", pragmas.excludeIdeData);
  7016. args: [],
  7017. source: "shallowCopy\x0a\x09^ self",
  7018. referencedClasses: [],
  7019. //>>excludeEnd("ide");
  7020. messageSends: []
  7021. }),
  7022. $globals.String);
  7023. $core.addMethod(
  7024. $core.method({
  7025. selector: "size",
  7026. protocol: "accessing",
  7027. fn: function (){
  7028. var self=this,$self=this;
  7029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7030. return $core.withContext(function($ctx1) {
  7031. //>>excludeEnd("ctx");
  7032. return self.length;
  7033. return self;
  7034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7035. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  7036. //>>excludeEnd("ctx");
  7037. },
  7038. //>>excludeStart("ide", pragmas.excludeIdeData);
  7039. args: [],
  7040. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  7041. referencedClasses: [],
  7042. //>>excludeEnd("ide");
  7043. messageSends: []
  7044. }),
  7045. $globals.String);
  7046. $core.addMethod(
  7047. $core.method({
  7048. selector: "subStrings:",
  7049. protocol: "split join",
  7050. fn: function (aString){
  7051. var self=this,$self=this;
  7052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7053. return $core.withContext(function($ctx1) {
  7054. //>>excludeEnd("ctx");
  7055. return $self._tokenize_(aString);
  7056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7057. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  7058. //>>excludeEnd("ctx");
  7059. },
  7060. //>>excludeStart("ide", pragmas.excludeIdeData);
  7061. args: ["aString"],
  7062. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  7063. referencedClasses: [],
  7064. //>>excludeEnd("ide");
  7065. messageSends: ["tokenize:"]
  7066. }),
  7067. $globals.String);
  7068. $core.addMethod(
  7069. $core.method({
  7070. selector: "tokenize:",
  7071. protocol: "split join",
  7072. fn: function (aString){
  7073. var self=this,$self=this;
  7074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7075. return $core.withContext(function($ctx1) {
  7076. //>>excludeEnd("ctx");
  7077. return self.split(aString);
  7078. return self;
  7079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7080. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  7081. //>>excludeEnd("ctx");
  7082. },
  7083. //>>excludeStart("ide", pragmas.excludeIdeData);
  7084. args: ["aString"],
  7085. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  7086. referencedClasses: [],
  7087. //>>excludeEnd("ide");
  7088. messageSends: []
  7089. }),
  7090. $globals.String);
  7091. $core.addMethod(
  7092. $core.method({
  7093. selector: "trimBoth",
  7094. protocol: "regular expressions",
  7095. fn: function (){
  7096. var self=this,$self=this;
  7097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7098. return $core.withContext(function($ctx1) {
  7099. //>>excludeEnd("ctx");
  7100. return $self._trimBoth_("\x5cs");
  7101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7102. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  7103. //>>excludeEnd("ctx");
  7104. },
  7105. //>>excludeStart("ide", pragmas.excludeIdeData);
  7106. args: [],
  7107. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  7108. referencedClasses: [],
  7109. //>>excludeEnd("ide");
  7110. messageSends: ["trimBoth:"]
  7111. }),
  7112. $globals.String);
  7113. $core.addMethod(
  7114. $core.method({
  7115. selector: "trimBoth:",
  7116. protocol: "regular expressions",
  7117. fn: function (separators){
  7118. var self=this,$self=this;
  7119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7120. return $core.withContext(function($ctx1) {
  7121. //>>excludeEnd("ctx");
  7122. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  7123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7124. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  7125. //>>excludeEnd("ctx");
  7126. },
  7127. //>>excludeStart("ide", pragmas.excludeIdeData);
  7128. args: ["separators"],
  7129. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  7130. referencedClasses: [],
  7131. //>>excludeEnd("ide");
  7132. messageSends: ["trimRight:", "trimLeft:"]
  7133. }),
  7134. $globals.String);
  7135. $core.addMethod(
  7136. $core.method({
  7137. selector: "trimLeft",
  7138. protocol: "regular expressions",
  7139. fn: function (){
  7140. var self=this,$self=this;
  7141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7142. return $core.withContext(function($ctx1) {
  7143. //>>excludeEnd("ctx");
  7144. return $self._trimLeft_("\x5cs");
  7145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7146. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  7147. //>>excludeEnd("ctx");
  7148. },
  7149. //>>excludeStart("ide", pragmas.excludeIdeData);
  7150. args: [],
  7151. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  7152. referencedClasses: [],
  7153. //>>excludeEnd("ide");
  7154. messageSends: ["trimLeft:"]
  7155. }),
  7156. $globals.String);
  7157. $core.addMethod(
  7158. $core.method({
  7159. selector: "trimLeft:",
  7160. protocol: "regular expressions",
  7161. fn: function (separators){
  7162. var self=this,$self=this;
  7163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7164. return $core.withContext(function($ctx1) {
  7165. //>>excludeEnd("ctx");
  7166. var $2,$1;
  7167. $2=$recv("^[".__comma(separators)).__comma("]+");
  7168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7169. $ctx1.sendIdx[","]=1;
  7170. //>>excludeEnd("ctx");
  7171. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  7172. return $self._replaceRegexp_with_($1,"");
  7173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7174. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  7175. //>>excludeEnd("ctx");
  7176. },
  7177. //>>excludeStart("ide", pragmas.excludeIdeData);
  7178. args: ["separators"],
  7179. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  7180. referencedClasses: ["RegularExpression"],
  7181. //>>excludeEnd("ide");
  7182. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  7183. }),
  7184. $globals.String);
  7185. $core.addMethod(
  7186. $core.method({
  7187. selector: "trimRight",
  7188. protocol: "regular expressions",
  7189. fn: function (){
  7190. var self=this,$self=this;
  7191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7192. return $core.withContext(function($ctx1) {
  7193. //>>excludeEnd("ctx");
  7194. return $self._trimRight_("\x5cs");
  7195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7196. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  7197. //>>excludeEnd("ctx");
  7198. },
  7199. //>>excludeStart("ide", pragmas.excludeIdeData);
  7200. args: [],
  7201. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  7202. referencedClasses: [],
  7203. //>>excludeEnd("ide");
  7204. messageSends: ["trimRight:"]
  7205. }),
  7206. $globals.String);
  7207. $core.addMethod(
  7208. $core.method({
  7209. selector: "trimRight:",
  7210. protocol: "regular expressions",
  7211. fn: function (separators){
  7212. var self=this,$self=this;
  7213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7214. return $core.withContext(function($ctx1) {
  7215. //>>excludeEnd("ctx");
  7216. var $2,$1;
  7217. $2=$recv("[".__comma(separators)).__comma("]+$");
  7218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7219. $ctx1.sendIdx[","]=1;
  7220. //>>excludeEnd("ctx");
  7221. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  7222. return $self._replaceRegexp_with_($1,"");
  7223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7224. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  7225. //>>excludeEnd("ctx");
  7226. },
  7227. //>>excludeStart("ide", pragmas.excludeIdeData);
  7228. args: ["separators"],
  7229. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  7230. referencedClasses: ["RegularExpression"],
  7231. //>>excludeEnd("ide");
  7232. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  7233. }),
  7234. $globals.String);
  7235. $core.addMethod(
  7236. $core.method({
  7237. selector: "unescaped",
  7238. protocol: "converting",
  7239. fn: function (){
  7240. var self=this,$self=this;
  7241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7242. return $core.withContext(function($ctx1) {
  7243. //>>excludeEnd("ctx");
  7244. return unescape(self);
  7245. return self;
  7246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7247. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  7248. //>>excludeEnd("ctx");
  7249. },
  7250. //>>excludeStart("ide", pragmas.excludeIdeData);
  7251. args: [],
  7252. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  7253. referencedClasses: [],
  7254. //>>excludeEnd("ide");
  7255. messageSends: []
  7256. }),
  7257. $globals.String);
  7258. $core.addMethod(
  7259. $core.method({
  7260. selector: "uriComponentDecoded",
  7261. protocol: "converting",
  7262. fn: function (){
  7263. var self=this,$self=this;
  7264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7265. return $core.withContext(function($ctx1) {
  7266. //>>excludeEnd("ctx");
  7267. return decodeURIComponent(self);
  7268. return self;
  7269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7270. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  7271. //>>excludeEnd("ctx");
  7272. },
  7273. //>>excludeStart("ide", pragmas.excludeIdeData);
  7274. args: [],
  7275. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  7276. referencedClasses: [],
  7277. //>>excludeEnd("ide");
  7278. messageSends: []
  7279. }),
  7280. $globals.String);
  7281. $core.addMethod(
  7282. $core.method({
  7283. selector: "uriComponentEncoded",
  7284. protocol: "converting",
  7285. fn: function (){
  7286. var self=this,$self=this;
  7287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7288. return $core.withContext(function($ctx1) {
  7289. //>>excludeEnd("ctx");
  7290. return encodeURIComponent(self);
  7291. return self;
  7292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7293. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  7294. //>>excludeEnd("ctx");
  7295. },
  7296. //>>excludeStart("ide", pragmas.excludeIdeData);
  7297. args: [],
  7298. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  7299. referencedClasses: [],
  7300. //>>excludeEnd("ide");
  7301. messageSends: []
  7302. }),
  7303. $globals.String);
  7304. $core.addMethod(
  7305. $core.method({
  7306. selector: "uriDecoded",
  7307. protocol: "converting",
  7308. fn: function (){
  7309. var self=this,$self=this;
  7310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7311. return $core.withContext(function($ctx1) {
  7312. //>>excludeEnd("ctx");
  7313. return decodeURI(self);
  7314. return self;
  7315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7316. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  7317. //>>excludeEnd("ctx");
  7318. },
  7319. //>>excludeStart("ide", pragmas.excludeIdeData);
  7320. args: [],
  7321. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  7322. referencedClasses: [],
  7323. //>>excludeEnd("ide");
  7324. messageSends: []
  7325. }),
  7326. $globals.String);
  7327. $core.addMethod(
  7328. $core.method({
  7329. selector: "uriEncoded",
  7330. protocol: "converting",
  7331. fn: function (){
  7332. var self=this,$self=this;
  7333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7334. return $core.withContext(function($ctx1) {
  7335. //>>excludeEnd("ctx");
  7336. return encodeURI(self);
  7337. return self;
  7338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7339. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  7340. //>>excludeEnd("ctx");
  7341. },
  7342. //>>excludeStart("ide", pragmas.excludeIdeData);
  7343. args: [],
  7344. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  7345. referencedClasses: [],
  7346. //>>excludeEnd("ide");
  7347. messageSends: []
  7348. }),
  7349. $globals.String);
  7350. $core.addMethod(
  7351. $core.method({
  7352. selector: "value:",
  7353. protocol: "evaluating",
  7354. fn: function (anObject){
  7355. var self=this,$self=this;
  7356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7357. return $core.withContext(function($ctx1) {
  7358. //>>excludeEnd("ctx");
  7359. return $recv(anObject)._perform_(self);
  7360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7361. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  7362. //>>excludeEnd("ctx");
  7363. },
  7364. //>>excludeStart("ide", pragmas.excludeIdeData);
  7365. args: ["anObject"],
  7366. source: "value: anObject \x0a\x09^ anObject perform: self",
  7367. referencedClasses: [],
  7368. //>>excludeEnd("ide");
  7369. messageSends: ["perform:"]
  7370. }),
  7371. $globals.String);
  7372. $core.addMethod(
  7373. $core.method({
  7374. selector: "cr",
  7375. protocol: "accessing",
  7376. fn: function (){
  7377. var self=this,$self=this;
  7378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7379. return $core.withContext(function($ctx1) {
  7380. //>>excludeEnd("ctx");
  7381. return "\r";
  7382. return self;
  7383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7384. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.a$cls)});
  7385. //>>excludeEnd("ctx");
  7386. },
  7387. //>>excludeStart("ide", pragmas.excludeIdeData);
  7388. args: [],
  7389. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  7390. referencedClasses: [],
  7391. //>>excludeEnd("ide");
  7392. messageSends: []
  7393. }),
  7394. $globals.String.a$cls);
  7395. $core.addMethod(
  7396. $core.method({
  7397. selector: "crlf",
  7398. protocol: "accessing",
  7399. fn: function (){
  7400. var self=this,$self=this;
  7401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7402. return $core.withContext(function($ctx1) {
  7403. //>>excludeEnd("ctx");
  7404. return "\r\n";
  7405. return self;
  7406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7407. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.a$cls)});
  7408. //>>excludeEnd("ctx");
  7409. },
  7410. //>>excludeStart("ide", pragmas.excludeIdeData);
  7411. args: [],
  7412. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  7413. referencedClasses: [],
  7414. //>>excludeEnd("ide");
  7415. messageSends: []
  7416. }),
  7417. $globals.String.a$cls);
  7418. $core.addMethod(
  7419. $core.method({
  7420. selector: "esc",
  7421. protocol: "accessing",
  7422. fn: function (){
  7423. var self=this,$self=this;
  7424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7425. return $core.withContext(function($ctx1) {
  7426. //>>excludeEnd("ctx");
  7427. return $self._fromCharCode_((27));
  7428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7429. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.a$cls)});
  7430. //>>excludeEnd("ctx");
  7431. },
  7432. //>>excludeStart("ide", pragmas.excludeIdeData);
  7433. args: [],
  7434. source: "esc\x0a\x09^ self fromCharCode: 27",
  7435. referencedClasses: [],
  7436. //>>excludeEnd("ide");
  7437. messageSends: ["fromCharCode:"]
  7438. }),
  7439. $globals.String.a$cls);
  7440. $core.addMethod(
  7441. $core.method({
  7442. selector: "fromCharCode:",
  7443. protocol: "instance creation",
  7444. fn: function (anInteger){
  7445. var self=this,$self=this;
  7446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7447. return $core.withContext(function($ctx1) {
  7448. //>>excludeEnd("ctx");
  7449. return String.fromCharCode(anInteger);
  7450. return self;
  7451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7452. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.a$cls)});
  7453. //>>excludeEnd("ctx");
  7454. },
  7455. //>>excludeStart("ide", pragmas.excludeIdeData);
  7456. args: ["anInteger"],
  7457. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  7458. referencedClasses: [],
  7459. //>>excludeEnd("ide");
  7460. messageSends: []
  7461. }),
  7462. $globals.String.a$cls);
  7463. $core.addMethod(
  7464. $core.method({
  7465. selector: "fromString:",
  7466. protocol: "instance creation",
  7467. fn: function (aString){
  7468. var self=this,$self=this;
  7469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7470. return $core.withContext(function($ctx1) {
  7471. //>>excludeEnd("ctx");
  7472. return String(aString);
  7473. return self;
  7474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7475. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.a$cls)});
  7476. //>>excludeEnd("ctx");
  7477. },
  7478. //>>excludeStart("ide", pragmas.excludeIdeData);
  7479. args: ["aString"],
  7480. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  7481. referencedClasses: [],
  7482. //>>excludeEnd("ide");
  7483. messageSends: []
  7484. }),
  7485. $globals.String.a$cls);
  7486. $core.addMethod(
  7487. $core.method({
  7488. selector: "lf",
  7489. protocol: "accessing",
  7490. fn: function (){
  7491. var self=this,$self=this;
  7492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7493. return $core.withContext(function($ctx1) {
  7494. //>>excludeEnd("ctx");
  7495. return "\n";
  7496. return self;
  7497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7498. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.a$cls)});
  7499. //>>excludeEnd("ctx");
  7500. },
  7501. //>>excludeStart("ide", pragmas.excludeIdeData);
  7502. args: [],
  7503. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  7504. referencedClasses: [],
  7505. //>>excludeEnd("ide");
  7506. messageSends: []
  7507. }),
  7508. $globals.String.a$cls);
  7509. $core.addMethod(
  7510. $core.method({
  7511. selector: "random",
  7512. protocol: "random",
  7513. fn: function (){
  7514. var self=this,$self=this;
  7515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7516. return $core.withContext(function($ctx1) {
  7517. //>>excludeEnd("ctx");
  7518. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  7519. return self;
  7520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7521. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.a$cls)});
  7522. //>>excludeEnd("ctx");
  7523. },
  7524. //>>excludeStart("ide", pragmas.excludeIdeData);
  7525. args: [],
  7526. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);'>",
  7527. referencedClasses: [],
  7528. //>>excludeEnd("ide");
  7529. messageSends: []
  7530. }),
  7531. $globals.String.a$cls);
  7532. $core.addMethod(
  7533. $core.method({
  7534. selector: "randomNotIn:",
  7535. protocol: "random",
  7536. fn: function (aString){
  7537. var self=this,$self=this;
  7538. var result;
  7539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7540. return $core.withContext(function($ctx1) {
  7541. //>>excludeEnd("ctx");
  7542. $recv((function(){
  7543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7544. return $core.withContext(function($ctx2) {
  7545. //>>excludeEnd("ctx");
  7546. result=$self._random();
  7547. result;
  7548. return $recv(aString)._includesSubString_(result);
  7549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7550. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7551. //>>excludeEnd("ctx");
  7552. }))._whileTrue();
  7553. return result;
  7554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7555. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.a$cls)});
  7556. //>>excludeEnd("ctx");
  7557. },
  7558. //>>excludeStart("ide", pragmas.excludeIdeData);
  7559. args: ["aString"],
  7560. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  7561. referencedClasses: [],
  7562. //>>excludeEnd("ide");
  7563. messageSends: ["whileTrue", "random", "includesSubString:"]
  7564. }),
  7565. $globals.String.a$cls);
  7566. $core.addMethod(
  7567. $core.method({
  7568. selector: "space",
  7569. protocol: "accessing",
  7570. fn: function (){
  7571. var self=this,$self=this;
  7572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7573. return $core.withContext(function($ctx1) {
  7574. //>>excludeEnd("ctx");
  7575. return " ";
  7576. return self;
  7577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7578. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.a$cls)});
  7579. //>>excludeEnd("ctx");
  7580. },
  7581. //>>excludeStart("ide", pragmas.excludeIdeData);
  7582. args: [],
  7583. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  7584. referencedClasses: [],
  7585. //>>excludeEnd("ide");
  7586. messageSends: []
  7587. }),
  7588. $globals.String.a$cls);
  7589. $core.addMethod(
  7590. $core.method({
  7591. selector: "streamClass",
  7592. protocol: "accessing",
  7593. fn: function (){
  7594. var self=this,$self=this;
  7595. return $globals.StringStream;
  7596. },
  7597. //>>excludeStart("ide", pragmas.excludeIdeData);
  7598. args: [],
  7599. source: "streamClass\x0a\x09\x09^ StringStream",
  7600. referencedClasses: ["StringStream"],
  7601. //>>excludeEnd("ide");
  7602. messageSends: []
  7603. }),
  7604. $globals.String.a$cls);
  7605. $core.addMethod(
  7606. $core.method({
  7607. selector: "tab",
  7608. protocol: "accessing",
  7609. fn: function (){
  7610. var self=this,$self=this;
  7611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7612. return $core.withContext(function($ctx1) {
  7613. //>>excludeEnd("ctx");
  7614. return "\t";
  7615. return self;
  7616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7617. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.a$cls)});
  7618. //>>excludeEnd("ctx");
  7619. },
  7620. //>>excludeStart("ide", pragmas.excludeIdeData);
  7621. args: [],
  7622. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  7623. referencedClasses: [],
  7624. //>>excludeEnd("ide");
  7625. messageSends: []
  7626. }),
  7627. $globals.String.a$cls);
  7628. $core.addMethod(
  7629. $core.method({
  7630. selector: "value:",
  7631. protocol: "instance creation",
  7632. fn: function (aUTFCharCode){
  7633. var self=this,$self=this;
  7634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7635. return $core.withContext(function($ctx1) {
  7636. //>>excludeEnd("ctx");
  7637. return String.fromCharCode(aUTFCharCode);;
  7638. return self;
  7639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7640. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.a$cls)});
  7641. //>>excludeEnd("ctx");
  7642. },
  7643. //>>excludeStart("ide", pragmas.excludeIdeData);
  7644. args: ["aUTFCharCode"],
  7645. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  7646. referencedClasses: [],
  7647. //>>excludeEnd("ide");
  7648. messageSends: []
  7649. }),
  7650. $globals.String.a$cls);
  7651. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  7652. //>>excludeStart("ide", pragmas.excludeIdeData);
  7653. $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`.";
  7654. //>>excludeEnd("ide");
  7655. $core.addMethod(
  7656. $core.method({
  7657. selector: "=",
  7658. protocol: "comparing",
  7659. fn: function (aCollection){
  7660. var self=this,$self=this;
  7661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7662. return $core.withContext(function($ctx1) {
  7663. //>>excludeEnd("ctx");
  7664. var $2,$1,$4,$3,$5;
  7665. var $early={};
  7666. try {
  7667. $2=$self._class();
  7668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7669. $ctx1.sendIdx["class"]=1;
  7670. //>>excludeEnd("ctx");
  7671. $1=$recv($2).__eq($recv(aCollection)._class());
  7672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7673. $ctx1.sendIdx["="]=1;
  7674. //>>excludeEnd("ctx");
  7675. if(!$core.assert($1)){
  7676. return false;
  7677. }
  7678. $4=$self._size();
  7679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7680. $ctx1.sendIdx["size"]=1;
  7681. //>>excludeEnd("ctx");
  7682. $3=$recv($4).__eq($recv(aCollection)._size());
  7683. if(!$core.assert($3)){
  7684. return false;
  7685. }
  7686. $self._do_((function(each){
  7687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7688. return $core.withContext(function($ctx2) {
  7689. //>>excludeEnd("ctx");
  7690. $5=$recv(aCollection)._includes_(each);
  7691. if(!$core.assert($5)){
  7692. throw $early=[false];
  7693. }
  7694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7695. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7696. //>>excludeEnd("ctx");
  7697. }));
  7698. return true;
  7699. }
  7700. catch(e) {if(e===$early)return e[0]; throw e}
  7701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7702. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  7703. //>>excludeEnd("ctx");
  7704. },
  7705. //>>excludeStart("ide", pragmas.excludeIdeData);
  7706. args: ["aCollection"],
  7707. source: "= aCollection\x0a\x09self class = aCollection class ifFalse: [ ^ false ].\x0a\x09self size = aCollection size ifFalse: [ ^ false ].\x0a\x09self do: [ :each | (aCollection includes: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  7708. referencedClasses: [],
  7709. //>>excludeEnd("ide");
  7710. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  7711. }),
  7712. $globals.Set);
  7713. $core.addMethod(
  7714. $core.method({
  7715. selector: "add:",
  7716. protocol: "adding/removing",
  7717. fn: function (anObject){
  7718. var self=this,$self=this;
  7719. var bucket;
  7720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7721. return $core.withContext(function($ctx1) {
  7722. //>>excludeEnd("ctx");
  7723. var $1,$receiver;
  7724. bucket=$self._bucketsOfElement_(anObject);
  7725. $1=$recv(bucket)._second();
  7726. if(($receiver = $1) == null || $receiver.a$nil){
  7727. var object,slowBucket;
  7728. object=$recv(bucket)._first();
  7729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7730. $ctx1.sendIdx["first"]=1;
  7731. //>>excludeEnd("ctx");
  7732. object;
  7733. slowBucket=$recv(bucket)._third();
  7734. slowBucket;
  7735. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  7736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7737. return $core.withContext(function($ctx2) {
  7738. //>>excludeEnd("ctx");
  7739. $recv(slowBucket)._add_(object);
  7740. $self["@size"]=$recv($self["@size"]).__plus((1));
  7741. return $self["@size"];
  7742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7743. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7744. //>>excludeEnd("ctx");
  7745. }));
  7746. return object;
  7747. } else {
  7748. var primitiveBucket;
  7749. primitiveBucket=$receiver;
  7750. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  7751. }
  7752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7753. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7754. //>>excludeEnd("ctx");
  7755. },
  7756. //>>excludeStart("ide", pragmas.excludeIdeData);
  7757. args: ["anObject"],
  7758. 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 ]",
  7759. referencedClasses: [],
  7760. //>>excludeEnd("ide");
  7761. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  7762. }),
  7763. $globals.Set);
  7764. $core.addMethod(
  7765. $core.method({
  7766. selector: "add:in:",
  7767. protocol: "private",
  7768. fn: function (anObject,anotherObject){
  7769. var self=this,$self=this;
  7770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7771. return $core.withContext(function($ctx1) {
  7772. //>>excludeEnd("ctx");
  7773. if (anObject in anotherObject.store) { return false; }
  7774. $self['@size']++;
  7775. anotherObject.store[anObject] = true;
  7776. return anObject;
  7777. ;
  7778. return self;
  7779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7780. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7781. //>>excludeEnd("ctx");
  7782. },
  7783. //>>excludeStart("ide", pragmas.excludeIdeData);
  7784. args: ["anObject", "anotherObject"],
  7785. source: "add: anObject in: anotherObject\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09$self[''@size'']++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09'>",
  7786. referencedClasses: [],
  7787. //>>excludeEnd("ide");
  7788. messageSends: []
  7789. }),
  7790. $globals.Set);
  7791. $core.addMethod(
  7792. $core.method({
  7793. selector: "bucketsOfElement:",
  7794. protocol: "private",
  7795. fn: function (anObject){
  7796. var self=this,$self=this;
  7797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7798. return $core.withContext(function($ctx1) {
  7799. //>>excludeEnd("ctx");
  7800. // include nil to well-known objects under "boolean" fastBucket
  7801. if (anObject == null || anObject.a$nil) return [ null, $self['@fastBuckets'].boolean ];
  7802. var prim = anObject.valueOf();
  7803. if (typeof prim === "object" || typeof prim === "function" || !$self['@fastBuckets'][typeof prim]) {
  7804. var bucket = null;
  7805. $self['@slowBucketStores'].some(function (store) {
  7806. return bucket = store._bucketOfElement_(anObject);
  7807. });
  7808. return [ anObject, null, bucket || $self['@defaultBucket'] ];
  7809. }
  7810. return [ prim, $self['@fastBuckets'][typeof prim] ];
  7811. ;
  7812. return self;
  7813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7814. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  7815. //>>excludeEnd("ctx");
  7816. },
  7817. //>>excludeStart("ide", pragmas.excludeIdeData);
  7818. args: ["anObject"],
  7819. 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'>",
  7820. referencedClasses: [],
  7821. //>>excludeEnd("ide");
  7822. messageSends: []
  7823. }),
  7824. $globals.Set);
  7825. $core.addMethod(
  7826. $core.method({
  7827. selector: "classNameOf:",
  7828. protocol: "private",
  7829. fn: function (anObject){
  7830. var self=this,$self=this;
  7831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7832. return $core.withContext(function($ctx1) {
  7833. //>>excludeEnd("ctx");
  7834. return anObject.a$cls != null && anObject.a$cls.className;
  7835. return self;
  7836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7837. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  7838. //>>excludeEnd("ctx");
  7839. },
  7840. //>>excludeStart("ide", pragmas.excludeIdeData);
  7841. args: ["anObject"],
  7842. 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.className'>",
  7843. referencedClasses: [],
  7844. //>>excludeEnd("ide");
  7845. messageSends: []
  7846. }),
  7847. $globals.Set);
  7848. $core.addMethod(
  7849. $core.method({
  7850. selector: "collect:",
  7851. protocol: "enumerating",
  7852. fn: function (aBlock){
  7853. var self=this,$self=this;
  7854. var collection;
  7855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7856. return $core.withContext(function($ctx1) {
  7857. //>>excludeEnd("ctx");
  7858. collection=$recv($self._class())._new();
  7859. $self._do_((function(each){
  7860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7861. return $core.withContext(function($ctx2) {
  7862. //>>excludeEnd("ctx");
  7863. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7865. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7866. //>>excludeEnd("ctx");
  7867. }));
  7868. return collection;
  7869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7870. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  7871. //>>excludeEnd("ctx");
  7872. },
  7873. //>>excludeStart("ide", pragmas.excludeIdeData);
  7874. args: ["aBlock"],
  7875. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7876. referencedClasses: [],
  7877. //>>excludeEnd("ide");
  7878. messageSends: ["new", "class", "do:", "add:", "value:"]
  7879. }),
  7880. $globals.Set);
  7881. $core.addMethod(
  7882. $core.method({
  7883. selector: "detect:ifNone:",
  7884. protocol: "enumerating",
  7885. fn: function (aBlock,anotherBlock){
  7886. var self=this,$self=this;
  7887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7888. return $core.withContext(function($ctx1) {
  7889. //>>excludeEnd("ctx");
  7890. var $1;
  7891. var $early={};
  7892. try {
  7893. $self._do_((function(each){
  7894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7895. return $core.withContext(function($ctx2) {
  7896. //>>excludeEnd("ctx");
  7897. $1=$recv(aBlock)._value_(each);
  7898. if($core.assert($1)){
  7899. throw $early=[each];
  7900. }
  7901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7902. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7903. //>>excludeEnd("ctx");
  7904. }));
  7905. return $recv(anotherBlock)._value();
  7906. }
  7907. catch(e) {if(e===$early)return e[0]; throw e}
  7908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7909. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  7910. //>>excludeEnd("ctx");
  7911. },
  7912. //>>excludeStart("ide", pragmas.excludeIdeData);
  7913. args: ["aBlock", "anotherBlock"],
  7914. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  7915. referencedClasses: [],
  7916. //>>excludeEnd("ide");
  7917. messageSends: ["do:", "ifTrue:", "value:", "value"]
  7918. }),
  7919. $globals.Set);
  7920. $core.addMethod(
  7921. $core.method({
  7922. selector: "do:",
  7923. protocol: "enumerating",
  7924. fn: function (aBlock){
  7925. var self=this,$self=this;
  7926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7927. return $core.withContext(function($ctx1) {
  7928. //>>excludeEnd("ctx");
  7929. var el, keys, i;
  7930. el = $self['@fastBuckets'];
  7931. keys = Object.keys(el);
  7932. for (i = 0; i < keys.length; ++i) {
  7933. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7934. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7935. else { store._do_(aBlock); }
  7936. }
  7937. el = $self['@slowBucketStores'];
  7938. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7939. $self['@defaultBucket']._do_(aBlock);
  7940. ;
  7941. return self;
  7942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7943. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  7944. //>>excludeEnd("ctx");
  7945. },
  7946. //>>excludeStart("ide", pragmas.excludeIdeData);
  7947. args: ["aBlock"],
  7948. 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'>",
  7949. referencedClasses: [],
  7950. //>>excludeEnd("ide");
  7951. messageSends: []
  7952. }),
  7953. $globals.Set);
  7954. $core.addMethod(
  7955. $core.method({
  7956. selector: "includes:",
  7957. protocol: "testing",
  7958. fn: function (anObject){
  7959. var self=this,$self=this;
  7960. var bucket;
  7961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7962. return $core.withContext(function($ctx1) {
  7963. //>>excludeEnd("ctx");
  7964. var $1,$2,$3,$receiver;
  7965. bucket=$self._bucketsOfElement_(anObject);
  7966. $1=$recv(bucket)._second();
  7967. if(($receiver = $1) == null || $receiver.a$nil){
  7968. $2=$recv(bucket)._third();
  7969. $3=$recv(bucket)._first();
  7970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7971. $ctx1.sendIdx["first"]=1;
  7972. //>>excludeEnd("ctx");
  7973. return $recv($2)._includes_($3);
  7974. } else {
  7975. var primitiveBucket;
  7976. primitiveBucket=$receiver;
  7977. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7978. }
  7979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7980. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7981. //>>excludeEnd("ctx");
  7982. },
  7983. //>>excludeStart("ide", pragmas.excludeIdeData);
  7984. args: ["anObject"],
  7985. 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 ]",
  7986. referencedClasses: [],
  7987. //>>excludeEnd("ide");
  7988. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7989. }),
  7990. $globals.Set);
  7991. $core.addMethod(
  7992. $core.method({
  7993. selector: "includes:in:",
  7994. protocol: "private",
  7995. fn: function (anObject,anotherObject){
  7996. var self=this,$self=this;
  7997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7998. return $core.withContext(function($ctx1) {
  7999. //>>excludeEnd("ctx");
  8000. return anObject in anotherObject.store;
  8001. return self;
  8002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8003. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  8004. //>>excludeEnd("ctx");
  8005. },
  8006. //>>excludeStart("ide", pragmas.excludeIdeData);
  8007. args: ["anObject", "anotherObject"],
  8008. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  8009. referencedClasses: [],
  8010. //>>excludeEnd("ide");
  8011. messageSends: []
  8012. }),
  8013. $globals.Set);
  8014. $core.addMethod(
  8015. $core.method({
  8016. selector: "initialize",
  8017. protocol: "initialization",
  8018. fn: function (){
  8019. var self=this,$self=this;
  8020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8021. return $core.withContext(function($ctx1) {
  8022. //>>excludeEnd("ctx");
  8023. (
  8024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8025. $ctx1.supercall = true,
  8026. //>>excludeEnd("ctx");
  8027. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  8028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8029. $ctx1.supercall = false;
  8030. //>>excludeEnd("ctx");;
  8031. $self["@defaultBucket"]=[];
  8032. $self._initializeSlowBucketStores();
  8033. $self._removeAll();
  8034. return self;
  8035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8036. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  8037. //>>excludeEnd("ctx");
  8038. },
  8039. //>>excludeStart("ide", pragmas.excludeIdeData);
  8040. args: [],
  8041. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  8042. referencedClasses: [],
  8043. //>>excludeEnd("ide");
  8044. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  8045. }),
  8046. $globals.Set);
  8047. $core.addMethod(
  8048. $core.method({
  8049. selector: "initializeSlowBucketStores",
  8050. protocol: "initialization",
  8051. fn: function (){
  8052. var self=this,$self=this;
  8053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8054. return $core.withContext(function($ctx1) {
  8055. //>>excludeEnd("ctx");
  8056. var $1;
  8057. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  8058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8059. return $core.withContext(function($ctx2) {
  8060. //>>excludeEnd("ctx");
  8061. return $self._classNameOf_(x);
  8062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8063. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  8064. //>>excludeEnd("ctx");
  8065. }));
  8066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8067. $ctx1.sendIdx["hashBlock:"]=1;
  8068. //>>excludeEnd("ctx");
  8069. $self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  8070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8071. return $core.withContext(function($ctx2) {
  8072. //>>excludeEnd("ctx");
  8073. return $self._jsConstructorNameOf_(x);
  8074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8075. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  8076. //>>excludeEnd("ctx");
  8077. }))];
  8078. return self;
  8079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8080. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  8081. //>>excludeEnd("ctx");
  8082. },
  8083. //>>excludeStart("ide", pragmas.excludeIdeData);
  8084. args: [],
  8085. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  8086. referencedClasses: ["ArrayBucketStore"],
  8087. //>>excludeEnd("ide");
  8088. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  8089. }),
  8090. $globals.Set);
  8091. $core.addMethod(
  8092. $core.method({
  8093. selector: "jsConstructorNameOf:",
  8094. protocol: "private",
  8095. fn: function (anObject){
  8096. var self=this,$self=this;
  8097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8098. return $core.withContext(function($ctx1) {
  8099. //>>excludeEnd("ctx");
  8100. return anObject.constructor && anObject.constructor.name;
  8101. return self;
  8102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8103. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  8104. //>>excludeEnd("ctx");
  8105. },
  8106. //>>excludeStart("ide", pragmas.excludeIdeData);
  8107. args: ["anObject"],
  8108. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  8109. referencedClasses: [],
  8110. //>>excludeEnd("ide");
  8111. messageSends: []
  8112. }),
  8113. $globals.Set);
  8114. $core.addMethod(
  8115. $core.method({
  8116. selector: "printOn:",
  8117. protocol: "printing",
  8118. fn: function (aStream){
  8119. var self=this,$self=this;
  8120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8121. return $core.withContext(function($ctx1) {
  8122. //>>excludeEnd("ctx");
  8123. (
  8124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8125. $ctx1.supercall = true,
  8126. //>>excludeEnd("ctx");
  8127. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  8128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8129. $ctx1.supercall = false;
  8130. //>>excludeEnd("ctx");;
  8131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8132. $ctx1.sendIdx["printOn:"]=1;
  8133. //>>excludeEnd("ctx");
  8134. $recv(aStream)._nextPutAll_(" (");
  8135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8136. $ctx1.sendIdx["nextPutAll:"]=1;
  8137. //>>excludeEnd("ctx");
  8138. $self._do_separatedBy_((function(each){
  8139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8140. return $core.withContext(function($ctx2) {
  8141. //>>excludeEnd("ctx");
  8142. return $recv(each)._printOn_(aStream);
  8143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8144. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8145. //>>excludeEnd("ctx");
  8146. }),(function(){
  8147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8148. return $core.withContext(function($ctx2) {
  8149. //>>excludeEnd("ctx");
  8150. return $recv(aStream)._nextPutAll_(" ");
  8151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8152. $ctx2.sendIdx["nextPutAll:"]=2;
  8153. //>>excludeEnd("ctx");
  8154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8155. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8156. //>>excludeEnd("ctx");
  8157. }));
  8158. $recv(aStream)._nextPutAll_(")");
  8159. return self;
  8160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8161. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  8162. //>>excludeEnd("ctx");
  8163. },
  8164. //>>excludeStart("ide", pragmas.excludeIdeData);
  8165. args: ["aStream"],
  8166. 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: ')'",
  8167. referencedClasses: [],
  8168. //>>excludeEnd("ide");
  8169. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  8170. }),
  8171. $globals.Set);
  8172. $core.addMethod(
  8173. $core.method({
  8174. selector: "remove:ifAbsent:",
  8175. protocol: "adding/removing",
  8176. fn: function (anObject,aBlock){
  8177. var self=this,$self=this;
  8178. var bucket;
  8179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8180. return $core.withContext(function($ctx1) {
  8181. //>>excludeEnd("ctx");
  8182. var $1,$2,$3,$receiver;
  8183. var $early={};
  8184. try {
  8185. bucket=$self._bucketsOfElement_(anObject);
  8186. $1=$recv(bucket)._second();
  8187. if(($receiver = $1) == null || $receiver.a$nil){
  8188. $2=$recv(bucket)._third();
  8189. $3=$recv(bucket)._first();
  8190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8191. $ctx1.sendIdx["first"]=1;
  8192. //>>excludeEnd("ctx");
  8193. $recv($2)._remove_ifAbsent_($3,(function(){
  8194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8195. return $core.withContext(function($ctx2) {
  8196. //>>excludeEnd("ctx");
  8197. throw $early=[$recv(aBlock)._value()];
  8198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8199. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8200. //>>excludeEnd("ctx");
  8201. }));
  8202. $self["@size"]=$recv($self["@size"]).__minus((1));
  8203. return $self["@size"];
  8204. } else {
  8205. var primitiveBucket;
  8206. primitiveBucket=$receiver;
  8207. return $self._remove_in_($recv(bucket)._first(),primitiveBucket);
  8208. }
  8209. }
  8210. catch(e) {if(e===$early)return e[0]; throw e}
  8211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8212. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  8213. //>>excludeEnd("ctx");
  8214. },
  8215. //>>excludeStart("ide", pragmas.excludeIdeData);
  8216. args: ["anObject", "aBlock"],
  8217. source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third remove: bucket first ifAbsent: [ ^aBlock value ]. size := size - 1 ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ]",
  8218. referencedClasses: [],
  8219. //>>excludeEnd("ide");
  8220. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  8221. }),
  8222. $globals.Set);
  8223. $core.addMethod(
  8224. $core.method({
  8225. selector: "remove:in:",
  8226. protocol: "private",
  8227. fn: function (anObject,anotherObject){
  8228. var self=this,$self=this;
  8229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8230. return $core.withContext(function($ctx1) {
  8231. //>>excludeEnd("ctx");
  8232. if (anObject in anotherObject.store) { delete anotherObject.store[anObject]; $self['@size']--; };
  8233. return self;
  8234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8235. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  8236. //>>excludeEnd("ctx");
  8237. },
  8238. //>>excludeStart("ide", pragmas.excludeIdeData);
  8239. args: ["anObject", "anotherObject"],
  8240. source: "remove: anObject in: anotherObject\x0a\x09<inlineJS: 'if (anObject in anotherObject.store) { delete anotherObject.store[anObject]; $self[''@size'']--; }'>",
  8241. referencedClasses: [],
  8242. //>>excludeEnd("ide");
  8243. messageSends: []
  8244. }),
  8245. $globals.Set);
  8246. $core.addMethod(
  8247. $core.method({
  8248. selector: "removeAll",
  8249. protocol: "adding/removing",
  8250. fn: function (){
  8251. var self=this,$self=this;
  8252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8253. return $core.withContext(function($ctx1) {
  8254. //>>excludeEnd("ctx");
  8255. $self['@fastBuckets'] = {
  8256. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  8257. "number": { store: Object.create(null), fn: Number },
  8258. "string": { store: Object.create(null) }
  8259. };
  8260. $self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  8261. $self['@defaultBucket']._removeAll();
  8262. $self['@size'] = 0;
  8263. ;
  8264. return self;
  8265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8266. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  8267. //>>excludeEnd("ctx");
  8268. },
  8269. //>>excludeStart("ide", pragmas.excludeIdeData);
  8270. args: [],
  8271. 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'>",
  8272. referencedClasses: [],
  8273. //>>excludeEnd("ide");
  8274. messageSends: []
  8275. }),
  8276. $globals.Set);
  8277. $core.addMethod(
  8278. $core.method({
  8279. selector: "select:",
  8280. protocol: "enumerating",
  8281. fn: function (aBlock){
  8282. var self=this,$self=this;
  8283. var collection;
  8284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8285. return $core.withContext(function($ctx1) {
  8286. //>>excludeEnd("ctx");
  8287. var $1;
  8288. collection=$recv($self._class())._new();
  8289. $self._do_((function(each){
  8290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8291. return $core.withContext(function($ctx2) {
  8292. //>>excludeEnd("ctx");
  8293. $1=$recv(aBlock)._value_(each);
  8294. if($core.assert($1)){
  8295. return $recv(collection)._add_(each);
  8296. }
  8297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8298. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8299. //>>excludeEnd("ctx");
  8300. }));
  8301. return collection;
  8302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8303. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  8304. //>>excludeEnd("ctx");
  8305. },
  8306. //>>excludeStart("ide", pragmas.excludeIdeData);
  8307. args: ["aBlock"],
  8308. 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",
  8309. referencedClasses: [],
  8310. //>>excludeEnd("ide");
  8311. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  8312. }),
  8313. $globals.Set);
  8314. $core.addMethod(
  8315. $core.method({
  8316. selector: "select:thenCollect:",
  8317. protocol: "enumerating",
  8318. fn: function (selectBlock,collectBlock){
  8319. var self=this,$self=this;
  8320. var collection;
  8321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8322. return $core.withContext(function($ctx1) {
  8323. //>>excludeEnd("ctx");
  8324. var $1;
  8325. collection=$recv($self._class())._new();
  8326. $self._do_((function(each){
  8327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8328. return $core.withContext(function($ctx2) {
  8329. //>>excludeEnd("ctx");
  8330. $1=$recv(selectBlock)._value_(each);
  8331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8332. $ctx2.sendIdx["value:"]=1;
  8333. //>>excludeEnd("ctx");
  8334. if($core.assert($1)){
  8335. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  8336. }
  8337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8338. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8339. //>>excludeEnd("ctx");
  8340. }));
  8341. return collection;
  8342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8343. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  8344. //>>excludeEnd("ctx");
  8345. },
  8346. //>>excludeStart("ide", pragmas.excludeIdeData);
  8347. args: ["selectBlock", "collectBlock"],
  8348. 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",
  8349. referencedClasses: [],
  8350. //>>excludeEnd("ide");
  8351. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  8352. }),
  8353. $globals.Set);
  8354. $core.addMethod(
  8355. $core.method({
  8356. selector: "size",
  8357. protocol: "accessing",
  8358. fn: function (){
  8359. var self=this,$self=this;
  8360. return $self["@size"];
  8361. },
  8362. //>>excludeStart("ide", pragmas.excludeIdeData);
  8363. args: [],
  8364. source: "size\x0a\x09^ size",
  8365. referencedClasses: [],
  8366. //>>excludeEnd("ide");
  8367. messageSends: []
  8368. }),
  8369. $globals.Set);
  8370. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  8371. //>>excludeStart("ide", pragmas.excludeIdeData);
  8372. $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.";
  8373. //>>excludeEnd("ide");
  8374. $core.addMethod(
  8375. $core.method({
  8376. selector: "<<",
  8377. protocol: "writing",
  8378. fn: function (anObject){
  8379. var self=this,$self=this;
  8380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8381. return $core.withContext(function($ctx1) {
  8382. //>>excludeEnd("ctx");
  8383. $self._write_(anObject);
  8384. return self;
  8385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8386. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  8387. //>>excludeEnd("ctx");
  8388. },
  8389. //>>excludeStart("ide", pragmas.excludeIdeData);
  8390. args: ["anObject"],
  8391. source: "<< anObject\x0a\x09self write: anObject",
  8392. referencedClasses: [],
  8393. //>>excludeEnd("ide");
  8394. messageSends: ["write:"]
  8395. }),
  8396. $globals.ProtoStream);
  8397. $core.addMethod(
  8398. $core.method({
  8399. selector: "atEnd",
  8400. protocol: "testing",
  8401. fn: function (){
  8402. var self=this,$self=this;
  8403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8404. return $core.withContext(function($ctx1) {
  8405. //>>excludeEnd("ctx");
  8406. $self._subclassResponsibility();
  8407. return self;
  8408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8409. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  8410. //>>excludeEnd("ctx");
  8411. },
  8412. //>>excludeStart("ide", pragmas.excludeIdeData);
  8413. args: [],
  8414. source: "atEnd\x0a\x09self subclassResponsibility",
  8415. referencedClasses: [],
  8416. //>>excludeEnd("ide");
  8417. messageSends: ["subclassResponsibility"]
  8418. }),
  8419. $globals.ProtoStream);
  8420. $core.addMethod(
  8421. $core.method({
  8422. selector: "atStart",
  8423. protocol: "testing",
  8424. fn: function (){
  8425. var self=this,$self=this;
  8426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8427. return $core.withContext(function($ctx1) {
  8428. //>>excludeEnd("ctx");
  8429. $self._subclassResponsibility();
  8430. return self;
  8431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8432. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  8433. //>>excludeEnd("ctx");
  8434. },
  8435. //>>excludeStart("ide", pragmas.excludeIdeData);
  8436. args: [],
  8437. source: "atStart\x0a\x09self subclassResponsibility",
  8438. referencedClasses: [],
  8439. //>>excludeEnd("ide");
  8440. messageSends: ["subclassResponsibility"]
  8441. }),
  8442. $globals.ProtoStream);
  8443. $core.addMethod(
  8444. $core.method({
  8445. selector: "contents",
  8446. protocol: "accessing",
  8447. fn: function (){
  8448. var self=this,$self=this;
  8449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8450. return $core.withContext(function($ctx1) {
  8451. //>>excludeEnd("ctx");
  8452. $self._subclassResponsibility();
  8453. return self;
  8454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8455. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  8456. //>>excludeEnd("ctx");
  8457. },
  8458. //>>excludeStart("ide", pragmas.excludeIdeData);
  8459. args: [],
  8460. source: "contents\x0a\x09self subclassResponsibility",
  8461. referencedClasses: [],
  8462. //>>excludeEnd("ide");
  8463. messageSends: ["subclassResponsibility"]
  8464. }),
  8465. $globals.ProtoStream);
  8466. $core.addMethod(
  8467. $core.method({
  8468. selector: "do:",
  8469. protocol: "enumerating",
  8470. fn: function (aBlock){
  8471. var self=this,$self=this;
  8472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8473. return $core.withContext(function($ctx1) {
  8474. //>>excludeEnd("ctx");
  8475. $recv((function(){
  8476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8477. return $core.withContext(function($ctx2) {
  8478. //>>excludeEnd("ctx");
  8479. return $self._atEnd();
  8480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8481. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8482. //>>excludeEnd("ctx");
  8483. }))._whileFalse_((function(){
  8484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8485. return $core.withContext(function($ctx2) {
  8486. //>>excludeEnd("ctx");
  8487. return $recv(aBlock)._value_($self._next());
  8488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8490. //>>excludeEnd("ctx");
  8491. }));
  8492. return self;
  8493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8494. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  8495. //>>excludeEnd("ctx");
  8496. },
  8497. //>>excludeStart("ide", pragmas.excludeIdeData);
  8498. args: ["aBlock"],
  8499. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  8500. referencedClasses: [],
  8501. //>>excludeEnd("ide");
  8502. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  8503. }),
  8504. $globals.ProtoStream);
  8505. $core.addMethod(
  8506. $core.method({
  8507. selector: "isEmpty",
  8508. protocol: "testing",
  8509. fn: function (){
  8510. var self=this,$self=this;
  8511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8512. return $core.withContext(function($ctx1) {
  8513. //>>excludeEnd("ctx");
  8514. return $recv($self._atStart())._and_((function(){
  8515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8516. return $core.withContext(function($ctx2) {
  8517. //>>excludeEnd("ctx");
  8518. return $self._atEnd();
  8519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8520. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8521. //>>excludeEnd("ctx");
  8522. }));
  8523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8524. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  8525. //>>excludeEnd("ctx");
  8526. },
  8527. //>>excludeStart("ide", pragmas.excludeIdeData);
  8528. args: [],
  8529. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  8530. referencedClasses: [],
  8531. //>>excludeEnd("ide");
  8532. messageSends: ["and:", "atStart", "atEnd"]
  8533. }),
  8534. $globals.ProtoStream);
  8535. $core.addMethod(
  8536. $core.method({
  8537. selector: "next",
  8538. protocol: "reading",
  8539. fn: function (){
  8540. var self=this,$self=this;
  8541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8542. return $core.withContext(function($ctx1) {
  8543. //>>excludeEnd("ctx");
  8544. var $1;
  8545. $1=$self._atEnd();
  8546. if($core.assert($1)){
  8547. return nil;
  8548. } else {
  8549. return $self._subclassResponsibility();
  8550. }
  8551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8552. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  8553. //>>excludeEnd("ctx");
  8554. },
  8555. //>>excludeStart("ide", pragmas.excludeIdeData);
  8556. args: [],
  8557. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8558. referencedClasses: [],
  8559. //>>excludeEnd("ide");
  8560. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8561. }),
  8562. $globals.ProtoStream);
  8563. $core.addMethod(
  8564. $core.method({
  8565. selector: "nextPut:",
  8566. protocol: "writing",
  8567. fn: function (anObject){
  8568. var self=this,$self=this;
  8569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8570. return $core.withContext(function($ctx1) {
  8571. //>>excludeEnd("ctx");
  8572. $self._subclassResponsibility();
  8573. return self;
  8574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8575. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  8576. //>>excludeEnd("ctx");
  8577. },
  8578. //>>excludeStart("ide", pragmas.excludeIdeData);
  8579. args: ["anObject"],
  8580. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  8581. referencedClasses: [],
  8582. //>>excludeEnd("ide");
  8583. messageSends: ["subclassResponsibility"]
  8584. }),
  8585. $globals.ProtoStream);
  8586. $core.addMethod(
  8587. $core.method({
  8588. selector: "nextPutAll:",
  8589. protocol: "writing",
  8590. fn: function (aCollection){
  8591. var self=this,$self=this;
  8592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8593. return $core.withContext(function($ctx1) {
  8594. //>>excludeEnd("ctx");
  8595. $recv(aCollection)._do_((function(each){
  8596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8597. return $core.withContext(function($ctx2) {
  8598. //>>excludeEnd("ctx");
  8599. return $self._nextPut_(each);
  8600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8601. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8602. //>>excludeEnd("ctx");
  8603. }));
  8604. return self;
  8605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8606. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  8607. //>>excludeEnd("ctx");
  8608. },
  8609. //>>excludeStart("ide", pragmas.excludeIdeData);
  8610. args: ["aCollection"],
  8611. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  8612. referencedClasses: [],
  8613. //>>excludeEnd("ide");
  8614. messageSends: ["do:", "nextPut:"]
  8615. }),
  8616. $globals.ProtoStream);
  8617. $core.addMethod(
  8618. $core.method({
  8619. selector: "nextPutString:",
  8620. protocol: "writing",
  8621. fn: function (aString){
  8622. var self=this,$self=this;
  8623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8624. return $core.withContext(function($ctx1) {
  8625. //>>excludeEnd("ctx");
  8626. $self._nextPut_(aString);
  8627. return self;
  8628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8629. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  8630. //>>excludeEnd("ctx");
  8631. },
  8632. //>>excludeStart("ide", pragmas.excludeIdeData);
  8633. args: ["aString"],
  8634. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  8635. referencedClasses: [],
  8636. //>>excludeEnd("ide");
  8637. messageSends: ["nextPut:"]
  8638. }),
  8639. $globals.ProtoStream);
  8640. $core.addMethod(
  8641. $core.method({
  8642. selector: "peek",
  8643. protocol: "reading",
  8644. fn: function (){
  8645. var self=this,$self=this;
  8646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8647. return $core.withContext(function($ctx1) {
  8648. //>>excludeEnd("ctx");
  8649. var $1;
  8650. $1=$self._atEnd();
  8651. if($core.assert($1)){
  8652. return nil;
  8653. } else {
  8654. return $self._subclassResponsibility();
  8655. }
  8656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8657. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  8658. //>>excludeEnd("ctx");
  8659. },
  8660. //>>excludeStart("ide", pragmas.excludeIdeData);
  8661. args: [],
  8662. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8663. referencedClasses: [],
  8664. //>>excludeEnd("ide");
  8665. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8666. }),
  8667. $globals.ProtoStream);
  8668. $core.addMethod(
  8669. $core.method({
  8670. selector: "reset",
  8671. protocol: "actions",
  8672. fn: function (){
  8673. var self=this,$self=this;
  8674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8675. return $core.withContext(function($ctx1) {
  8676. //>>excludeEnd("ctx");
  8677. $self._subclassResponsibility();
  8678. return self;
  8679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8680. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  8681. //>>excludeEnd("ctx");
  8682. },
  8683. //>>excludeStart("ide", pragmas.excludeIdeData);
  8684. args: [],
  8685. source: "reset\x0a\x09self subclassResponsibility",
  8686. referencedClasses: [],
  8687. //>>excludeEnd("ide");
  8688. messageSends: ["subclassResponsibility"]
  8689. }),
  8690. $globals.ProtoStream);
  8691. $core.addMethod(
  8692. $core.method({
  8693. selector: "resetContents",
  8694. protocol: "actions",
  8695. fn: function (){
  8696. var self=this,$self=this;
  8697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8698. return $core.withContext(function($ctx1) {
  8699. //>>excludeEnd("ctx");
  8700. $self._subclassResponsibility();
  8701. return self;
  8702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8703. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  8704. //>>excludeEnd("ctx");
  8705. },
  8706. //>>excludeStart("ide", pragmas.excludeIdeData);
  8707. args: [],
  8708. source: "resetContents\x0a\x09self subclassResponsibility",
  8709. referencedClasses: [],
  8710. //>>excludeEnd("ide");
  8711. messageSends: ["subclassResponsibility"]
  8712. }),
  8713. $globals.ProtoStream);
  8714. $core.addMethod(
  8715. $core.method({
  8716. selector: "setToEnd",
  8717. protocol: "positioning",
  8718. fn: function (){
  8719. var self=this,$self=this;
  8720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8721. return $core.withContext(function($ctx1) {
  8722. //>>excludeEnd("ctx");
  8723. $self._subclassResponsibility();
  8724. return self;
  8725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8726. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  8727. //>>excludeEnd("ctx");
  8728. },
  8729. //>>excludeStart("ide", pragmas.excludeIdeData);
  8730. args: [],
  8731. source: "setToEnd\x0a\x09self subclassResponsibility",
  8732. referencedClasses: [],
  8733. //>>excludeEnd("ide");
  8734. messageSends: ["subclassResponsibility"]
  8735. }),
  8736. $globals.ProtoStream);
  8737. $core.addMethod(
  8738. $core.method({
  8739. selector: "setToStart",
  8740. protocol: "positioning",
  8741. fn: function (){
  8742. var self=this,$self=this;
  8743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8744. return $core.withContext(function($ctx1) {
  8745. //>>excludeEnd("ctx");
  8746. $self._reset();
  8747. return self;
  8748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8749. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  8750. //>>excludeEnd("ctx");
  8751. },
  8752. //>>excludeStart("ide", pragmas.excludeIdeData);
  8753. args: [],
  8754. source: "setToStart\x0a\x09self reset",
  8755. referencedClasses: [],
  8756. //>>excludeEnd("ide");
  8757. messageSends: ["reset"]
  8758. }),
  8759. $globals.ProtoStream);
  8760. $core.addMethod(
  8761. $core.method({
  8762. selector: "write:",
  8763. protocol: "writing",
  8764. fn: function (anObject){
  8765. var self=this,$self=this;
  8766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8767. return $core.withContext(function($ctx1) {
  8768. //>>excludeEnd("ctx");
  8769. $recv(anObject)._putOn_(self);
  8770. return self;
  8771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8772. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  8773. //>>excludeEnd("ctx");
  8774. },
  8775. //>>excludeStart("ide", pragmas.excludeIdeData);
  8776. args: ["anObject"],
  8777. source: "write: anObject\x0a\x09anObject putOn: self",
  8778. referencedClasses: [],
  8779. //>>excludeEnd("ide");
  8780. messageSends: ["putOn:"]
  8781. }),
  8782. $globals.ProtoStream);
  8783. $core.addMethod(
  8784. $core.method({
  8785. selector: "on:",
  8786. protocol: "instance creation",
  8787. fn: function (aCollection){
  8788. var self=this,$self=this;
  8789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8790. return $core.withContext(function($ctx1) {
  8791. //>>excludeEnd("ctx");
  8792. var $1;
  8793. $1=$self._new();
  8794. $recv($1)._setCollection_(aCollection);
  8795. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8796. return $recv($1)._yourself();
  8797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8798. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.a$cls)});
  8799. //>>excludeEnd("ctx");
  8800. },
  8801. //>>excludeStart("ide", pragmas.excludeIdeData);
  8802. args: ["aCollection"],
  8803. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8804. referencedClasses: [],
  8805. //>>excludeEnd("ide");
  8806. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8807. }),
  8808. $globals.ProtoStream.a$cls);
  8809. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  8810. //>>excludeStart("ide", pragmas.excludeIdeData);
  8811. $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.";
  8812. //>>excludeEnd("ide");
  8813. $core.addMethod(
  8814. $core.method({
  8815. selector: "atEnd",
  8816. protocol: "testing",
  8817. fn: function (){
  8818. var self=this,$self=this;
  8819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8820. return $core.withContext(function($ctx1) {
  8821. //>>excludeEnd("ctx");
  8822. return $recv($self._position()).__eq($self._size());
  8823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8824. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  8825. //>>excludeEnd("ctx");
  8826. },
  8827. //>>excludeStart("ide", pragmas.excludeIdeData);
  8828. args: [],
  8829. source: "atEnd\x0a\x09^ self position = self size",
  8830. referencedClasses: [],
  8831. //>>excludeEnd("ide");
  8832. messageSends: ["=", "position", "size"]
  8833. }),
  8834. $globals.Stream);
  8835. $core.addMethod(
  8836. $core.method({
  8837. selector: "atStart",
  8838. protocol: "testing",
  8839. fn: function (){
  8840. var self=this,$self=this;
  8841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8842. return $core.withContext(function($ctx1) {
  8843. //>>excludeEnd("ctx");
  8844. return $recv($self._position()).__eq((0));
  8845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8846. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  8847. //>>excludeEnd("ctx");
  8848. },
  8849. //>>excludeStart("ide", pragmas.excludeIdeData);
  8850. args: [],
  8851. source: "atStart\x0a\x09^ self position = 0",
  8852. referencedClasses: [],
  8853. //>>excludeEnd("ide");
  8854. messageSends: ["=", "position"]
  8855. }),
  8856. $globals.Stream);
  8857. $core.addMethod(
  8858. $core.method({
  8859. selector: "close",
  8860. protocol: "actions",
  8861. fn: function (){
  8862. var self=this,$self=this;
  8863. return self;
  8864. },
  8865. //>>excludeStart("ide", pragmas.excludeIdeData);
  8866. args: [],
  8867. source: "close",
  8868. referencedClasses: [],
  8869. //>>excludeEnd("ide");
  8870. messageSends: []
  8871. }),
  8872. $globals.Stream);
  8873. $core.addMethod(
  8874. $core.method({
  8875. selector: "collection",
  8876. protocol: "accessing",
  8877. fn: function (){
  8878. var self=this,$self=this;
  8879. return $self["@collection"];
  8880. },
  8881. //>>excludeStart("ide", pragmas.excludeIdeData);
  8882. args: [],
  8883. source: "collection\x0a\x09^ collection",
  8884. referencedClasses: [],
  8885. //>>excludeEnd("ide");
  8886. messageSends: []
  8887. }),
  8888. $globals.Stream);
  8889. $core.addMethod(
  8890. $core.method({
  8891. selector: "contents",
  8892. protocol: "accessing",
  8893. fn: function (){
  8894. var self=this,$self=this;
  8895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8896. return $core.withContext(function($ctx1) {
  8897. //>>excludeEnd("ctx");
  8898. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  8899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8900. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  8901. //>>excludeEnd("ctx");
  8902. },
  8903. //>>excludeStart("ide", pragmas.excludeIdeData);
  8904. args: [],
  8905. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8906. referencedClasses: [],
  8907. //>>excludeEnd("ide");
  8908. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8909. }),
  8910. $globals.Stream);
  8911. $core.addMethod(
  8912. $core.method({
  8913. selector: "flush",
  8914. protocol: "actions",
  8915. fn: function (){
  8916. var self=this,$self=this;
  8917. return self;
  8918. },
  8919. //>>excludeStart("ide", pragmas.excludeIdeData);
  8920. args: [],
  8921. source: "flush",
  8922. referencedClasses: [],
  8923. //>>excludeEnd("ide");
  8924. messageSends: []
  8925. }),
  8926. $globals.Stream);
  8927. $core.addMethod(
  8928. $core.method({
  8929. selector: "isEmpty",
  8930. protocol: "testing",
  8931. fn: function (){
  8932. var self=this,$self=this;
  8933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8934. return $core.withContext(function($ctx1) {
  8935. //>>excludeEnd("ctx");
  8936. return $recv($self._size()).__eq((0));
  8937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8938. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  8939. //>>excludeEnd("ctx");
  8940. },
  8941. //>>excludeStart("ide", pragmas.excludeIdeData);
  8942. args: [],
  8943. source: "isEmpty\x0a\x09^ self size = 0",
  8944. referencedClasses: [],
  8945. //>>excludeEnd("ide");
  8946. messageSends: ["=", "size"]
  8947. }),
  8948. $globals.Stream);
  8949. $core.addMethod(
  8950. $core.method({
  8951. selector: "next",
  8952. protocol: "reading",
  8953. fn: function (){
  8954. var self=this,$self=this;
  8955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8956. return $core.withContext(function($ctx1) {
  8957. //>>excludeEnd("ctx");
  8958. var $1,$3,$2;
  8959. $1=$self._atEnd();
  8960. if($core.assert($1)){
  8961. return nil;
  8962. } else {
  8963. $3=$self._position();
  8964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8965. $ctx1.sendIdx["position"]=1;
  8966. //>>excludeEnd("ctx");
  8967. $2=$recv($3).__plus((1));
  8968. $self._position_($2);
  8969. return $recv($self["@collection"])._at_($self._position());
  8970. }
  8971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8972. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  8973. //>>excludeEnd("ctx");
  8974. },
  8975. //>>excludeStart("ide", pragmas.excludeIdeData);
  8976. args: [],
  8977. 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 ]",
  8978. referencedClasses: [],
  8979. //>>excludeEnd("ide");
  8980. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8981. }),
  8982. $globals.Stream);
  8983. $core.addMethod(
  8984. $core.method({
  8985. selector: "next:",
  8986. protocol: "reading",
  8987. fn: function (anInteger){
  8988. var self=this,$self=this;
  8989. var tempCollection;
  8990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8991. return $core.withContext(function($ctx1) {
  8992. //>>excludeEnd("ctx");
  8993. var $1;
  8994. tempCollection=$recv($recv($self._collection())._class())._new();
  8995. $recv(anInteger)._timesRepeat_((function(){
  8996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8997. return $core.withContext(function($ctx2) {
  8998. //>>excludeEnd("ctx");
  8999. $1=$self._atEnd();
  9000. if(!$core.assert($1)){
  9001. return $recv(tempCollection)._add_($self._next());
  9002. }
  9003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9005. //>>excludeEnd("ctx");
  9006. }));
  9007. return tempCollection;
  9008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9009. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  9010. //>>excludeEnd("ctx");
  9011. },
  9012. //>>excludeStart("ide", pragmas.excludeIdeData);
  9013. args: ["anInteger"],
  9014. 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",
  9015. referencedClasses: [],
  9016. //>>excludeEnd("ide");
  9017. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  9018. }),
  9019. $globals.Stream);
  9020. $core.addMethod(
  9021. $core.method({
  9022. selector: "nextPut:",
  9023. protocol: "writing",
  9024. fn: function (anObject){
  9025. var self=this,$self=this;
  9026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9027. return $core.withContext(function($ctx1) {
  9028. //>>excludeEnd("ctx");
  9029. var $2,$1,$3,$4;
  9030. $2=$self._position();
  9031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9032. $ctx1.sendIdx["position"]=1;
  9033. //>>excludeEnd("ctx");
  9034. $1=$recv($2).__plus((1));
  9035. $self._position_($1);
  9036. $3=$self._collection();
  9037. $4=$self._position();
  9038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9039. $ctx1.sendIdx["position"]=2;
  9040. //>>excludeEnd("ctx");
  9041. $recv($3)._at_put_($4,anObject);
  9042. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  9043. return self;
  9044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9045. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  9046. //>>excludeEnd("ctx");
  9047. },
  9048. //>>excludeStart("ide", pragmas.excludeIdeData);
  9049. args: ["anObject"],
  9050. 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)",
  9051. referencedClasses: [],
  9052. //>>excludeEnd("ide");
  9053. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  9054. }),
  9055. $globals.Stream);
  9056. $core.addMethod(
  9057. $core.method({
  9058. selector: "peek",
  9059. protocol: "reading",
  9060. fn: function (){
  9061. var self=this,$self=this;
  9062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9063. return $core.withContext(function($ctx1) {
  9064. //>>excludeEnd("ctx");
  9065. var $1;
  9066. $1=$self._atEnd();
  9067. if(!$core.assert($1)){
  9068. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  9069. }
  9070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9071. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  9072. //>>excludeEnd("ctx");
  9073. },
  9074. //>>excludeStart("ide", pragmas.excludeIdeData);
  9075. args: [],
  9076. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  9077. referencedClasses: [],
  9078. //>>excludeEnd("ide");
  9079. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  9080. }),
  9081. $globals.Stream);
  9082. $core.addMethod(
  9083. $core.method({
  9084. selector: "position",
  9085. protocol: "accessing",
  9086. fn: function (){
  9087. var self=this,$self=this;
  9088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9089. return $core.withContext(function($ctx1) {
  9090. //>>excludeEnd("ctx");
  9091. var $1,$receiver;
  9092. $1=$self["@position"];
  9093. if(($receiver = $1) == null || $receiver.a$nil){
  9094. $self["@position"]=(0);
  9095. return $self["@position"];
  9096. } else {
  9097. return $1;
  9098. }
  9099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9100. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  9101. //>>excludeEnd("ctx");
  9102. },
  9103. //>>excludeStart("ide", pragmas.excludeIdeData);
  9104. args: [],
  9105. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  9106. referencedClasses: [],
  9107. //>>excludeEnd("ide");
  9108. messageSends: ["ifNil:"]
  9109. }),
  9110. $globals.Stream);
  9111. $core.addMethod(
  9112. $core.method({
  9113. selector: "position:",
  9114. protocol: "accessing",
  9115. fn: function (anInteger){
  9116. var self=this,$self=this;
  9117. $self["@position"]=anInteger;
  9118. return self;
  9119. },
  9120. //>>excludeStart("ide", pragmas.excludeIdeData);
  9121. args: ["anInteger"],
  9122. source: "position: anInteger\x0a\x09position := anInteger",
  9123. referencedClasses: [],
  9124. //>>excludeEnd("ide");
  9125. messageSends: []
  9126. }),
  9127. $globals.Stream);
  9128. $core.addMethod(
  9129. $core.method({
  9130. selector: "reset",
  9131. protocol: "actions",
  9132. fn: function (){
  9133. var self=this,$self=this;
  9134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9135. return $core.withContext(function($ctx1) {
  9136. //>>excludeEnd("ctx");
  9137. $self._position_((0));
  9138. return self;
  9139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9140. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  9141. //>>excludeEnd("ctx");
  9142. },
  9143. //>>excludeStart("ide", pragmas.excludeIdeData);
  9144. args: [],
  9145. source: "reset\x0a\x09self position: 0",
  9146. referencedClasses: [],
  9147. //>>excludeEnd("ide");
  9148. messageSends: ["position:"]
  9149. }),
  9150. $globals.Stream);
  9151. $core.addMethod(
  9152. $core.method({
  9153. selector: "resetContents",
  9154. protocol: "actions",
  9155. fn: function (){
  9156. var self=this,$self=this;
  9157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9158. return $core.withContext(function($ctx1) {
  9159. //>>excludeEnd("ctx");
  9160. $self._reset();
  9161. $self._setStreamSize_((0));
  9162. return self;
  9163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9164. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  9165. //>>excludeEnd("ctx");
  9166. },
  9167. //>>excludeStart("ide", pragmas.excludeIdeData);
  9168. args: [],
  9169. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  9170. referencedClasses: [],
  9171. //>>excludeEnd("ide");
  9172. messageSends: ["reset", "setStreamSize:"]
  9173. }),
  9174. $globals.Stream);
  9175. $core.addMethod(
  9176. $core.method({
  9177. selector: "setCollection:",
  9178. protocol: "accessing",
  9179. fn: function (aCollection){
  9180. var self=this,$self=this;
  9181. $self["@collection"]=aCollection;
  9182. return self;
  9183. },
  9184. //>>excludeStart("ide", pragmas.excludeIdeData);
  9185. args: ["aCollection"],
  9186. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  9187. referencedClasses: [],
  9188. //>>excludeEnd("ide");
  9189. messageSends: []
  9190. }),
  9191. $globals.Stream);
  9192. $core.addMethod(
  9193. $core.method({
  9194. selector: "setStreamSize:",
  9195. protocol: "accessing",
  9196. fn: function (anInteger){
  9197. var self=this,$self=this;
  9198. $self["@streamSize"]=anInteger;
  9199. return self;
  9200. },
  9201. //>>excludeStart("ide", pragmas.excludeIdeData);
  9202. args: ["anInteger"],
  9203. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  9204. referencedClasses: [],
  9205. //>>excludeEnd("ide");
  9206. messageSends: []
  9207. }),
  9208. $globals.Stream);
  9209. $core.addMethod(
  9210. $core.method({
  9211. selector: "setToEnd",
  9212. protocol: "positioning",
  9213. fn: function (){
  9214. var self=this,$self=this;
  9215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9216. return $core.withContext(function($ctx1) {
  9217. //>>excludeEnd("ctx");
  9218. $self._position_($self._size());
  9219. return self;
  9220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9221. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  9222. //>>excludeEnd("ctx");
  9223. },
  9224. //>>excludeStart("ide", pragmas.excludeIdeData);
  9225. args: [],
  9226. source: "setToEnd\x0a\x09self position: self size",
  9227. referencedClasses: [],
  9228. //>>excludeEnd("ide");
  9229. messageSends: ["position:", "size"]
  9230. }),
  9231. $globals.Stream);
  9232. $core.addMethod(
  9233. $core.method({
  9234. selector: "size",
  9235. protocol: "accessing",
  9236. fn: function (){
  9237. var self=this,$self=this;
  9238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9239. return $core.withContext(function($ctx1) {
  9240. //>>excludeEnd("ctx");
  9241. return $self._streamSize();
  9242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9243. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  9244. //>>excludeEnd("ctx");
  9245. },
  9246. //>>excludeStart("ide", pragmas.excludeIdeData);
  9247. args: [],
  9248. source: "size\x0a\x09^ self streamSize",
  9249. referencedClasses: [],
  9250. //>>excludeEnd("ide");
  9251. messageSends: ["streamSize"]
  9252. }),
  9253. $globals.Stream);
  9254. $core.addMethod(
  9255. $core.method({
  9256. selector: "skip:",
  9257. protocol: "positioning",
  9258. fn: function (anInteger){
  9259. var self=this,$self=this;
  9260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9261. return $core.withContext(function($ctx1) {
  9262. //>>excludeEnd("ctx");
  9263. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  9264. return self;
  9265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9266. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  9267. //>>excludeEnd("ctx");
  9268. },
  9269. //>>excludeStart("ide", pragmas.excludeIdeData);
  9270. args: ["anInteger"],
  9271. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  9272. referencedClasses: [],
  9273. //>>excludeEnd("ide");
  9274. messageSends: ["position:", "min:max:", "+", "position", "size"]
  9275. }),
  9276. $globals.Stream);
  9277. $core.addMethod(
  9278. $core.method({
  9279. selector: "streamSize",
  9280. protocol: "accessing",
  9281. fn: function (){
  9282. var self=this,$self=this;
  9283. return $self["@streamSize"];
  9284. },
  9285. //>>excludeStart("ide", pragmas.excludeIdeData);
  9286. args: [],
  9287. source: "streamSize\x0a\x09^ streamSize",
  9288. referencedClasses: [],
  9289. //>>excludeEnd("ide");
  9290. messageSends: []
  9291. }),
  9292. $globals.Stream);
  9293. $core.addMethod(
  9294. $core.method({
  9295. selector: "on:",
  9296. protocol: "instance creation",
  9297. fn: function (aCollection){
  9298. var self=this,$self=this;
  9299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9300. return $core.withContext(function($ctx1) {
  9301. //>>excludeEnd("ctx");
  9302. var $1;
  9303. $1=$self._new();
  9304. $recv($1)._setCollection_(aCollection);
  9305. $recv($1)._setStreamSize_($recv(aCollection)._size());
  9306. return $recv($1)._yourself();
  9307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9308. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.a$cls)});
  9309. //>>excludeEnd("ctx");
  9310. },
  9311. //>>excludeStart("ide", pragmas.excludeIdeData);
  9312. args: ["aCollection"],
  9313. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  9314. referencedClasses: [],
  9315. //>>excludeEnd("ide");
  9316. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  9317. }),
  9318. $globals.Stream.a$cls);
  9319. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  9320. //>>excludeStart("ide", pragmas.excludeIdeData);
  9321. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  9322. //>>excludeEnd("ide");
  9323. $core.addMethod(
  9324. $core.method({
  9325. selector: "cr",
  9326. protocol: "writing",
  9327. fn: function (){
  9328. var self=this,$self=this;
  9329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9330. return $core.withContext(function($ctx1) {
  9331. //>>excludeEnd("ctx");
  9332. return $self._nextPutAll_($recv($globals.String)._cr());
  9333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9334. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  9335. //>>excludeEnd("ctx");
  9336. },
  9337. //>>excludeStart("ide", pragmas.excludeIdeData);
  9338. args: [],
  9339. source: "cr\x0a\x09^ self nextPutAll: String cr",
  9340. referencedClasses: ["String"],
  9341. //>>excludeEnd("ide");
  9342. messageSends: ["nextPutAll:", "cr"]
  9343. }),
  9344. $globals.StringStream);
  9345. $core.addMethod(
  9346. $core.method({
  9347. selector: "crlf",
  9348. protocol: "writing",
  9349. fn: function (){
  9350. var self=this,$self=this;
  9351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9352. return $core.withContext(function($ctx1) {
  9353. //>>excludeEnd("ctx");
  9354. return $self._nextPutAll_($recv($globals.String)._crlf());
  9355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9356. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  9357. //>>excludeEnd("ctx");
  9358. },
  9359. //>>excludeStart("ide", pragmas.excludeIdeData);
  9360. args: [],
  9361. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  9362. referencedClasses: ["String"],
  9363. //>>excludeEnd("ide");
  9364. messageSends: ["nextPutAll:", "crlf"]
  9365. }),
  9366. $globals.StringStream);
  9367. $core.addMethod(
  9368. $core.method({
  9369. selector: "lf",
  9370. protocol: "writing",
  9371. fn: function (){
  9372. var self=this,$self=this;
  9373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9374. return $core.withContext(function($ctx1) {
  9375. //>>excludeEnd("ctx");
  9376. return $self._nextPutAll_($recv($globals.String)._lf());
  9377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9378. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  9379. //>>excludeEnd("ctx");
  9380. },
  9381. //>>excludeStart("ide", pragmas.excludeIdeData);
  9382. args: [],
  9383. source: "lf\x0a\x09^ self nextPutAll: String lf",
  9384. referencedClasses: ["String"],
  9385. //>>excludeEnd("ide");
  9386. messageSends: ["nextPutAll:", "lf"]
  9387. }),
  9388. $globals.StringStream);
  9389. $core.addMethod(
  9390. $core.method({
  9391. selector: "next:",
  9392. protocol: "reading",
  9393. fn: function (anInteger){
  9394. var self=this,$self=this;
  9395. var tempCollection;
  9396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9397. return $core.withContext(function($ctx1) {
  9398. //>>excludeEnd("ctx");
  9399. var $1;
  9400. tempCollection=$recv($recv($self._collection())._class())._new();
  9401. $recv(anInteger)._timesRepeat_((function(){
  9402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9403. return $core.withContext(function($ctx2) {
  9404. //>>excludeEnd("ctx");
  9405. $1=$self._atEnd();
  9406. if(!$core.assert($1)){
  9407. tempCollection=$recv(tempCollection).__comma($self._next());
  9408. return tempCollection;
  9409. }
  9410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9411. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9412. //>>excludeEnd("ctx");
  9413. }));
  9414. return tempCollection;
  9415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9416. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  9417. //>>excludeEnd("ctx");
  9418. },
  9419. //>>excludeStart("ide", pragmas.excludeIdeData);
  9420. args: ["anInteger"],
  9421. 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",
  9422. referencedClasses: [],
  9423. //>>excludeEnd("ide");
  9424. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  9425. }),
  9426. $globals.StringStream);
  9427. $core.addMethod(
  9428. $core.method({
  9429. selector: "nextPut:",
  9430. protocol: "writing",
  9431. fn: function (aString){
  9432. var self=this,$self=this;
  9433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9434. return $core.withContext(function($ctx1) {
  9435. //>>excludeEnd("ctx");
  9436. $self._nextPutAll_(aString);
  9437. return self;
  9438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9439. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  9440. //>>excludeEnd("ctx");
  9441. },
  9442. //>>excludeStart("ide", pragmas.excludeIdeData);
  9443. args: ["aString"],
  9444. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  9445. referencedClasses: [],
  9446. //>>excludeEnd("ide");
  9447. messageSends: ["nextPutAll:"]
  9448. }),
  9449. $globals.StringStream);
  9450. $core.addMethod(
  9451. $core.method({
  9452. selector: "nextPutAll:",
  9453. protocol: "writing",
  9454. fn: function (aString){
  9455. var self=this,$self=this;
  9456. var pre,post;
  9457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9458. return $core.withContext(function($ctx1) {
  9459. //>>excludeEnd("ctx");
  9460. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  9461. $1=$self._atEnd();
  9462. if($core.assert($1)){
  9463. $3=$self._collection();
  9464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9465. $ctx1.sendIdx["collection"]=1;
  9466. //>>excludeEnd("ctx");
  9467. $2=$recv($3).__comma(aString);
  9468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9469. $ctx1.sendIdx[","]=1;
  9470. //>>excludeEnd("ctx");
  9471. $self._setCollection_($2);
  9472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9473. $ctx1.sendIdx["setCollection:"]=1;
  9474. //>>excludeEnd("ctx");
  9475. } else {
  9476. $4=$self._collection();
  9477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9478. $ctx1.sendIdx["collection"]=2;
  9479. //>>excludeEnd("ctx");
  9480. $5=$self._position();
  9481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9482. $ctx1.sendIdx["position"]=1;
  9483. //>>excludeEnd("ctx");
  9484. pre=$recv($4)._copyFrom_to_((1),$5);
  9485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9486. $ctx1.sendIdx["copyFrom:to:"]=1;
  9487. //>>excludeEnd("ctx");
  9488. pre;
  9489. $6=$self._collection();
  9490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9491. $ctx1.sendIdx["collection"]=3;
  9492. //>>excludeEnd("ctx");
  9493. $9=$self._position();
  9494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9495. $ctx1.sendIdx["position"]=2;
  9496. //>>excludeEnd("ctx");
  9497. $8=$recv($9).__plus((1));
  9498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9499. $ctx1.sendIdx["+"]=2;
  9500. //>>excludeEnd("ctx");
  9501. $10=$recv(aString)._size();
  9502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9503. $ctx1.sendIdx["size"]=1;
  9504. //>>excludeEnd("ctx");
  9505. $7=$recv($8).__plus($10);
  9506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9507. $ctx1.sendIdx["+"]=1;
  9508. //>>excludeEnd("ctx");
  9509. $11=$recv($self._collection())._size();
  9510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9511. $ctx1.sendIdx["size"]=2;
  9512. //>>excludeEnd("ctx");
  9513. post=$recv($6)._copyFrom_to_($7,$11);
  9514. post;
  9515. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  9516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9517. $ctx1.sendIdx[","]=2;
  9518. //>>excludeEnd("ctx");
  9519. $self._setCollection_($12);
  9520. }
  9521. $14=$self._position();
  9522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9523. $ctx1.sendIdx["position"]=3;
  9524. //>>excludeEnd("ctx");
  9525. $13=$recv($14).__plus($recv(aString)._size());
  9526. $self._position_($13);
  9527. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  9528. return self;
  9529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9530. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  9531. //>>excludeEnd("ctx");
  9532. },
  9533. //>>excludeStart("ide", pragmas.excludeIdeData);
  9534. args: ["aString"],
  9535. source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self atEnd ifTrue: [ self setCollection: self collection, aString ] ifFalse: [\x0a\x09\x09pre := self collection copyFrom: 1 to: self position.\x0a\x09\x09post := self collection copyFrom: (self position + 1 + aString size) to: self collection size.\x0a\x09\x09self setCollection: pre, aString, post\x0a\x09].\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  9536. referencedClasses: [],
  9537. //>>excludeEnd("ide");
  9538. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  9539. }),
  9540. $globals.StringStream);
  9541. $core.addMethod(
  9542. $core.method({
  9543. selector: "nextPutString:",
  9544. protocol: "writing",
  9545. fn: function (aString){
  9546. var self=this,$self=this;
  9547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9548. return $core.withContext(function($ctx1) {
  9549. //>>excludeEnd("ctx");
  9550. $self._nextPutAll_(aString);
  9551. return self;
  9552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9553. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  9554. //>>excludeEnd("ctx");
  9555. },
  9556. //>>excludeStart("ide", pragmas.excludeIdeData);
  9557. args: ["aString"],
  9558. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  9559. referencedClasses: [],
  9560. //>>excludeEnd("ide");
  9561. messageSends: ["nextPutAll:"]
  9562. }),
  9563. $globals.StringStream);
  9564. $core.addMethod(
  9565. $core.method({
  9566. selector: "print:",
  9567. protocol: "writing",
  9568. fn: function (anObject){
  9569. var self=this,$self=this;
  9570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9571. return $core.withContext(function($ctx1) {
  9572. //>>excludeEnd("ctx");
  9573. $recv(anObject)._printOn_(self);
  9574. return self;
  9575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9576. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  9577. //>>excludeEnd("ctx");
  9578. },
  9579. //>>excludeStart("ide", pragmas.excludeIdeData);
  9580. args: ["anObject"],
  9581. source: "print: anObject\x0a\x09anObject printOn: self",
  9582. referencedClasses: [],
  9583. //>>excludeEnd("ide");
  9584. messageSends: ["printOn:"]
  9585. }),
  9586. $globals.StringStream);
  9587. $core.addMethod(
  9588. $core.method({
  9589. selector: "printSymbol:",
  9590. protocol: "writing",
  9591. fn: function (anObject){
  9592. var self=this,$self=this;
  9593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9594. return $core.withContext(function($ctx1) {
  9595. //>>excludeEnd("ctx");
  9596. $recv(anObject)._asSymbolPrintOn_(self);
  9597. return self;
  9598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9599. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  9600. //>>excludeEnd("ctx");
  9601. },
  9602. //>>excludeStart("ide", pragmas.excludeIdeData);
  9603. args: ["anObject"],
  9604. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  9605. referencedClasses: [],
  9606. //>>excludeEnd("ide");
  9607. messageSends: ["asSymbolPrintOn:"]
  9608. }),
  9609. $globals.StringStream);
  9610. $core.addMethod(
  9611. $core.method({
  9612. selector: "space",
  9613. protocol: "writing",
  9614. fn: function (){
  9615. var self=this,$self=this;
  9616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9617. return $core.withContext(function($ctx1) {
  9618. //>>excludeEnd("ctx");
  9619. $self._nextPut_(" ");
  9620. return self;
  9621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9622. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  9623. //>>excludeEnd("ctx");
  9624. },
  9625. //>>excludeStart("ide", pragmas.excludeIdeData);
  9626. args: [],
  9627. source: "space\x0a\x09self nextPut: ' '",
  9628. referencedClasses: [],
  9629. //>>excludeEnd("ide");
  9630. messageSends: ["nextPut:"]
  9631. }),
  9632. $globals.StringStream);
  9633. $core.addMethod(
  9634. $core.method({
  9635. selector: "tab",
  9636. protocol: "writing",
  9637. fn: function (){
  9638. var self=this,$self=this;
  9639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9640. return $core.withContext(function($ctx1) {
  9641. //>>excludeEnd("ctx");
  9642. return $self._nextPutAll_($recv($globals.String)._tab());
  9643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9644. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  9645. //>>excludeEnd("ctx");
  9646. },
  9647. //>>excludeStart("ide", pragmas.excludeIdeData);
  9648. args: [],
  9649. source: "tab\x0a\x09^ self nextPutAll: String tab",
  9650. referencedClasses: ["String"],
  9651. //>>excludeEnd("ide");
  9652. messageSends: ["nextPutAll:", "tab"]
  9653. }),
  9654. $globals.StringStream);
  9655. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  9656. //>>excludeStart("ide", pragmas.excludeIdeData);
  9657. $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.";
  9658. //>>excludeEnd("ide");
  9659. $core.addMethod(
  9660. $core.method({
  9661. selector: "initialize",
  9662. protocol: "initialization",
  9663. fn: function (){
  9664. var self=this,$self=this;
  9665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9666. return $core.withContext(function($ctx1) {
  9667. //>>excludeEnd("ctx");
  9668. (
  9669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9670. $ctx1.supercall = true,
  9671. //>>excludeEnd("ctx");
  9672. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  9673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9674. $ctx1.supercall = false;
  9675. //>>excludeEnd("ctx");;
  9676. $self["@read"]=$recv($globals.OrderedCollection)._new();
  9677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9678. $ctx1.sendIdx["new"]=1;
  9679. //>>excludeEnd("ctx");
  9680. $self["@write"]=$recv($globals.OrderedCollection)._new();
  9681. $self["@readIndex"]=(1);
  9682. return self;
  9683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9684. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  9685. //>>excludeEnd("ctx");
  9686. },
  9687. //>>excludeStart("ide", pragmas.excludeIdeData);
  9688. args: [],
  9689. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  9690. referencedClasses: ["OrderedCollection"],
  9691. //>>excludeEnd("ide");
  9692. messageSends: ["initialize", "new"]
  9693. }),
  9694. $globals.Queue);
  9695. $core.addMethod(
  9696. $core.method({
  9697. selector: "next",
  9698. protocol: "accessing",
  9699. fn: function (){
  9700. var self=this,$self=this;
  9701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9702. return $core.withContext(function($ctx1) {
  9703. //>>excludeEnd("ctx");
  9704. return $self._nextIfAbsent_((function(){
  9705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9706. return $core.withContext(function($ctx2) {
  9707. //>>excludeEnd("ctx");
  9708. return $self._error_("Cannot read from empty Queue.");
  9709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9710. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9711. //>>excludeEnd("ctx");
  9712. }));
  9713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9714. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  9715. //>>excludeEnd("ctx");
  9716. },
  9717. //>>excludeStart("ide", pragmas.excludeIdeData);
  9718. args: [],
  9719. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  9720. referencedClasses: [],
  9721. //>>excludeEnd("ide");
  9722. messageSends: ["nextIfAbsent:", "error:"]
  9723. }),
  9724. $globals.Queue);
  9725. $core.addMethod(
  9726. $core.method({
  9727. selector: "nextIfAbsent:",
  9728. protocol: "accessing",
  9729. fn: function (aBlock){
  9730. var self=this,$self=this;
  9731. var result;
  9732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9733. return $core.withContext(function($ctx1) {
  9734. //>>excludeEnd("ctx");
  9735. var $1;
  9736. var $early={};
  9737. try {
  9738. result=$recv($self["@read"])._at_ifAbsent_($self["@readIndex"],(function(){
  9739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9740. return $core.withContext(function($ctx2) {
  9741. //>>excludeEnd("ctx");
  9742. $recv($self["@write"])._ifEmpty_((function(){
  9743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9744. return $core.withContext(function($ctx3) {
  9745. //>>excludeEnd("ctx");
  9746. $1=$recv($self["@readIndex"]).__gt((1));
  9747. if($core.assert($1)){
  9748. $self["@read"]=[];
  9749. $self["@read"];
  9750. $self["@readIndex"]=(1);
  9751. $self["@readIndex"];
  9752. }
  9753. throw $early=[$recv(aBlock)._value()];
  9754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9755. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  9756. //>>excludeEnd("ctx");
  9757. }));
  9758. $self["@read"]=$self["@write"];
  9759. $self["@read"];
  9760. $self["@readIndex"]=(1);
  9761. $self["@readIndex"];
  9762. $self["@write"]=$recv($globals.OrderedCollection)._new();
  9763. $self["@write"];
  9764. return $recv($self["@read"])._first();
  9765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9766. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9767. //>>excludeEnd("ctx");
  9768. }));
  9769. $recv($self["@read"])._at_put_($self["@readIndex"],nil);
  9770. $self["@readIndex"]=$recv($self["@readIndex"]).__plus((1));
  9771. return result;
  9772. }
  9773. catch(e) {if(e===$early)return e[0]; throw e}
  9774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9775. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  9776. //>>excludeEnd("ctx");
  9777. },
  9778. //>>excludeStart("ide", pragmas.excludeIdeData);
  9779. args: ["aBlock"],
  9780. 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",
  9781. referencedClasses: ["OrderedCollection"],
  9782. //>>excludeEnd("ide");
  9783. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  9784. }),
  9785. $globals.Queue);
  9786. $core.addMethod(
  9787. $core.method({
  9788. selector: "nextPut:",
  9789. protocol: "accessing",
  9790. fn: function (anObject){
  9791. var self=this,$self=this;
  9792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9793. return $core.withContext(function($ctx1) {
  9794. //>>excludeEnd("ctx");
  9795. $recv($self["@write"])._add_(anObject);
  9796. return self;
  9797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9798. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  9799. //>>excludeEnd("ctx");
  9800. },
  9801. //>>excludeStart("ide", pragmas.excludeIdeData);
  9802. args: ["anObject"],
  9803. source: "nextPut: anObject\x0a\x09write add: anObject",
  9804. referencedClasses: [],
  9805. //>>excludeEnd("ide");
  9806. messageSends: ["add:"]
  9807. }),
  9808. $globals.Queue);
  9809. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  9810. //>>excludeStart("ide", pragmas.excludeIdeData);
  9811. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9812. //>>excludeEnd("ide");
  9813. $core.addMethod(
  9814. $core.method({
  9815. selector: "compile:",
  9816. protocol: "evaluating",
  9817. fn: function (aString){
  9818. var self=this,$self=this;
  9819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9820. return $core.withContext(function($ctx1) {
  9821. //>>excludeEnd("ctx");
  9822. return self.compile(aString);
  9823. return self;
  9824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9825. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  9826. //>>excludeEnd("ctx");
  9827. },
  9828. //>>excludeStart("ide", pragmas.excludeIdeData);
  9829. args: ["aString"],
  9830. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  9831. referencedClasses: [],
  9832. //>>excludeEnd("ide");
  9833. messageSends: []
  9834. }),
  9835. $globals.RegularExpression);
  9836. $core.addMethod(
  9837. $core.method({
  9838. selector: "exec:",
  9839. protocol: "evaluating",
  9840. fn: function (aString){
  9841. var self=this,$self=this;
  9842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9843. return $core.withContext(function($ctx1) {
  9844. //>>excludeEnd("ctx");
  9845. return self.exec(aString) || nil;
  9846. return self;
  9847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9848. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  9849. //>>excludeEnd("ctx");
  9850. },
  9851. //>>excludeStart("ide", pragmas.excludeIdeData);
  9852. args: ["aString"],
  9853. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  9854. referencedClasses: [],
  9855. //>>excludeEnd("ide");
  9856. messageSends: []
  9857. }),
  9858. $globals.RegularExpression);
  9859. $core.addMethod(
  9860. $core.method({
  9861. selector: "test:",
  9862. protocol: "evaluating",
  9863. fn: function (aString){
  9864. var self=this,$self=this;
  9865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9866. return $core.withContext(function($ctx1) {
  9867. //>>excludeEnd("ctx");
  9868. return self.test(aString);
  9869. return self;
  9870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9871. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  9872. //>>excludeEnd("ctx");
  9873. },
  9874. //>>excludeStart("ide", pragmas.excludeIdeData);
  9875. args: ["aString"],
  9876. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  9877. referencedClasses: [],
  9878. //>>excludeEnd("ide");
  9879. messageSends: []
  9880. }),
  9881. $globals.RegularExpression);
  9882. $core.addMethod(
  9883. $core.method({
  9884. selector: "fromString:",
  9885. protocol: "instance creation",
  9886. fn: function (aString){
  9887. var self=this,$self=this;
  9888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9889. return $core.withContext(function($ctx1) {
  9890. //>>excludeEnd("ctx");
  9891. return $self._fromString_flag_(aString,"");
  9892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9893. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.a$cls)});
  9894. //>>excludeEnd("ctx");
  9895. },
  9896. //>>excludeStart("ide", pragmas.excludeIdeData);
  9897. args: ["aString"],
  9898. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9899. referencedClasses: [],
  9900. //>>excludeEnd("ide");
  9901. messageSends: ["fromString:flag:"]
  9902. }),
  9903. $globals.RegularExpression.a$cls);
  9904. $core.addMethod(
  9905. $core.method({
  9906. selector: "fromString:flag:",
  9907. protocol: "instance creation",
  9908. fn: function (aString,anotherString){
  9909. var self=this,$self=this;
  9910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9911. return $core.withContext(function($ctx1) {
  9912. //>>excludeEnd("ctx");
  9913. return new RegExp(aString, anotherString);
  9914. return self;
  9915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9916. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.a$cls)});
  9917. //>>excludeEnd("ctx");
  9918. },
  9919. //>>excludeStart("ide", pragmas.excludeIdeData);
  9920. args: ["aString", "anotherString"],
  9921. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  9922. referencedClasses: [],
  9923. //>>excludeEnd("ide");
  9924. messageSends: []
  9925. }),
  9926. $globals.RegularExpression.a$cls);
  9927. });