Kernel-Collections.js 336 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452
  1. define(["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  2. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. var $pkg = $core.addPackage("Kernel-Collections");
  4. $pkg.innerEval = function (expr) { return eval(expr); };
  5. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  6. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  7. //>>excludeStart("ide", pragmas.excludeIdeData);
  8. $globals.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`";
  9. //>>excludeEnd("ide");
  10. $core.addMethod(
  11. $core.method({
  12. selector: "=",
  13. protocol: "comparing",
  14. fn: function (anAssociation){
  15. var self=this,$self=this;
  16. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17. return $core.withContext(function($ctx1) {
  18. //>>excludeEnd("ctx");
  19. var $3,$2,$5,$4,$6,$1;
  20. $3=$self._class();
  21. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22. $ctx1.sendIdx["class"]=1;
  23. //>>excludeEnd("ctx");
  24. $2=$recv($3).__eq($recv(anAssociation)._class());
  25. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26. $ctx1.sendIdx["="]=1;
  27. //>>excludeEnd("ctx");
  28. $1=$recv($2)._and_((function(){
  29. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30. return $core.withContext(function($ctx2) {
  31. //>>excludeEnd("ctx");
  32. $5=$self._key();
  33. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34. $ctx2.sendIdx["key"]=1;
  35. //>>excludeEnd("ctx");
  36. $4=$recv($5).__eq($recv(anAssociation)._key());
  37. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38. $ctx2.sendIdx["="]=2;
  39. //>>excludeEnd("ctx");
  40. return $recv($4)._and_((function(){
  41. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42. return $core.withContext(function($ctx3) {
  43. //>>excludeEnd("ctx");
  44. $6=$self._value();
  45. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46. $ctx3.sendIdx["value"]=1;
  47. //>>excludeEnd("ctx");
  48. return $recv($6).__eq($recv(anAssociation)._value());
  49. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  50. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51. //>>excludeEnd("ctx");
  52. }));
  53. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55. //>>excludeEnd("ctx");
  56. }));
  57. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58. $ctx1.sendIdx["and:"]=1;
  59. //>>excludeEnd("ctx");
  60. return $1;
  61. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation})});
  63. //>>excludeEnd("ctx");
  64. },
  65. //>>excludeStart("ide", pragmas.excludeIdeData);
  66. args: ["anAssociation"],
  67. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  68. referencedClasses: [],
  69. //>>excludeEnd("ide");
  70. pragmas: [],
  71. messageSends: ["and:", "=", "class", "key", "value"]
  72. }),
  73. $globals.Association);
  74. $core.addMethod(
  75. $core.method({
  76. selector: "key",
  77. protocol: "accessing",
  78. fn: function (){
  79. var self=this,$self=this;
  80. return $self.key;
  81. },
  82. //>>excludeStart("ide", pragmas.excludeIdeData);
  83. args: [],
  84. source: "key\x0a\x09^ key",
  85. referencedClasses: [],
  86. //>>excludeEnd("ide");
  87. pragmas: [],
  88. messageSends: []
  89. }),
  90. $globals.Association);
  91. $core.addMethod(
  92. $core.method({
  93. selector: "key:",
  94. protocol: "accessing",
  95. fn: function (aKey){
  96. var self=this,$self=this;
  97. $self.key=aKey;
  98. return self;
  99. },
  100. //>>excludeStart("ide", pragmas.excludeIdeData);
  101. args: ["aKey"],
  102. source: "key: aKey\x0a\x09key := aKey",
  103. referencedClasses: [],
  104. //>>excludeEnd("ide");
  105. pragmas: [],
  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})});
  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. pragmas: [],
  135. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  136. }),
  137. $globals.Association);
  138. $core.addMethod(
  139. $core.method({
  140. selector: "value",
  141. protocol: "accessing",
  142. fn: function (){
  143. var self=this,$self=this;
  144. return $self.value;
  145. },
  146. //>>excludeStart("ide", pragmas.excludeIdeData);
  147. args: [],
  148. source: "value\x0a\x09^ value",
  149. referencedClasses: [],
  150. //>>excludeEnd("ide");
  151. pragmas: [],
  152. messageSends: []
  153. }),
  154. $globals.Association);
  155. $core.addMethod(
  156. $core.method({
  157. selector: "value:",
  158. protocol: "accessing",
  159. fn: function (aValue){
  160. var self=this,$self=this;
  161. $self.value=aValue;
  162. return self;
  163. },
  164. //>>excludeStart("ide", pragmas.excludeIdeData);
  165. args: ["aValue"],
  166. source: "value: aValue\x0a\x09value := aValue",
  167. referencedClasses: [],
  168. //>>excludeEnd("ide");
  169. pragmas: [],
  170. messageSends: []
  171. }),
  172. $globals.Association);
  173. $core.addMethod(
  174. $core.method({
  175. selector: "key:value:",
  176. protocol: "instance creation",
  177. fn: function (aKey,aValue){
  178. var self=this,$self=this;
  179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  180. return $core.withContext(function($ctx1) {
  181. //>>excludeEnd("ctx");
  182. var $1;
  183. $1=$self._new();
  184. $recv($1)._key_(aKey);
  185. $recv($1)._value_(aValue);
  186. return $recv($1)._yourself();
  187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  188. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue})});
  189. //>>excludeEnd("ctx");
  190. },
  191. //>>excludeStart("ide", pragmas.excludeIdeData);
  192. args: ["aKey", "aValue"],
  193. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  194. referencedClasses: [],
  195. //>>excludeEnd("ide");
  196. pragmas: [],
  197. messageSends: ["key:", "new", "value:", "yourself"]
  198. }),
  199. $globals.Association.a$cls);
  200. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  201. //>>excludeStart("ide", pragmas.excludeIdeData);
  202. $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`.";
  203. //>>excludeEnd("ide");
  204. $core.addMethod(
  205. $core.method({
  206. selector: "bucketOfElement:",
  207. protocol: "accessing",
  208. fn: function (anObject){
  209. var self=this,$self=this;
  210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  211. return $core.withContext(function($ctx1) {
  212. //>>excludeEnd("ctx");
  213. var hash = $self.hashBlock(anObject);
  214. if (!hash) return null;
  215. var buckets = $self.buckets,
  216. bucket = buckets[hash];
  217. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  218. return bucket;
  219. ;
  220. return self;
  221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  222. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject})});
  223. //>>excludeEnd("ctx");
  224. },
  225. //>>excludeStart("ide", pragmas.excludeIdeData);
  226. args: ["anObject"],
  227. 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'>",
  228. referencedClasses: [],
  229. //>>excludeEnd("ide");
  230. pragmas: [["inlineJS:", ["\x0a\x09\x09var hash = $self.hashBlock(anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = $self.buckets,\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09"]]],
  231. messageSends: []
  232. }),
  233. $globals.BucketStore);
  234. $core.addMethod(
  235. $core.method({
  236. selector: "do:",
  237. protocol: "enumerating",
  238. fn: function (aBlock){
  239. var self=this,$self=this;
  240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  241. return $core.withContext(function($ctx1) {
  242. //>>excludeEnd("ctx");
  243. var buckets = $self.buckets;
  244. var keys = Object.keys(buckets);
  245. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  246. ;
  247. return self;
  248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  249. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  250. //>>excludeEnd("ctx");
  251. },
  252. //>>excludeStart("ide", pragmas.excludeIdeData);
  253. args: ["aBlock"],
  254. 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'>",
  255. referencedClasses: [],
  256. //>>excludeEnd("ide");
  257. pragmas: [["inlineJS:", ["\x0a\x09\x09var buckets = $self.buckets;\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09"]]],
  258. messageSends: []
  259. }),
  260. $globals.BucketStore);
  261. $core.addMethod(
  262. $core.method({
  263. selector: "hashBlock:",
  264. protocol: "accessing",
  265. fn: function (aBlock){
  266. var self=this,$self=this;
  267. $self.hashBlock=aBlock;
  268. return self;
  269. },
  270. //>>excludeStart("ide", pragmas.excludeIdeData);
  271. args: ["aBlock"],
  272. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  273. referencedClasses: [],
  274. //>>excludeEnd("ide");
  275. pragmas: [],
  276. messageSends: []
  277. }),
  278. $globals.BucketStore);
  279. $core.addMethod(
  280. $core.method({
  281. selector: "initialize",
  282. protocol: "initialization",
  283. fn: function (){
  284. var self=this,$self=this;
  285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  286. return $core.withContext(function($ctx1) {
  287. //>>excludeEnd("ctx");
  288. (
  289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  290. $ctx1.supercall = true,
  291. //>>excludeEnd("ctx");
  292. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  294. $ctx1.supercall = false;
  295. //>>excludeEnd("ctx");;
  296. $self._removeAll();
  297. return self;
  298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  299. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  300. //>>excludeEnd("ctx");
  301. },
  302. //>>excludeStart("ide", pragmas.excludeIdeData);
  303. args: [],
  304. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  305. referencedClasses: [],
  306. //>>excludeEnd("ide");
  307. pragmas: [],
  308. messageSends: ["initialize", "removeAll"]
  309. }),
  310. $globals.BucketStore);
  311. $core.addMethod(
  312. $core.method({
  313. selector: "newBucket",
  314. protocol: "private",
  315. fn: function (){
  316. var self=this,$self=this;
  317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  318. return $core.withContext(function($ctx1) {
  319. //>>excludeEnd("ctx");
  320. $self._subclassResponsibility();
  321. return self;
  322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  323. }, function($ctx1) {$ctx1.fill(self,"newBucket",{})});
  324. //>>excludeEnd("ctx");
  325. },
  326. //>>excludeStart("ide", pragmas.excludeIdeData);
  327. args: [],
  328. source: "newBucket\x0a\x09self subclassResponsibility",
  329. referencedClasses: [],
  330. //>>excludeEnd("ide");
  331. pragmas: [],
  332. messageSends: ["subclassResponsibility"]
  333. }),
  334. $globals.BucketStore);
  335. $core.addMethod(
  336. $core.method({
  337. selector: "removeAll",
  338. protocol: "adding/removing",
  339. fn: function (){
  340. var self=this,$self=this;
  341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  342. return $core.withContext(function($ctx1) {
  343. //>>excludeEnd("ctx");
  344. $self.buckets = Object.create(null);;
  345. return self;
  346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  347. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  348. //>>excludeEnd("ctx");
  349. },
  350. //>>excludeStart("ide", pragmas.excludeIdeData);
  351. args: [],
  352. source: "removeAll\x0a\x09<inlineJS: '$self.buckets = Object.create(null);'>",
  353. referencedClasses: [],
  354. //>>excludeEnd("ide");
  355. pragmas: [["inlineJS:", ["$self.buckets = Object.create(null);"]]],
  356. messageSends: []
  357. }),
  358. $globals.BucketStore);
  359. $core.addMethod(
  360. $core.method({
  361. selector: "hashBlock:",
  362. protocol: "instance creation",
  363. fn: function (aBlock){
  364. var self=this,$self=this;
  365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  366. return $core.withContext(function($ctx1) {
  367. //>>excludeEnd("ctx");
  368. var $1;
  369. $1=$self._new();
  370. $recv($1)._hashBlock_(aBlock);
  371. return $recv($1)._yourself();
  372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  373. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock})});
  374. //>>excludeEnd("ctx");
  375. },
  376. //>>excludeStart("ide", pragmas.excludeIdeData);
  377. args: ["aBlock"],
  378. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  379. referencedClasses: [],
  380. //>>excludeEnd("ide");
  381. pragmas: [],
  382. messageSends: ["hashBlock:", "new", "yourself"]
  383. }),
  384. $globals.BucketStore.a$cls);
  385. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  386. //>>excludeStart("ide", pragmas.excludeIdeData);
  387. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  388. //>>excludeEnd("ide");
  389. $core.addMethod(
  390. $core.method({
  391. selector: "newBucket",
  392. protocol: "private",
  393. fn: function (){
  394. var self=this,$self=this;
  395. return [];
  396. },
  397. //>>excludeStart("ide", pragmas.excludeIdeData);
  398. args: [],
  399. source: "newBucket\x0a\x09^ #()",
  400. referencedClasses: [],
  401. //>>excludeEnd("ide");
  402. pragmas: [],
  403. messageSends: []
  404. }),
  405. $globals.ArrayBucketStore);
  406. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  407. //>>excludeStart("ide", pragmas.excludeIdeData);
  408. $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.";
  409. //>>excludeEnd("ide");
  410. $core.addMethod(
  411. $core.method({
  412. selector: ",",
  413. protocol: "copying",
  414. fn: function (aCollection){
  415. var self=this,$self=this;
  416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  417. return $core.withContext(function($ctx1) {
  418. //>>excludeEnd("ctx");
  419. var $1;
  420. $1=$self._copy();
  421. $recv($1)._addAll_(aCollection);
  422. return $recv($1)._yourself();
  423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  424. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection})});
  425. //>>excludeEnd("ctx");
  426. },
  427. //>>excludeStart("ide", pragmas.excludeIdeData);
  428. args: ["aCollection"],
  429. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  430. referencedClasses: [],
  431. //>>excludeEnd("ide");
  432. pragmas: [],
  433. messageSends: ["addAll:", "copy", "yourself"]
  434. }),
  435. $globals.Collection);
  436. $core.addMethod(
  437. $core.method({
  438. selector: "add:",
  439. protocol: "adding/removing",
  440. fn: function (anObject){
  441. var self=this,$self=this;
  442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  443. return $core.withContext(function($ctx1) {
  444. //>>excludeEnd("ctx");
  445. $self._subclassResponsibility();
  446. return self;
  447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  448. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  449. //>>excludeEnd("ctx");
  450. },
  451. //>>excludeStart("ide", pragmas.excludeIdeData);
  452. args: ["anObject"],
  453. source: "add: anObject\x0a\x09self subclassResponsibility",
  454. referencedClasses: [],
  455. //>>excludeEnd("ide");
  456. pragmas: [],
  457. messageSends: ["subclassResponsibility"]
  458. }),
  459. $globals.Collection);
  460. $core.addMethod(
  461. $core.method({
  462. selector: "addAll:",
  463. protocol: "adding/removing",
  464. fn: function (aCollection){
  465. var self=this,$self=this;
  466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  467. return $core.withContext(function($ctx1) {
  468. //>>excludeEnd("ctx");
  469. $recv(aCollection)._do_((function(each){
  470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  471. return $core.withContext(function($ctx2) {
  472. //>>excludeEnd("ctx");
  473. return $self._add_(each);
  474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  475. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  476. //>>excludeEnd("ctx");
  477. }));
  478. return aCollection;
  479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  480. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  481. //>>excludeEnd("ctx");
  482. },
  483. //>>excludeStart("ide", pragmas.excludeIdeData);
  484. args: ["aCollection"],
  485. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  486. referencedClasses: [],
  487. //>>excludeEnd("ide");
  488. pragmas: [],
  489. messageSends: ["do:", "add:"]
  490. }),
  491. $globals.Collection);
  492. $core.addMethod(
  493. $core.method({
  494. selector: "allSatisfy:",
  495. protocol: "enumerating",
  496. fn: function (aBlock){
  497. var self=this,$self=this;
  498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  499. return $core.withContext(function($ctx1) {
  500. //>>excludeEnd("ctx");
  501. var $1;
  502. var $early={};
  503. try {
  504. $self._do_((function(each){
  505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  506. return $core.withContext(function($ctx2) {
  507. //>>excludeEnd("ctx");
  508. $1=$recv(aBlock)._value_(each);
  509. if(!$core.assert($1)){
  510. throw $early=[false];
  511. }
  512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  513. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  514. //>>excludeEnd("ctx");
  515. }));
  516. return true;
  517. }
  518. catch(e) {if(e===$early)return e[0]; throw e}
  519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  520. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock})});
  521. //>>excludeEnd("ctx");
  522. },
  523. //>>excludeStart("ide", pragmas.excludeIdeData);
  524. args: ["aBlock"],
  525. 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",
  526. referencedClasses: [],
  527. //>>excludeEnd("ide");
  528. pragmas: [],
  529. messageSends: ["do:", "ifFalse:", "value:"]
  530. }),
  531. $globals.Collection);
  532. $core.addMethod(
  533. $core.method({
  534. selector: "anyOne",
  535. protocol: "accessing",
  536. fn: function (){
  537. var self=this,$self=this;
  538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  539. return $core.withContext(function($ctx1) {
  540. //>>excludeEnd("ctx");
  541. var $early={};
  542. try {
  543. $self._ifEmpty_((function(){
  544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  545. return $core.withContext(function($ctx2) {
  546. //>>excludeEnd("ctx");
  547. return $self._error_("Collection is empty");
  548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  549. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  550. //>>excludeEnd("ctx");
  551. }));
  552. $self._do_((function(each){
  553. throw $early=[each];
  554. }));
  555. return self;
  556. }
  557. catch(e) {if(e===$early)return e[0]; throw e}
  558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  559. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  560. //>>excludeEnd("ctx");
  561. },
  562. //>>excludeStart("ide", pragmas.excludeIdeData);
  563. args: [],
  564. 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 ]",
  565. referencedClasses: [],
  566. //>>excludeEnd("ide");
  567. pragmas: [],
  568. messageSends: ["ifEmpty:", "error:", "do:"]
  569. }),
  570. $globals.Collection);
  571. $core.addMethod(
  572. $core.method({
  573. selector: "anySatisfy:",
  574. protocol: "enumerating",
  575. fn: function (aBlock){
  576. var self=this,$self=this;
  577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  578. return $core.withContext(function($ctx1) {
  579. //>>excludeEnd("ctx");
  580. var $1;
  581. var $early={};
  582. try {
  583. $self._do_((function(each){
  584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  585. return $core.withContext(function($ctx2) {
  586. //>>excludeEnd("ctx");
  587. $1=$recv(aBlock)._value_(each);
  588. if($core.assert($1)){
  589. throw $early=[true];
  590. }
  591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  592. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  593. //>>excludeEnd("ctx");
  594. }));
  595. return false;
  596. }
  597. catch(e) {if(e===$early)return e[0]; throw e}
  598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  599. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock})});
  600. //>>excludeEnd("ctx");
  601. },
  602. //>>excludeStart("ide", pragmas.excludeIdeData);
  603. args: ["aBlock"],
  604. 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",
  605. referencedClasses: [],
  606. //>>excludeEnd("ide");
  607. pragmas: [],
  608. messageSends: ["do:", "ifTrue:", "value:"]
  609. }),
  610. $globals.Collection);
  611. $core.addMethod(
  612. $core.method({
  613. selector: "asArray",
  614. protocol: "converting",
  615. fn: function (){
  616. var self=this,$self=this;
  617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  618. return $core.withContext(function($ctx1) {
  619. //>>excludeEnd("ctx");
  620. return $recv($globals.Array)._withAll_(self);
  621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  622. }, function($ctx1) {$ctx1.fill(self,"asArray",{})});
  623. //>>excludeEnd("ctx");
  624. },
  625. //>>excludeStart("ide", pragmas.excludeIdeData);
  626. args: [],
  627. source: "asArray\x0a\x09^ Array withAll: self",
  628. referencedClasses: ["Array"],
  629. //>>excludeEnd("ide");
  630. pragmas: [],
  631. messageSends: ["withAll:"]
  632. }),
  633. $globals.Collection);
  634. $core.addMethod(
  635. $core.method({
  636. selector: "asJavaScriptObject",
  637. protocol: "converting",
  638. fn: function (){
  639. var self=this,$self=this;
  640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  641. return $core.withContext(function($ctx1) {
  642. //>>excludeEnd("ctx");
  643. return $recv($self._asArray())._collect_((function(each){
  644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  645. return $core.withContext(function($ctx2) {
  646. //>>excludeEnd("ctx");
  647. return $recv(each)._asJavaScriptObject();
  648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  649. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  650. //>>excludeEnd("ctx");
  651. }));
  652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  653. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{})});
  654. //>>excludeEnd("ctx");
  655. },
  656. //>>excludeStart("ide", pragmas.excludeIdeData);
  657. args: [],
  658. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  659. referencedClasses: [],
  660. //>>excludeEnd("ide");
  661. pragmas: [],
  662. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  663. }),
  664. $globals.Collection);
  665. $core.addMethod(
  666. $core.method({
  667. selector: "asOrderedCollection",
  668. protocol: "converting",
  669. fn: function (){
  670. var self=this,$self=this;
  671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  672. return $core.withContext(function($ctx1) {
  673. //>>excludeEnd("ctx");
  674. return $self._asArray();
  675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  676. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{})});
  677. //>>excludeEnd("ctx");
  678. },
  679. //>>excludeStart("ide", pragmas.excludeIdeData);
  680. args: [],
  681. source: "asOrderedCollection\x0a\x09^ self asArray",
  682. referencedClasses: [],
  683. //>>excludeEnd("ide");
  684. pragmas: [],
  685. messageSends: ["asArray"]
  686. }),
  687. $globals.Collection);
  688. $core.addMethod(
  689. $core.method({
  690. selector: "asSet",
  691. protocol: "converting",
  692. fn: function (){
  693. var self=this,$self=this;
  694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  695. return $core.withContext(function($ctx1) {
  696. //>>excludeEnd("ctx");
  697. return $recv($globals.Set)._withAll_(self);
  698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  699. }, function($ctx1) {$ctx1.fill(self,"asSet",{})});
  700. //>>excludeEnd("ctx");
  701. },
  702. //>>excludeStart("ide", pragmas.excludeIdeData);
  703. args: [],
  704. source: "asSet\x0a\x09^ Set withAll: self",
  705. referencedClasses: ["Set"],
  706. //>>excludeEnd("ide");
  707. pragmas: [],
  708. messageSends: ["withAll:"]
  709. }),
  710. $globals.Collection);
  711. $core.addMethod(
  712. $core.method({
  713. selector: "collect:",
  714. protocol: "enumerating",
  715. fn: function (aBlock){
  716. var self=this,$self=this;
  717. var stream;
  718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  719. return $core.withContext(function($ctx1) {
  720. //>>excludeEnd("ctx");
  721. stream=$recv($recv($self._class())._new())._writeStream();
  722. $self._do_((function(each){
  723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  724. return $core.withContext(function($ctx2) {
  725. //>>excludeEnd("ctx");
  726. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  728. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  729. //>>excludeEnd("ctx");
  730. }));
  731. return $recv(stream)._contents();
  732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  733. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream})});
  734. //>>excludeEnd("ctx");
  735. },
  736. //>>excludeStart("ide", pragmas.excludeIdeData);
  737. args: ["aBlock"],
  738. 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",
  739. referencedClasses: [],
  740. //>>excludeEnd("ide");
  741. pragmas: [],
  742. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  743. }),
  744. $globals.Collection);
  745. $core.addMethod(
  746. $core.method({
  747. selector: "copyWith:",
  748. protocol: "copying",
  749. fn: function (anObject){
  750. var self=this,$self=this;
  751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  752. return $core.withContext(function($ctx1) {
  753. //>>excludeEnd("ctx");
  754. var $1;
  755. $1=$self._copy();
  756. $recv($1)._add_(anObject);
  757. return $recv($1)._yourself();
  758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  759. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject})});
  760. //>>excludeEnd("ctx");
  761. },
  762. //>>excludeStart("ide", pragmas.excludeIdeData);
  763. args: ["anObject"],
  764. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  765. referencedClasses: [],
  766. //>>excludeEnd("ide");
  767. pragmas: [],
  768. messageSends: ["add:", "copy", "yourself"]
  769. }),
  770. $globals.Collection);
  771. $core.addMethod(
  772. $core.method({
  773. selector: "copyWithAll:",
  774. protocol: "copying",
  775. fn: function (aCollection){
  776. var self=this,$self=this;
  777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  778. return $core.withContext(function($ctx1) {
  779. //>>excludeEnd("ctx");
  780. $self._deprecatedAPI_("Use #, instead.");
  781. return $self.__comma(aCollection);
  782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  783. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection})});
  784. //>>excludeEnd("ctx");
  785. },
  786. //>>excludeStart("ide", pragmas.excludeIdeData);
  787. args: ["aCollection"],
  788. source: "copyWithAll: aCollection\x0a\x09self deprecatedAPI: 'Use #, instead.'.\x0a\x09^ self, aCollection",
  789. referencedClasses: [],
  790. //>>excludeEnd("ide");
  791. pragmas: [],
  792. messageSends: ["deprecatedAPI:", ","]
  793. }),
  794. $globals.Collection);
  795. $core.addMethod(
  796. $core.method({
  797. selector: "copyWithout:",
  798. protocol: "copying",
  799. fn: function (anObject){
  800. var self=this,$self=this;
  801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  802. return $core.withContext(function($ctx1) {
  803. //>>excludeEnd("ctx");
  804. return $self._reject_((function(each){
  805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  806. return $core.withContext(function($ctx2) {
  807. //>>excludeEnd("ctx");
  808. return $recv(each).__eq(anObject);
  809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  810. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  811. //>>excludeEnd("ctx");
  812. }));
  813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  814. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject})});
  815. //>>excludeEnd("ctx");
  816. },
  817. //>>excludeStart("ide", pragmas.excludeIdeData);
  818. args: ["anObject"],
  819. 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 ]",
  820. referencedClasses: [],
  821. //>>excludeEnd("ide");
  822. pragmas: [],
  823. messageSends: ["reject:", "="]
  824. }),
  825. $globals.Collection);
  826. $core.addMethod(
  827. $core.method({
  828. selector: "copyWithoutAll:",
  829. protocol: "copying",
  830. fn: function (aCollection){
  831. var self=this,$self=this;
  832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  833. return $core.withContext(function($ctx1) {
  834. //>>excludeEnd("ctx");
  835. return $self._reject_((function(each){
  836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  837. return $core.withContext(function($ctx2) {
  838. //>>excludeEnd("ctx");
  839. return $recv(aCollection)._includes_(each);
  840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  841. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  842. //>>excludeEnd("ctx");
  843. }));
  844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  845. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection})});
  846. //>>excludeEnd("ctx");
  847. },
  848. //>>excludeStart("ide", pragmas.excludeIdeData);
  849. args: ["aCollection"],
  850. 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 ]",
  851. referencedClasses: [],
  852. //>>excludeEnd("ide");
  853. pragmas: [],
  854. messageSends: ["reject:", "includes:"]
  855. }),
  856. $globals.Collection);
  857. $core.addMethod(
  858. $core.method({
  859. selector: "deepCopy",
  860. protocol: "copying",
  861. fn: function (){
  862. var self=this,$self=this;
  863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  864. return $core.withContext(function($ctx1) {
  865. //>>excludeEnd("ctx");
  866. return $self._collect_((function(each){
  867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  868. return $core.withContext(function($ctx2) {
  869. //>>excludeEnd("ctx");
  870. return $recv(each)._deepCopy();
  871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  872. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  873. //>>excludeEnd("ctx");
  874. }));
  875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  876. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  877. //>>excludeEnd("ctx");
  878. },
  879. //>>excludeStart("ide", pragmas.excludeIdeData);
  880. args: [],
  881. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  882. referencedClasses: [],
  883. //>>excludeEnd("ide");
  884. pragmas: [],
  885. messageSends: ["collect:", "deepCopy"]
  886. }),
  887. $globals.Collection);
  888. $core.addMethod(
  889. $core.method({
  890. selector: "detect:",
  891. protocol: "enumerating",
  892. fn: function (aBlock){
  893. var self=this,$self=this;
  894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  895. return $core.withContext(function($ctx1) {
  896. //>>excludeEnd("ctx");
  897. return $self._detect_ifNone_(aBlock,(function(){
  898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  899. return $core.withContext(function($ctx2) {
  900. //>>excludeEnd("ctx");
  901. return $self._errorNotFound();
  902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  903. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  904. //>>excludeEnd("ctx");
  905. }));
  906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  907. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock})});
  908. //>>excludeEnd("ctx");
  909. },
  910. //>>excludeStart("ide", pragmas.excludeIdeData);
  911. args: ["aBlock"],
  912. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  913. referencedClasses: [],
  914. //>>excludeEnd("ide");
  915. pragmas: [],
  916. messageSends: ["detect:ifNone:", "errorNotFound"]
  917. }),
  918. $globals.Collection);
  919. $core.addMethod(
  920. $core.method({
  921. selector: "detect:ifNone:",
  922. protocol: "enumerating",
  923. fn: function (aBlock,anotherBlock){
  924. var self=this,$self=this;
  925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  926. return $core.withContext(function($ctx1) {
  927. //>>excludeEnd("ctx");
  928. var $1;
  929. var $early={};
  930. try {
  931. $self._do_((function(each){
  932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  933. return $core.withContext(function($ctx2) {
  934. //>>excludeEnd("ctx");
  935. $1=$recv(aBlock)._value_(each);
  936. if($core.assert($1)){
  937. throw $early=[each];
  938. }
  939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  940. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  941. //>>excludeEnd("ctx");
  942. }));
  943. return $recv(anotherBlock)._value();
  944. }
  945. catch(e) {if(e===$early)return e[0]; throw e}
  946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  947. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  948. //>>excludeEnd("ctx");
  949. },
  950. //>>excludeStart("ide", pragmas.excludeIdeData);
  951. args: ["aBlock", "anotherBlock"],
  952. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  953. referencedClasses: [],
  954. //>>excludeEnd("ide");
  955. pragmas: [],
  956. messageSends: ["do:", "ifTrue:", "value:", "value"]
  957. }),
  958. $globals.Collection);
  959. $core.addMethod(
  960. $core.method({
  961. selector: "do:",
  962. protocol: "enumerating",
  963. fn: function (aBlock){
  964. var self=this,$self=this;
  965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  966. return $core.withContext(function($ctx1) {
  967. //>>excludeEnd("ctx");
  968. $self._subclassResponsibility();
  969. return self;
  970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  971. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  972. //>>excludeEnd("ctx");
  973. },
  974. //>>excludeStart("ide", pragmas.excludeIdeData);
  975. args: ["aBlock"],
  976. source: "do: aBlock\x0a\x09self subclassResponsibility",
  977. referencedClasses: [],
  978. //>>excludeEnd("ide");
  979. pragmas: [],
  980. messageSends: ["subclassResponsibility"]
  981. }),
  982. $globals.Collection);
  983. $core.addMethod(
  984. $core.method({
  985. selector: "do:separatedBy:",
  986. protocol: "enumerating",
  987. fn: function (aBlock,anotherBlock){
  988. var self=this,$self=this;
  989. var actionBeforeElement;
  990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  991. return $core.withContext(function($ctx1) {
  992. //>>excludeEnd("ctx");
  993. actionBeforeElement=(function(){
  994. actionBeforeElement=anotherBlock;
  995. return actionBeforeElement;
  996. });
  997. $self._do_((function(each){
  998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  999. return $core.withContext(function($ctx2) {
  1000. //>>excludeEnd("ctx");
  1001. $recv(actionBeforeElement)._value();
  1002. return $recv(aBlock)._value_(each);
  1003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1004. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  1005. //>>excludeEnd("ctx");
  1006. }));
  1007. return self;
  1008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1009. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement})});
  1010. //>>excludeEnd("ctx");
  1011. },
  1012. //>>excludeStart("ide", pragmas.excludeIdeData);
  1013. args: ["aBlock", "anotherBlock"],
  1014. 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 ]",
  1015. referencedClasses: [],
  1016. //>>excludeEnd("ide");
  1017. pragmas: [],
  1018. messageSends: ["do:", "value", "value:"]
  1019. }),
  1020. $globals.Collection);
  1021. $core.addMethod(
  1022. $core.method({
  1023. selector: "errorNotFound",
  1024. protocol: "error handling",
  1025. fn: function (){
  1026. var self=this,$self=this;
  1027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1028. return $core.withContext(function($ctx1) {
  1029. //>>excludeEnd("ctx");
  1030. $self._error_("Object is not in the collection");
  1031. return self;
  1032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1033. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{})});
  1034. //>>excludeEnd("ctx");
  1035. },
  1036. //>>excludeStart("ide", pragmas.excludeIdeData);
  1037. args: [],
  1038. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  1039. referencedClasses: [],
  1040. //>>excludeEnd("ide");
  1041. pragmas: [],
  1042. messageSends: ["error:"]
  1043. }),
  1044. $globals.Collection);
  1045. $core.addMethod(
  1046. $core.method({
  1047. selector: "ifEmpty:",
  1048. protocol: "testing",
  1049. fn: function (aBlock){
  1050. var self=this,$self=this;
  1051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1052. return $core.withContext(function($ctx1) {
  1053. //>>excludeEnd("ctx");
  1054. var $1;
  1055. $1=$self._isEmpty();
  1056. if($core.assert($1)){
  1057. return $recv(aBlock)._value();
  1058. } else {
  1059. return self;
  1060. }
  1061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1062. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock})});
  1063. //>>excludeEnd("ctx");
  1064. },
  1065. //>>excludeStart("ide", pragmas.excludeIdeData);
  1066. args: ["aBlock"],
  1067. 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 ]",
  1068. referencedClasses: [],
  1069. //>>excludeEnd("ide");
  1070. pragmas: [],
  1071. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  1072. }),
  1073. $globals.Collection);
  1074. $core.addMethod(
  1075. $core.method({
  1076. selector: "ifEmpty:ifNotEmpty:",
  1077. protocol: "testing",
  1078. fn: function (aBlock,anotherBlock){
  1079. var self=this,$self=this;
  1080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1081. return $core.withContext(function($ctx1) {
  1082. //>>excludeEnd("ctx");
  1083. var $1;
  1084. $1=$self._isEmpty();
  1085. if($core.assert($1)){
  1086. return $recv(aBlock)._value();
  1087. } else {
  1088. return $recv(anotherBlock)._value_(self);
  1089. }
  1090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1091. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  1092. //>>excludeEnd("ctx");
  1093. },
  1094. //>>excludeStart("ide", pragmas.excludeIdeData);
  1095. args: ["aBlock", "anotherBlock"],
  1096. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  1097. referencedClasses: [],
  1098. //>>excludeEnd("ide");
  1099. pragmas: [],
  1100. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  1101. }),
  1102. $globals.Collection);
  1103. $core.addMethod(
  1104. $core.method({
  1105. selector: "ifNotEmpty:",
  1106. protocol: "testing",
  1107. fn: function (aBlock){
  1108. var self=this,$self=this;
  1109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1110. return $core.withContext(function($ctx1) {
  1111. //>>excludeEnd("ctx");
  1112. var $1;
  1113. $1=$self._notEmpty();
  1114. if($core.assert($1)){
  1115. return $recv(aBlock)._value_(self);
  1116. } else {
  1117. return self;
  1118. }
  1119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1120. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock})});
  1121. //>>excludeEnd("ctx");
  1122. },
  1123. //>>excludeStart("ide", pragmas.excludeIdeData);
  1124. args: ["aBlock"],
  1125. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  1126. referencedClasses: [],
  1127. //>>excludeEnd("ide");
  1128. pragmas: [],
  1129. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1130. }),
  1131. $globals.Collection);
  1132. $core.addMethod(
  1133. $core.method({
  1134. selector: "ifNotEmpty:ifEmpty:",
  1135. protocol: "testing",
  1136. fn: function (aBlock,anotherBlock){
  1137. var self=this,$self=this;
  1138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1139. return $core.withContext(function($ctx1) {
  1140. //>>excludeEnd("ctx");
  1141. var $1;
  1142. $1=$self._notEmpty();
  1143. if($core.assert($1)){
  1144. return $recv(aBlock)._value_(self);
  1145. } else {
  1146. return $recv(anotherBlock)._value();
  1147. }
  1148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1149. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  1150. //>>excludeEnd("ctx");
  1151. },
  1152. //>>excludeStart("ide", pragmas.excludeIdeData);
  1153. args: ["aBlock", "anotherBlock"],
  1154. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  1155. referencedClasses: [],
  1156. //>>excludeEnd("ide");
  1157. pragmas: [],
  1158. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  1159. }),
  1160. $globals.Collection);
  1161. $core.addMethod(
  1162. $core.method({
  1163. selector: "includes:",
  1164. protocol: "testing",
  1165. fn: function (anObject){
  1166. var self=this,$self=this;
  1167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1168. return $core.withContext(function($ctx1) {
  1169. //>>excludeEnd("ctx");
  1170. return $self._anySatisfy_((function(each){
  1171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1172. return $core.withContext(function($ctx2) {
  1173. //>>excludeEnd("ctx");
  1174. return $recv(each).__eq(anObject);
  1175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1176. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1177. //>>excludeEnd("ctx");
  1178. }));
  1179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1180. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  1181. //>>excludeEnd("ctx");
  1182. },
  1183. //>>excludeStart("ide", pragmas.excludeIdeData);
  1184. args: ["anObject"],
  1185. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  1186. referencedClasses: [],
  1187. //>>excludeEnd("ide");
  1188. pragmas: [],
  1189. messageSends: ["anySatisfy:", "="]
  1190. }),
  1191. $globals.Collection);
  1192. $core.addMethod(
  1193. $core.method({
  1194. selector: "inject:into:",
  1195. protocol: "enumerating",
  1196. fn: function (anObject,aBlock){
  1197. var self=this,$self=this;
  1198. var result;
  1199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1200. return $core.withContext(function($ctx1) {
  1201. //>>excludeEnd("ctx");
  1202. result=anObject;
  1203. $self._do_((function(each){
  1204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1205. return $core.withContext(function($ctx2) {
  1206. //>>excludeEnd("ctx");
  1207. result=$recv(aBlock)._value_value_(result,each);
  1208. return result;
  1209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1210. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1211. //>>excludeEnd("ctx");
  1212. }));
  1213. return result;
  1214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1215. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result})});
  1216. //>>excludeEnd("ctx");
  1217. },
  1218. //>>excludeStart("ide", pragmas.excludeIdeData);
  1219. args: ["anObject", "aBlock"],
  1220. 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",
  1221. referencedClasses: [],
  1222. //>>excludeEnd("ide");
  1223. pragmas: [],
  1224. messageSends: ["do:", "value:value:"]
  1225. }),
  1226. $globals.Collection);
  1227. $core.addMethod(
  1228. $core.method({
  1229. selector: "intersection:",
  1230. protocol: "enumerating",
  1231. fn: function (aCollection){
  1232. var self=this,$self=this;
  1233. var set,outputSet;
  1234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1235. return $core.withContext(function($ctx1) {
  1236. //>>excludeEnd("ctx");
  1237. var $2,$1;
  1238. set=$self._asSet();
  1239. outputSet=$recv($globals.Set)._new();
  1240. $recv(aCollection)._do_((function(each){
  1241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1242. return $core.withContext(function($ctx2) {
  1243. //>>excludeEnd("ctx");
  1244. $2=$recv(set)._includes_(each);
  1245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1246. $ctx2.sendIdx["includes:"]=1;
  1247. //>>excludeEnd("ctx");
  1248. $1=$recv($2)._and_((function(){
  1249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1250. return $core.withContext(function($ctx3) {
  1251. //>>excludeEnd("ctx");
  1252. return $recv($recv(outputSet)._includes_(each))._not();
  1253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1254. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1255. //>>excludeEnd("ctx");
  1256. }));
  1257. if($core.assert($1)){
  1258. return $recv(outputSet)._add_(each);
  1259. }
  1260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1261. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1262. //>>excludeEnd("ctx");
  1263. }));
  1264. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  1265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1266. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet})});
  1267. //>>excludeEnd("ctx");
  1268. },
  1269. //>>excludeStart("ide", pragmas.excludeIdeData);
  1270. args: ["aCollection"],
  1271. 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",
  1272. referencedClasses: ["Set"],
  1273. //>>excludeEnd("ide");
  1274. pragmas: [],
  1275. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  1276. }),
  1277. $globals.Collection);
  1278. $core.addMethod(
  1279. $core.method({
  1280. selector: "isEmpty",
  1281. protocol: "testing",
  1282. fn: function (){
  1283. var self=this,$self=this;
  1284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1285. return $core.withContext(function($ctx1) {
  1286. //>>excludeEnd("ctx");
  1287. return $recv($self._size()).__eq((0));
  1288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1289. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  1290. //>>excludeEnd("ctx");
  1291. },
  1292. //>>excludeStart("ide", pragmas.excludeIdeData);
  1293. args: [],
  1294. source: "isEmpty\x0a\x09^ self size = 0",
  1295. referencedClasses: [],
  1296. //>>excludeEnd("ide");
  1297. pragmas: [],
  1298. messageSends: ["=", "size"]
  1299. }),
  1300. $globals.Collection);
  1301. $core.addMethod(
  1302. $core.method({
  1303. selector: "noneSatisfy:",
  1304. protocol: "enumerating",
  1305. fn: function (aBlock){
  1306. var self=this,$self=this;
  1307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1308. return $core.withContext(function($ctx1) {
  1309. //>>excludeEnd("ctx");
  1310. var $1;
  1311. var $early={};
  1312. try {
  1313. $self._do_((function(item){
  1314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1315. return $core.withContext(function($ctx2) {
  1316. //>>excludeEnd("ctx");
  1317. $1=$recv(aBlock)._value_(item);
  1318. if($core.assert($1)){
  1319. throw $early=[false];
  1320. }
  1321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1322. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  1323. //>>excludeEnd("ctx");
  1324. }));
  1325. return true;
  1326. }
  1327. catch(e) {if(e===$early)return e[0]; throw e}
  1328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1329. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock})});
  1330. //>>excludeEnd("ctx");
  1331. },
  1332. //>>excludeStart("ide", pragmas.excludeIdeData);
  1333. args: ["aBlock"],
  1334. 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",
  1335. referencedClasses: [],
  1336. //>>excludeEnd("ide");
  1337. pragmas: [],
  1338. messageSends: ["do:", "ifTrue:", "value:"]
  1339. }),
  1340. $globals.Collection);
  1341. $core.addMethod(
  1342. $core.method({
  1343. selector: "notEmpty",
  1344. protocol: "testing",
  1345. fn: function (){
  1346. var self=this,$self=this;
  1347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1348. return $core.withContext(function($ctx1) {
  1349. //>>excludeEnd("ctx");
  1350. return $recv($self._isEmpty())._not();
  1351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1352. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{})});
  1353. //>>excludeEnd("ctx");
  1354. },
  1355. //>>excludeStart("ide", pragmas.excludeIdeData);
  1356. args: [],
  1357. source: "notEmpty\x0a\x09^ self isEmpty not",
  1358. referencedClasses: [],
  1359. //>>excludeEnd("ide");
  1360. pragmas: [],
  1361. messageSends: ["not", "isEmpty"]
  1362. }),
  1363. $globals.Collection);
  1364. $core.addMethod(
  1365. $core.method({
  1366. selector: "occurrencesOf:",
  1367. protocol: "accessing",
  1368. fn: function (anObject){
  1369. var self=this,$self=this;
  1370. var tally;
  1371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1372. return $core.withContext(function($ctx1) {
  1373. //>>excludeEnd("ctx");
  1374. var $1;
  1375. tally=(0);
  1376. $self._do_((function(each){
  1377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1378. return $core.withContext(function($ctx2) {
  1379. //>>excludeEnd("ctx");
  1380. $1=$recv(anObject).__eq(each);
  1381. if($core.assert($1)){
  1382. tally=$recv(tally).__plus((1));
  1383. return tally;
  1384. }
  1385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1386. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1387. //>>excludeEnd("ctx");
  1388. }));
  1389. return tally;
  1390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1391. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally})});
  1392. //>>excludeEnd("ctx");
  1393. },
  1394. //>>excludeStart("ide", pragmas.excludeIdeData);
  1395. args: ["anObject"],
  1396. 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",
  1397. referencedClasses: [],
  1398. //>>excludeEnd("ide");
  1399. pragmas: [],
  1400. messageSends: ["do:", "ifTrue:", "=", "+"]
  1401. }),
  1402. $globals.Collection);
  1403. $core.addMethod(
  1404. $core.method({
  1405. selector: "putOn:",
  1406. protocol: "streaming",
  1407. fn: function (aStream){
  1408. var self=this,$self=this;
  1409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1410. return $core.withContext(function($ctx1) {
  1411. //>>excludeEnd("ctx");
  1412. $self._do_((function(each){
  1413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1414. return $core.withContext(function($ctx2) {
  1415. //>>excludeEnd("ctx");
  1416. return $recv(each)._putOn_(aStream);
  1417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1418. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1419. //>>excludeEnd("ctx");
  1420. }));
  1421. return self;
  1422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1423. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  1424. //>>excludeEnd("ctx");
  1425. },
  1426. //>>excludeStart("ide", pragmas.excludeIdeData);
  1427. args: ["aStream"],
  1428. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  1429. referencedClasses: [],
  1430. //>>excludeEnd("ide");
  1431. pragmas: [],
  1432. messageSends: ["do:", "putOn:"]
  1433. }),
  1434. $globals.Collection);
  1435. $core.addMethod(
  1436. $core.method({
  1437. selector: "reject:",
  1438. protocol: "enumerating",
  1439. fn: function (aBlock){
  1440. var self=this,$self=this;
  1441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1442. return $core.withContext(function($ctx1) {
  1443. //>>excludeEnd("ctx");
  1444. return $self._select_((function(each){
  1445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1446. return $core.withContext(function($ctx2) {
  1447. //>>excludeEnd("ctx");
  1448. return $recv($recv(aBlock)._value_(each)).__eq(false);
  1449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1450. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1451. //>>excludeEnd("ctx");
  1452. }));
  1453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1454. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock})});
  1455. //>>excludeEnd("ctx");
  1456. },
  1457. //>>excludeStart("ide", pragmas.excludeIdeData);
  1458. args: ["aBlock"],
  1459. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  1460. referencedClasses: [],
  1461. //>>excludeEnd("ide");
  1462. pragmas: [],
  1463. messageSends: ["select:", "=", "value:"]
  1464. }),
  1465. $globals.Collection);
  1466. $core.addMethod(
  1467. $core.method({
  1468. selector: "remove:",
  1469. protocol: "adding/removing",
  1470. fn: function (anObject){
  1471. var self=this,$self=this;
  1472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1473. return $core.withContext(function($ctx1) {
  1474. //>>excludeEnd("ctx");
  1475. return $self._remove_ifAbsent_(anObject,(function(){
  1476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1477. return $core.withContext(function($ctx2) {
  1478. //>>excludeEnd("ctx");
  1479. return $self._errorNotFound();
  1480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1481. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1482. //>>excludeEnd("ctx");
  1483. }));
  1484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1485. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  1486. //>>excludeEnd("ctx");
  1487. },
  1488. //>>excludeStart("ide", pragmas.excludeIdeData);
  1489. args: ["anObject"],
  1490. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  1491. referencedClasses: [],
  1492. //>>excludeEnd("ide");
  1493. pragmas: [],
  1494. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  1495. }),
  1496. $globals.Collection);
  1497. $core.addMethod(
  1498. $core.method({
  1499. selector: "remove:ifAbsent:",
  1500. protocol: "adding/removing",
  1501. fn: function (anObject,aBlock){
  1502. var self=this,$self=this;
  1503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1504. return $core.withContext(function($ctx1) {
  1505. //>>excludeEnd("ctx");
  1506. $self._subclassResponsibility();
  1507. return self;
  1508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1509. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  1510. //>>excludeEnd("ctx");
  1511. },
  1512. //>>excludeStart("ide", pragmas.excludeIdeData);
  1513. args: ["anObject", "aBlock"],
  1514. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1515. referencedClasses: [],
  1516. //>>excludeEnd("ide");
  1517. pragmas: [],
  1518. messageSends: ["subclassResponsibility"]
  1519. }),
  1520. $globals.Collection);
  1521. $core.addMethod(
  1522. $core.method({
  1523. selector: "removeAll",
  1524. protocol: "adding/removing",
  1525. fn: function (){
  1526. var self=this,$self=this;
  1527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1528. return $core.withContext(function($ctx1) {
  1529. //>>excludeEnd("ctx");
  1530. $self._subclassResponsibility();
  1531. return self;
  1532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1533. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  1534. //>>excludeEnd("ctx");
  1535. },
  1536. //>>excludeStart("ide", pragmas.excludeIdeData);
  1537. args: [],
  1538. source: "removeAll\x0a\x09self subclassResponsibility",
  1539. referencedClasses: [],
  1540. //>>excludeEnd("ide");
  1541. pragmas: [],
  1542. messageSends: ["subclassResponsibility"]
  1543. }),
  1544. $globals.Collection);
  1545. $core.addMethod(
  1546. $core.method({
  1547. selector: "select:",
  1548. protocol: "enumerating",
  1549. fn: function (aBlock){
  1550. var self=this,$self=this;
  1551. var stream;
  1552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1553. return $core.withContext(function($ctx1) {
  1554. //>>excludeEnd("ctx");
  1555. var $1;
  1556. stream=$recv($recv($self._class())._new())._writeStream();
  1557. $self._do_((function(each){
  1558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1559. return $core.withContext(function($ctx2) {
  1560. //>>excludeEnd("ctx");
  1561. $1=$recv(aBlock)._value_(each);
  1562. if($core.assert($1)){
  1563. return $recv(stream)._nextPut_(each);
  1564. }
  1565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1566. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1567. //>>excludeEnd("ctx");
  1568. }));
  1569. return $recv(stream)._contents();
  1570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1571. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream})});
  1572. //>>excludeEnd("ctx");
  1573. },
  1574. //>>excludeStart("ide", pragmas.excludeIdeData);
  1575. args: ["aBlock"],
  1576. 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",
  1577. referencedClasses: [],
  1578. //>>excludeEnd("ide");
  1579. pragmas: [],
  1580. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1581. }),
  1582. $globals.Collection);
  1583. $core.addMethod(
  1584. $core.method({
  1585. selector: "select:thenCollect:",
  1586. protocol: "enumerating",
  1587. fn: function (selectBlock,collectBlock){
  1588. var self=this,$self=this;
  1589. var stream;
  1590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1591. return $core.withContext(function($ctx1) {
  1592. //>>excludeEnd("ctx");
  1593. var $1;
  1594. stream=$recv($recv($self._class())._new())._writeStream();
  1595. $self._do_((function(each){
  1596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1597. return $core.withContext(function($ctx2) {
  1598. //>>excludeEnd("ctx");
  1599. $1=$recv(selectBlock)._value_(each);
  1600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1601. $ctx2.sendIdx["value:"]=1;
  1602. //>>excludeEnd("ctx");
  1603. if($core.assert($1)){
  1604. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  1605. }
  1606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1607. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1608. //>>excludeEnd("ctx");
  1609. }));
  1610. return $recv(stream)._contents();
  1611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1612. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream})});
  1613. //>>excludeEnd("ctx");
  1614. },
  1615. //>>excludeStart("ide", pragmas.excludeIdeData);
  1616. args: ["selectBlock", "collectBlock"],
  1617. 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",
  1618. referencedClasses: [],
  1619. //>>excludeEnd("ide");
  1620. pragmas: [],
  1621. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1622. }),
  1623. $globals.Collection);
  1624. $core.addMethod(
  1625. $core.method({
  1626. selector: "shallowCopy",
  1627. protocol: "copying",
  1628. fn: function (){
  1629. var self=this,$self=this;
  1630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1631. return $core.withContext(function($ctx1) {
  1632. //>>excludeEnd("ctx");
  1633. return $self._collect_((function(each){
  1634. return each;
  1635. }));
  1636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1637. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  1638. //>>excludeEnd("ctx");
  1639. },
  1640. //>>excludeStart("ide", pragmas.excludeIdeData);
  1641. args: [],
  1642. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  1643. referencedClasses: [],
  1644. //>>excludeEnd("ide");
  1645. pragmas: [],
  1646. messageSends: ["collect:"]
  1647. }),
  1648. $globals.Collection);
  1649. $core.addMethod(
  1650. $core.method({
  1651. selector: "single",
  1652. protocol: "accessing",
  1653. fn: function (){
  1654. var self=this,$self=this;
  1655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1656. return $core.withContext(function($ctx1) {
  1657. //>>excludeEnd("ctx");
  1658. var $1;
  1659. $self._ifEmpty_((function(){
  1660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1661. return $core.withContext(function($ctx2) {
  1662. //>>excludeEnd("ctx");
  1663. return $self._error_("Collection is empty");
  1664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1665. $ctx2.sendIdx["error:"]=1;
  1666. //>>excludeEnd("ctx");
  1667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1668. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1669. //>>excludeEnd("ctx");
  1670. }));
  1671. $1=$recv($self._size()).__gt((1));
  1672. if($core.assert($1)){
  1673. $self._error_("Collection holds more than one element");
  1674. }
  1675. return $self._anyOne();
  1676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1677. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  1678. //>>excludeEnd("ctx");
  1679. },
  1680. //>>excludeStart("ide", pragmas.excludeIdeData);
  1681. args: [],
  1682. 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",
  1683. referencedClasses: [],
  1684. //>>excludeEnd("ide");
  1685. pragmas: [],
  1686. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  1687. }),
  1688. $globals.Collection);
  1689. $core.addMethod(
  1690. $core.method({
  1691. selector: "size",
  1692. protocol: "accessing",
  1693. fn: function (){
  1694. var self=this,$self=this;
  1695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1696. return $core.withContext(function($ctx1) {
  1697. //>>excludeEnd("ctx");
  1698. $self._subclassResponsibility();
  1699. return self;
  1700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1701. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  1702. //>>excludeEnd("ctx");
  1703. },
  1704. //>>excludeStart("ide", pragmas.excludeIdeData);
  1705. args: [],
  1706. source: "size\x0a\x09self subclassResponsibility",
  1707. referencedClasses: [],
  1708. //>>excludeEnd("ide");
  1709. pragmas: [],
  1710. messageSends: ["subclassResponsibility"]
  1711. }),
  1712. $globals.Collection);
  1713. $core.addMethod(
  1714. $core.method({
  1715. selector: "classTag",
  1716. protocol: "accessing",
  1717. fn: function (){
  1718. var self=this,$self=this;
  1719. return "collection";
  1720. },
  1721. //>>excludeStart("ide", pragmas.excludeIdeData);
  1722. args: [],
  1723. 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'",
  1724. referencedClasses: [],
  1725. //>>excludeEnd("ide");
  1726. pragmas: [],
  1727. messageSends: []
  1728. }),
  1729. $globals.Collection.a$cls);
  1730. $core.addMethod(
  1731. $core.method({
  1732. selector: "new:",
  1733. protocol: "instance creation",
  1734. fn: function (anInteger){
  1735. var self=this,$self=this;
  1736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1737. return $core.withContext(function($ctx1) {
  1738. //>>excludeEnd("ctx");
  1739. return $self._new();
  1740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1741. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  1742. //>>excludeEnd("ctx");
  1743. },
  1744. //>>excludeStart("ide", pragmas.excludeIdeData);
  1745. args: ["anInteger"],
  1746. source: "new: anInteger\x0a\x09^ self new",
  1747. referencedClasses: [],
  1748. //>>excludeEnd("ide");
  1749. pragmas: [],
  1750. messageSends: ["new"]
  1751. }),
  1752. $globals.Collection.a$cls);
  1753. $core.addMethod(
  1754. $core.method({
  1755. selector: "with:",
  1756. protocol: "instance creation",
  1757. fn: function (anObject){
  1758. var self=this,$self=this;
  1759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1760. return $core.withContext(function($ctx1) {
  1761. //>>excludeEnd("ctx");
  1762. var $1;
  1763. $1=$self._new();
  1764. $recv($1)._add_(anObject);
  1765. return $recv($1)._yourself();
  1766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1767. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  1768. //>>excludeEnd("ctx");
  1769. },
  1770. //>>excludeStart("ide", pragmas.excludeIdeData);
  1771. args: ["anObject"],
  1772. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1773. referencedClasses: [],
  1774. //>>excludeEnd("ide");
  1775. pragmas: [],
  1776. messageSends: ["add:", "new", "yourself"]
  1777. }),
  1778. $globals.Collection.a$cls);
  1779. $core.addMethod(
  1780. $core.method({
  1781. selector: "with:with:",
  1782. protocol: "instance creation",
  1783. fn: function (anObject,anotherObject){
  1784. var self=this,$self=this;
  1785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1786. return $core.withContext(function($ctx1) {
  1787. //>>excludeEnd("ctx");
  1788. var $1;
  1789. $1=$self._new();
  1790. $recv($1)._add_(anObject);
  1791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1792. $ctx1.sendIdx["add:"]=1;
  1793. //>>excludeEnd("ctx");
  1794. $recv($1)._add_(anotherObject);
  1795. return $recv($1)._yourself();
  1796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1797. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject})});
  1798. //>>excludeEnd("ctx");
  1799. },
  1800. //>>excludeStart("ide", pragmas.excludeIdeData);
  1801. args: ["anObject", "anotherObject"],
  1802. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1803. referencedClasses: [],
  1804. //>>excludeEnd("ide");
  1805. pragmas: [],
  1806. messageSends: ["add:", "new", "yourself"]
  1807. }),
  1808. $globals.Collection.a$cls);
  1809. $core.addMethod(
  1810. $core.method({
  1811. selector: "with:with:with:",
  1812. protocol: "instance creation",
  1813. fn: function (firstObject,secondObject,thirdObject){
  1814. var self=this,$self=this;
  1815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1816. return $core.withContext(function($ctx1) {
  1817. //>>excludeEnd("ctx");
  1818. var $1;
  1819. $1=$self._new();
  1820. $recv($1)._add_(firstObject);
  1821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1822. $ctx1.sendIdx["add:"]=1;
  1823. //>>excludeEnd("ctx");
  1824. $recv($1)._add_(secondObject);
  1825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1826. $ctx1.sendIdx["add:"]=2;
  1827. //>>excludeEnd("ctx");
  1828. $recv($1)._add_(thirdObject);
  1829. return $recv($1)._yourself();
  1830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1831. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject})});
  1832. //>>excludeEnd("ctx");
  1833. },
  1834. //>>excludeStart("ide", pragmas.excludeIdeData);
  1835. args: ["firstObject", "secondObject", "thirdObject"],
  1836. 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",
  1837. referencedClasses: [],
  1838. //>>excludeEnd("ide");
  1839. pragmas: [],
  1840. messageSends: ["add:", "new", "yourself"]
  1841. }),
  1842. $globals.Collection.a$cls);
  1843. $core.addMethod(
  1844. $core.method({
  1845. selector: "withAll:",
  1846. protocol: "instance creation",
  1847. fn: function (aCollection){
  1848. var self=this,$self=this;
  1849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1850. return $core.withContext(function($ctx1) {
  1851. //>>excludeEnd("ctx");
  1852. var $1;
  1853. $1=$self._new();
  1854. $recv($1)._addAll_(aCollection);
  1855. return $recv($1)._yourself();
  1856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1857. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection})});
  1858. //>>excludeEnd("ctx");
  1859. },
  1860. //>>excludeStart("ide", pragmas.excludeIdeData);
  1861. args: ["aCollection"],
  1862. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1863. referencedClasses: [],
  1864. //>>excludeEnd("ide");
  1865. pragmas: [],
  1866. messageSends: ["addAll:", "new", "yourself"]
  1867. }),
  1868. $globals.Collection.a$cls);
  1869. $core.addClass("AssociativeCollection", $globals.Collection, [], "Kernel-Collections");
  1870. //>>excludeStart("ide", pragmas.excludeIdeData);
  1871. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  1872. //>>excludeEnd("ide");
  1873. $core.addMethod(
  1874. $core.method({
  1875. selector: "=",
  1876. protocol: "comparing",
  1877. fn: function (anAssocitativeCollection){
  1878. var self=this,$self=this;
  1879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1880. return $core.withContext(function($ctx1) {
  1881. //>>excludeEnd("ctx");
  1882. var $2,$1,$4,$3,$5;
  1883. $2=$self._class();
  1884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1885. $ctx1.sendIdx["class"]=1;
  1886. //>>excludeEnd("ctx");
  1887. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  1888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1889. $ctx1.sendIdx["="]=1;
  1890. //>>excludeEnd("ctx");
  1891. if(!$core.assert($1)){
  1892. return false;
  1893. }
  1894. $4=$self._size();
  1895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1896. $ctx1.sendIdx["size"]=1;
  1897. //>>excludeEnd("ctx");
  1898. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  1899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1900. $ctx1.sendIdx["="]=2;
  1901. //>>excludeEnd("ctx");
  1902. if(!$core.assert($3)){
  1903. return false;
  1904. }
  1905. $5=$self._associations();
  1906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1907. $ctx1.sendIdx["associations"]=1;
  1908. //>>excludeEnd("ctx");
  1909. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  1910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1911. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection})});
  1912. //>>excludeEnd("ctx");
  1913. },
  1914. //>>excludeStart("ide", pragmas.excludeIdeData);
  1915. args: ["anAssocitativeCollection"],
  1916. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  1917. referencedClasses: [],
  1918. //>>excludeEnd("ide");
  1919. pragmas: [],
  1920. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  1921. }),
  1922. $globals.AssociativeCollection);
  1923. $core.addMethod(
  1924. $core.method({
  1925. selector: "add:",
  1926. protocol: "adding/removing",
  1927. fn: function (anAssociation){
  1928. var self=this,$self=this;
  1929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1930. return $core.withContext(function($ctx1) {
  1931. //>>excludeEnd("ctx");
  1932. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  1933. return self;
  1934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1935. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation})});
  1936. //>>excludeEnd("ctx");
  1937. },
  1938. //>>excludeStart("ide", pragmas.excludeIdeData);
  1939. args: ["anAssociation"],
  1940. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  1941. referencedClasses: [],
  1942. //>>excludeEnd("ide");
  1943. pragmas: [],
  1944. messageSends: ["at:put:", "key", "value"]
  1945. }),
  1946. $globals.AssociativeCollection);
  1947. $core.addMethod(
  1948. $core.method({
  1949. selector: "addAll:",
  1950. protocol: "adding/removing",
  1951. fn: function (anAssociativeCollection){
  1952. var self=this,$self=this;
  1953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1954. return $core.withContext(function($ctx1) {
  1955. //>>excludeEnd("ctx");
  1956. (
  1957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1958. $ctx1.supercall = true,
  1959. //>>excludeEnd("ctx");
  1960. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  1961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1962. $ctx1.supercall = false;
  1963. //>>excludeEnd("ctx");;
  1964. return anAssociativeCollection;
  1965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1966. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection})});
  1967. //>>excludeEnd("ctx");
  1968. },
  1969. //>>excludeStart("ide", pragmas.excludeIdeData);
  1970. args: ["anAssociativeCollection"],
  1971. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  1972. referencedClasses: [],
  1973. //>>excludeEnd("ide");
  1974. pragmas: [],
  1975. messageSends: ["addAll:", "associations"]
  1976. }),
  1977. $globals.AssociativeCollection);
  1978. $core.addMethod(
  1979. $core.method({
  1980. selector: "asDictionary",
  1981. protocol: "converting",
  1982. fn: function (){
  1983. var self=this,$self=this;
  1984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1985. return $core.withContext(function($ctx1) {
  1986. //>>excludeEnd("ctx");
  1987. return $recv($globals.Dictionary)._from_($self._associations());
  1988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1989. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{})});
  1990. //>>excludeEnd("ctx");
  1991. },
  1992. //>>excludeStart("ide", pragmas.excludeIdeData);
  1993. args: [],
  1994. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  1995. referencedClasses: ["Dictionary"],
  1996. //>>excludeEnd("ide");
  1997. pragmas: [],
  1998. messageSends: ["from:", "associations"]
  1999. }),
  2000. $globals.AssociativeCollection);
  2001. $core.addMethod(
  2002. $core.method({
  2003. selector: "asHashedCollection",
  2004. protocol: "converting",
  2005. fn: function (){
  2006. var self=this,$self=this;
  2007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2008. return $core.withContext(function($ctx1) {
  2009. //>>excludeEnd("ctx");
  2010. return $recv($globals.HashedCollection)._from_($self._associations());
  2011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2012. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{})});
  2013. //>>excludeEnd("ctx");
  2014. },
  2015. //>>excludeStart("ide", pragmas.excludeIdeData);
  2016. args: [],
  2017. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  2018. referencedClasses: ["HashedCollection"],
  2019. //>>excludeEnd("ide");
  2020. pragmas: [],
  2021. messageSends: ["from:", "associations"]
  2022. }),
  2023. $globals.AssociativeCollection);
  2024. $core.addMethod(
  2025. $core.method({
  2026. selector: "asJavaScriptObject",
  2027. protocol: "converting",
  2028. fn: function (){
  2029. var self=this,$self=this;
  2030. var hash;
  2031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2032. return $core.withContext(function($ctx1) {
  2033. //>>excludeEnd("ctx");
  2034. hash=$recv($globals.HashedCollection)._new();
  2035. $self._keysAndValuesDo_((function(key,value){
  2036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2037. return $core.withContext(function($ctx2) {
  2038. //>>excludeEnd("ctx");
  2039. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  2040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2041. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2042. //>>excludeEnd("ctx");
  2043. }));
  2044. return hash;
  2045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2046. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash})});
  2047. //>>excludeEnd("ctx");
  2048. },
  2049. //>>excludeStart("ide", pragmas.excludeIdeData);
  2050. args: [],
  2051. 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",
  2052. referencedClasses: ["HashedCollection"],
  2053. //>>excludeEnd("ide");
  2054. pragmas: [],
  2055. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  2056. }),
  2057. $globals.AssociativeCollection);
  2058. $core.addMethod(
  2059. $core.method({
  2060. selector: "associations",
  2061. protocol: "accessing",
  2062. fn: function (){
  2063. var self=this,$self=this;
  2064. var associations;
  2065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2066. return $core.withContext(function($ctx1) {
  2067. //>>excludeEnd("ctx");
  2068. associations=[];
  2069. $self._associationsDo_((function(each){
  2070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2071. return $core.withContext(function($ctx2) {
  2072. //>>excludeEnd("ctx");
  2073. return $recv(associations)._add_(each);
  2074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2075. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2076. //>>excludeEnd("ctx");
  2077. }));
  2078. return associations;
  2079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2080. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations})});
  2081. //>>excludeEnd("ctx");
  2082. },
  2083. //>>excludeStart("ide", pragmas.excludeIdeData);
  2084. args: [],
  2085. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  2086. referencedClasses: [],
  2087. //>>excludeEnd("ide");
  2088. pragmas: [],
  2089. messageSends: ["associationsDo:", "add:"]
  2090. }),
  2091. $globals.AssociativeCollection);
  2092. $core.addMethod(
  2093. $core.method({
  2094. selector: "associationsDo:",
  2095. protocol: "enumerating",
  2096. fn: function (aBlock){
  2097. var self=this,$self=this;
  2098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2099. return $core.withContext(function($ctx1) {
  2100. //>>excludeEnd("ctx");
  2101. $self._keysAndValuesDo_((function(key,value){
  2102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2103. return $core.withContext(function($ctx2) {
  2104. //>>excludeEnd("ctx");
  2105. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  2106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2107. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2108. //>>excludeEnd("ctx");
  2109. }));
  2110. return self;
  2111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2112. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock})});
  2113. //>>excludeEnd("ctx");
  2114. },
  2115. //>>excludeStart("ide", pragmas.excludeIdeData);
  2116. args: ["aBlock"],
  2117. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2118. referencedClasses: ["Association"],
  2119. //>>excludeEnd("ide");
  2120. pragmas: [],
  2121. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2122. }),
  2123. $globals.AssociativeCollection);
  2124. $core.addMethod(
  2125. $core.method({
  2126. selector: "at:ifPresent:ifAbsent:",
  2127. protocol: "accessing",
  2128. fn: function (aKey,aBlock,anotherBlock){
  2129. var self=this,$self=this;
  2130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2131. return $core.withContext(function($ctx1) {
  2132. //>>excludeEnd("ctx");
  2133. var $1;
  2134. $1=$self._includesKey_(aKey);
  2135. if($core.assert($1)){
  2136. return $recv(aBlock)._value_($self._at_(aKey));
  2137. } else {
  2138. return $recv(anotherBlock)._value();
  2139. }
  2140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2141. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock})});
  2142. //>>excludeEnd("ctx");
  2143. },
  2144. //>>excludeStart("ide", pragmas.excludeIdeData);
  2145. args: ["aKey", "aBlock", "anotherBlock"],
  2146. 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 ]",
  2147. referencedClasses: [],
  2148. //>>excludeEnd("ide");
  2149. pragmas: [],
  2150. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2151. }),
  2152. $globals.AssociativeCollection);
  2153. $core.addMethod(
  2154. $core.method({
  2155. selector: "collect:",
  2156. protocol: "enumerating",
  2157. fn: function (aBlock){
  2158. var self=this,$self=this;
  2159. var newDict;
  2160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2161. return $core.withContext(function($ctx1) {
  2162. //>>excludeEnd("ctx");
  2163. newDict=$recv($self._class())._new();
  2164. $self._keysAndValuesDo_((function(key,value){
  2165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2166. return $core.withContext(function($ctx2) {
  2167. //>>excludeEnd("ctx");
  2168. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  2169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2170. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2171. //>>excludeEnd("ctx");
  2172. }));
  2173. return newDict;
  2174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2175. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict})});
  2176. //>>excludeEnd("ctx");
  2177. },
  2178. //>>excludeStart("ide", pragmas.excludeIdeData);
  2179. args: ["aBlock"],
  2180. 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",
  2181. referencedClasses: [],
  2182. //>>excludeEnd("ide");
  2183. pragmas: [],
  2184. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  2185. }),
  2186. $globals.AssociativeCollection);
  2187. $core.addMethod(
  2188. $core.method({
  2189. selector: "deepCopy",
  2190. protocol: "copying",
  2191. fn: function (){
  2192. var self=this,$self=this;
  2193. var copy;
  2194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2195. return $core.withContext(function($ctx1) {
  2196. //>>excludeEnd("ctx");
  2197. copy=$recv($self._class())._new();
  2198. $self._keysAndValuesDo_((function(key,value){
  2199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2200. return $core.withContext(function($ctx2) {
  2201. //>>excludeEnd("ctx");
  2202. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  2203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2204. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2205. //>>excludeEnd("ctx");
  2206. }));
  2207. return copy;
  2208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2209. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy})});
  2210. //>>excludeEnd("ctx");
  2211. },
  2212. //>>excludeStart("ide", pragmas.excludeIdeData);
  2213. args: [],
  2214. 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",
  2215. referencedClasses: [],
  2216. //>>excludeEnd("ide");
  2217. pragmas: [],
  2218. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  2219. }),
  2220. $globals.AssociativeCollection);
  2221. $core.addMethod(
  2222. $core.method({
  2223. selector: "detect:ifNone:",
  2224. protocol: "enumerating",
  2225. fn: function (aBlock,anotherBlock){
  2226. var self=this,$self=this;
  2227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2228. return $core.withContext(function($ctx1) {
  2229. //>>excludeEnd("ctx");
  2230. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  2231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2232. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  2233. //>>excludeEnd("ctx");
  2234. },
  2235. //>>excludeStart("ide", pragmas.excludeIdeData);
  2236. args: ["aBlock", "anotherBlock"],
  2237. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  2238. referencedClasses: [],
  2239. //>>excludeEnd("ide");
  2240. pragmas: [],
  2241. messageSends: ["detect:ifNone:", "values"]
  2242. }),
  2243. $globals.AssociativeCollection);
  2244. $core.addMethod(
  2245. $core.method({
  2246. selector: "do:",
  2247. protocol: "enumerating",
  2248. fn: function (aBlock){
  2249. var self=this,$self=this;
  2250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2251. return $core.withContext(function($ctx1) {
  2252. //>>excludeEnd("ctx");
  2253. $self._valuesDo_(aBlock);
  2254. return self;
  2255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2256. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  2257. //>>excludeEnd("ctx");
  2258. },
  2259. //>>excludeStart("ide", pragmas.excludeIdeData);
  2260. args: ["aBlock"],
  2261. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  2262. referencedClasses: [],
  2263. //>>excludeEnd("ide");
  2264. pragmas: [],
  2265. messageSends: ["valuesDo:"]
  2266. }),
  2267. $globals.AssociativeCollection);
  2268. $core.addMethod(
  2269. $core.method({
  2270. selector: "includes:",
  2271. protocol: "enumerating",
  2272. fn: function (anObject){
  2273. var self=this,$self=this;
  2274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2275. return $core.withContext(function($ctx1) {
  2276. //>>excludeEnd("ctx");
  2277. return $recv($self._values())._includes_(anObject);
  2278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2279. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  2280. //>>excludeEnd("ctx");
  2281. },
  2282. //>>excludeStart("ide", pragmas.excludeIdeData);
  2283. args: ["anObject"],
  2284. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  2285. referencedClasses: [],
  2286. //>>excludeEnd("ide");
  2287. pragmas: [],
  2288. messageSends: ["includes:", "values"]
  2289. }),
  2290. $globals.AssociativeCollection);
  2291. $core.addMethod(
  2292. $core.method({
  2293. selector: "includesKey:",
  2294. protocol: "testing",
  2295. fn: function (aKey){
  2296. var self=this,$self=this;
  2297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2298. return $core.withContext(function($ctx1) {
  2299. //>>excludeEnd("ctx");
  2300. $self._subclassResponsibility();
  2301. return self;
  2302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2303. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  2304. //>>excludeEnd("ctx");
  2305. },
  2306. //>>excludeStart("ide", pragmas.excludeIdeData);
  2307. args: ["aKey"],
  2308. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  2309. referencedClasses: [],
  2310. //>>excludeEnd("ide");
  2311. pragmas: [],
  2312. messageSends: ["subclassResponsibility"]
  2313. }),
  2314. $globals.AssociativeCollection);
  2315. $core.addMethod(
  2316. $core.method({
  2317. selector: "indexOf:ifAbsent:",
  2318. protocol: "accessing",
  2319. fn: function (anObject,aBlock){
  2320. var self=this,$self=this;
  2321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2322. return $core.withContext(function($ctx1) {
  2323. //>>excludeEnd("ctx");
  2324. return $recv($self._keys())._detect_ifNone_((function(each){
  2325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2326. return $core.withContext(function($ctx2) {
  2327. //>>excludeEnd("ctx");
  2328. return $recv($self._at_(each)).__eq(anObject);
  2329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2330. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2331. //>>excludeEnd("ctx");
  2332. }),aBlock);
  2333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2334. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  2335. //>>excludeEnd("ctx");
  2336. },
  2337. //>>excludeStart("ide", pragmas.excludeIdeData);
  2338. args: ["anObject", "aBlock"],
  2339. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  2340. referencedClasses: [],
  2341. //>>excludeEnd("ide");
  2342. pragmas: [],
  2343. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  2344. }),
  2345. $globals.AssociativeCollection);
  2346. $core.addMethod(
  2347. $core.method({
  2348. selector: "keyAtValue:",
  2349. protocol: "accessing",
  2350. fn: function (anObject){
  2351. var self=this,$self=this;
  2352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2353. return $core.withContext(function($ctx1) {
  2354. //>>excludeEnd("ctx");
  2355. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  2356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2357. return $core.withContext(function($ctx2) {
  2358. //>>excludeEnd("ctx");
  2359. return $self._errorNotFound();
  2360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2361. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2362. //>>excludeEnd("ctx");
  2363. }));
  2364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2365. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject})});
  2366. //>>excludeEnd("ctx");
  2367. },
  2368. //>>excludeStart("ide", pragmas.excludeIdeData);
  2369. args: ["anObject"],
  2370. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  2371. referencedClasses: [],
  2372. //>>excludeEnd("ide");
  2373. pragmas: [],
  2374. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  2375. }),
  2376. $globals.AssociativeCollection);
  2377. $core.addMethod(
  2378. $core.method({
  2379. selector: "keyAtValue:ifAbsent:",
  2380. protocol: "accessing",
  2381. fn: function (anObject,aBlock){
  2382. var self=this,$self=this;
  2383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2384. return $core.withContext(function($ctx1) {
  2385. //>>excludeEnd("ctx");
  2386. return $self._indexOf_ifAbsent_(anObject,aBlock);
  2387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2388. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  2389. //>>excludeEnd("ctx");
  2390. },
  2391. //>>excludeStart("ide", pragmas.excludeIdeData);
  2392. args: ["anObject", "aBlock"],
  2393. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  2394. referencedClasses: [],
  2395. //>>excludeEnd("ide");
  2396. pragmas: [],
  2397. messageSends: ["indexOf:ifAbsent:"]
  2398. }),
  2399. $globals.AssociativeCollection);
  2400. $core.addMethod(
  2401. $core.method({
  2402. selector: "keys",
  2403. protocol: "accessing",
  2404. fn: function (){
  2405. var self=this,$self=this;
  2406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2407. return $core.withContext(function($ctx1) {
  2408. //>>excludeEnd("ctx");
  2409. $self._subclassResponsibility();
  2410. return self;
  2411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2412. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  2413. //>>excludeEnd("ctx");
  2414. },
  2415. //>>excludeStart("ide", pragmas.excludeIdeData);
  2416. args: [],
  2417. source: "keys\x0a\x09self subclassResponsibility",
  2418. referencedClasses: [],
  2419. //>>excludeEnd("ide");
  2420. pragmas: [],
  2421. messageSends: ["subclassResponsibility"]
  2422. }),
  2423. $globals.AssociativeCollection);
  2424. $core.addMethod(
  2425. $core.method({
  2426. selector: "keysAndValuesDo:",
  2427. protocol: "enumerating",
  2428. fn: function (aBlock){
  2429. var self=this,$self=this;
  2430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2431. return $core.withContext(function($ctx1) {
  2432. //>>excludeEnd("ctx");
  2433. $self._keysDo_((function(each){
  2434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2435. return $core.withContext(function($ctx2) {
  2436. //>>excludeEnd("ctx");
  2437. return $recv(aBlock)._value_value_(each,$self._at_(each));
  2438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2439. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2440. //>>excludeEnd("ctx");
  2441. }));
  2442. return self;
  2443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2444. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  2445. //>>excludeEnd("ctx");
  2446. },
  2447. //>>excludeStart("ide", pragmas.excludeIdeData);
  2448. args: ["aBlock"],
  2449. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  2450. referencedClasses: [],
  2451. //>>excludeEnd("ide");
  2452. pragmas: [],
  2453. messageSends: ["keysDo:", "value:value:", "at:"]
  2454. }),
  2455. $globals.AssociativeCollection);
  2456. $core.addMethod(
  2457. $core.method({
  2458. selector: "keysDo:",
  2459. protocol: "enumerating",
  2460. fn: function (aBlock){
  2461. var self=this,$self=this;
  2462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2463. return $core.withContext(function($ctx1) {
  2464. //>>excludeEnd("ctx");
  2465. $self._subclassResponsibility();
  2466. return self;
  2467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2468. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  2469. //>>excludeEnd("ctx");
  2470. },
  2471. //>>excludeStart("ide", pragmas.excludeIdeData);
  2472. args: ["aBlock"],
  2473. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  2474. referencedClasses: [],
  2475. //>>excludeEnd("ide");
  2476. pragmas: [],
  2477. messageSends: ["subclassResponsibility"]
  2478. }),
  2479. $globals.AssociativeCollection);
  2480. $core.addMethod(
  2481. $core.method({
  2482. selector: "printOn:",
  2483. protocol: "printing",
  2484. fn: function (aStream){
  2485. var self=this,$self=this;
  2486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2487. return $core.withContext(function($ctx1) {
  2488. //>>excludeEnd("ctx");
  2489. (
  2490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2491. $ctx1.supercall = true,
  2492. //>>excludeEnd("ctx");
  2493. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  2494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2495. $ctx1.supercall = false;
  2496. //>>excludeEnd("ctx");;
  2497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2498. $ctx1.sendIdx["printOn:"]=1;
  2499. //>>excludeEnd("ctx");
  2500. $recv(aStream)._nextPutAll_(" (");
  2501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2502. $ctx1.sendIdx["nextPutAll:"]=1;
  2503. //>>excludeEnd("ctx");
  2504. $recv($self._associations())._do_separatedBy_((function(each){
  2505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2506. return $core.withContext(function($ctx2) {
  2507. //>>excludeEnd("ctx");
  2508. return $recv(each)._printOn_(aStream);
  2509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2510. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2511. //>>excludeEnd("ctx");
  2512. }),(function(){
  2513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2514. return $core.withContext(function($ctx2) {
  2515. //>>excludeEnd("ctx");
  2516. return $recv(aStream)._nextPutAll_(" , ");
  2517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2518. $ctx2.sendIdx["nextPutAll:"]=2;
  2519. //>>excludeEnd("ctx");
  2520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2521. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2522. //>>excludeEnd("ctx");
  2523. }));
  2524. $recv(aStream)._nextPutAll_(")");
  2525. return self;
  2526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2527. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  2528. //>>excludeEnd("ctx");
  2529. },
  2530. //>>excludeStart("ide", pragmas.excludeIdeData);
  2531. args: ["aStream"],
  2532. 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: ')'",
  2533. referencedClasses: [],
  2534. //>>excludeEnd("ide");
  2535. pragmas: [],
  2536. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  2537. }),
  2538. $globals.AssociativeCollection);
  2539. $core.addMethod(
  2540. $core.method({
  2541. selector: "remove:ifAbsent:",
  2542. protocol: "adding/removing",
  2543. fn: function (aKey,aBlock){
  2544. var self=this,$self=this;
  2545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2546. return $core.withContext(function($ctx1) {
  2547. //>>excludeEnd("ctx");
  2548. return $self._removeKey_ifAbsent_(aKey,aBlock);
  2549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2550. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2551. //>>excludeEnd("ctx");
  2552. },
  2553. //>>excludeStart("ide", pragmas.excludeIdeData);
  2554. args: ["aKey", "aBlock"],
  2555. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  2556. referencedClasses: [],
  2557. //>>excludeEnd("ide");
  2558. pragmas: [],
  2559. messageSends: ["removeKey:ifAbsent:"]
  2560. }),
  2561. $globals.AssociativeCollection);
  2562. $core.addMethod(
  2563. $core.method({
  2564. selector: "removeAll",
  2565. protocol: "adding/removing",
  2566. fn: function (){
  2567. var self=this,$self=this;
  2568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2569. return $core.withContext(function($ctx1) {
  2570. //>>excludeEnd("ctx");
  2571. return $recv($self._keys())._do_((function(each){
  2572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2573. return $core.withContext(function($ctx2) {
  2574. //>>excludeEnd("ctx");
  2575. return $self._removeKey_(each);
  2576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2577. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2578. //>>excludeEnd("ctx");
  2579. }));
  2580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2581. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  2582. //>>excludeEnd("ctx");
  2583. },
  2584. //>>excludeStart("ide", pragmas.excludeIdeData);
  2585. args: [],
  2586. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  2587. referencedClasses: [],
  2588. //>>excludeEnd("ide");
  2589. pragmas: [],
  2590. messageSends: ["do:", "keys", "removeKey:"]
  2591. }),
  2592. $globals.AssociativeCollection);
  2593. $core.addMethod(
  2594. $core.method({
  2595. selector: "removeKey:",
  2596. protocol: "adding/removing",
  2597. fn: function (aKey){
  2598. var self=this,$self=this;
  2599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2600. return $core.withContext(function($ctx1) {
  2601. //>>excludeEnd("ctx");
  2602. return $self._remove_(aKey);
  2603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2604. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey})});
  2605. //>>excludeEnd("ctx");
  2606. },
  2607. //>>excludeStart("ide", pragmas.excludeIdeData);
  2608. args: ["aKey"],
  2609. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  2610. referencedClasses: [],
  2611. //>>excludeEnd("ide");
  2612. pragmas: [],
  2613. messageSends: ["remove:"]
  2614. }),
  2615. $globals.AssociativeCollection);
  2616. $core.addMethod(
  2617. $core.method({
  2618. selector: "removeKey:ifAbsent:",
  2619. protocol: "adding/removing",
  2620. fn: function (aKey,aBlock){
  2621. var self=this,$self=this;
  2622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2623. return $core.withContext(function($ctx1) {
  2624. //>>excludeEnd("ctx");
  2625. $self._subclassResponsibility();
  2626. return self;
  2627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2628. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2629. //>>excludeEnd("ctx");
  2630. },
  2631. //>>excludeStart("ide", pragmas.excludeIdeData);
  2632. args: ["aKey", "aBlock"],
  2633. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2634. referencedClasses: [],
  2635. //>>excludeEnd("ide");
  2636. pragmas: [],
  2637. messageSends: ["subclassResponsibility"]
  2638. }),
  2639. $globals.AssociativeCollection);
  2640. $core.addMethod(
  2641. $core.method({
  2642. selector: "select:",
  2643. protocol: "enumerating",
  2644. fn: function (aBlock){
  2645. var self=this,$self=this;
  2646. var newDict;
  2647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2648. return $core.withContext(function($ctx1) {
  2649. //>>excludeEnd("ctx");
  2650. var $1;
  2651. newDict=$recv($self._class())._new();
  2652. $self._keysAndValuesDo_((function(key,value){
  2653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2654. return $core.withContext(function($ctx2) {
  2655. //>>excludeEnd("ctx");
  2656. $1=$recv(aBlock)._value_(value);
  2657. if($core.assert($1)){
  2658. return $recv(newDict)._at_put_(key,value);
  2659. }
  2660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2661. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2662. //>>excludeEnd("ctx");
  2663. }));
  2664. return newDict;
  2665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2666. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict})});
  2667. //>>excludeEnd("ctx");
  2668. },
  2669. //>>excludeStart("ide", pragmas.excludeIdeData);
  2670. args: ["aBlock"],
  2671. 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",
  2672. referencedClasses: [],
  2673. //>>excludeEnd("ide");
  2674. pragmas: [],
  2675. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2676. }),
  2677. $globals.AssociativeCollection);
  2678. $core.addMethod(
  2679. $core.method({
  2680. selector: "select:thenCollect:",
  2681. protocol: "enumerating",
  2682. fn: function (selectBlock,collectBlock){
  2683. var self=this,$self=this;
  2684. var newDict;
  2685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2686. return $core.withContext(function($ctx1) {
  2687. //>>excludeEnd("ctx");
  2688. var $1;
  2689. newDict=$recv($self._class())._new();
  2690. $self._keysAndValuesDo_((function(key,value){
  2691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2692. return $core.withContext(function($ctx2) {
  2693. //>>excludeEnd("ctx");
  2694. $1=$recv(selectBlock)._value_(value);
  2695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2696. $ctx2.sendIdx["value:"]=1;
  2697. //>>excludeEnd("ctx");
  2698. if($core.assert($1)){
  2699. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  2700. }
  2701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2702. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2703. //>>excludeEnd("ctx");
  2704. }));
  2705. return newDict;
  2706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2707. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict})});
  2708. //>>excludeEnd("ctx");
  2709. },
  2710. //>>excludeStart("ide", pragmas.excludeIdeData);
  2711. args: ["selectBlock", "collectBlock"],
  2712. 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",
  2713. referencedClasses: [],
  2714. //>>excludeEnd("ide");
  2715. pragmas: [],
  2716. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2717. }),
  2718. $globals.AssociativeCollection);
  2719. $core.addMethod(
  2720. $core.method({
  2721. selector: "shallowCopy",
  2722. protocol: "copying",
  2723. fn: function (){
  2724. var self=this,$self=this;
  2725. var copy;
  2726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2727. return $core.withContext(function($ctx1) {
  2728. //>>excludeEnd("ctx");
  2729. copy=$recv($self._class())._new();
  2730. $self._keysAndValuesDo_((function(key,value){
  2731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2732. return $core.withContext(function($ctx2) {
  2733. //>>excludeEnd("ctx");
  2734. return $recv(copy)._at_put_(key,value);
  2735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2736. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2737. //>>excludeEnd("ctx");
  2738. }));
  2739. return copy;
  2740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2741. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy})});
  2742. //>>excludeEnd("ctx");
  2743. },
  2744. //>>excludeStart("ide", pragmas.excludeIdeData);
  2745. args: [],
  2746. 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",
  2747. referencedClasses: [],
  2748. //>>excludeEnd("ide");
  2749. pragmas: [],
  2750. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2751. }),
  2752. $globals.AssociativeCollection);
  2753. $core.addMethod(
  2754. $core.method({
  2755. selector: "size",
  2756. protocol: "accessing",
  2757. fn: function (){
  2758. var self=this,$self=this;
  2759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2760. return $core.withContext(function($ctx1) {
  2761. //>>excludeEnd("ctx");
  2762. return $recv($self._keys())._size();
  2763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2764. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  2765. //>>excludeEnd("ctx");
  2766. },
  2767. //>>excludeStart("ide", pragmas.excludeIdeData);
  2768. args: [],
  2769. source: "size\x0a\x09^ self keys size",
  2770. referencedClasses: [],
  2771. //>>excludeEnd("ide");
  2772. pragmas: [],
  2773. messageSends: ["size", "keys"]
  2774. }),
  2775. $globals.AssociativeCollection);
  2776. $core.addMethod(
  2777. $core.method({
  2778. selector: "values",
  2779. protocol: "accessing",
  2780. fn: function (){
  2781. var self=this,$self=this;
  2782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2783. return $core.withContext(function($ctx1) {
  2784. //>>excludeEnd("ctx");
  2785. $self._subclassResponsibility();
  2786. return self;
  2787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2788. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  2789. //>>excludeEnd("ctx");
  2790. },
  2791. //>>excludeStart("ide", pragmas.excludeIdeData);
  2792. args: [],
  2793. source: "values\x0a\x09self subclassResponsibility",
  2794. referencedClasses: [],
  2795. //>>excludeEnd("ide");
  2796. pragmas: [],
  2797. messageSends: ["subclassResponsibility"]
  2798. }),
  2799. $globals.AssociativeCollection);
  2800. $core.addMethod(
  2801. $core.method({
  2802. selector: "valuesDo:",
  2803. protocol: "enumerating",
  2804. fn: function (aBlock){
  2805. var self=this,$self=this;
  2806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2807. return $core.withContext(function($ctx1) {
  2808. //>>excludeEnd("ctx");
  2809. $self._subclassResponsibility();
  2810. return self;
  2811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2812. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  2813. //>>excludeEnd("ctx");
  2814. },
  2815. //>>excludeStart("ide", pragmas.excludeIdeData);
  2816. args: ["aBlock"],
  2817. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2818. referencedClasses: [],
  2819. //>>excludeEnd("ide");
  2820. pragmas: [],
  2821. messageSends: ["subclassResponsibility"]
  2822. }),
  2823. $globals.AssociativeCollection);
  2824. $core.addMethod(
  2825. $core.method({
  2826. selector: "withIndexDo:",
  2827. protocol: "enumerating",
  2828. fn: function (aBlock){
  2829. var self=this,$self=this;
  2830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2831. return $core.withContext(function($ctx1) {
  2832. //>>excludeEnd("ctx");
  2833. $self._keysAndValuesDo_((function(key,value){
  2834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2835. return $core.withContext(function($ctx2) {
  2836. //>>excludeEnd("ctx");
  2837. return $recv(aBlock)._value_value_(value,key);
  2838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2839. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2840. //>>excludeEnd("ctx");
  2841. }));
  2842. return self;
  2843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2844. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  2845. //>>excludeEnd("ctx");
  2846. },
  2847. //>>excludeStart("ide", pragmas.excludeIdeData);
  2848. args: ["aBlock"],
  2849. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  2850. referencedClasses: [],
  2851. //>>excludeEnd("ide");
  2852. pragmas: [],
  2853. messageSends: ["keysAndValuesDo:", "value:value:"]
  2854. }),
  2855. $globals.AssociativeCollection);
  2856. $core.addMethod(
  2857. $core.method({
  2858. selector: "from:",
  2859. protocol: "instance creation",
  2860. fn: function (aCollection){
  2861. var self=this,$self=this;
  2862. var newCollection;
  2863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2864. return $core.withContext(function($ctx1) {
  2865. //>>excludeEnd("ctx");
  2866. newCollection=$self._new();
  2867. $recv(aCollection)._do_((function(each){
  2868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2869. return $core.withContext(function($ctx2) {
  2870. //>>excludeEnd("ctx");
  2871. return $recv(newCollection)._add_(each);
  2872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2873. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2874. //>>excludeEnd("ctx");
  2875. }));
  2876. return newCollection;
  2877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2878. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection})});
  2879. //>>excludeEnd("ctx");
  2880. },
  2881. //>>excludeStart("ide", pragmas.excludeIdeData);
  2882. args: ["aCollection"],
  2883. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  2884. referencedClasses: [],
  2885. //>>excludeEnd("ide");
  2886. pragmas: [],
  2887. messageSends: ["new", "do:", "add:"]
  2888. }),
  2889. $globals.AssociativeCollection.a$cls);
  2890. $core.addMethod(
  2891. $core.method({
  2892. selector: "fromPairs:",
  2893. protocol: "instance creation",
  2894. fn: function (aCollection){
  2895. var self=this,$self=this;
  2896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2897. return $core.withContext(function($ctx1) {
  2898. //>>excludeEnd("ctx");
  2899. return $self._from_(aCollection);
  2900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2901. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection})});
  2902. //>>excludeEnd("ctx");
  2903. },
  2904. //>>excludeStart("ide", pragmas.excludeIdeData);
  2905. args: ["aCollection"],
  2906. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  2907. referencedClasses: [],
  2908. //>>excludeEnd("ide");
  2909. pragmas: [],
  2910. messageSends: ["from:"]
  2911. }),
  2912. $globals.AssociativeCollection.a$cls);
  2913. $core.addMethod(
  2914. $core.method({
  2915. selector: "newFromPairs:",
  2916. protocol: "instance creation",
  2917. fn: function (aCollection){
  2918. var self=this,$self=this;
  2919. var newCollection;
  2920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2921. return $core.withContext(function($ctx1) {
  2922. //>>excludeEnd("ctx");
  2923. var $2,$1,$3,$4;
  2924. $2=$recv(aCollection)._size();
  2925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2926. $ctx1.sendIdx["size"]=1;
  2927. //>>excludeEnd("ctx");
  2928. $1=$recv($2)._even();
  2929. if(!$core.assert($1)){
  2930. $self._error_("#newFromPairs only accepts arrays of an even length");
  2931. }
  2932. newCollection=$self._new();
  2933. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  2934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2935. return $core.withContext(function($ctx2) {
  2936. //>>excludeEnd("ctx");
  2937. $3=newCollection;
  2938. $4=$recv(aCollection)._at_(each);
  2939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2940. $ctx2.sendIdx["at:"]=1;
  2941. //>>excludeEnd("ctx");
  2942. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  2943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2944. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2945. //>>excludeEnd("ctx");
  2946. }));
  2947. return newCollection;
  2948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2949. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection})});
  2950. //>>excludeEnd("ctx");
  2951. },
  2952. //>>excludeStart("ide", pragmas.excludeIdeData);
  2953. args: ["aCollection"],
  2954. 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",
  2955. referencedClasses: [],
  2956. //>>excludeEnd("ide");
  2957. pragmas: [],
  2958. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  2959. }),
  2960. $globals.AssociativeCollection.a$cls);
  2961. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  2962. //>>excludeStart("ide", pragmas.excludeIdeData);
  2963. $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.";
  2964. //>>excludeEnd("ide");
  2965. $core.addMethod(
  2966. $core.method({
  2967. selector: "at:ifAbsent:",
  2968. protocol: "accessing",
  2969. fn: function (aKey,aBlock){
  2970. var self=this,$self=this;
  2971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2972. return $core.withContext(function($ctx1) {
  2973. //>>excludeEnd("ctx");
  2974. var index = $self._positionOfKey_(aKey);
  2975. return index >=0 ? $self.values[index] : aBlock._value();
  2976. ;
  2977. return self;
  2978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2979. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2980. //>>excludeEnd("ctx");
  2981. },
  2982. //>>excludeStart("ide", pragmas.excludeIdeData);
  2983. args: ["aKey", "aBlock"],
  2984. 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'>",
  2985. referencedClasses: [],
  2986. //>>excludeEnd("ide");
  2987. pragmas: [["inlineJS:", ["\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? $self.values[index] : aBlock._value();\x0a\x09"]]],
  2988. messageSends: []
  2989. }),
  2990. $globals.Dictionary);
  2991. $core.addMethod(
  2992. $core.method({
  2993. selector: "at:put:",
  2994. protocol: "accessing",
  2995. fn: function (aKey,aValue){
  2996. var self=this,$self=this;
  2997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2998. return $core.withContext(function($ctx1) {
  2999. //>>excludeEnd("ctx");
  3000. var index = $self._positionOfKey_(aKey);
  3001. if(index === -1) {
  3002. var keys = $self.keys;
  3003. index = keys.length;
  3004. keys.push(aKey);
  3005. }
  3006. return $self.values[index] = aValue;
  3007. ;
  3008. return self;
  3009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3010. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  3011. //>>excludeEnd("ctx");
  3012. },
  3013. //>>excludeStart("ide", pragmas.excludeIdeData);
  3014. args: ["aKey", "aValue"],
  3015. 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'>",
  3016. referencedClasses: [],
  3017. //>>excludeEnd("ide");
  3018. pragmas: [["inlineJS:", ["\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09var keys = $self.keys;\x0a\x09\x09\x09index = keys.length;\x0a\x09\x09\x09keys.push(aKey);\x0a\x09\x09}\x0a\x0a\x09\x09return $self.values[index] = aValue;\x0a\x09"]]],
  3019. messageSends: []
  3020. }),
  3021. $globals.Dictionary);
  3022. $core.addMethod(
  3023. $core.method({
  3024. selector: "includesKey:",
  3025. protocol: "testing",
  3026. fn: function (aKey){
  3027. var self=this,$self=this;
  3028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3029. return $core.withContext(function($ctx1) {
  3030. //>>excludeEnd("ctx");
  3031. return $self._positionOfKey_(aKey) >= 0;;
  3032. return self;
  3033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3034. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  3035. //>>excludeEnd("ctx");
  3036. },
  3037. //>>excludeStart("ide", pragmas.excludeIdeData);
  3038. args: ["aKey"],
  3039. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  3040. referencedClasses: [],
  3041. //>>excludeEnd("ide");
  3042. pragmas: [["inlineJS:", ["return $self._positionOfKey_(aKey) >= 0;"]]],
  3043. messageSends: []
  3044. }),
  3045. $globals.Dictionary);
  3046. $core.addMethod(
  3047. $core.method({
  3048. selector: "indexOf:ifAbsent:",
  3049. protocol: "accessing",
  3050. fn: function (anObject,aBlock){
  3051. var self=this,$self=this;
  3052. var index;
  3053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3054. return $core.withContext(function($ctx1) {
  3055. //>>excludeEnd("ctx");
  3056. var $1;
  3057. index=$recv($self.values)._indexOf_ifAbsent_(anObject,(function(){
  3058. return (0);
  3059. }));
  3060. $1=$recv(index).__eq((0));
  3061. if($core.assert($1)){
  3062. return $recv(aBlock)._value();
  3063. } else {
  3064. return $recv($self.keys)._at_(index);
  3065. }
  3066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3067. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  3068. //>>excludeEnd("ctx");
  3069. },
  3070. //>>excludeStart("ide", pragmas.excludeIdeData);
  3071. args: ["anObject", "aBlock"],
  3072. 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 ]",
  3073. referencedClasses: [],
  3074. //>>excludeEnd("ide");
  3075. pragmas: [],
  3076. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  3077. }),
  3078. $globals.Dictionary);
  3079. $core.addMethod(
  3080. $core.method({
  3081. selector: "initialize",
  3082. protocol: "initialization",
  3083. fn: function (){
  3084. var self=this,$self=this;
  3085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3086. return $core.withContext(function($ctx1) {
  3087. //>>excludeEnd("ctx");
  3088. (
  3089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3090. $ctx1.supercall = true,
  3091. //>>excludeEnd("ctx");
  3092. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  3093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3094. $ctx1.supercall = false;
  3095. //>>excludeEnd("ctx");;
  3096. $self.keys=[];
  3097. $self.values=[];
  3098. return self;
  3099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3100. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  3101. //>>excludeEnd("ctx");
  3102. },
  3103. //>>excludeStart("ide", pragmas.excludeIdeData);
  3104. args: [],
  3105. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  3106. referencedClasses: [],
  3107. //>>excludeEnd("ide");
  3108. pragmas: [],
  3109. messageSends: ["initialize"]
  3110. }),
  3111. $globals.Dictionary);
  3112. $core.addMethod(
  3113. $core.method({
  3114. selector: "keys",
  3115. protocol: "accessing",
  3116. fn: function (){
  3117. var self=this,$self=this;
  3118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3119. return $core.withContext(function($ctx1) {
  3120. //>>excludeEnd("ctx");
  3121. return $recv($self.keys)._copy();
  3122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3123. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  3124. //>>excludeEnd("ctx");
  3125. },
  3126. //>>excludeStart("ide", pragmas.excludeIdeData);
  3127. args: [],
  3128. source: "keys\x0a\x09^ keys copy",
  3129. referencedClasses: [],
  3130. //>>excludeEnd("ide");
  3131. pragmas: [],
  3132. messageSends: ["copy"]
  3133. }),
  3134. $globals.Dictionary);
  3135. $core.addMethod(
  3136. $core.method({
  3137. selector: "keysAndValuesDo:",
  3138. protocol: "enumerating",
  3139. fn: function (aBlock){
  3140. var self=this,$self=this;
  3141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3142. return $core.withContext(function($ctx1) {
  3143. //>>excludeEnd("ctx");
  3144. return $recv($self.keys)._with_do_($self.values,aBlock);
  3145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3146. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  3147. //>>excludeEnd("ctx");
  3148. },
  3149. //>>excludeStart("ide", pragmas.excludeIdeData);
  3150. args: ["aBlock"],
  3151. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3152. referencedClasses: [],
  3153. //>>excludeEnd("ide");
  3154. pragmas: [],
  3155. messageSends: ["with:do:"]
  3156. }),
  3157. $globals.Dictionary);
  3158. $core.addMethod(
  3159. $core.method({
  3160. selector: "keysDo:",
  3161. protocol: "enumerating",
  3162. fn: function (aBlock){
  3163. var self=this,$self=this;
  3164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3165. return $core.withContext(function($ctx1) {
  3166. //>>excludeEnd("ctx");
  3167. return $recv($self.keys)._do_(aBlock);
  3168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3169. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  3170. //>>excludeEnd("ctx");
  3171. },
  3172. //>>excludeStart("ide", pragmas.excludeIdeData);
  3173. args: ["aBlock"],
  3174. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3175. referencedClasses: [],
  3176. //>>excludeEnd("ide");
  3177. pragmas: [],
  3178. messageSends: ["do:"]
  3179. }),
  3180. $globals.Dictionary);
  3181. $core.addMethod(
  3182. $core.method({
  3183. selector: "positionOfKey:",
  3184. protocol: "private",
  3185. fn: function (anObject){
  3186. var self=this,$self=this;
  3187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3188. return $core.withContext(function($ctx1) {
  3189. //>>excludeEnd("ctx");
  3190. var keys = $self.keys;
  3191. for(var i=0;i<keys.length;i++){
  3192. if(keys[i].__eq(anObject)) { return i;}
  3193. }
  3194. return -1;
  3195. ;
  3196. return self;
  3197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3198. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject})});
  3199. //>>excludeEnd("ctx");
  3200. },
  3201. //>>excludeStart("ide", pragmas.excludeIdeData);
  3202. args: ["anObject"],
  3203. 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'>",
  3204. referencedClasses: [],
  3205. //>>excludeEnd("ide");
  3206. pragmas: [["inlineJS:", ["\x0a\x09\x09var keys = $self.keys;\x0a\x09\x09for(var i=0;i<keys.length;i++){\x0a\x09\x09\x09if(keys[i].__eq(anObject)) { return i;}\x0a\x09\x09}\x0a\x09\x09return -1;\x0a\x09"]]],
  3207. messageSends: []
  3208. }),
  3209. $globals.Dictionary);
  3210. $core.addMethod(
  3211. $core.method({
  3212. selector: "removeAll",
  3213. protocol: "adding/removing",
  3214. fn: function (){
  3215. var self=this,$self=this;
  3216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3217. return $core.withContext(function($ctx1) {
  3218. //>>excludeEnd("ctx");
  3219. $recv($self.keys)._removeAll();
  3220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3221. $ctx1.sendIdx["removeAll"]=1;
  3222. //>>excludeEnd("ctx");
  3223. $recv($self.values)._removeAll();
  3224. return self;
  3225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3226. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  3227. //>>excludeEnd("ctx");
  3228. },
  3229. //>>excludeStart("ide", pragmas.excludeIdeData);
  3230. args: [],
  3231. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3232. referencedClasses: [],
  3233. //>>excludeEnd("ide");
  3234. pragmas: [],
  3235. messageSends: ["removeAll"]
  3236. }),
  3237. $globals.Dictionary);
  3238. $core.addMethod(
  3239. $core.method({
  3240. selector: "removeKey:ifAbsent:",
  3241. protocol: "adding/removing",
  3242. fn: function (aKey,aBlock){
  3243. var self=this,$self=this;
  3244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3245. return $core.withContext(function($ctx1) {
  3246. //>>excludeEnd("ctx");
  3247. var index = $self._positionOfKey_(aKey);
  3248. if(index === -1) {
  3249. return aBlock._value()
  3250. } else {
  3251. var keys = $self.keys, values = $self.values;
  3252. var value = values[index], l = keys.length;
  3253. keys[index] = keys[l-1];
  3254. keys.pop();
  3255. values[index] = values[l-1];
  3256. values.pop();
  3257. return value;
  3258. }
  3259. ;
  3260. return self;
  3261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3262. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3263. //>>excludeEnd("ctx");
  3264. },
  3265. //>>excludeStart("ide", pragmas.excludeIdeData);
  3266. args: ["aKey", "aBlock"],
  3267. 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'>",
  3268. referencedClasses: [],
  3269. //>>excludeEnd("ide");
  3270. pragmas: [["inlineJS:", ["\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09return aBlock._value()\x0a\x09\x09} else {\x0a\x09\x09\x09var keys = $self.keys, values = $self.values;\x0a\x09\x09\x09var value = values[index], l = keys.length;\x0a\x09\x09\x09keys[index] = keys[l-1];\x0a\x09\x09\x09keys.pop();\x0a\x09\x09\x09values[index] = values[l-1];\x0a\x09\x09\x09values.pop();\x0a\x09\x09\x09return value;\x0a\x09\x09}\x0a\x09"]]],
  3271. messageSends: []
  3272. }),
  3273. $globals.Dictionary);
  3274. $core.addMethod(
  3275. $core.method({
  3276. selector: "values",
  3277. protocol: "accessing",
  3278. fn: function (){
  3279. var self=this,$self=this;
  3280. return $self.values;
  3281. },
  3282. //>>excludeStart("ide", pragmas.excludeIdeData);
  3283. args: [],
  3284. source: "values\x0a\x09^ values",
  3285. referencedClasses: [],
  3286. //>>excludeEnd("ide");
  3287. pragmas: [],
  3288. messageSends: []
  3289. }),
  3290. $globals.Dictionary);
  3291. $core.addMethod(
  3292. $core.method({
  3293. selector: "valuesDo:",
  3294. protocol: "enumerating",
  3295. fn: function (aBlock){
  3296. var self=this,$self=this;
  3297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3298. return $core.withContext(function($ctx1) {
  3299. //>>excludeEnd("ctx");
  3300. return $recv($self.values)._do_(aBlock);
  3301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3302. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  3303. //>>excludeEnd("ctx");
  3304. },
  3305. //>>excludeStart("ide", pragmas.excludeIdeData);
  3306. args: ["aBlock"],
  3307. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3308. referencedClasses: [],
  3309. //>>excludeEnd("ide");
  3310. pragmas: [],
  3311. messageSends: ["do:"]
  3312. }),
  3313. $globals.Dictionary);
  3314. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  3315. //>>excludeStart("ide", pragmas.excludeIdeData);
  3316. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3317. //>>excludeEnd("ide");
  3318. $core.addMethod(
  3319. $core.method({
  3320. selector: "at:ifAbsent:",
  3321. protocol: "accessing",
  3322. fn: function (aKey,aBlock){
  3323. var self=this,$self=this;
  3324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3325. return $core.withContext(function($ctx1) {
  3326. //>>excludeEnd("ctx");
  3327. var $1;
  3328. $1=$self._includesKey_(aKey);
  3329. if($core.assert($1)){
  3330. return $self._basicAt_(aKey);
  3331. } else {
  3332. return $recv(aBlock)._value();
  3333. }
  3334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3335. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3336. //>>excludeEnd("ctx");
  3337. },
  3338. //>>excludeStart("ide", pragmas.excludeIdeData);
  3339. args: ["aKey", "aBlock"],
  3340. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3341. referencedClasses: [],
  3342. //>>excludeEnd("ide");
  3343. pragmas: [],
  3344. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3345. }),
  3346. $globals.HashedCollection);
  3347. $core.addMethod(
  3348. $core.method({
  3349. selector: "at:put:",
  3350. protocol: "accessing",
  3351. fn: function (aKey,aValue){
  3352. var self=this,$self=this;
  3353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3354. return $core.withContext(function($ctx1) {
  3355. //>>excludeEnd("ctx");
  3356. return $self._basicAt_put_(aKey,aValue);
  3357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3358. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  3359. //>>excludeEnd("ctx");
  3360. },
  3361. //>>excludeStart("ide", pragmas.excludeIdeData);
  3362. args: ["aKey", "aValue"],
  3363. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3364. referencedClasses: [],
  3365. //>>excludeEnd("ide");
  3366. pragmas: [],
  3367. messageSends: ["basicAt:put:"]
  3368. }),
  3369. $globals.HashedCollection);
  3370. $core.addMethod(
  3371. $core.method({
  3372. selector: "includesKey:",
  3373. protocol: "testing",
  3374. fn: function (aKey){
  3375. var self=this,$self=this;
  3376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3377. return $core.withContext(function($ctx1) {
  3378. //>>excludeEnd("ctx");
  3379. return self.hasOwnProperty(aKey);
  3380. return self;
  3381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3382. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  3383. //>>excludeEnd("ctx");
  3384. },
  3385. //>>excludeStart("ide", pragmas.excludeIdeData);
  3386. args: ["aKey"],
  3387. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  3388. referencedClasses: [],
  3389. //>>excludeEnd("ide");
  3390. pragmas: [["inlineJS:", ["return self.hasOwnProperty(aKey)"]]],
  3391. messageSends: []
  3392. }),
  3393. $globals.HashedCollection);
  3394. $core.addMethod(
  3395. $core.method({
  3396. selector: "keys",
  3397. protocol: "accessing",
  3398. fn: function (){
  3399. var self=this,$self=this;
  3400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3401. return $core.withContext(function($ctx1) {
  3402. //>>excludeEnd("ctx");
  3403. return Object.keys(self);
  3404. return self;
  3405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3406. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  3407. //>>excludeEnd("ctx");
  3408. },
  3409. //>>excludeStart("ide", pragmas.excludeIdeData);
  3410. args: [],
  3411. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  3412. referencedClasses: [],
  3413. //>>excludeEnd("ide");
  3414. pragmas: [["inlineJS:", ["return Object.keys(self)"]]],
  3415. messageSends: []
  3416. }),
  3417. $globals.HashedCollection);
  3418. $core.addMethod(
  3419. $core.method({
  3420. selector: "keysDo:",
  3421. protocol: "enumerating",
  3422. fn: function (aBlock){
  3423. var self=this,$self=this;
  3424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3425. return $core.withContext(function($ctx1) {
  3426. //>>excludeEnd("ctx");
  3427. $recv($self._keys())._do_(aBlock);
  3428. return self;
  3429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3430. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  3431. //>>excludeEnd("ctx");
  3432. },
  3433. //>>excludeStart("ide", pragmas.excludeIdeData);
  3434. args: ["aBlock"],
  3435. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3436. referencedClasses: [],
  3437. //>>excludeEnd("ide");
  3438. pragmas: [],
  3439. messageSends: ["do:", "keys"]
  3440. }),
  3441. $globals.HashedCollection);
  3442. $core.addMethod(
  3443. $core.method({
  3444. selector: "removeKey:ifAbsent:",
  3445. protocol: "adding/removing",
  3446. fn: function (aKey,aBlock){
  3447. var self=this,$self=this;
  3448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3449. return $core.withContext(function($ctx1) {
  3450. //>>excludeEnd("ctx");
  3451. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3453. return $core.withContext(function($ctx2) {
  3454. //>>excludeEnd("ctx");
  3455. $self._basicDelete_(aKey);
  3456. return removed;
  3457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3458. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3459. //>>excludeEnd("ctx");
  3460. }),(function(){
  3461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3462. return $core.withContext(function($ctx2) {
  3463. //>>excludeEnd("ctx");
  3464. return $recv(aBlock)._value();
  3465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3467. //>>excludeEnd("ctx");
  3468. }));
  3469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3470. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3471. //>>excludeEnd("ctx");
  3472. },
  3473. //>>excludeStart("ide", pragmas.excludeIdeData);
  3474. args: ["aKey", "aBlock"],
  3475. 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 ]",
  3476. referencedClasses: [],
  3477. //>>excludeEnd("ide");
  3478. pragmas: [],
  3479. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3480. }),
  3481. $globals.HashedCollection);
  3482. $core.addMethod(
  3483. $core.method({
  3484. selector: "values",
  3485. protocol: "accessing",
  3486. fn: function (){
  3487. var self=this,$self=this;
  3488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3489. return $core.withContext(function($ctx1) {
  3490. //>>excludeEnd("ctx");
  3491. return $self._keys().map(function(key){
  3492. return $self._at_(key);
  3493. });
  3494. ;
  3495. return self;
  3496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3497. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  3498. //>>excludeEnd("ctx");
  3499. },
  3500. //>>excludeStart("ide", pragmas.excludeIdeData);
  3501. args: [],
  3502. 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'>",
  3503. referencedClasses: [],
  3504. //>>excludeEnd("ide");
  3505. pragmas: [["inlineJS:", ["\x0a\x09\x09return $self._keys().map(function(key){\x0a\x09\x09\x09return $self._at_(key);\x0a\x09\x09});\x0a\x09"]]],
  3506. messageSends: []
  3507. }),
  3508. $globals.HashedCollection);
  3509. $core.addMethod(
  3510. $core.method({
  3511. selector: "valuesDo:",
  3512. protocol: "enumerating",
  3513. fn: function (aBlock){
  3514. var self=this,$self=this;
  3515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3516. return $core.withContext(function($ctx1) {
  3517. //>>excludeEnd("ctx");
  3518. $recv($self._values())._do_(aBlock);
  3519. return self;
  3520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3521. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  3522. //>>excludeEnd("ctx");
  3523. },
  3524. //>>excludeStart("ide", pragmas.excludeIdeData);
  3525. args: ["aBlock"],
  3526. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3527. referencedClasses: [],
  3528. //>>excludeEnd("ide");
  3529. pragmas: [],
  3530. messageSends: ["do:", "values"]
  3531. }),
  3532. $globals.HashedCollection);
  3533. $core.addClass("SequenceableCollection", $globals.Collection, [], "Kernel-Collections");
  3534. //>>excludeStart("ide", pragmas.excludeIdeData);
  3535. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3536. //>>excludeEnd("ide");
  3537. $core.addMethod(
  3538. $core.method({
  3539. selector: "=",
  3540. protocol: "comparing",
  3541. fn: function (aCollection){
  3542. var self=this,$self=this;
  3543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3544. return $core.withContext(function($ctx1) {
  3545. //>>excludeEnd("ctx");
  3546. var $3,$2,$4,$1,$5;
  3547. var $early={};
  3548. try {
  3549. $3=$self._class();
  3550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3551. $ctx1.sendIdx["class"]=1;
  3552. //>>excludeEnd("ctx");
  3553. $2=$recv($3).__eq($recv(aCollection)._class());
  3554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3555. $ctx1.sendIdx["="]=1;
  3556. //>>excludeEnd("ctx");
  3557. $1=$recv($2)._and_((function(){
  3558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3559. return $core.withContext(function($ctx2) {
  3560. //>>excludeEnd("ctx");
  3561. $4=$self._size();
  3562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3563. $ctx2.sendIdx["size"]=1;
  3564. //>>excludeEnd("ctx");
  3565. return $recv($4).__eq($recv(aCollection)._size());
  3566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3567. $ctx2.sendIdx["="]=2;
  3568. //>>excludeEnd("ctx");
  3569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3570. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3571. //>>excludeEnd("ctx");
  3572. }));
  3573. if(!$core.assert($1)){
  3574. return false;
  3575. }
  3576. $self._withIndexDo_((function(each,i){
  3577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3578. return $core.withContext(function($ctx2) {
  3579. //>>excludeEnd("ctx");
  3580. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  3581. if(!$core.assert($5)){
  3582. throw $early=[false];
  3583. }
  3584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3585. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3586. //>>excludeEnd("ctx");
  3587. }));
  3588. return true;
  3589. }
  3590. catch(e) {if(e===$early)return e[0]; throw e}
  3591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3592. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  3593. //>>excludeEnd("ctx");
  3594. },
  3595. //>>excludeStart("ide", pragmas.excludeIdeData);
  3596. args: ["aCollection"],
  3597. 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",
  3598. referencedClasses: [],
  3599. //>>excludeEnd("ide");
  3600. pragmas: [],
  3601. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3602. }),
  3603. $globals.SequenceableCollection);
  3604. $core.addMethod(
  3605. $core.method({
  3606. selector: "addLast:",
  3607. protocol: "adding/removing",
  3608. fn: function (anObject){
  3609. var self=this,$self=this;
  3610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3611. return $core.withContext(function($ctx1) {
  3612. //>>excludeEnd("ctx");
  3613. $self._add_(anObject);
  3614. return self;
  3615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3616. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject})});
  3617. //>>excludeEnd("ctx");
  3618. },
  3619. //>>excludeStart("ide", pragmas.excludeIdeData);
  3620. args: ["anObject"],
  3621. source: "addLast: anObject\x0a\x09self add: anObject",
  3622. referencedClasses: [],
  3623. //>>excludeEnd("ide");
  3624. pragmas: [],
  3625. messageSends: ["add:"]
  3626. }),
  3627. $globals.SequenceableCollection);
  3628. $core.addMethod(
  3629. $core.method({
  3630. selector: "allButFirst",
  3631. protocol: "accessing",
  3632. fn: function (){
  3633. var self=this,$self=this;
  3634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3635. return $core.withContext(function($ctx1) {
  3636. //>>excludeEnd("ctx");
  3637. return $self._copyFrom_to_((2),$self._size());
  3638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3639. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{})});
  3640. //>>excludeEnd("ctx");
  3641. },
  3642. //>>excludeStart("ide", pragmas.excludeIdeData);
  3643. args: [],
  3644. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3645. referencedClasses: [],
  3646. //>>excludeEnd("ide");
  3647. pragmas: [],
  3648. messageSends: ["copyFrom:to:", "size"]
  3649. }),
  3650. $globals.SequenceableCollection);
  3651. $core.addMethod(
  3652. $core.method({
  3653. selector: "allButLast",
  3654. protocol: "accessing",
  3655. fn: function (){
  3656. var self=this,$self=this;
  3657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3658. return $core.withContext(function($ctx1) {
  3659. //>>excludeEnd("ctx");
  3660. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  3661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3662. }, function($ctx1) {$ctx1.fill(self,"allButLast",{})});
  3663. //>>excludeEnd("ctx");
  3664. },
  3665. //>>excludeStart("ide", pragmas.excludeIdeData);
  3666. args: [],
  3667. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  3668. referencedClasses: [],
  3669. //>>excludeEnd("ide");
  3670. pragmas: [],
  3671. messageSends: ["copyFrom:to:", "-", "size"]
  3672. }),
  3673. $globals.SequenceableCollection);
  3674. $core.addMethod(
  3675. $core.method({
  3676. selector: "anyOne",
  3677. protocol: "accessing",
  3678. fn: function (){
  3679. var self=this,$self=this;
  3680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3681. return $core.withContext(function($ctx1) {
  3682. //>>excludeEnd("ctx");
  3683. return $self._at_((1));
  3684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3685. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  3686. //>>excludeEnd("ctx");
  3687. },
  3688. //>>excludeStart("ide", pragmas.excludeIdeData);
  3689. args: [],
  3690. source: "anyOne\x0a\x09^ self at: 1",
  3691. referencedClasses: [],
  3692. //>>excludeEnd("ide");
  3693. pragmas: [],
  3694. messageSends: ["at:"]
  3695. }),
  3696. $globals.SequenceableCollection);
  3697. $core.addMethod(
  3698. $core.method({
  3699. selector: "atRandom",
  3700. protocol: "accessing",
  3701. fn: function (){
  3702. var self=this,$self=this;
  3703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3704. return $core.withContext(function($ctx1) {
  3705. //>>excludeEnd("ctx");
  3706. return $self._at_($recv($self._size())._atRandom());
  3707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3708. }, function($ctx1) {$ctx1.fill(self,"atRandom",{})});
  3709. //>>excludeEnd("ctx");
  3710. },
  3711. //>>excludeStart("ide", pragmas.excludeIdeData);
  3712. args: [],
  3713. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3714. referencedClasses: [],
  3715. //>>excludeEnd("ide");
  3716. pragmas: [],
  3717. messageSends: ["at:", "atRandom", "size"]
  3718. }),
  3719. $globals.SequenceableCollection);
  3720. $core.addMethod(
  3721. $core.method({
  3722. selector: "beginsWith:",
  3723. protocol: "testing",
  3724. fn: function (prefix){
  3725. var self=this,$self=this;
  3726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3727. return $core.withContext(function($ctx1) {
  3728. //>>excludeEnd("ctx");
  3729. var $2,$3,$1;
  3730. $2=$self._size();
  3731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3732. $ctx1.sendIdx["size"]=1;
  3733. //>>excludeEnd("ctx");
  3734. $3=$recv(prefix)._size();
  3735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3736. $ctx1.sendIdx["size"]=2;
  3737. //>>excludeEnd("ctx");
  3738. $1=$recv($2).__lt($3);
  3739. if($core.assert($1)){
  3740. return false;
  3741. }
  3742. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  3743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3744. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix})});
  3745. //>>excludeEnd("ctx");
  3746. },
  3747. //>>excludeStart("ide", pragmas.excludeIdeData);
  3748. args: ["prefix"],
  3749. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3750. referencedClasses: [],
  3751. //>>excludeEnd("ide");
  3752. pragmas: [],
  3753. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3754. }),
  3755. $globals.SequenceableCollection);
  3756. $core.addMethod(
  3757. $core.method({
  3758. selector: "copyFrom:to:",
  3759. protocol: "copying",
  3760. fn: function (anIndex,anotherIndex){
  3761. var self=this,$self=this;
  3762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3763. return $core.withContext(function($ctx1) {
  3764. //>>excludeEnd("ctx");
  3765. $self._subclassResponsibility();
  3766. return self;
  3767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3768. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  3769. //>>excludeEnd("ctx");
  3770. },
  3771. //>>excludeStart("ide", pragmas.excludeIdeData);
  3772. args: ["anIndex", "anotherIndex"],
  3773. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  3774. referencedClasses: [],
  3775. //>>excludeEnd("ide");
  3776. pragmas: [],
  3777. messageSends: ["subclassResponsibility"]
  3778. }),
  3779. $globals.SequenceableCollection);
  3780. $core.addMethod(
  3781. $core.method({
  3782. selector: "endsWith:",
  3783. protocol: "testing",
  3784. fn: function (suffix){
  3785. var self=this,$self=this;
  3786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3787. return $core.withContext(function($ctx1) {
  3788. //>>excludeEnd("ctx");
  3789. var $2,$3,$1;
  3790. $2=$self._size();
  3791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3792. $ctx1.sendIdx["size"]=1;
  3793. //>>excludeEnd("ctx");
  3794. $3=$recv(suffix)._size();
  3795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3796. $ctx1.sendIdx["size"]=2;
  3797. //>>excludeEnd("ctx");
  3798. $1=$recv($2).__lt($3);
  3799. if($core.assert($1)){
  3800. return false;
  3801. }
  3802. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  3803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3804. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix})});
  3805. //>>excludeEnd("ctx");
  3806. },
  3807. //>>excludeStart("ide", pragmas.excludeIdeData);
  3808. args: ["suffix"],
  3809. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  3810. referencedClasses: [],
  3811. //>>excludeEnd("ide");
  3812. pragmas: [],
  3813. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  3814. }),
  3815. $globals.SequenceableCollection);
  3816. $core.addMethod(
  3817. $core.method({
  3818. selector: "first",
  3819. protocol: "accessing",
  3820. fn: function (){
  3821. var self=this,$self=this;
  3822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3823. return $core.withContext(function($ctx1) {
  3824. //>>excludeEnd("ctx");
  3825. return $self._at_((1));
  3826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3827. }, function($ctx1) {$ctx1.fill(self,"first",{})});
  3828. //>>excludeEnd("ctx");
  3829. },
  3830. //>>excludeStart("ide", pragmas.excludeIdeData);
  3831. args: [],
  3832. source: "first\x0a\x09^ self at: 1",
  3833. referencedClasses: [],
  3834. //>>excludeEnd("ide");
  3835. pragmas: [],
  3836. messageSends: ["at:"]
  3837. }),
  3838. $globals.SequenceableCollection);
  3839. $core.addMethod(
  3840. $core.method({
  3841. selector: "first:",
  3842. protocol: "accessing",
  3843. fn: function (aNumber){
  3844. var self=this,$self=this;
  3845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3846. return $core.withContext(function($ctx1) {
  3847. //>>excludeEnd("ctx");
  3848. var $1;
  3849. $1=$recv($self._size()).__lt(aNumber);
  3850. if($core.assert($1)){
  3851. $self._error_("Invalid number of elements");
  3852. }
  3853. return $self._copyFrom_to_((1),aNumber);
  3854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3855. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber})});
  3856. //>>excludeEnd("ctx");
  3857. },
  3858. //>>excludeStart("ide", pragmas.excludeIdeData);
  3859. args: ["aNumber"],
  3860. 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",
  3861. referencedClasses: [],
  3862. //>>excludeEnd("ide");
  3863. pragmas: [],
  3864. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  3865. }),
  3866. $globals.SequenceableCollection);
  3867. $core.addMethod(
  3868. $core.method({
  3869. selector: "fourth",
  3870. protocol: "accessing",
  3871. fn: function (){
  3872. var self=this,$self=this;
  3873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3874. return $core.withContext(function($ctx1) {
  3875. //>>excludeEnd("ctx");
  3876. return $self._at_((4));
  3877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3878. }, function($ctx1) {$ctx1.fill(self,"fourth",{})});
  3879. //>>excludeEnd("ctx");
  3880. },
  3881. //>>excludeStart("ide", pragmas.excludeIdeData);
  3882. args: [],
  3883. source: "fourth\x0a\x09^ self at: 4",
  3884. referencedClasses: [],
  3885. //>>excludeEnd("ide");
  3886. pragmas: [],
  3887. messageSends: ["at:"]
  3888. }),
  3889. $globals.SequenceableCollection);
  3890. $core.addMethod(
  3891. $core.method({
  3892. selector: "includes:",
  3893. protocol: "testing",
  3894. fn: function (anObject){
  3895. var self=this,$self=this;
  3896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3897. return $core.withContext(function($ctx1) {
  3898. //>>excludeEnd("ctx");
  3899. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  3900. return nil;
  3901. })))._notNil();
  3902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3903. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  3904. //>>excludeEnd("ctx");
  3905. },
  3906. //>>excludeStart("ide", pragmas.excludeIdeData);
  3907. args: ["anObject"],
  3908. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  3909. referencedClasses: [],
  3910. //>>excludeEnd("ide");
  3911. pragmas: [],
  3912. messageSends: ["notNil", "indexOf:ifAbsent:"]
  3913. }),
  3914. $globals.SequenceableCollection);
  3915. $core.addMethod(
  3916. $core.method({
  3917. selector: "indexOf:startingAt:",
  3918. protocol: "accessing",
  3919. fn: function (anObject,start){
  3920. var self=this,$self=this;
  3921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3922. return $core.withContext(function($ctx1) {
  3923. //>>excludeEnd("ctx");
  3924. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  3925. return (0);
  3926. }));
  3927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3928. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start})});
  3929. //>>excludeEnd("ctx");
  3930. },
  3931. //>>excludeStart("ide", pragmas.excludeIdeData);
  3932. args: ["anObject", "start"],
  3933. 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 ]",
  3934. referencedClasses: [],
  3935. //>>excludeEnd("ide");
  3936. pragmas: [],
  3937. messageSends: ["indexOf:startingAt:ifAbsent:"]
  3938. }),
  3939. $globals.SequenceableCollection);
  3940. $core.addMethod(
  3941. $core.method({
  3942. selector: "indexOf:startingAt:ifAbsent:",
  3943. protocol: "accessing",
  3944. fn: function (anObject,start,aBlock){
  3945. var self=this,$self=this;
  3946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3947. return $core.withContext(function($ctx1) {
  3948. //>>excludeEnd("ctx");
  3949. $self._subclassResponsibility();
  3950. return self;
  3951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3952. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  3953. //>>excludeEnd("ctx");
  3954. },
  3955. //>>excludeStart("ide", pragmas.excludeIdeData);
  3956. args: ["anObject", "start", "aBlock"],
  3957. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  3958. referencedClasses: [],
  3959. //>>excludeEnd("ide");
  3960. pragmas: [],
  3961. messageSends: ["subclassResponsibility"]
  3962. }),
  3963. $globals.SequenceableCollection);
  3964. $core.addMethod(
  3965. $core.method({
  3966. selector: "last",
  3967. protocol: "accessing",
  3968. fn: function (){
  3969. var self=this,$self=this;
  3970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3971. return $core.withContext(function($ctx1) {
  3972. //>>excludeEnd("ctx");
  3973. return $self._at_($self._size());
  3974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3975. }, function($ctx1) {$ctx1.fill(self,"last",{})});
  3976. //>>excludeEnd("ctx");
  3977. },
  3978. //>>excludeStart("ide", pragmas.excludeIdeData);
  3979. args: [],
  3980. source: "last\x0a\x09^ self at: self size",
  3981. referencedClasses: [],
  3982. //>>excludeEnd("ide");
  3983. pragmas: [],
  3984. messageSends: ["at:", "size"]
  3985. }),
  3986. $globals.SequenceableCollection);
  3987. $core.addMethod(
  3988. $core.method({
  3989. selector: "last:",
  3990. protocol: "accessing",
  3991. fn: function (aNumber){
  3992. var self=this,$self=this;
  3993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3994. return $core.withContext(function($ctx1) {
  3995. //>>excludeEnd("ctx");
  3996. var $2,$1,$5,$4,$3;
  3997. $2=$self._size();
  3998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3999. $ctx1.sendIdx["size"]=1;
  4000. //>>excludeEnd("ctx");
  4001. $1=$recv($2).__lt(aNumber);
  4002. if($core.assert($1)){
  4003. $self._error_("Invalid number of elements");
  4004. }
  4005. $5=$self._size();
  4006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4007. $ctx1.sendIdx["size"]=2;
  4008. //>>excludeEnd("ctx");
  4009. $4=$recv($5).__minus(aNumber);
  4010. $3=$recv($4).__plus((1));
  4011. return $self._copyFrom_to_($3,$self._size());
  4012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4013. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber})});
  4014. //>>excludeEnd("ctx");
  4015. },
  4016. //>>excludeStart("ide", pragmas.excludeIdeData);
  4017. args: ["aNumber"],
  4018. 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",
  4019. referencedClasses: [],
  4020. //>>excludeEnd("ide");
  4021. pragmas: [],
  4022. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  4023. }),
  4024. $globals.SequenceableCollection);
  4025. $core.addMethod(
  4026. $core.method({
  4027. selector: "newStream",
  4028. protocol: "streaming",
  4029. fn: function (){
  4030. var self=this,$self=this;
  4031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4032. return $core.withContext(function($ctx1) {
  4033. //>>excludeEnd("ctx");
  4034. return $recv($self._streamClass())._on_(self);
  4035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4036. }, function($ctx1) {$ctx1.fill(self,"newStream",{})});
  4037. //>>excludeEnd("ctx");
  4038. },
  4039. //>>excludeStart("ide", pragmas.excludeIdeData);
  4040. args: [],
  4041. source: "newStream\x0a\x09^ self streamClass on: self",
  4042. referencedClasses: [],
  4043. //>>excludeEnd("ide");
  4044. pragmas: [],
  4045. messageSends: ["on:", "streamClass"]
  4046. }),
  4047. $globals.SequenceableCollection);
  4048. $core.addMethod(
  4049. $core.method({
  4050. selector: "readStream",
  4051. protocol: "streaming",
  4052. fn: function (){
  4053. var self=this,$self=this;
  4054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4055. return $core.withContext(function($ctx1) {
  4056. //>>excludeEnd("ctx");
  4057. return $self._stream();
  4058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4059. }, function($ctx1) {$ctx1.fill(self,"readStream",{})});
  4060. //>>excludeEnd("ctx");
  4061. },
  4062. //>>excludeStart("ide", pragmas.excludeIdeData);
  4063. args: [],
  4064. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4065. referencedClasses: [],
  4066. //>>excludeEnd("ide");
  4067. pragmas: [],
  4068. messageSends: ["stream"]
  4069. }),
  4070. $globals.SequenceableCollection);
  4071. $core.addMethod(
  4072. $core.method({
  4073. selector: "removeLast",
  4074. protocol: "adding/removing",
  4075. fn: function (){
  4076. var self=this,$self=this;
  4077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4078. return $core.withContext(function($ctx1) {
  4079. //>>excludeEnd("ctx");
  4080. return $self._remove_($self._last());
  4081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4082. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  4083. //>>excludeEnd("ctx");
  4084. },
  4085. //>>excludeStart("ide", pragmas.excludeIdeData);
  4086. args: [],
  4087. source: "removeLast\x0a\x09^ self remove: self last",
  4088. referencedClasses: [],
  4089. //>>excludeEnd("ide");
  4090. pragmas: [],
  4091. messageSends: ["remove:", "last"]
  4092. }),
  4093. $globals.SequenceableCollection);
  4094. $core.addMethod(
  4095. $core.method({
  4096. selector: "reverseDo:",
  4097. protocol: "enumerating",
  4098. fn: function (aBlock){
  4099. var self=this,$self=this;
  4100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4101. return $core.withContext(function($ctx1) {
  4102. //>>excludeEnd("ctx");
  4103. $recv($self._reversed())._do_(aBlock);
  4104. return self;
  4105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4106. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock})});
  4107. //>>excludeEnd("ctx");
  4108. },
  4109. //>>excludeStart("ide", pragmas.excludeIdeData);
  4110. args: ["aBlock"],
  4111. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  4112. referencedClasses: [],
  4113. //>>excludeEnd("ide");
  4114. pragmas: [],
  4115. messageSends: ["do:", "reversed"]
  4116. }),
  4117. $globals.SequenceableCollection);
  4118. $core.addMethod(
  4119. $core.method({
  4120. selector: "reversed",
  4121. protocol: "converting",
  4122. fn: function (){
  4123. var self=this,$self=this;
  4124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4125. return $core.withContext(function($ctx1) {
  4126. //>>excludeEnd("ctx");
  4127. $self._subclassResponsibility();
  4128. return self;
  4129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4130. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  4131. //>>excludeEnd("ctx");
  4132. },
  4133. //>>excludeStart("ide", pragmas.excludeIdeData);
  4134. args: [],
  4135. source: "reversed\x0a\x09self subclassResponsibility",
  4136. referencedClasses: [],
  4137. //>>excludeEnd("ide");
  4138. pragmas: [],
  4139. messageSends: ["subclassResponsibility"]
  4140. }),
  4141. $globals.SequenceableCollection);
  4142. $core.addMethod(
  4143. $core.method({
  4144. selector: "second",
  4145. protocol: "accessing",
  4146. fn: function (){
  4147. var self=this,$self=this;
  4148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4149. return $core.withContext(function($ctx1) {
  4150. //>>excludeEnd("ctx");
  4151. return $self._at_((2));
  4152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4153. }, function($ctx1) {$ctx1.fill(self,"second",{})});
  4154. //>>excludeEnd("ctx");
  4155. },
  4156. //>>excludeStart("ide", pragmas.excludeIdeData);
  4157. args: [],
  4158. source: "second\x0a\x09^ self at: 2",
  4159. referencedClasses: [],
  4160. //>>excludeEnd("ide");
  4161. pragmas: [],
  4162. messageSends: ["at:"]
  4163. }),
  4164. $globals.SequenceableCollection);
  4165. $core.addMethod(
  4166. $core.method({
  4167. selector: "stream",
  4168. protocol: "streaming",
  4169. fn: function (){
  4170. var self=this,$self=this;
  4171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4172. return $core.withContext(function($ctx1) {
  4173. //>>excludeEnd("ctx");
  4174. return $self._newStream();
  4175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4176. }, function($ctx1) {$ctx1.fill(self,"stream",{})});
  4177. //>>excludeEnd("ctx");
  4178. },
  4179. //>>excludeStart("ide", pragmas.excludeIdeData);
  4180. args: [],
  4181. source: "stream\x0a\x09^ self newStream",
  4182. referencedClasses: [],
  4183. //>>excludeEnd("ide");
  4184. pragmas: [],
  4185. messageSends: ["newStream"]
  4186. }),
  4187. $globals.SequenceableCollection);
  4188. $core.addMethod(
  4189. $core.method({
  4190. selector: "streamClass",
  4191. protocol: "streaming",
  4192. fn: function (){
  4193. var self=this,$self=this;
  4194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4195. return $core.withContext(function($ctx1) {
  4196. //>>excludeEnd("ctx");
  4197. return $recv($self._class())._streamClass();
  4198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4199. }, function($ctx1) {$ctx1.fill(self,"streamClass",{})});
  4200. //>>excludeEnd("ctx");
  4201. },
  4202. //>>excludeStart("ide", pragmas.excludeIdeData);
  4203. args: [],
  4204. source: "streamClass\x0a\x09^ self class streamClass",
  4205. referencedClasses: [],
  4206. //>>excludeEnd("ide");
  4207. pragmas: [],
  4208. messageSends: ["streamClass", "class"]
  4209. }),
  4210. $globals.SequenceableCollection);
  4211. $core.addMethod(
  4212. $core.method({
  4213. selector: "third",
  4214. protocol: "accessing",
  4215. fn: function (){
  4216. var self=this,$self=this;
  4217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4218. return $core.withContext(function($ctx1) {
  4219. //>>excludeEnd("ctx");
  4220. return $self._at_((3));
  4221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4222. }, function($ctx1) {$ctx1.fill(self,"third",{})});
  4223. //>>excludeEnd("ctx");
  4224. },
  4225. //>>excludeStart("ide", pragmas.excludeIdeData);
  4226. args: [],
  4227. source: "third\x0a\x09^ self at: 3",
  4228. referencedClasses: [],
  4229. //>>excludeEnd("ide");
  4230. pragmas: [],
  4231. messageSends: ["at:"]
  4232. }),
  4233. $globals.SequenceableCollection);
  4234. $core.addMethod(
  4235. $core.method({
  4236. selector: "writeStream",
  4237. protocol: "streaming",
  4238. fn: function (){
  4239. var self=this,$self=this;
  4240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4241. return $core.withContext(function($ctx1) {
  4242. //>>excludeEnd("ctx");
  4243. return $self._stream();
  4244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4245. }, function($ctx1) {$ctx1.fill(self,"writeStream",{})});
  4246. //>>excludeEnd("ctx");
  4247. },
  4248. //>>excludeStart("ide", pragmas.excludeIdeData);
  4249. args: [],
  4250. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4251. referencedClasses: [],
  4252. //>>excludeEnd("ide");
  4253. pragmas: [],
  4254. messageSends: ["stream"]
  4255. }),
  4256. $globals.SequenceableCollection);
  4257. $core.addMethod(
  4258. $core.method({
  4259. selector: "streamClass",
  4260. protocol: "accessing",
  4261. fn: function (){
  4262. var self=this,$self=this;
  4263. return $globals.Stream;
  4264. },
  4265. //>>excludeStart("ide", pragmas.excludeIdeData);
  4266. args: [],
  4267. source: "streamClass\x0a\x09\x09^ Stream",
  4268. referencedClasses: ["Stream"],
  4269. //>>excludeEnd("ide");
  4270. pragmas: [],
  4271. messageSends: []
  4272. }),
  4273. $globals.SequenceableCollection.a$cls);
  4274. $core.addMethod(
  4275. $core.method({
  4276. selector: "streamContents:",
  4277. protocol: "streaming",
  4278. fn: function (aBlock){
  4279. var self=this,$self=this;
  4280. var stream;
  4281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4282. return $core.withContext(function($ctx1) {
  4283. //>>excludeEnd("ctx");
  4284. stream=$recv($self._streamClass())._on_($self._new());
  4285. $recv(aBlock)._value_(stream);
  4286. return $recv(stream)._contents();
  4287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4288. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream})});
  4289. //>>excludeEnd("ctx");
  4290. },
  4291. //>>excludeStart("ide", pragmas.excludeIdeData);
  4292. args: ["aBlock"],
  4293. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4294. referencedClasses: [],
  4295. //>>excludeEnd("ide");
  4296. pragmas: [],
  4297. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4298. }),
  4299. $globals.SequenceableCollection.a$cls);
  4300. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  4301. //>>excludeStart("ide", pragmas.excludeIdeData);
  4302. $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`.";
  4303. //>>excludeEnd("ide");
  4304. $core.addMethod(
  4305. $core.method({
  4306. selector: "add:",
  4307. protocol: "adding/removing",
  4308. fn: function (anObject){
  4309. var self=this,$self=this;
  4310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4311. return $core.withContext(function($ctx1) {
  4312. //>>excludeEnd("ctx");
  4313. self.push(anObject); return anObject;;
  4314. return self;
  4315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4316. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  4317. //>>excludeEnd("ctx");
  4318. },
  4319. //>>excludeStart("ide", pragmas.excludeIdeData);
  4320. args: ["anObject"],
  4321. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  4322. referencedClasses: [],
  4323. //>>excludeEnd("ide");
  4324. pragmas: [["inlineJS:", ["self.push(anObject); return anObject;"]]],
  4325. messageSends: []
  4326. }),
  4327. $globals.Array);
  4328. $core.addMethod(
  4329. $core.method({
  4330. selector: "addAll:",
  4331. protocol: "adding/removing",
  4332. fn: function (aCollection){
  4333. var self=this,$self=this;
  4334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4335. return $core.withContext(function($ctx1) {
  4336. //>>excludeEnd("ctx");
  4337. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  4338. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  4339. return aCollection;;
  4340. return self;
  4341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4342. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  4343. //>>excludeEnd("ctx");
  4344. },
  4345. //>>excludeStart("ide", pragmas.excludeIdeData);
  4346. args: ["aCollection"],
  4347. 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'>",
  4348. referencedClasses: [],
  4349. //>>excludeEnd("ide");
  4350. pragmas: [["inlineJS:", ["\x0a\x09if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);\x0a\x09else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);\x0a\x09return aCollection;"]]],
  4351. messageSends: []
  4352. }),
  4353. $globals.Array);
  4354. $core.addMethod(
  4355. $core.method({
  4356. selector: "addFirst:",
  4357. protocol: "adding/removing",
  4358. fn: function (anObject){
  4359. var self=this,$self=this;
  4360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4361. return $core.withContext(function($ctx1) {
  4362. //>>excludeEnd("ctx");
  4363. self.unshift(anObject); return anObject;;
  4364. return self;
  4365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4366. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject})});
  4367. //>>excludeEnd("ctx");
  4368. },
  4369. //>>excludeStart("ide", pragmas.excludeIdeData);
  4370. args: ["anObject"],
  4371. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  4372. referencedClasses: [],
  4373. //>>excludeEnd("ide");
  4374. pragmas: [["inlineJS:", ["self.unshift(anObject); return anObject;"]]],
  4375. messageSends: []
  4376. }),
  4377. $globals.Array);
  4378. $core.addMethod(
  4379. $core.method({
  4380. selector: "asJavaScriptSource",
  4381. protocol: "converting",
  4382. fn: function (){
  4383. var self=this,$self=this;
  4384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4385. return $core.withContext(function($ctx1) {
  4386. //>>excludeEnd("ctx");
  4387. var $1;
  4388. $1=$recv("[".__comma($recv($self._collect_((function(each){
  4389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4390. return $core.withContext(function($ctx2) {
  4391. //>>excludeEnd("ctx");
  4392. return $recv(each)._asJavaScriptSource();
  4393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4394. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4395. //>>excludeEnd("ctx");
  4396. })))._join_(", "))).__comma("]");
  4397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4398. $ctx1.sendIdx[","]=1;
  4399. //>>excludeEnd("ctx");
  4400. return $1;
  4401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4402. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  4403. //>>excludeEnd("ctx");
  4404. },
  4405. //>>excludeStart("ide", pragmas.excludeIdeData);
  4406. args: [],
  4407. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  4408. referencedClasses: [],
  4409. //>>excludeEnd("ide");
  4410. pragmas: [],
  4411. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  4412. }),
  4413. $globals.Array);
  4414. $core.addMethod(
  4415. $core.method({
  4416. selector: "at:put:",
  4417. protocol: "accessing",
  4418. fn: function (anIndex,anObject){
  4419. var self=this,$self=this;
  4420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4421. return $core.withContext(function($ctx1) {
  4422. //>>excludeEnd("ctx");
  4423. return self[anIndex - 1] = anObject;
  4424. return self;
  4425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4426. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  4427. //>>excludeEnd("ctx");
  4428. },
  4429. //>>excludeStart("ide", pragmas.excludeIdeData);
  4430. args: ["anIndex", "anObject"],
  4431. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  4432. referencedClasses: [],
  4433. //>>excludeEnd("ide");
  4434. pragmas: [["inlineJS:", ["return self[anIndex - 1] = anObject"]]],
  4435. messageSends: []
  4436. }),
  4437. $globals.Array);
  4438. $core.addMethod(
  4439. $core.method({
  4440. selector: "collect:",
  4441. protocol: "enumerating",
  4442. fn: function (aBlock){
  4443. var self=this,$self=this;
  4444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4445. return $core.withContext(function($ctx1) {
  4446. //>>excludeEnd("ctx");
  4447. return self.map(function(each) {return aBlock._value_(each)});
  4448. return self;
  4449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4450. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock})});
  4451. //>>excludeEnd("ctx");
  4452. },
  4453. //>>excludeStart("ide", pragmas.excludeIdeData);
  4454. args: ["aBlock"],
  4455. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  4456. referencedClasses: [],
  4457. //>>excludeEnd("ide");
  4458. pragmas: [["inlineJS:", ["return self.map(function(each) {return aBlock._value_(each)})"]]],
  4459. messageSends: []
  4460. }),
  4461. $globals.Array);
  4462. $core.addMethod(
  4463. $core.method({
  4464. selector: "copyFrom:to:",
  4465. protocol: "copying",
  4466. fn: function (anIndex,anotherIndex){
  4467. var self=this,$self=this;
  4468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4469. return $core.withContext(function($ctx1) {
  4470. //>>excludeEnd("ctx");
  4471. if (anIndex >= 1 && anotherIndex <= self.length) {
  4472. return self.slice(anIndex - 1, anotherIndex);
  4473. } else {
  4474. self._at_(anIndex);
  4475. self._at_(self.length + 1);
  4476. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4477. };
  4478. return self;
  4479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4480. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  4481. //>>excludeEnd("ctx");
  4482. },
  4483. //>>excludeStart("ide", pragmas.excludeIdeData);
  4484. args: ["anIndex", "anotherIndex"],
  4485. 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'>",
  4486. referencedClasses: [],
  4487. //>>excludeEnd("ide");
  4488. pragmas: [["inlineJS:", ["\x0a\x09if (anIndex >= 1 && anotherIndex <= self.length) {\x0a\x09\x09return self.slice(anIndex - 1, anotherIndex);\x0a\x09} else {\x0a\x09\x09self._at_(anIndex);\x0a\x09\x09self._at_(self.length + 1);\x0a\x09\x09throw new Error(\x22Incorrect indexes in #copyFrom:to: not caught by #at:\x22);\x0a\x09}"]]],
  4489. messageSends: []
  4490. }),
  4491. $globals.Array);
  4492. $core.addMethod(
  4493. $core.method({
  4494. selector: "join:",
  4495. protocol: "enumerating",
  4496. fn: function (aString){
  4497. var self=this,$self=this;
  4498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4499. return $core.withContext(function($ctx1) {
  4500. //>>excludeEnd("ctx");
  4501. return self.join(aString);
  4502. return self;
  4503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4504. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString})});
  4505. //>>excludeEnd("ctx");
  4506. },
  4507. //>>excludeStart("ide", pragmas.excludeIdeData);
  4508. args: ["aString"],
  4509. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  4510. referencedClasses: [],
  4511. //>>excludeEnd("ide");
  4512. pragmas: [["inlineJS:", ["return self.join(aString)"]]],
  4513. messageSends: []
  4514. }),
  4515. $globals.Array);
  4516. $core.addMethod(
  4517. $core.method({
  4518. selector: "printOn:",
  4519. protocol: "printing",
  4520. fn: function (aStream){
  4521. var self=this,$self=this;
  4522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4523. return $core.withContext(function($ctx1) {
  4524. //>>excludeEnd("ctx");
  4525. (
  4526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4527. $ctx1.supercall = true,
  4528. //>>excludeEnd("ctx");
  4529. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  4530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4531. $ctx1.supercall = false;
  4532. //>>excludeEnd("ctx");;
  4533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4534. $ctx1.sendIdx["printOn:"]=1;
  4535. //>>excludeEnd("ctx");
  4536. $recv(aStream)._nextPutAll_(" (");
  4537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4538. $ctx1.sendIdx["nextPutAll:"]=1;
  4539. //>>excludeEnd("ctx");
  4540. $self._do_separatedBy_((function(each){
  4541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4542. return $core.withContext(function($ctx2) {
  4543. //>>excludeEnd("ctx");
  4544. return $recv(each)._printOn_(aStream);
  4545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4546. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4547. //>>excludeEnd("ctx");
  4548. }),(function(){
  4549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4550. return $core.withContext(function($ctx2) {
  4551. //>>excludeEnd("ctx");
  4552. return $recv(aStream)._nextPutAll_(" ");
  4553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4554. $ctx2.sendIdx["nextPutAll:"]=2;
  4555. //>>excludeEnd("ctx");
  4556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4557. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4558. //>>excludeEnd("ctx");
  4559. }));
  4560. $recv(aStream)._nextPutAll_(")");
  4561. return self;
  4562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4563. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  4564. //>>excludeEnd("ctx");
  4565. },
  4566. //>>excludeStart("ide", pragmas.excludeIdeData);
  4567. args: ["aStream"],
  4568. 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: ')'",
  4569. referencedClasses: [],
  4570. //>>excludeEnd("ide");
  4571. pragmas: [],
  4572. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4573. }),
  4574. $globals.Array);
  4575. $core.addMethod(
  4576. $core.method({
  4577. selector: "remove:ifAbsent:",
  4578. protocol: "adding/removing",
  4579. fn: function (anObject,aBlock){
  4580. var self=this,$self=this;
  4581. var index;
  4582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4583. return $core.withContext(function($ctx1) {
  4584. //>>excludeEnd("ctx");
  4585. var $1;
  4586. index=$self._indexOf_ifAbsent_(anObject,(function(){
  4587. return (0);
  4588. }));
  4589. $1=$recv(index).__eq((0));
  4590. if($core.assert($1)){
  4591. return $recv(aBlock)._value();
  4592. } else {
  4593. $self._removeIndex_(index);
  4594. return anObject;
  4595. }
  4596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4597. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  4598. //>>excludeEnd("ctx");
  4599. },
  4600. //>>excludeStart("ide", pragmas.excludeIdeData);
  4601. args: ["anObject", "aBlock"],
  4602. 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 ]",
  4603. referencedClasses: [],
  4604. //>>excludeEnd("ide");
  4605. pragmas: [],
  4606. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4607. }),
  4608. $globals.Array);
  4609. $core.addMethod(
  4610. $core.method({
  4611. selector: "removeAll",
  4612. protocol: "adding/removing",
  4613. fn: function (){
  4614. var self=this,$self=this;
  4615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4616. return $core.withContext(function($ctx1) {
  4617. //>>excludeEnd("ctx");
  4618. self.length = 0;
  4619. return self;
  4620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4621. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  4622. //>>excludeEnd("ctx");
  4623. },
  4624. //>>excludeStart("ide", pragmas.excludeIdeData);
  4625. args: [],
  4626. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  4627. referencedClasses: [],
  4628. //>>excludeEnd("ide");
  4629. pragmas: [["inlineJS:", ["self.length = 0"]]],
  4630. messageSends: []
  4631. }),
  4632. $globals.Array);
  4633. $core.addMethod(
  4634. $core.method({
  4635. selector: "removeFrom:to:",
  4636. protocol: "adding/removing",
  4637. fn: function (aNumber,anotherNumber){
  4638. var self=this,$self=this;
  4639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4640. return $core.withContext(function($ctx1) {
  4641. //>>excludeEnd("ctx");
  4642. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4643. return self;
  4644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4645. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber})});
  4646. //>>excludeEnd("ctx");
  4647. },
  4648. //>>excludeStart("ide", pragmas.excludeIdeData);
  4649. args: ["aNumber", "anotherNumber"],
  4650. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  4651. referencedClasses: [],
  4652. //>>excludeEnd("ide");
  4653. pragmas: [["inlineJS:", ["self.splice(aNumber -1, anotherNumber - aNumber + 1)"]]],
  4654. messageSends: []
  4655. }),
  4656. $globals.Array);
  4657. $core.addMethod(
  4658. $core.method({
  4659. selector: "removeIndex:",
  4660. protocol: "adding/removing",
  4661. fn: function (anInteger){
  4662. var self=this,$self=this;
  4663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4664. return $core.withContext(function($ctx1) {
  4665. //>>excludeEnd("ctx");
  4666. self.splice(anInteger - 1, 1);
  4667. return self;
  4668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4669. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger})});
  4670. //>>excludeEnd("ctx");
  4671. },
  4672. //>>excludeStart("ide", pragmas.excludeIdeData);
  4673. args: ["anInteger"],
  4674. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  4675. referencedClasses: [],
  4676. //>>excludeEnd("ide");
  4677. pragmas: [["inlineJS:", ["self.splice(anInteger - 1, 1)"]]],
  4678. messageSends: []
  4679. }),
  4680. $globals.Array);
  4681. $core.addMethod(
  4682. $core.method({
  4683. selector: "removeLast",
  4684. protocol: "adding/removing",
  4685. fn: function (){
  4686. var self=this,$self=this;
  4687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4688. return $core.withContext(function($ctx1) {
  4689. //>>excludeEnd("ctx");
  4690. return self.pop();;
  4691. return self;
  4692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4693. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  4694. //>>excludeEnd("ctx");
  4695. },
  4696. //>>excludeStart("ide", pragmas.excludeIdeData);
  4697. args: [],
  4698. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  4699. referencedClasses: [],
  4700. //>>excludeEnd("ide");
  4701. pragmas: [["inlineJS:", ["return self.pop();"]]],
  4702. messageSends: []
  4703. }),
  4704. $globals.Array);
  4705. $core.addMethod(
  4706. $core.method({
  4707. selector: "reversed",
  4708. protocol: "converting",
  4709. fn: function (){
  4710. var self=this,$self=this;
  4711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4712. return $core.withContext(function($ctx1) {
  4713. //>>excludeEnd("ctx");
  4714. return self.slice().reverse();
  4715. return self;
  4716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4717. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  4718. //>>excludeEnd("ctx");
  4719. },
  4720. //>>excludeStart("ide", pragmas.excludeIdeData);
  4721. args: [],
  4722. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  4723. referencedClasses: [],
  4724. //>>excludeEnd("ide");
  4725. pragmas: [["inlineJS:", ["return self.slice().reverse()"]]],
  4726. messageSends: []
  4727. }),
  4728. $globals.Array);
  4729. $core.addMethod(
  4730. $core.method({
  4731. selector: "select:",
  4732. protocol: "enumerating",
  4733. fn: function (aBlock){
  4734. var self=this,$self=this;
  4735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4736. return $core.withContext(function($ctx1) {
  4737. //>>excludeEnd("ctx");
  4738. return self.filter(function(each) {return aBlock._value_(each)});
  4739. return self;
  4740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4741. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock})});
  4742. //>>excludeEnd("ctx");
  4743. },
  4744. //>>excludeStart("ide", pragmas.excludeIdeData);
  4745. args: ["aBlock"],
  4746. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  4747. referencedClasses: [],
  4748. //>>excludeEnd("ide");
  4749. pragmas: [["inlineJS:", ["return self.filter(function(each) {return aBlock._value_(each)})"]]],
  4750. messageSends: []
  4751. }),
  4752. $globals.Array);
  4753. $core.addMethod(
  4754. $core.method({
  4755. selector: "shallowCopy",
  4756. protocol: "copying",
  4757. fn: function (){
  4758. var self=this,$self=this;
  4759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4760. return $core.withContext(function($ctx1) {
  4761. //>>excludeEnd("ctx");
  4762. return self.slice();
  4763. return self;
  4764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4765. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  4766. //>>excludeEnd("ctx");
  4767. },
  4768. //>>excludeStart("ide", pragmas.excludeIdeData);
  4769. args: [],
  4770. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  4771. referencedClasses: [],
  4772. //>>excludeEnd("ide");
  4773. pragmas: [["inlineJS:", ["return self.slice()"]]],
  4774. messageSends: []
  4775. }),
  4776. $globals.Array);
  4777. $core.addMethod(
  4778. $core.method({
  4779. selector: "sort",
  4780. protocol: "enumerating",
  4781. fn: function (){
  4782. var self=this,$self=this;
  4783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4784. return $core.withContext(function($ctx1) {
  4785. //>>excludeEnd("ctx");
  4786. return $self._sort_((function(a,b){
  4787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4788. return $core.withContext(function($ctx2) {
  4789. //>>excludeEnd("ctx");
  4790. return $recv(a).__lt(b);
  4791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4792. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  4793. //>>excludeEnd("ctx");
  4794. }));
  4795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4796. }, function($ctx1) {$ctx1.fill(self,"sort",{})});
  4797. //>>excludeEnd("ctx");
  4798. },
  4799. //>>excludeStart("ide", pragmas.excludeIdeData);
  4800. args: [],
  4801. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  4802. referencedClasses: [],
  4803. //>>excludeEnd("ide");
  4804. pragmas: [],
  4805. messageSends: ["sort:", "<"]
  4806. }),
  4807. $globals.Array);
  4808. $core.addMethod(
  4809. $core.method({
  4810. selector: "sort:",
  4811. protocol: "enumerating",
  4812. fn: function (aBlock){
  4813. var self=this,$self=this;
  4814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4815. return $core.withContext(function($ctx1) {
  4816. //>>excludeEnd("ctx");
  4817. return self.sort(function(a, b) {
  4818. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  4819. })
  4820. ;
  4821. return self;
  4822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4823. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock})});
  4824. //>>excludeEnd("ctx");
  4825. },
  4826. //>>excludeStart("ide", pragmas.excludeIdeData);
  4827. args: ["aBlock"],
  4828. 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'>",
  4829. referencedClasses: [],
  4830. //>>excludeEnd("ide");
  4831. pragmas: [["inlineJS:", ["\x0a\x09\x09return self.sort(function(a, b) {\x0a\x09\x09\x09if(aBlock._value_value_(a,b)) {return -1} else {return 1}\x0a\x09\x09})\x0a\x09"]]],
  4832. messageSends: []
  4833. }),
  4834. $globals.Array);
  4835. $core.addMethod(
  4836. $core.method({
  4837. selector: "sorted",
  4838. protocol: "enumerating",
  4839. fn: function (){
  4840. var self=this,$self=this;
  4841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4842. return $core.withContext(function($ctx1) {
  4843. //>>excludeEnd("ctx");
  4844. return $recv($self._copy())._sort();
  4845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4846. }, function($ctx1) {$ctx1.fill(self,"sorted",{})});
  4847. //>>excludeEnd("ctx");
  4848. },
  4849. //>>excludeStart("ide", pragmas.excludeIdeData);
  4850. args: [],
  4851. source: "sorted\x0a\x09^ self copy sort",
  4852. referencedClasses: [],
  4853. //>>excludeEnd("ide");
  4854. pragmas: [],
  4855. messageSends: ["sort", "copy"]
  4856. }),
  4857. $globals.Array);
  4858. $core.addMethod(
  4859. $core.method({
  4860. selector: "sorted:",
  4861. protocol: "enumerating",
  4862. fn: function (aBlock){
  4863. var self=this,$self=this;
  4864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4865. return $core.withContext(function($ctx1) {
  4866. //>>excludeEnd("ctx");
  4867. return $recv($self._copy())._sort_(aBlock);
  4868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4869. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock})});
  4870. //>>excludeEnd("ctx");
  4871. },
  4872. //>>excludeStart("ide", pragmas.excludeIdeData);
  4873. args: ["aBlock"],
  4874. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  4875. referencedClasses: [],
  4876. //>>excludeEnd("ide");
  4877. pragmas: [],
  4878. messageSends: ["sort:", "copy"]
  4879. }),
  4880. $globals.Array);
  4881. $core.addMethod(
  4882. $core.method({
  4883. selector: "new:",
  4884. protocol: "instance creation",
  4885. fn: function (anInteger){
  4886. var self=this,$self=this;
  4887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4888. return $core.withContext(function($ctx1) {
  4889. //>>excludeEnd("ctx");
  4890. return new Array(anInteger);
  4891. return self;
  4892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4893. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  4894. //>>excludeEnd("ctx");
  4895. },
  4896. //>>excludeStart("ide", pragmas.excludeIdeData);
  4897. args: ["anInteger"],
  4898. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  4899. referencedClasses: [],
  4900. //>>excludeEnd("ide");
  4901. pragmas: [["inlineJS:", ["return new Array(anInteger)"]]],
  4902. messageSends: []
  4903. }),
  4904. $globals.Array.a$cls);
  4905. $core.addMethod(
  4906. $core.method({
  4907. selector: "with:",
  4908. protocol: "instance creation",
  4909. fn: function (anObject){
  4910. var self=this,$self=this;
  4911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4912. return $core.withContext(function($ctx1) {
  4913. //>>excludeEnd("ctx");
  4914. var $1;
  4915. $1=$self._new_((1));
  4916. $recv($1)._at_put_((1),anObject);
  4917. return $recv($1)._yourself();
  4918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4919. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  4920. //>>excludeEnd("ctx");
  4921. },
  4922. //>>excludeStart("ide", pragmas.excludeIdeData);
  4923. args: ["anObject"],
  4924. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  4925. referencedClasses: [],
  4926. //>>excludeEnd("ide");
  4927. pragmas: [],
  4928. messageSends: ["at:put:", "new:", "yourself"]
  4929. }),
  4930. $globals.Array.a$cls);
  4931. $core.addMethod(
  4932. $core.method({
  4933. selector: "with:with:",
  4934. protocol: "instance creation",
  4935. fn: function (anObject,anObject2){
  4936. var self=this,$self=this;
  4937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4938. return $core.withContext(function($ctx1) {
  4939. //>>excludeEnd("ctx");
  4940. var $1;
  4941. $1=$self._new_((2));
  4942. $recv($1)._at_put_((1),anObject);
  4943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4944. $ctx1.sendIdx["at:put:"]=1;
  4945. //>>excludeEnd("ctx");
  4946. $recv($1)._at_put_((2),anObject2);
  4947. return $recv($1)._yourself();
  4948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4949. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2})});
  4950. //>>excludeEnd("ctx");
  4951. },
  4952. //>>excludeStart("ide", pragmas.excludeIdeData);
  4953. args: ["anObject", "anObject2"],
  4954. 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",
  4955. referencedClasses: [],
  4956. //>>excludeEnd("ide");
  4957. pragmas: [],
  4958. messageSends: ["at:put:", "new:", "yourself"]
  4959. }),
  4960. $globals.Array.a$cls);
  4961. $core.addMethod(
  4962. $core.method({
  4963. selector: "with:with:with:",
  4964. protocol: "instance creation",
  4965. fn: function (anObject,anObject2,anObject3){
  4966. var self=this,$self=this;
  4967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4968. return $core.withContext(function($ctx1) {
  4969. //>>excludeEnd("ctx");
  4970. var $1;
  4971. $1=$self._new_((3));
  4972. $recv($1)._at_put_((1),anObject);
  4973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4974. $ctx1.sendIdx["at:put:"]=1;
  4975. //>>excludeEnd("ctx");
  4976. $recv($1)._at_put_((2),anObject2);
  4977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4978. $ctx1.sendIdx["at:put:"]=2;
  4979. //>>excludeEnd("ctx");
  4980. $recv($1)._at_put_((3),anObject3);
  4981. return $recv($1)._yourself();
  4982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4983. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  4984. //>>excludeEnd("ctx");
  4985. },
  4986. //>>excludeStart("ide", pragmas.excludeIdeData);
  4987. args: ["anObject", "anObject2", "anObject3"],
  4988. 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",
  4989. referencedClasses: [],
  4990. //>>excludeEnd("ide");
  4991. pragmas: [],
  4992. messageSends: ["at:put:", "new:", "yourself"]
  4993. }),
  4994. $globals.Array.a$cls);
  4995. $core.addMethod(
  4996. $core.method({
  4997. selector: "withAll:",
  4998. protocol: "instance creation",
  4999. fn: function (aCollection){
  5000. var self=this,$self=this;
  5001. var instance,index;
  5002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5003. return $core.withContext(function($ctx1) {
  5004. //>>excludeEnd("ctx");
  5005. index=(1);
  5006. instance=$self._new_($recv(aCollection)._size());
  5007. $recv(aCollection)._do_((function(each){
  5008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5009. return $core.withContext(function($ctx2) {
  5010. //>>excludeEnd("ctx");
  5011. $recv(instance)._at_put_(index,each);
  5012. index=$recv(index).__plus((1));
  5013. return index;
  5014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5015. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5016. //>>excludeEnd("ctx");
  5017. }));
  5018. return instance;
  5019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5020. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index})});
  5021. //>>excludeEnd("ctx");
  5022. },
  5023. //>>excludeStart("ide", pragmas.excludeIdeData);
  5024. args: ["aCollection"],
  5025. 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",
  5026. referencedClasses: [],
  5027. //>>excludeEnd("ide");
  5028. pragmas: [],
  5029. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  5030. }),
  5031. $globals.Array.a$cls);
  5032. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  5033. //>>excludeStart("ide", pragmas.excludeIdeData);
  5034. $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 >> #,`";
  5035. //>>excludeEnd("ide");
  5036. $core.addMethod(
  5037. $core.method({
  5038. selector: ",",
  5039. protocol: "copying",
  5040. fn: function (aString){
  5041. var self=this,$self=this;
  5042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5043. return $core.withContext(function($ctx1) {
  5044. //>>excludeEnd("ctx");
  5045. return String(self) + aString;
  5046. return self;
  5047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5048. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString})});
  5049. //>>excludeEnd("ctx");
  5050. },
  5051. //>>excludeStart("ide", pragmas.excludeIdeData);
  5052. args: ["aString"],
  5053. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  5054. referencedClasses: [],
  5055. //>>excludeEnd("ide");
  5056. pragmas: [["inlineJS:", ["return String(self) + aString"]]],
  5057. messageSends: []
  5058. }),
  5059. $globals.String);
  5060. $core.addMethod(
  5061. $core.method({
  5062. selector: "<",
  5063. protocol: "comparing",
  5064. fn: function (aString){
  5065. var self=this,$self=this;
  5066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5067. return $core.withContext(function($ctx1) {
  5068. //>>excludeEnd("ctx");
  5069. return String(self) < aString._asString();
  5070. return self;
  5071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5072. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString})});
  5073. //>>excludeEnd("ctx");
  5074. },
  5075. //>>excludeStart("ide", pragmas.excludeIdeData);
  5076. args: ["aString"],
  5077. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  5078. referencedClasses: [],
  5079. //>>excludeEnd("ide");
  5080. pragmas: [["inlineJS:", ["return String(self) < aString._asString()"]]],
  5081. messageSends: []
  5082. }),
  5083. $globals.String);
  5084. $core.addMethod(
  5085. $core.method({
  5086. selector: "<=",
  5087. protocol: "comparing",
  5088. fn: function (aString){
  5089. var self=this,$self=this;
  5090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5091. return $core.withContext(function($ctx1) {
  5092. //>>excludeEnd("ctx");
  5093. return String(self) <= aString._asString();
  5094. return self;
  5095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5096. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString})});
  5097. //>>excludeEnd("ctx");
  5098. },
  5099. //>>excludeStart("ide", pragmas.excludeIdeData);
  5100. args: ["aString"],
  5101. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  5102. referencedClasses: [],
  5103. //>>excludeEnd("ide");
  5104. pragmas: [["inlineJS:", ["return String(self) <= aString._asString()"]]],
  5105. messageSends: []
  5106. }),
  5107. $globals.String);
  5108. $core.addMethod(
  5109. $core.method({
  5110. selector: "=",
  5111. protocol: "comparing",
  5112. fn: function (aString){
  5113. var self=this,$self=this;
  5114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5115. return $core.withContext(function($ctx1) {
  5116. //>>excludeEnd("ctx");
  5117. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  5118. return self;
  5119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5120. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString})});
  5121. //>>excludeEnd("ctx");
  5122. },
  5123. //>>excludeStart("ide", pragmas.excludeIdeData);
  5124. args: ["aString"],
  5125. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  5126. referencedClasses: [],
  5127. //>>excludeEnd("ide");
  5128. pragmas: [["inlineJS:", ["return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())"]]],
  5129. messageSends: []
  5130. }),
  5131. $globals.String);
  5132. $core.addMethod(
  5133. $core.method({
  5134. selector: "==",
  5135. protocol: "comparing",
  5136. fn: function (aString){
  5137. var self=this,$self=this;
  5138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5139. return $core.withContext(function($ctx1) {
  5140. //>>excludeEnd("ctx");
  5141. if (typeof aString === "string") return String(self) === aString;
  5142. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  5143. else return false;;
  5144. return self;
  5145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5146. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString})});
  5147. //>>excludeEnd("ctx");
  5148. },
  5149. //>>excludeStart("ide", pragmas.excludeIdeData);
  5150. args: ["aString"],
  5151. 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'>",
  5152. referencedClasses: [],
  5153. //>>excludeEnd("ide");
  5154. pragmas: [["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;"]]],
  5155. messageSends: []
  5156. }),
  5157. $globals.String);
  5158. $core.addMethod(
  5159. $core.method({
  5160. selector: ">",
  5161. protocol: "comparing",
  5162. fn: function (aString){
  5163. var self=this,$self=this;
  5164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5165. return $core.withContext(function($ctx1) {
  5166. //>>excludeEnd("ctx");
  5167. return String(self) > aString._asString();
  5168. return self;
  5169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5170. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString})});
  5171. //>>excludeEnd("ctx");
  5172. },
  5173. //>>excludeStart("ide", pragmas.excludeIdeData);
  5174. args: ["aString"],
  5175. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  5176. referencedClasses: [],
  5177. //>>excludeEnd("ide");
  5178. pragmas: [["inlineJS:", ["return String(self) > aString._asString()"]]],
  5179. messageSends: []
  5180. }),
  5181. $globals.String);
  5182. $core.addMethod(
  5183. $core.method({
  5184. selector: ">=",
  5185. protocol: "comparing",
  5186. fn: function (aString){
  5187. var self=this,$self=this;
  5188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5189. return $core.withContext(function($ctx1) {
  5190. //>>excludeEnd("ctx");
  5191. return String(self) >= aString._asString();
  5192. return self;
  5193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5194. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString})});
  5195. //>>excludeEnd("ctx");
  5196. },
  5197. //>>excludeStart("ide", pragmas.excludeIdeData);
  5198. args: ["aString"],
  5199. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  5200. referencedClasses: [],
  5201. //>>excludeEnd("ide");
  5202. pragmas: [["inlineJS:", ["return String(self) >= aString._asString()"]]],
  5203. messageSends: []
  5204. }),
  5205. $globals.String);
  5206. $core.addMethod(
  5207. $core.method({
  5208. selector: "add:",
  5209. protocol: "adding/removing",
  5210. fn: function (anObject){
  5211. var self=this,$self=this;
  5212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5213. return $core.withContext(function($ctx1) {
  5214. //>>excludeEnd("ctx");
  5215. $self._errorReadOnly();
  5216. return self;
  5217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5218. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  5219. //>>excludeEnd("ctx");
  5220. },
  5221. //>>excludeStart("ide", pragmas.excludeIdeData);
  5222. args: ["anObject"],
  5223. source: "add: anObject\x0a\x09self errorReadOnly",
  5224. referencedClasses: [],
  5225. //>>excludeEnd("ide");
  5226. pragmas: [],
  5227. messageSends: ["errorReadOnly"]
  5228. }),
  5229. $globals.String);
  5230. $core.addMethod(
  5231. $core.method({
  5232. selector: "asJavaScriptMethodName",
  5233. protocol: "converting",
  5234. fn: function (){
  5235. var self=this,$self=this;
  5236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5237. return $core.withContext(function($ctx1) {
  5238. //>>excludeEnd("ctx");
  5239. return $core.st2js(self);
  5240. return self;
  5241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5242. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{})});
  5243. //>>excludeEnd("ctx");
  5244. },
  5245. //>>excludeStart("ide", pragmas.excludeIdeData);
  5246. args: [],
  5247. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  5248. referencedClasses: [],
  5249. //>>excludeEnd("ide");
  5250. pragmas: [["inlineJS:", ["return $core.st2js(self)"]]],
  5251. messageSends: []
  5252. }),
  5253. $globals.String);
  5254. $core.addMethod(
  5255. $core.method({
  5256. selector: "asJavaScriptObject",
  5257. protocol: "converting",
  5258. fn: function (){
  5259. var self=this,$self=this;
  5260. return self;
  5261. },
  5262. //>>excludeStart("ide", pragmas.excludeIdeData);
  5263. args: [],
  5264. source: "asJavaScriptObject\x0a\x09^ self",
  5265. referencedClasses: [],
  5266. //>>excludeEnd("ide");
  5267. pragmas: [],
  5268. messageSends: []
  5269. }),
  5270. $globals.String);
  5271. $core.addMethod(
  5272. $core.method({
  5273. selector: "asJavaScriptSource",
  5274. protocol: "converting",
  5275. fn: function (){
  5276. var self=this,$self=this;
  5277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5278. return $core.withContext(function($ctx1) {
  5279. //>>excludeEnd("ctx");
  5280. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5281. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5282. else
  5283. return "\"" + self + "\"";
  5284. ;
  5285. return self;
  5286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5287. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  5288. //>>excludeEnd("ctx");
  5289. },
  5290. //>>excludeStart("ide", pragmas.excludeIdeData);
  5291. args: [],
  5292. 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'>",
  5293. referencedClasses: [],
  5294. //>>excludeEnd("ide");
  5295. pragmas: [["inlineJS:", ["\x0a\x09\x09if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self.replace(/[\x5cx00-\x5cx1f\x22\x5c\x5c\x5cx7f-\x5cx9f]/g, function(ch){var c=ch.charCodeAt(0);return \x22\x5c\x5cx\x22+(\x220\x22+c.toString(16)).slice(-2)}) + \x22\x5c\x22\x22;\x0a\x09\x09else\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self + \x22\x5c\x22\x22;\x0a\x09"]]],
  5296. messageSends: []
  5297. }),
  5298. $globals.String);
  5299. $core.addMethod(
  5300. $core.method({
  5301. selector: "asLowercase",
  5302. protocol: "converting",
  5303. fn: function (){
  5304. var self=this,$self=this;
  5305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5306. return $core.withContext(function($ctx1) {
  5307. //>>excludeEnd("ctx");
  5308. return self.toLowerCase();
  5309. return self;
  5310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5311. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{})});
  5312. //>>excludeEnd("ctx");
  5313. },
  5314. //>>excludeStart("ide", pragmas.excludeIdeData);
  5315. args: [],
  5316. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  5317. referencedClasses: [],
  5318. //>>excludeEnd("ide");
  5319. pragmas: [["inlineJS:", ["return self.toLowerCase()"]]],
  5320. messageSends: []
  5321. }),
  5322. $globals.String);
  5323. $core.addMethod(
  5324. $core.method({
  5325. selector: "asMutator",
  5326. protocol: "converting",
  5327. fn: function (){
  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=$recv($self._last()).__eq(":");
  5334. if(!$core.assert($1)){
  5335. return $self.__comma(":");
  5336. }
  5337. return self;
  5338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5339. }, function($ctx1) {$ctx1.fill(self,"asMutator",{})});
  5340. //>>excludeEnd("ctx");
  5341. },
  5342. //>>excludeStart("ide", pragmas.excludeIdeData);
  5343. args: [],
  5344. 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",
  5345. referencedClasses: [],
  5346. //>>excludeEnd("ide");
  5347. pragmas: [],
  5348. messageSends: ["ifFalse:", "=", "last", ","]
  5349. }),
  5350. $globals.String);
  5351. $core.addMethod(
  5352. $core.method({
  5353. selector: "asNumber",
  5354. protocol: "converting",
  5355. fn: function (){
  5356. var self=this,$self=this;
  5357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5358. return $core.withContext(function($ctx1) {
  5359. //>>excludeEnd("ctx");
  5360. return Number(self);
  5361. return self;
  5362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5363. }, function($ctx1) {$ctx1.fill(self,"asNumber",{})});
  5364. //>>excludeEnd("ctx");
  5365. },
  5366. //>>excludeStart("ide", pragmas.excludeIdeData);
  5367. args: [],
  5368. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  5369. referencedClasses: [],
  5370. //>>excludeEnd("ide");
  5371. pragmas: [["inlineJS:", ["return Number(self)"]]],
  5372. messageSends: []
  5373. }),
  5374. $globals.String);
  5375. $core.addMethod(
  5376. $core.method({
  5377. selector: "asRegexp",
  5378. protocol: "converting",
  5379. fn: function (){
  5380. var self=this,$self=this;
  5381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5382. return $core.withContext(function($ctx1) {
  5383. //>>excludeEnd("ctx");
  5384. return $recv($globals.RegularExpression)._fromString_(self);
  5385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5386. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{})});
  5387. //>>excludeEnd("ctx");
  5388. },
  5389. //>>excludeStart("ide", pragmas.excludeIdeData);
  5390. args: [],
  5391. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  5392. referencedClasses: ["RegularExpression"],
  5393. //>>excludeEnd("ide");
  5394. pragmas: [],
  5395. messageSends: ["fromString:"]
  5396. }),
  5397. $globals.String);
  5398. $core.addMethod(
  5399. $core.method({
  5400. selector: "asString",
  5401. protocol: "converting",
  5402. fn: function (){
  5403. var self=this,$self=this;
  5404. return self;
  5405. },
  5406. //>>excludeStart("ide", pragmas.excludeIdeData);
  5407. args: [],
  5408. source: "asString\x0a\x09^ self",
  5409. referencedClasses: [],
  5410. //>>excludeEnd("ide");
  5411. pragmas: [],
  5412. messageSends: []
  5413. }),
  5414. $globals.String);
  5415. $core.addMethod(
  5416. $core.method({
  5417. selector: "asSymbol",
  5418. protocol: "converting",
  5419. fn: function (){
  5420. var self=this,$self=this;
  5421. return self;
  5422. },
  5423. //>>excludeStart("ide", pragmas.excludeIdeData);
  5424. args: [],
  5425. source: "asSymbol\x0a\x09^ self",
  5426. referencedClasses: [],
  5427. //>>excludeEnd("ide");
  5428. pragmas: [],
  5429. messageSends: []
  5430. }),
  5431. $globals.String);
  5432. $core.addMethod(
  5433. $core.method({
  5434. selector: "asSymbolPrintOn:",
  5435. protocol: "printing",
  5436. fn: function (aStream){
  5437. var self=this,$self=this;
  5438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5439. return $core.withContext(function($ctx1) {
  5440. //>>excludeEnd("ctx");
  5441. var $1;
  5442. $recv(aStream)._nextPutAll_("#");
  5443. $1=$recv($self._asString())._isSelector();
  5444. if($core.assert($1)){
  5445. $recv(aStream)._nextPut_(self);
  5446. } else {
  5447. $self._printOn_(aStream);
  5448. }
  5449. return self;
  5450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5451. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream})});
  5452. //>>excludeEnd("ctx");
  5453. },
  5454. //>>excludeStart("ide", pragmas.excludeIdeData);
  5455. args: ["aStream"],
  5456. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  5457. referencedClasses: [],
  5458. //>>excludeEnd("ide");
  5459. pragmas: [],
  5460. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  5461. }),
  5462. $globals.String);
  5463. $core.addMethod(
  5464. $core.method({
  5465. selector: "asUppercase",
  5466. protocol: "converting",
  5467. fn: function (){
  5468. var self=this,$self=this;
  5469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5470. return $core.withContext(function($ctx1) {
  5471. //>>excludeEnd("ctx");
  5472. return self.toUpperCase();
  5473. return self;
  5474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5475. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{})});
  5476. //>>excludeEnd("ctx");
  5477. },
  5478. //>>excludeStart("ide", pragmas.excludeIdeData);
  5479. args: [],
  5480. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  5481. referencedClasses: [],
  5482. //>>excludeEnd("ide");
  5483. pragmas: [["inlineJS:", ["return self.toUpperCase()"]]],
  5484. messageSends: []
  5485. }),
  5486. $globals.String);
  5487. $core.addMethod(
  5488. $core.method({
  5489. selector: "asciiValue",
  5490. protocol: "accessing",
  5491. fn: function (){
  5492. var self=this,$self=this;
  5493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5494. return $core.withContext(function($ctx1) {
  5495. //>>excludeEnd("ctx");
  5496. return self.charCodeAt(0);;
  5497. return self;
  5498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5499. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{})});
  5500. //>>excludeEnd("ctx");
  5501. },
  5502. //>>excludeStart("ide", pragmas.excludeIdeData);
  5503. args: [],
  5504. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  5505. referencedClasses: [],
  5506. //>>excludeEnd("ide");
  5507. pragmas: [["inlineJS:", ["return self.charCodeAt(0);"]]],
  5508. messageSends: []
  5509. }),
  5510. $globals.String);
  5511. $core.addMethod(
  5512. $core.method({
  5513. selector: "at:ifAbsent:",
  5514. protocol: "accessing",
  5515. fn: function (anIndex,aBlock){
  5516. var self=this,$self=this;
  5517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5518. return $core.withContext(function($ctx1) {
  5519. //>>excludeEnd("ctx");
  5520. return String(self)[anIndex - 1] || aBlock._value();
  5521. return self;
  5522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5523. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  5524. //>>excludeEnd("ctx");
  5525. },
  5526. //>>excludeStart("ide", pragmas.excludeIdeData);
  5527. args: ["anIndex", "aBlock"],
  5528. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  5529. referencedClasses: [],
  5530. //>>excludeEnd("ide");
  5531. pragmas: [["inlineJS:", ["return String(self)[anIndex - 1] || aBlock._value()"]]],
  5532. messageSends: []
  5533. }),
  5534. $globals.String);
  5535. $core.addMethod(
  5536. $core.method({
  5537. selector: "at:ifPresent:ifAbsent:",
  5538. protocol: "accessing",
  5539. fn: function (anIndex,aBlock,anotherBlock){
  5540. var self=this,$self=this;
  5541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5542. return $core.withContext(function($ctx1) {
  5543. //>>excludeEnd("ctx");
  5544. var result = String(self)[anIndex - 1];
  5545. return result ? aBlock._value_(result) : anotherBlock._value();
  5546. ;
  5547. return self;
  5548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5549. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  5550. //>>excludeEnd("ctx");
  5551. },
  5552. //>>excludeStart("ide", pragmas.excludeIdeData);
  5553. args: ["anIndex", "aBlock", "anotherBlock"],
  5554. 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'>",
  5555. referencedClasses: [],
  5556. //>>excludeEnd("ide");
  5557. pragmas: [["inlineJS:", ["\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09"]]],
  5558. messageSends: []
  5559. }),
  5560. $globals.String);
  5561. $core.addMethod(
  5562. $core.method({
  5563. selector: "at:put:",
  5564. protocol: "accessing",
  5565. fn: function (anIndex,anObject){
  5566. var self=this,$self=this;
  5567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5568. return $core.withContext(function($ctx1) {
  5569. //>>excludeEnd("ctx");
  5570. $self._errorReadOnly();
  5571. return self;
  5572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5573. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  5574. //>>excludeEnd("ctx");
  5575. },
  5576. //>>excludeStart("ide", pragmas.excludeIdeData);
  5577. args: ["anIndex", "anObject"],
  5578. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5579. referencedClasses: [],
  5580. //>>excludeEnd("ide");
  5581. pragmas: [],
  5582. messageSends: ["errorReadOnly"]
  5583. }),
  5584. $globals.String);
  5585. $core.addMethod(
  5586. $core.method({
  5587. selector: "capitalized",
  5588. protocol: "converting",
  5589. fn: function (){
  5590. var self=this,$self=this;
  5591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5592. return $core.withContext(function($ctx1) {
  5593. //>>excludeEnd("ctx");
  5594. return $self._ifNotEmpty_((function(){
  5595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5596. return $core.withContext(function($ctx2) {
  5597. //>>excludeEnd("ctx");
  5598. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  5599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5600. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5601. //>>excludeEnd("ctx");
  5602. }));
  5603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5604. }, function($ctx1) {$ctx1.fill(self,"capitalized",{})});
  5605. //>>excludeEnd("ctx");
  5606. },
  5607. //>>excludeStart("ide", pragmas.excludeIdeData);
  5608. args: [],
  5609. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  5610. referencedClasses: [],
  5611. //>>excludeEnd("ide");
  5612. pragmas: [],
  5613. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  5614. }),
  5615. $globals.String);
  5616. $core.addMethod(
  5617. $core.method({
  5618. selector: "charCodeAt:",
  5619. protocol: "accessing",
  5620. fn: function (anInteger){
  5621. var self=this,$self=this;
  5622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5623. return $core.withContext(function($ctx1) {
  5624. //>>excludeEnd("ctx");
  5625. return self.charCodeAt(anInteger - 1);
  5626. return self;
  5627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5628. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger})});
  5629. //>>excludeEnd("ctx");
  5630. },
  5631. //>>excludeStart("ide", pragmas.excludeIdeData);
  5632. args: ["anInteger"],
  5633. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  5634. referencedClasses: [],
  5635. //>>excludeEnd("ide");
  5636. pragmas: [["inlineJS:", ["return self.charCodeAt(anInteger - 1)"]]],
  5637. messageSends: []
  5638. }),
  5639. $globals.String);
  5640. $core.addMethod(
  5641. $core.method({
  5642. selector: "copyFrom:to:",
  5643. protocol: "copying",
  5644. fn: function (anIndex,anotherIndex){
  5645. var self=this,$self=this;
  5646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5647. return $core.withContext(function($ctx1) {
  5648. //>>excludeEnd("ctx");
  5649. return self.substring(anIndex - 1, anotherIndex);
  5650. return self;
  5651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5652. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  5653. //>>excludeEnd("ctx");
  5654. },
  5655. //>>excludeStart("ide", pragmas.excludeIdeData);
  5656. args: ["anIndex", "anotherIndex"],
  5657. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  5658. referencedClasses: [],
  5659. //>>excludeEnd("ide");
  5660. pragmas: [["inlineJS:", ["return self.substring(anIndex - 1, anotherIndex)"]]],
  5661. messageSends: []
  5662. }),
  5663. $globals.String);
  5664. $core.addMethod(
  5665. $core.method({
  5666. selector: "crlfSanitized",
  5667. protocol: "converting",
  5668. fn: function (){
  5669. var self=this,$self=this;
  5670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5671. return $core.withContext(function($ctx1) {
  5672. //>>excludeEnd("ctx");
  5673. return $recv($self._lines())._join_($recv($globals.String)._lf());
  5674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5675. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{})});
  5676. //>>excludeEnd("ctx");
  5677. },
  5678. //>>excludeStart("ide", pragmas.excludeIdeData);
  5679. args: [],
  5680. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  5681. referencedClasses: ["String"],
  5682. //>>excludeEnd("ide");
  5683. pragmas: [],
  5684. messageSends: ["join:", "lines", "lf"]
  5685. }),
  5686. $globals.String);
  5687. $core.addMethod(
  5688. $core.method({
  5689. selector: "deepCopy",
  5690. protocol: "copying",
  5691. fn: function (){
  5692. var self=this,$self=this;
  5693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5694. return $core.withContext(function($ctx1) {
  5695. //>>excludeEnd("ctx");
  5696. return $self._shallowCopy();
  5697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5698. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  5699. //>>excludeEnd("ctx");
  5700. },
  5701. //>>excludeStart("ide", pragmas.excludeIdeData);
  5702. args: [],
  5703. source: "deepCopy\x0a\x09^ self shallowCopy",
  5704. referencedClasses: [],
  5705. //>>excludeEnd("ide");
  5706. pragmas: [],
  5707. messageSends: ["shallowCopy"]
  5708. }),
  5709. $globals.String);
  5710. $core.addMethod(
  5711. $core.method({
  5712. selector: "errorReadOnly",
  5713. protocol: "error handling",
  5714. fn: function (){
  5715. var self=this,$self=this;
  5716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5717. return $core.withContext(function($ctx1) {
  5718. //>>excludeEnd("ctx");
  5719. $self._error_("Object is read-only");
  5720. return self;
  5721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5722. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{})});
  5723. //>>excludeEnd("ctx");
  5724. },
  5725. //>>excludeStart("ide", pragmas.excludeIdeData);
  5726. args: [],
  5727. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5728. referencedClasses: [],
  5729. //>>excludeEnd("ide");
  5730. pragmas: [],
  5731. messageSends: ["error:"]
  5732. }),
  5733. $globals.String);
  5734. $core.addMethod(
  5735. $core.method({
  5736. selector: "escaped",
  5737. protocol: "converting",
  5738. fn: function (){
  5739. var self=this,$self=this;
  5740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5741. return $core.withContext(function($ctx1) {
  5742. //>>excludeEnd("ctx");
  5743. return escape(self);
  5744. return self;
  5745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5746. }, function($ctx1) {$ctx1.fill(self,"escaped",{})});
  5747. //>>excludeEnd("ctx");
  5748. },
  5749. //>>excludeStart("ide", pragmas.excludeIdeData);
  5750. args: [],
  5751. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  5752. referencedClasses: [],
  5753. //>>excludeEnd("ide");
  5754. pragmas: [["inlineJS:", ["return escape(self)"]]],
  5755. messageSends: []
  5756. }),
  5757. $globals.String);
  5758. $core.addMethod(
  5759. $core.method({
  5760. selector: "includesSubString:",
  5761. protocol: "testing",
  5762. fn: function (subString){
  5763. var self=this,$self=this;
  5764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5765. return $core.withContext(function($ctx1) {
  5766. //>>excludeEnd("ctx");
  5767. return self.indexOf(subString) != -1;
  5768. return self;
  5769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5770. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString})});
  5771. //>>excludeEnd("ctx");
  5772. },
  5773. //>>excludeStart("ide", pragmas.excludeIdeData);
  5774. args: ["subString"],
  5775. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  5776. referencedClasses: [],
  5777. //>>excludeEnd("ide");
  5778. pragmas: [["inlineJS:", ["return self.indexOf(subString) != -1"]]],
  5779. messageSends: []
  5780. }),
  5781. $globals.String);
  5782. $core.addMethod(
  5783. $core.method({
  5784. selector: "isCapitalized",
  5785. protocol: "testing",
  5786. fn: function (){
  5787. var self=this,$self=this;
  5788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5789. return $core.withContext(function($ctx1) {
  5790. //>>excludeEnd("ctx");
  5791. var $2,$1;
  5792. $2=$self._first();
  5793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5794. $ctx1.sendIdx["first"]=1;
  5795. //>>excludeEnd("ctx");
  5796. $1=$recv($2)._asUppercase();
  5797. return $recv($1).__eq_eq($self._first());
  5798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5799. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{})});
  5800. //>>excludeEnd("ctx");
  5801. },
  5802. //>>excludeStart("ide", pragmas.excludeIdeData);
  5803. args: [],
  5804. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  5805. referencedClasses: [],
  5806. //>>excludeEnd("ide");
  5807. pragmas: [],
  5808. messageSends: ["==", "asUppercase", "first"]
  5809. }),
  5810. $globals.String);
  5811. $core.addMethod(
  5812. $core.method({
  5813. selector: "isImmutable",
  5814. protocol: "testing",
  5815. fn: function (){
  5816. var self=this,$self=this;
  5817. return true;
  5818. },
  5819. //>>excludeStart("ide", pragmas.excludeIdeData);
  5820. args: [],
  5821. source: "isImmutable\x0a\x09^ true",
  5822. referencedClasses: [],
  5823. //>>excludeEnd("ide");
  5824. pragmas: [],
  5825. messageSends: []
  5826. }),
  5827. $globals.String);
  5828. $core.addMethod(
  5829. $core.method({
  5830. selector: "isSelector",
  5831. protocol: "testing",
  5832. fn: function (){
  5833. var self=this,$self=this;
  5834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5835. return $core.withContext(function($ctx1) {
  5836. //>>excludeEnd("ctx");
  5837. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  5838. return self;
  5839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5840. }, function($ctx1) {$ctx1.fill(self,"isSelector",{})});
  5841. //>>excludeEnd("ctx");
  5842. },
  5843. //>>excludeStart("ide", pragmas.excludeIdeData);
  5844. args: [],
  5845. 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>",
  5846. referencedClasses: [],
  5847. //>>excludeEnd("ide");
  5848. pragmas: [["inlineJS:", ["return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\x5c\x5c+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\x5c:)+)$/)"]]],
  5849. messageSends: []
  5850. }),
  5851. $globals.String);
  5852. $core.addMethod(
  5853. $core.method({
  5854. selector: "isString",
  5855. protocol: "testing",
  5856. fn: function (){
  5857. var self=this,$self=this;
  5858. return true;
  5859. },
  5860. //>>excludeStart("ide", pragmas.excludeIdeData);
  5861. args: [],
  5862. source: "isString\x0a\x09^ true",
  5863. referencedClasses: [],
  5864. //>>excludeEnd("ide");
  5865. pragmas: [],
  5866. messageSends: []
  5867. }),
  5868. $globals.String);
  5869. $core.addMethod(
  5870. $core.method({
  5871. selector: "isVowel",
  5872. protocol: "testing",
  5873. fn: function (){
  5874. var self=this,$self=this;
  5875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5876. return $core.withContext(function($ctx1) {
  5877. //>>excludeEnd("ctx");
  5878. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  5879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5880. return $core.withContext(function($ctx2) {
  5881. //>>excludeEnd("ctx");
  5882. return "aeiou"._includes_($self._asLowercase());
  5883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5885. //>>excludeEnd("ctx");
  5886. }));
  5887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5888. }, function($ctx1) {$ctx1.fill(self,"isVowel",{})});
  5889. //>>excludeEnd("ctx");
  5890. },
  5891. //>>excludeStart("ide", pragmas.excludeIdeData);
  5892. args: [],
  5893. 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 ]",
  5894. referencedClasses: [],
  5895. //>>excludeEnd("ide");
  5896. pragmas: [],
  5897. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  5898. }),
  5899. $globals.String);
  5900. $core.addMethod(
  5901. $core.method({
  5902. selector: "join:",
  5903. protocol: "split join",
  5904. fn: function (aCollection){
  5905. var self=this,$self=this;
  5906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5907. return $core.withContext(function($ctx1) {
  5908. //>>excludeEnd("ctx");
  5909. return $recv($globals.String)._streamContents_((function(stream){
  5910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5911. return $core.withContext(function($ctx2) {
  5912. //>>excludeEnd("ctx");
  5913. return $recv(aCollection)._do_separatedBy_((function(each){
  5914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5915. return $core.withContext(function($ctx3) {
  5916. //>>excludeEnd("ctx");
  5917. return $recv(stream)._nextPutAll_($recv(each)._asString());
  5918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5919. $ctx3.sendIdx["nextPutAll:"]=1;
  5920. //>>excludeEnd("ctx");
  5921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5922. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  5923. //>>excludeEnd("ctx");
  5924. }),(function(){
  5925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5926. return $core.withContext(function($ctx3) {
  5927. //>>excludeEnd("ctx");
  5928. return $recv(stream)._nextPutAll_(self);
  5929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5930. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5931. //>>excludeEnd("ctx");
  5932. }));
  5933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5934. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  5935. //>>excludeEnd("ctx");
  5936. }));
  5937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5938. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection})});
  5939. //>>excludeEnd("ctx");
  5940. },
  5941. //>>excludeStart("ide", pragmas.excludeIdeData);
  5942. args: ["aCollection"],
  5943. 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 ]]",
  5944. referencedClasses: ["String"],
  5945. //>>excludeEnd("ide");
  5946. pragmas: [],
  5947. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  5948. }),
  5949. $globals.String);
  5950. $core.addMethod(
  5951. $core.method({
  5952. selector: "lineIndicesDo:",
  5953. protocol: "split join",
  5954. fn: function (aBlock){
  5955. var self=this,$self=this;
  5956. var cr,lf,start,sz,nextLF,nextCR;
  5957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5958. return $core.withContext(function($ctx1) {
  5959. //>>excludeEnd("ctx");
  5960. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  5961. var $early={};
  5962. try {
  5963. start=(1);
  5964. sz=$self._size();
  5965. cr=$recv($globals.String)._cr();
  5966. nextCR=$self._indexOf_startingAt_(cr,(1));
  5967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5968. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  5969. //>>excludeEnd("ctx");
  5970. lf=$recv($globals.String)._lf();
  5971. nextLF=$self._indexOf_startingAt_(lf,(1));
  5972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5973. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  5974. //>>excludeEnd("ctx");
  5975. $recv((function(){
  5976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5977. return $core.withContext(function($ctx2) {
  5978. //>>excludeEnd("ctx");
  5979. return $recv(start).__lt_eq(sz);
  5980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5982. //>>excludeEnd("ctx");
  5983. }))._whileTrue_((function(){
  5984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5985. return $core.withContext(function($ctx2) {
  5986. //>>excludeEnd("ctx");
  5987. $2=$recv(nextLF).__eq((0));
  5988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5989. $ctx2.sendIdx["="]=1;
  5990. //>>excludeEnd("ctx");
  5991. $1=$recv($2)._and_((function(){
  5992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5993. return $core.withContext(function($ctx3) {
  5994. //>>excludeEnd("ctx");
  5995. return $recv(nextCR).__eq((0));
  5996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5997. $ctx3.sendIdx["="]=2;
  5998. //>>excludeEnd("ctx");
  5999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6000. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6001. //>>excludeEnd("ctx");
  6002. }));
  6003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6004. $ctx2.sendIdx["and:"]=1;
  6005. //>>excludeEnd("ctx");
  6006. if($core.assert($1)){
  6007. $recv(aBlock)._value_value_value_(start,sz,sz);
  6008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6009. $ctx2.sendIdx["value:value:value:"]=1;
  6010. //>>excludeEnd("ctx");
  6011. throw $early=[self];
  6012. }
  6013. $4=$recv(nextCR).__eq((0));
  6014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6015. $ctx2.sendIdx["="]=3;
  6016. //>>excludeEnd("ctx");
  6017. $3=$recv($4)._or_((function(){
  6018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6019. return $core.withContext(function($ctx3) {
  6020. //>>excludeEnd("ctx");
  6021. $5=(0).__lt(nextLF);
  6022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6023. $ctx3.sendIdx["<"]=1;
  6024. //>>excludeEnd("ctx");
  6025. return $recv($5)._and_((function(){
  6026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6027. return $core.withContext(function($ctx4) {
  6028. //>>excludeEnd("ctx");
  6029. return $recv(nextLF).__lt(nextCR);
  6030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6031. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  6032. //>>excludeEnd("ctx");
  6033. }));
  6034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6035. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  6036. //>>excludeEnd("ctx");
  6037. }));
  6038. if($core.assert($3)){
  6039. $6=start;
  6040. $7=$recv(nextLF).__minus((1));
  6041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6042. $ctx2.sendIdx["-"]=1;
  6043. //>>excludeEnd("ctx");
  6044. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  6045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6046. $ctx2.sendIdx["value:value:value:"]=2;
  6047. //>>excludeEnd("ctx");
  6048. start=(1).__plus(nextLF);
  6049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6050. $ctx2.sendIdx["+"]=1;
  6051. //>>excludeEnd("ctx");
  6052. nextLF=$self._indexOf_startingAt_(lf,start);
  6053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6054. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  6055. //>>excludeEnd("ctx");
  6056. return nextLF;
  6057. } else {
  6058. $9=(1).__plus(nextCR);
  6059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6060. $ctx2.sendIdx["+"]=2;
  6061. //>>excludeEnd("ctx");
  6062. $8=$recv($9).__eq(nextLF);
  6063. if($core.assert($8)){
  6064. $10=start;
  6065. $11=$recv(nextCR).__minus((1));
  6066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6067. $ctx2.sendIdx["-"]=2;
  6068. //>>excludeEnd("ctx");
  6069. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  6070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6071. $ctx2.sendIdx["value:value:value:"]=3;
  6072. //>>excludeEnd("ctx");
  6073. start=(1).__plus(nextLF);
  6074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6075. $ctx2.sendIdx["+"]=3;
  6076. //>>excludeEnd("ctx");
  6077. nextCR=$self._indexOf_startingAt_(cr,start);
  6078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6079. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  6080. //>>excludeEnd("ctx");
  6081. nextLF=$self._indexOf_startingAt_(lf,start);
  6082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6083. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  6084. //>>excludeEnd("ctx");
  6085. return nextLF;
  6086. } else {
  6087. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  6088. start=(1).__plus(nextCR);
  6089. nextCR=$self._indexOf_startingAt_(cr,start);
  6090. return nextCR;
  6091. }
  6092. }
  6093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6095. //>>excludeEnd("ctx");
  6096. }));
  6097. return self;
  6098. }
  6099. catch(e) {if(e===$early)return e[0]; throw e}
  6100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6101. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR})});
  6102. //>>excludeEnd("ctx");
  6103. },
  6104. //>>excludeStart("ide", pragmas.excludeIdeData);
  6105. args: ["aBlock"],
  6106. 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 ] ]]",
  6107. referencedClasses: ["String"],
  6108. //>>excludeEnd("ide");
  6109. pragmas: [],
  6110. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  6111. }),
  6112. $globals.String);
  6113. $core.addMethod(
  6114. $core.method({
  6115. selector: "lineNumber:",
  6116. protocol: "split join",
  6117. fn: function (anIndex){
  6118. var self=this,$self=this;
  6119. var lineCount;
  6120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6121. return $core.withContext(function($ctx1) {
  6122. //>>excludeEnd("ctx");
  6123. var $2,$1;
  6124. var $early={};
  6125. try {
  6126. lineCount=(0);
  6127. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  6128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6129. return $core.withContext(function($ctx2) {
  6130. //>>excludeEnd("ctx");
  6131. lineCount=$recv(lineCount).__plus((1));
  6132. $2=lineCount;
  6133. $1=$recv($2).__eq(anIndex);
  6134. if($core.assert($1)){
  6135. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  6136. }
  6137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6138. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  6139. //>>excludeEnd("ctx");
  6140. }));
  6141. return nil;
  6142. }
  6143. catch(e) {if(e===$early)return e[0]; throw e}
  6144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6145. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount})});
  6146. //>>excludeEnd("ctx");
  6147. },
  6148. //>>excludeStart("ide", pragmas.excludeIdeData);
  6149. args: ["anIndex"],
  6150. 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",
  6151. referencedClasses: [],
  6152. //>>excludeEnd("ide");
  6153. pragmas: [],
  6154. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  6155. }),
  6156. $globals.String);
  6157. $core.addMethod(
  6158. $core.method({
  6159. selector: "lines",
  6160. protocol: "split join",
  6161. fn: function (){
  6162. var self=this,$self=this;
  6163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6164. return $core.withContext(function($ctx1) {
  6165. //>>excludeEnd("ctx");
  6166. var result = self.split(/\r\n|\r|\n/);
  6167. if (!result[result.length-1]) result.pop();
  6168. return result;;
  6169. return self;
  6170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6171. }, function($ctx1) {$ctx1.fill(self,"lines",{})});
  6172. //>>excludeEnd("ctx");
  6173. },
  6174. //>>excludeStart("ide", pragmas.excludeIdeData);
  6175. args: [],
  6176. 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'>",
  6177. referencedClasses: [],
  6178. //>>excludeEnd("ide");
  6179. pragmas: [["inlineJS:", ["\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;"]]],
  6180. messageSends: []
  6181. }),
  6182. $globals.String);
  6183. $core.addMethod(
  6184. $core.method({
  6185. selector: "linesDo:",
  6186. protocol: "split join",
  6187. fn: function (aBlock){
  6188. var self=this,$self=this;
  6189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6190. return $core.withContext(function($ctx1) {
  6191. //>>excludeEnd("ctx");
  6192. $recv($self._lines())._do_(aBlock);
  6193. return self;
  6194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6195. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock})});
  6196. //>>excludeEnd("ctx");
  6197. },
  6198. //>>excludeStart("ide", pragmas.excludeIdeData);
  6199. args: ["aBlock"],
  6200. 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",
  6201. referencedClasses: [],
  6202. //>>excludeEnd("ide");
  6203. pragmas: [],
  6204. messageSends: ["do:", "lines"]
  6205. }),
  6206. $globals.String);
  6207. $core.addMethod(
  6208. $core.method({
  6209. selector: "match:",
  6210. protocol: "regular expressions",
  6211. fn: function (aRegexp){
  6212. var self=this,$self=this;
  6213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6214. return $core.withContext(function($ctx1) {
  6215. //>>excludeEnd("ctx");
  6216. return self.search(aRegexp) != -1;
  6217. return self;
  6218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6219. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp})});
  6220. //>>excludeEnd("ctx");
  6221. },
  6222. //>>excludeStart("ide", pragmas.excludeIdeData);
  6223. args: ["aRegexp"],
  6224. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  6225. referencedClasses: [],
  6226. //>>excludeEnd("ide");
  6227. pragmas: [["inlineJS:", ["return self.search(aRegexp) != -1"]]],
  6228. messageSends: []
  6229. }),
  6230. $globals.String);
  6231. $core.addMethod(
  6232. $core.method({
  6233. selector: "matchesOf:",
  6234. protocol: "regular expressions",
  6235. fn: function (aRegularExpression){
  6236. var self=this,$self=this;
  6237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6238. return $core.withContext(function($ctx1) {
  6239. //>>excludeEnd("ctx");
  6240. return self.match(aRegularExpression);
  6241. return self;
  6242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6243. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression})});
  6244. //>>excludeEnd("ctx");
  6245. },
  6246. //>>excludeStart("ide", pragmas.excludeIdeData);
  6247. args: ["aRegularExpression"],
  6248. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  6249. referencedClasses: [],
  6250. //>>excludeEnd("ide");
  6251. pragmas: [["inlineJS:", ["return self.match(aRegularExpression)"]]],
  6252. messageSends: []
  6253. }),
  6254. $globals.String);
  6255. $core.addMethod(
  6256. $core.method({
  6257. selector: "printNl",
  6258. protocol: "printing",
  6259. fn: function (){
  6260. var self=this,$self=this;
  6261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6262. return $core.withContext(function($ctx1) {
  6263. //>>excludeEnd("ctx");
  6264. console.log(self);
  6265. return self;
  6266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6267. }, function($ctx1) {$ctx1.fill(self,"printNl",{})});
  6268. //>>excludeEnd("ctx");
  6269. },
  6270. //>>excludeStart("ide", pragmas.excludeIdeData);
  6271. args: [],
  6272. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  6273. referencedClasses: [],
  6274. //>>excludeEnd("ide");
  6275. pragmas: [["inlineJS:", ["console.log(self)"]]],
  6276. messageSends: []
  6277. }),
  6278. $globals.String);
  6279. $core.addMethod(
  6280. $core.method({
  6281. selector: "printOn:",
  6282. protocol: "printing",
  6283. fn: function (aStream){
  6284. var self=this,$self=this;
  6285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6286. return $core.withContext(function($ctx1) {
  6287. //>>excludeEnd("ctx");
  6288. $recv(aStream)._nextPutAll_("'");
  6289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6290. $ctx1.sendIdx["nextPutAll:"]=1;
  6291. //>>excludeEnd("ctx");
  6292. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  6293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6294. $ctx1.sendIdx["nextPutAll:"]=2;
  6295. //>>excludeEnd("ctx");
  6296. $recv(aStream)._nextPutAll_("'");
  6297. return self;
  6298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6299. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  6300. //>>excludeEnd("ctx");
  6301. },
  6302. //>>excludeStart("ide", pragmas.excludeIdeData);
  6303. args: ["aStream"],
  6304. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  6305. referencedClasses: [],
  6306. //>>excludeEnd("ide");
  6307. pragmas: [],
  6308. messageSends: ["nextPutAll:", "replace:with:"]
  6309. }),
  6310. $globals.String);
  6311. $core.addMethod(
  6312. $core.method({
  6313. selector: "putOn:",
  6314. protocol: "streaming",
  6315. fn: function (aStream){
  6316. var self=this,$self=this;
  6317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6318. return $core.withContext(function($ctx1) {
  6319. //>>excludeEnd("ctx");
  6320. $recv(aStream)._nextPutString_(self);
  6321. return self;
  6322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6323. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  6324. //>>excludeEnd("ctx");
  6325. },
  6326. //>>excludeStart("ide", pragmas.excludeIdeData);
  6327. args: ["aStream"],
  6328. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  6329. referencedClasses: [],
  6330. //>>excludeEnd("ide");
  6331. pragmas: [],
  6332. messageSends: ["nextPutString:"]
  6333. }),
  6334. $globals.String);
  6335. $core.addMethod(
  6336. $core.method({
  6337. selector: "remove:",
  6338. protocol: "adding/removing",
  6339. fn: function (anObject){
  6340. var self=this,$self=this;
  6341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6342. return $core.withContext(function($ctx1) {
  6343. //>>excludeEnd("ctx");
  6344. $self._errorReadOnly();
  6345. return self;
  6346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6347. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  6348. //>>excludeEnd("ctx");
  6349. },
  6350. //>>excludeStart("ide", pragmas.excludeIdeData);
  6351. args: ["anObject"],
  6352. source: "remove: anObject\x0a\x09self errorReadOnly",
  6353. referencedClasses: [],
  6354. //>>excludeEnd("ide");
  6355. pragmas: [],
  6356. messageSends: ["errorReadOnly"]
  6357. }),
  6358. $globals.String);
  6359. $core.addMethod(
  6360. $core.method({
  6361. selector: "remove:ifAbsent:",
  6362. protocol: "adding/removing",
  6363. fn: function (anObject,aBlock){
  6364. var self=this,$self=this;
  6365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6366. return $core.withContext(function($ctx1) {
  6367. //>>excludeEnd("ctx");
  6368. $self._errorReadOnly();
  6369. return self;
  6370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6371. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  6372. //>>excludeEnd("ctx");
  6373. },
  6374. //>>excludeStart("ide", pragmas.excludeIdeData);
  6375. args: ["anObject", "aBlock"],
  6376. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  6377. referencedClasses: [],
  6378. //>>excludeEnd("ide");
  6379. pragmas: [],
  6380. messageSends: ["errorReadOnly"]
  6381. }),
  6382. $globals.String);
  6383. $core.addMethod(
  6384. $core.method({
  6385. selector: "replace:with:",
  6386. protocol: "regular expressions",
  6387. fn: function (aString,anotherString){
  6388. var self=this,$self=this;
  6389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6390. return $core.withContext(function($ctx1) {
  6391. //>>excludeEnd("ctx");
  6392. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6394. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString})});
  6395. //>>excludeEnd("ctx");
  6396. },
  6397. //>>excludeStart("ide", pragmas.excludeIdeData);
  6398. args: ["aString", "anotherString"],
  6399. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6400. referencedClasses: ["RegularExpression"],
  6401. //>>excludeEnd("ide");
  6402. pragmas: [],
  6403. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6404. }),
  6405. $globals.String);
  6406. $core.addMethod(
  6407. $core.method({
  6408. selector: "replaceRegexp:with:",
  6409. protocol: "regular expressions",
  6410. fn: function (aRegexp,aString){
  6411. var self=this,$self=this;
  6412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6413. return $core.withContext(function($ctx1) {
  6414. //>>excludeEnd("ctx");
  6415. return self.replace(aRegexp, aString);
  6416. return self;
  6417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6418. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString})});
  6419. //>>excludeEnd("ctx");
  6420. },
  6421. //>>excludeStart("ide", pragmas.excludeIdeData);
  6422. args: ["aRegexp", "aString"],
  6423. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  6424. referencedClasses: [],
  6425. //>>excludeEnd("ide");
  6426. pragmas: [["inlineJS:", ["return self.replace(aRegexp, aString)"]]],
  6427. messageSends: []
  6428. }),
  6429. $globals.String);
  6430. $core.addMethod(
  6431. $core.method({
  6432. selector: "reversed",
  6433. protocol: "converting",
  6434. fn: function (){
  6435. var self=this,$self=this;
  6436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6437. return $core.withContext(function($ctx1) {
  6438. //>>excludeEnd("ctx");
  6439. return self.split("").reverse().join("");
  6440. return self;
  6441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6442. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  6443. //>>excludeEnd("ctx");
  6444. },
  6445. //>>excludeStart("ide", pragmas.excludeIdeData);
  6446. args: [],
  6447. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  6448. referencedClasses: [],
  6449. //>>excludeEnd("ide");
  6450. pragmas: [["inlineJS:", ["return self.split(\x22\x22).reverse().join(\x22\x22)"]]],
  6451. messageSends: []
  6452. }),
  6453. $globals.String);
  6454. $core.addMethod(
  6455. $core.method({
  6456. selector: "shallowCopy",
  6457. protocol: "copying",
  6458. fn: function (){
  6459. var self=this,$self=this;
  6460. return self;
  6461. },
  6462. //>>excludeStart("ide", pragmas.excludeIdeData);
  6463. args: [],
  6464. source: "shallowCopy\x0a\x09^ self",
  6465. referencedClasses: [],
  6466. //>>excludeEnd("ide");
  6467. pragmas: [],
  6468. messageSends: []
  6469. }),
  6470. $globals.String);
  6471. $core.addMethod(
  6472. $core.method({
  6473. selector: "subStrings:",
  6474. protocol: "split join",
  6475. fn: function (aString){
  6476. var self=this,$self=this;
  6477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6478. return $core.withContext(function($ctx1) {
  6479. //>>excludeEnd("ctx");
  6480. return $self._tokenize_(aString);
  6481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6482. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString})});
  6483. //>>excludeEnd("ctx");
  6484. },
  6485. //>>excludeStart("ide", pragmas.excludeIdeData);
  6486. args: ["aString"],
  6487. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6488. referencedClasses: [],
  6489. //>>excludeEnd("ide");
  6490. pragmas: [],
  6491. messageSends: ["tokenize:"]
  6492. }),
  6493. $globals.String);
  6494. $core.addMethod(
  6495. $core.method({
  6496. selector: "symbolPrintString",
  6497. protocol: "printing",
  6498. fn: function (){
  6499. var self=this,$self=this;
  6500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6501. return $core.withContext(function($ctx1) {
  6502. //>>excludeEnd("ctx");
  6503. return $recv($globals.String)._streamContents_((function(str){
  6504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6505. return $core.withContext(function($ctx2) {
  6506. //>>excludeEnd("ctx");
  6507. return $self._asSymbolPrintOn_(str);
  6508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6509. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  6510. //>>excludeEnd("ctx");
  6511. }));
  6512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6513. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{})});
  6514. //>>excludeEnd("ctx");
  6515. },
  6516. //>>excludeStart("ide", pragmas.excludeIdeData);
  6517. args: [],
  6518. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  6519. referencedClasses: ["String"],
  6520. //>>excludeEnd("ide");
  6521. pragmas: [],
  6522. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  6523. }),
  6524. $globals.String);
  6525. $core.addMethod(
  6526. $core.method({
  6527. selector: "tokenize:",
  6528. protocol: "split join",
  6529. fn: function (aString){
  6530. var self=this,$self=this;
  6531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6532. return $core.withContext(function($ctx1) {
  6533. //>>excludeEnd("ctx");
  6534. return self.split(aString);
  6535. return self;
  6536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6537. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString})});
  6538. //>>excludeEnd("ctx");
  6539. },
  6540. //>>excludeStart("ide", pragmas.excludeIdeData);
  6541. args: ["aString"],
  6542. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  6543. referencedClasses: [],
  6544. //>>excludeEnd("ide");
  6545. pragmas: [["inlineJS:", ["return self.split(aString)"]]],
  6546. messageSends: []
  6547. }),
  6548. $globals.String);
  6549. $core.addMethod(
  6550. $core.method({
  6551. selector: "trimBoth",
  6552. protocol: "regular expressions",
  6553. fn: function (){
  6554. var self=this,$self=this;
  6555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6556. return $core.withContext(function($ctx1) {
  6557. //>>excludeEnd("ctx");
  6558. return $self._trimBoth_("\x5cs");
  6559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6560. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{})});
  6561. //>>excludeEnd("ctx");
  6562. },
  6563. //>>excludeStart("ide", pragmas.excludeIdeData);
  6564. args: [],
  6565. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  6566. referencedClasses: [],
  6567. //>>excludeEnd("ide");
  6568. pragmas: [],
  6569. messageSends: ["trimBoth:"]
  6570. }),
  6571. $globals.String);
  6572. $core.addMethod(
  6573. $core.method({
  6574. selector: "trimBoth:",
  6575. protocol: "regular expressions",
  6576. fn: function (separators){
  6577. var self=this,$self=this;
  6578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6579. return $core.withContext(function($ctx1) {
  6580. //>>excludeEnd("ctx");
  6581. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  6582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6583. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators})});
  6584. //>>excludeEnd("ctx");
  6585. },
  6586. //>>excludeStart("ide", pragmas.excludeIdeData);
  6587. args: ["separators"],
  6588. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  6589. referencedClasses: [],
  6590. //>>excludeEnd("ide");
  6591. pragmas: [],
  6592. messageSends: ["trimRight:", "trimLeft:"]
  6593. }),
  6594. $globals.String);
  6595. $core.addMethod(
  6596. $core.method({
  6597. selector: "trimLeft",
  6598. protocol: "regular expressions",
  6599. fn: function (){
  6600. var self=this,$self=this;
  6601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6602. return $core.withContext(function($ctx1) {
  6603. //>>excludeEnd("ctx");
  6604. return $self._trimLeft_("\x5cs");
  6605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6606. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{})});
  6607. //>>excludeEnd("ctx");
  6608. },
  6609. //>>excludeStart("ide", pragmas.excludeIdeData);
  6610. args: [],
  6611. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  6612. referencedClasses: [],
  6613. //>>excludeEnd("ide");
  6614. pragmas: [],
  6615. messageSends: ["trimLeft:"]
  6616. }),
  6617. $globals.String);
  6618. $core.addMethod(
  6619. $core.method({
  6620. selector: "trimLeft:",
  6621. protocol: "regular expressions",
  6622. fn: function (separators){
  6623. var self=this,$self=this;
  6624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6625. return $core.withContext(function($ctx1) {
  6626. //>>excludeEnd("ctx");
  6627. var $2,$1;
  6628. $2=$recv("^[".__comma(separators)).__comma("]+");
  6629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6630. $ctx1.sendIdx[","]=1;
  6631. //>>excludeEnd("ctx");
  6632. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6633. return $self._replaceRegexp_with_($1,"");
  6634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6635. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators})});
  6636. //>>excludeEnd("ctx");
  6637. },
  6638. //>>excludeStart("ide", pragmas.excludeIdeData);
  6639. args: ["separators"],
  6640. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  6641. referencedClasses: ["RegularExpression"],
  6642. //>>excludeEnd("ide");
  6643. pragmas: [],
  6644. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6645. }),
  6646. $globals.String);
  6647. $core.addMethod(
  6648. $core.method({
  6649. selector: "trimRight",
  6650. protocol: "regular expressions",
  6651. fn: function (){
  6652. var self=this,$self=this;
  6653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6654. return $core.withContext(function($ctx1) {
  6655. //>>excludeEnd("ctx");
  6656. return $self._trimRight_("\x5cs");
  6657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6658. }, function($ctx1) {$ctx1.fill(self,"trimRight",{})});
  6659. //>>excludeEnd("ctx");
  6660. },
  6661. //>>excludeStart("ide", pragmas.excludeIdeData);
  6662. args: [],
  6663. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  6664. referencedClasses: [],
  6665. //>>excludeEnd("ide");
  6666. pragmas: [],
  6667. messageSends: ["trimRight:"]
  6668. }),
  6669. $globals.String);
  6670. $core.addMethod(
  6671. $core.method({
  6672. selector: "trimRight:",
  6673. protocol: "regular expressions",
  6674. fn: function (separators){
  6675. var self=this,$self=this;
  6676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6677. return $core.withContext(function($ctx1) {
  6678. //>>excludeEnd("ctx");
  6679. var $2,$1;
  6680. $2=$recv("[".__comma(separators)).__comma("]+$");
  6681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6682. $ctx1.sendIdx[","]=1;
  6683. //>>excludeEnd("ctx");
  6684. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6685. return $self._replaceRegexp_with_($1,"");
  6686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6687. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators})});
  6688. //>>excludeEnd("ctx");
  6689. },
  6690. //>>excludeStart("ide", pragmas.excludeIdeData);
  6691. args: ["separators"],
  6692. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  6693. referencedClasses: ["RegularExpression"],
  6694. //>>excludeEnd("ide");
  6695. pragmas: [],
  6696. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6697. }),
  6698. $globals.String);
  6699. $core.addMethod(
  6700. $core.method({
  6701. selector: "unescaped",
  6702. protocol: "converting",
  6703. fn: function (){
  6704. var self=this,$self=this;
  6705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6706. return $core.withContext(function($ctx1) {
  6707. //>>excludeEnd("ctx");
  6708. return unescape(self);
  6709. return self;
  6710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6711. }, function($ctx1) {$ctx1.fill(self,"unescaped",{})});
  6712. //>>excludeEnd("ctx");
  6713. },
  6714. //>>excludeStart("ide", pragmas.excludeIdeData);
  6715. args: [],
  6716. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  6717. referencedClasses: [],
  6718. //>>excludeEnd("ide");
  6719. pragmas: [["inlineJS:", ["return unescape(self)"]]],
  6720. messageSends: []
  6721. }),
  6722. $globals.String);
  6723. $core.addMethod(
  6724. $core.method({
  6725. selector: "uriComponentDecoded",
  6726. protocol: "converting",
  6727. fn: function (){
  6728. var self=this,$self=this;
  6729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6730. return $core.withContext(function($ctx1) {
  6731. //>>excludeEnd("ctx");
  6732. return decodeURIComponent(self);
  6733. return self;
  6734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6735. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{})});
  6736. //>>excludeEnd("ctx");
  6737. },
  6738. //>>excludeStart("ide", pragmas.excludeIdeData);
  6739. args: [],
  6740. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  6741. referencedClasses: [],
  6742. //>>excludeEnd("ide");
  6743. pragmas: [["inlineJS:", ["return decodeURIComponent(self)"]]],
  6744. messageSends: []
  6745. }),
  6746. $globals.String);
  6747. $core.addMethod(
  6748. $core.method({
  6749. selector: "uriComponentEncoded",
  6750. protocol: "converting",
  6751. fn: function (){
  6752. var self=this,$self=this;
  6753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6754. return $core.withContext(function($ctx1) {
  6755. //>>excludeEnd("ctx");
  6756. return encodeURIComponent(self);
  6757. return self;
  6758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6759. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{})});
  6760. //>>excludeEnd("ctx");
  6761. },
  6762. //>>excludeStart("ide", pragmas.excludeIdeData);
  6763. args: [],
  6764. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  6765. referencedClasses: [],
  6766. //>>excludeEnd("ide");
  6767. pragmas: [["inlineJS:", ["return encodeURIComponent(self)"]]],
  6768. messageSends: []
  6769. }),
  6770. $globals.String);
  6771. $core.addMethod(
  6772. $core.method({
  6773. selector: "uriDecoded",
  6774. protocol: "converting",
  6775. fn: function (){
  6776. var self=this,$self=this;
  6777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6778. return $core.withContext(function($ctx1) {
  6779. //>>excludeEnd("ctx");
  6780. return decodeURI(self);
  6781. return self;
  6782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6783. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{})});
  6784. //>>excludeEnd("ctx");
  6785. },
  6786. //>>excludeStart("ide", pragmas.excludeIdeData);
  6787. args: [],
  6788. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  6789. referencedClasses: [],
  6790. //>>excludeEnd("ide");
  6791. pragmas: [["inlineJS:", ["return decodeURI(self)"]]],
  6792. messageSends: []
  6793. }),
  6794. $globals.String);
  6795. $core.addMethod(
  6796. $core.method({
  6797. selector: "uriEncoded",
  6798. protocol: "converting",
  6799. fn: function (){
  6800. var self=this,$self=this;
  6801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6802. return $core.withContext(function($ctx1) {
  6803. //>>excludeEnd("ctx");
  6804. return encodeURI(self);
  6805. return self;
  6806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6807. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{})});
  6808. //>>excludeEnd("ctx");
  6809. },
  6810. //>>excludeStart("ide", pragmas.excludeIdeData);
  6811. args: [],
  6812. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  6813. referencedClasses: [],
  6814. //>>excludeEnd("ide");
  6815. pragmas: [["inlineJS:", ["return encodeURI(self)"]]],
  6816. messageSends: []
  6817. }),
  6818. $globals.String);
  6819. $core.addMethod(
  6820. $core.method({
  6821. selector: "value:",
  6822. protocol: "evaluating",
  6823. fn: function (anObject){
  6824. var self=this,$self=this;
  6825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6826. return $core.withContext(function($ctx1) {
  6827. //>>excludeEnd("ctx");
  6828. return $recv(anObject)._perform_(self);
  6829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6830. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  6831. //>>excludeEnd("ctx");
  6832. },
  6833. //>>excludeStart("ide", pragmas.excludeIdeData);
  6834. args: ["anObject"],
  6835. source: "value: anObject \x0a\x09^ anObject perform: self",
  6836. referencedClasses: [],
  6837. //>>excludeEnd("ide");
  6838. pragmas: [],
  6839. messageSends: ["perform:"]
  6840. }),
  6841. $globals.String);
  6842. $core.addMethod(
  6843. $core.method({
  6844. selector: "cr",
  6845. protocol: "accessing",
  6846. fn: function (){
  6847. var self=this,$self=this;
  6848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6849. return $core.withContext(function($ctx1) {
  6850. //>>excludeEnd("ctx");
  6851. return "\r";
  6852. return self;
  6853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6854. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  6855. //>>excludeEnd("ctx");
  6856. },
  6857. //>>excludeStart("ide", pragmas.excludeIdeData);
  6858. args: [],
  6859. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  6860. referencedClasses: [],
  6861. //>>excludeEnd("ide");
  6862. pragmas: [["inlineJS:", ["return \x22\x5cr\x22"]]],
  6863. messageSends: []
  6864. }),
  6865. $globals.String.a$cls);
  6866. $core.addMethod(
  6867. $core.method({
  6868. selector: "crlf",
  6869. protocol: "accessing",
  6870. fn: function (){
  6871. var self=this,$self=this;
  6872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6873. return $core.withContext(function($ctx1) {
  6874. //>>excludeEnd("ctx");
  6875. return "\r\n";
  6876. return self;
  6877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6878. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  6879. //>>excludeEnd("ctx");
  6880. },
  6881. //>>excludeStart("ide", pragmas.excludeIdeData);
  6882. args: [],
  6883. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  6884. referencedClasses: [],
  6885. //>>excludeEnd("ide");
  6886. pragmas: [["inlineJS:", ["return \x22\x5cr\x5cn\x22"]]],
  6887. messageSends: []
  6888. }),
  6889. $globals.String.a$cls);
  6890. $core.addMethod(
  6891. $core.method({
  6892. selector: "esc",
  6893. protocol: "accessing",
  6894. fn: function (){
  6895. var self=this,$self=this;
  6896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6897. return $core.withContext(function($ctx1) {
  6898. //>>excludeEnd("ctx");
  6899. return $self._fromCharCode_((27));
  6900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6901. }, function($ctx1) {$ctx1.fill(self,"esc",{})});
  6902. //>>excludeEnd("ctx");
  6903. },
  6904. //>>excludeStart("ide", pragmas.excludeIdeData);
  6905. args: [],
  6906. source: "esc\x0a\x09^ self fromCharCode: 27",
  6907. referencedClasses: [],
  6908. //>>excludeEnd("ide");
  6909. pragmas: [],
  6910. messageSends: ["fromCharCode:"]
  6911. }),
  6912. $globals.String.a$cls);
  6913. $core.addMethod(
  6914. $core.method({
  6915. selector: "fromCharCode:",
  6916. protocol: "instance creation",
  6917. fn: function (anInteger){
  6918. var self=this,$self=this;
  6919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6920. return $core.withContext(function($ctx1) {
  6921. //>>excludeEnd("ctx");
  6922. return String.fromCharCode(anInteger);
  6923. return self;
  6924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6925. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger})});
  6926. //>>excludeEnd("ctx");
  6927. },
  6928. //>>excludeStart("ide", pragmas.excludeIdeData);
  6929. args: ["anInteger"],
  6930. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  6931. referencedClasses: [],
  6932. //>>excludeEnd("ide");
  6933. pragmas: [["inlineJS:", ["return String.fromCharCode(anInteger)"]]],
  6934. messageSends: []
  6935. }),
  6936. $globals.String.a$cls);
  6937. $core.addMethod(
  6938. $core.method({
  6939. selector: "fromString:",
  6940. protocol: "instance creation",
  6941. fn: function (aString){
  6942. var self=this,$self=this;
  6943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6944. return $core.withContext(function($ctx1) {
  6945. //>>excludeEnd("ctx");
  6946. return String(aString);
  6947. return self;
  6948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6949. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  6950. //>>excludeEnd("ctx");
  6951. },
  6952. //>>excludeStart("ide", pragmas.excludeIdeData);
  6953. args: ["aString"],
  6954. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  6955. referencedClasses: [],
  6956. //>>excludeEnd("ide");
  6957. pragmas: [["inlineJS:", ["return String(aString)"]]],
  6958. messageSends: []
  6959. }),
  6960. $globals.String.a$cls);
  6961. $core.addMethod(
  6962. $core.method({
  6963. selector: "lf",
  6964. protocol: "accessing",
  6965. fn: function (){
  6966. var self=this,$self=this;
  6967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6968. return $core.withContext(function($ctx1) {
  6969. //>>excludeEnd("ctx");
  6970. return "\n";
  6971. return self;
  6972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6973. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  6974. //>>excludeEnd("ctx");
  6975. },
  6976. //>>excludeStart("ide", pragmas.excludeIdeData);
  6977. args: [],
  6978. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  6979. referencedClasses: [],
  6980. //>>excludeEnd("ide");
  6981. pragmas: [["inlineJS:", ["return \x22\x5cn\x22"]]],
  6982. messageSends: []
  6983. }),
  6984. $globals.String.a$cls);
  6985. $core.addMethod(
  6986. $core.method({
  6987. selector: "random",
  6988. protocol: "random",
  6989. fn: function (){
  6990. var self=this,$self=this;
  6991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6992. return $core.withContext(function($ctx1) {
  6993. //>>excludeEnd("ctx");
  6994. return ((10+22*Math.random())/32).toString(32).slice(2);;
  6995. return self;
  6996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6997. }, function($ctx1) {$ctx1.fill(self,"random",{})});
  6998. //>>excludeEnd("ctx");
  6999. },
  7000. //>>excludeStart("ide", pragmas.excludeIdeData);
  7001. args: [],
  7002. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return ((10+22*Math.random())/32).toString(32).slice(2);'>",
  7003. referencedClasses: [],
  7004. //>>excludeEnd("ide");
  7005. pragmas: [["inlineJS:", ["return ((10+22*Math.random())/32).toString(32).slice(2);"]]],
  7006. messageSends: []
  7007. }),
  7008. $globals.String.a$cls);
  7009. $core.addMethod(
  7010. $core.method({
  7011. selector: "randomNotIn:",
  7012. protocol: "random",
  7013. fn: function (aString){
  7014. var self=this,$self=this;
  7015. var result;
  7016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7017. return $core.withContext(function($ctx1) {
  7018. //>>excludeEnd("ctx");
  7019. $recv((function(){
  7020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7021. return $core.withContext(function($ctx2) {
  7022. //>>excludeEnd("ctx");
  7023. result=$self._random();
  7024. return $recv(aString)._includesSubString_(result);
  7025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7027. //>>excludeEnd("ctx");
  7028. }))._whileTrue();
  7029. return result;
  7030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7031. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result})});
  7032. //>>excludeEnd("ctx");
  7033. },
  7034. //>>excludeStart("ide", pragmas.excludeIdeData);
  7035. args: ["aString"],
  7036. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  7037. referencedClasses: [],
  7038. //>>excludeEnd("ide");
  7039. pragmas: [],
  7040. messageSends: ["whileTrue", "random", "includesSubString:"]
  7041. }),
  7042. $globals.String.a$cls);
  7043. $core.addMethod(
  7044. $core.method({
  7045. selector: "space",
  7046. protocol: "accessing",
  7047. fn: function (){
  7048. var self=this,$self=this;
  7049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7050. return $core.withContext(function($ctx1) {
  7051. //>>excludeEnd("ctx");
  7052. return " ";
  7053. return self;
  7054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7055. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  7056. //>>excludeEnd("ctx");
  7057. },
  7058. //>>excludeStart("ide", pragmas.excludeIdeData);
  7059. args: [],
  7060. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  7061. referencedClasses: [],
  7062. //>>excludeEnd("ide");
  7063. pragmas: [["inlineJS:", ["return \x22 \x22"]]],
  7064. messageSends: []
  7065. }),
  7066. $globals.String.a$cls);
  7067. $core.addMethod(
  7068. $core.method({
  7069. selector: "streamClass",
  7070. protocol: "accessing",
  7071. fn: function (){
  7072. var self=this,$self=this;
  7073. return $globals.StringStream;
  7074. },
  7075. //>>excludeStart("ide", pragmas.excludeIdeData);
  7076. args: [],
  7077. source: "streamClass\x0a\x09\x09^ StringStream",
  7078. referencedClasses: ["StringStream"],
  7079. //>>excludeEnd("ide");
  7080. pragmas: [],
  7081. messageSends: []
  7082. }),
  7083. $globals.String.a$cls);
  7084. $core.addMethod(
  7085. $core.method({
  7086. selector: "tab",
  7087. protocol: "accessing",
  7088. fn: function (){
  7089. var self=this,$self=this;
  7090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7091. return $core.withContext(function($ctx1) {
  7092. //>>excludeEnd("ctx");
  7093. return "\t";
  7094. return self;
  7095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7096. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  7097. //>>excludeEnd("ctx");
  7098. },
  7099. //>>excludeStart("ide", pragmas.excludeIdeData);
  7100. args: [],
  7101. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  7102. referencedClasses: [],
  7103. //>>excludeEnd("ide");
  7104. pragmas: [["inlineJS:", ["return \x22\x5ct\x22"]]],
  7105. messageSends: []
  7106. }),
  7107. $globals.String.a$cls);
  7108. $core.addMethod(
  7109. $core.method({
  7110. selector: "value:",
  7111. protocol: "instance creation",
  7112. fn: function (aUTFCharCode){
  7113. var self=this,$self=this;
  7114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7115. return $core.withContext(function($ctx1) {
  7116. //>>excludeEnd("ctx");
  7117. return String.fromCharCode(aUTFCharCode);;
  7118. return self;
  7119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7120. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode})});
  7121. //>>excludeEnd("ctx");
  7122. },
  7123. //>>excludeStart("ide", pragmas.excludeIdeData);
  7124. args: ["aUTFCharCode"],
  7125. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  7126. referencedClasses: [],
  7127. //>>excludeEnd("ide");
  7128. pragmas: [["inlineJS:", ["return String.fromCharCode(aUTFCharCode);"]]],
  7129. messageSends: []
  7130. }),
  7131. $globals.String.a$cls);
  7132. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  7133. //>>excludeStart("ide", pragmas.excludeIdeData);
  7134. $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`.";
  7135. //>>excludeEnd("ide");
  7136. $core.addMethod(
  7137. $core.method({
  7138. selector: "=",
  7139. protocol: "comparing",
  7140. fn: function (aCollection){
  7141. var self=this,$self=this;
  7142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7143. return $core.withContext(function($ctx1) {
  7144. //>>excludeEnd("ctx");
  7145. var $2,$1,$4,$3,$5;
  7146. var $early={};
  7147. try {
  7148. $2=$self._class();
  7149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7150. $ctx1.sendIdx["class"]=1;
  7151. //>>excludeEnd("ctx");
  7152. $1=$recv($2).__eq($recv(aCollection)._class());
  7153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7154. $ctx1.sendIdx["="]=1;
  7155. //>>excludeEnd("ctx");
  7156. if(!$core.assert($1)){
  7157. return false;
  7158. }
  7159. $4=$self._size();
  7160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7161. $ctx1.sendIdx["size"]=1;
  7162. //>>excludeEnd("ctx");
  7163. $3=$recv($4).__eq($recv(aCollection)._size());
  7164. if(!$core.assert($3)){
  7165. return false;
  7166. }
  7167. $self._do_((function(each){
  7168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7169. return $core.withContext(function($ctx2) {
  7170. //>>excludeEnd("ctx");
  7171. $5=$recv(aCollection)._includes_(each);
  7172. if(!$core.assert($5)){
  7173. throw $early=[false];
  7174. }
  7175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7176. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7177. //>>excludeEnd("ctx");
  7178. }));
  7179. return true;
  7180. }
  7181. catch(e) {if(e===$early)return e[0]; throw e}
  7182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7183. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  7184. //>>excludeEnd("ctx");
  7185. },
  7186. //>>excludeStart("ide", pragmas.excludeIdeData);
  7187. args: ["aCollection"],
  7188. 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",
  7189. referencedClasses: [],
  7190. //>>excludeEnd("ide");
  7191. pragmas: [],
  7192. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  7193. }),
  7194. $globals.Set);
  7195. $core.addMethod(
  7196. $core.method({
  7197. selector: "add:",
  7198. protocol: "adding/removing",
  7199. fn: function (anObject){
  7200. var self=this,$self=this;
  7201. var bucket;
  7202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7203. return $core.withContext(function($ctx1) {
  7204. //>>excludeEnd("ctx");
  7205. var $1,$receiver;
  7206. bucket=$self._bucketsOfElement_(anObject);
  7207. $1=$recv(bucket)._second();
  7208. if(($receiver = $1) == null || $receiver.a$nil){
  7209. var object,slowBucket;
  7210. object=$recv(bucket)._first();
  7211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7212. $ctx1.sendIdx["first"]=1;
  7213. //>>excludeEnd("ctx");
  7214. slowBucket=$recv(bucket)._third();
  7215. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  7216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7217. return $core.withContext(function($ctx2) {
  7218. //>>excludeEnd("ctx");
  7219. $recv(slowBucket)._add_(object);
  7220. $self.size=$recv($self.size).__plus((1));
  7221. return $self.size;
  7222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7223. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7224. //>>excludeEnd("ctx");
  7225. }));
  7226. return object;
  7227. } else {
  7228. var primitiveBucket;
  7229. primitiveBucket=$receiver;
  7230. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  7231. }
  7232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7233. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket})});
  7234. //>>excludeEnd("ctx");
  7235. },
  7236. //>>excludeStart("ide", pragmas.excludeIdeData);
  7237. args: ["anObject"],
  7238. 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 ]",
  7239. referencedClasses: [],
  7240. //>>excludeEnd("ide");
  7241. pragmas: [],
  7242. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  7243. }),
  7244. $globals.Set);
  7245. $core.addMethod(
  7246. $core.method({
  7247. selector: "add:in:",
  7248. protocol: "private",
  7249. fn: function (anObject,anotherObject){
  7250. var self=this,$self=this;
  7251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7252. return $core.withContext(function($ctx1) {
  7253. //>>excludeEnd("ctx");
  7254. if (anObject in anotherObject.store) { return anObject; }
  7255. $self.size++;
  7256. anotherObject.store[anObject] = true;
  7257. return anObject;
  7258. ;
  7259. return self;
  7260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7261. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject})});
  7262. //>>excludeEnd("ctx");
  7263. },
  7264. //>>excludeStart("ide", pragmas.excludeIdeData);
  7265. args: ["anObject", "anotherObject"],
  7266. source: "add: anObject in: anotherObject\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) { return anObject; }\x0a\x09\x09$self.size++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09'>",
  7267. referencedClasses: [],
  7268. //>>excludeEnd("ide");
  7269. pragmas: [["inlineJS:", ["\x0a\x09\x09if (anObject in anotherObject.store) { return anObject; }\x0a\x09\x09$self.size++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09"]]],
  7270. messageSends: []
  7271. }),
  7272. $globals.Set);
  7273. $core.addMethod(
  7274. $core.method({
  7275. selector: "bucketsOfElement:",
  7276. protocol: "private",
  7277. fn: function (anObject){
  7278. var self=this,$self=this;
  7279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7280. return $core.withContext(function($ctx1) {
  7281. //>>excludeEnd("ctx");
  7282. // include nil to well-known objects under "boolean" fastBucket
  7283. if (anObject == null || anObject.a$nil) return [ null, $self.fastBuckets.boolean ];
  7284. var prim = anObject.valueOf();
  7285. if (typeof prim === "object" || typeof prim === "function" || !$self.fastBuckets[typeof prim]) {
  7286. var bucket = null;
  7287. $self.slowBucketStores.some(function (store) {
  7288. return bucket = store._bucketOfElement_(anObject);
  7289. });
  7290. return [ anObject, null, bucket || $self.defaultBucket ];
  7291. }
  7292. return [ prim, $self.fastBuckets[typeof prim] ];
  7293. ;
  7294. return self;
  7295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7296. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject})});
  7297. //>>excludeEnd("ctx");
  7298. },
  7299. //>>excludeStart("ide", pragmas.excludeIdeData);
  7300. args: ["anObject"],
  7301. 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'>",
  7302. referencedClasses: [],
  7303. //>>excludeEnd("ide");
  7304. pragmas: [["inlineJS:", ["\x0a\x09\x09// include nil to well-known objects under \x22boolean\x22 fastBucket\x0a\x09\x09if (anObject == null || anObject.a$nil) return [ null, $self.fastBuckets.boolean ];\x0a\x09\x09\x0a\x09\x09var prim = anObject.valueOf();\x0a\x09\x09if (typeof prim === \x22object\x22 || typeof prim === \x22function\x22 || !$self.fastBuckets[typeof prim]) {\x0a\x09\x09\x09var bucket = null;\x0a\x09\x09\x09$self.slowBucketStores.some(function (store) {\x0a\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09});\x0a\x09\x09\x09return [ anObject, null, bucket || $self.defaultBucket ];\x0a\x09\x09}\x0a\x09\x09return [ prim, $self.fastBuckets[typeof prim] ];\x0a\x09"]]],
  7305. messageSends: []
  7306. }),
  7307. $globals.Set);
  7308. $core.addMethod(
  7309. $core.method({
  7310. selector: "classNameOf:",
  7311. protocol: "private",
  7312. fn: function (anObject){
  7313. var self=this,$self=this;
  7314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7315. return $core.withContext(function($ctx1) {
  7316. //>>excludeEnd("ctx");
  7317. return anObject.a$cls != null && anObject.a$cls.name;
  7318. return self;
  7319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7320. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject})});
  7321. //>>excludeEnd("ctx");
  7322. },
  7323. //>>excludeStart("ide", pragmas.excludeIdeData);
  7324. args: ["anObject"],
  7325. source: "classNameOf: anObject\x0a\x09\x22Answer the class name of `anObject`, or `undefined` \x0a\x09if `anObject` is not an Smalltalk object\x22\x0a\x09\x0a\x09<inlineJS: 'return anObject.a$cls != null && anObject.a$cls.name'>",
  7326. referencedClasses: [],
  7327. //>>excludeEnd("ide");
  7328. pragmas: [["inlineJS:", ["return anObject.a$cls != null && anObject.a$cls.name"]]],
  7329. messageSends: []
  7330. }),
  7331. $globals.Set);
  7332. $core.addMethod(
  7333. $core.method({
  7334. selector: "collect:",
  7335. protocol: "enumerating",
  7336. fn: function (aBlock){
  7337. var self=this,$self=this;
  7338. var collection;
  7339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7340. return $core.withContext(function($ctx1) {
  7341. //>>excludeEnd("ctx");
  7342. collection=$recv($self._class())._new();
  7343. $self._do_((function(each){
  7344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7345. return $core.withContext(function($ctx2) {
  7346. //>>excludeEnd("ctx");
  7347. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7349. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7350. //>>excludeEnd("ctx");
  7351. }));
  7352. return collection;
  7353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7354. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection})});
  7355. //>>excludeEnd("ctx");
  7356. },
  7357. //>>excludeStart("ide", pragmas.excludeIdeData);
  7358. args: ["aBlock"],
  7359. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7360. referencedClasses: [],
  7361. //>>excludeEnd("ide");
  7362. pragmas: [],
  7363. messageSends: ["new", "class", "do:", "add:", "value:"]
  7364. }),
  7365. $globals.Set);
  7366. $core.addMethod(
  7367. $core.method({
  7368. selector: "do:",
  7369. protocol: "enumerating",
  7370. fn: function (aBlock){
  7371. var self=this,$self=this;
  7372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7373. return $core.withContext(function($ctx1) {
  7374. //>>excludeEnd("ctx");
  7375. var el, keys, i;
  7376. el = $self.fastBuckets;
  7377. keys = Object.keys(el);
  7378. for (i = 0; i < keys.length; ++i) {
  7379. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7380. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7381. else { store._do_(aBlock); }
  7382. }
  7383. el = $self.slowBucketStores;
  7384. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7385. $self.defaultBucket._do_(aBlock);
  7386. ;
  7387. return self;
  7388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7389. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7390. //>>excludeEnd("ctx");
  7391. },
  7392. //>>excludeStart("ide", pragmas.excludeIdeData);
  7393. args: ["aBlock"],
  7394. 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'>",
  7395. referencedClasses: [],
  7396. //>>excludeEnd("ide");
  7397. pragmas: [["inlineJS:", ["\x0a\x09\x09var el, keys, i;\x0a\x09\x09el = $self.fastBuckets;\x0a\x09\x09keys = Object.keys(el);\x0a\x09\x09for (i = 0; i < keys.length; ++i) {\x0a\x09\x09\x09var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);\x0a\x09\x09\x09if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }\x0a\x09\x09\x09else { store._do_(aBlock); }\x0a\x09\x09}\x0a\x09\x09el = $self.slowBucketStores;\x0a\x09\x09for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }\x0a\x09\x09$self.defaultBucket._do_(aBlock);\x0a\x09"]]],
  7398. messageSends: []
  7399. }),
  7400. $globals.Set);
  7401. $core.addMethod(
  7402. $core.method({
  7403. selector: "includes:",
  7404. protocol: "testing",
  7405. fn: function (anObject){
  7406. var self=this,$self=this;
  7407. var bucket;
  7408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7409. return $core.withContext(function($ctx1) {
  7410. //>>excludeEnd("ctx");
  7411. var $1,$2,$3,$receiver;
  7412. bucket=$self._bucketsOfElement_(anObject);
  7413. $1=$recv(bucket)._second();
  7414. if(($receiver = $1) == null || $receiver.a$nil){
  7415. $2=$recv(bucket)._third();
  7416. $3=$recv(bucket)._first();
  7417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7418. $ctx1.sendIdx["first"]=1;
  7419. //>>excludeEnd("ctx");
  7420. return $recv($2)._includes_($3);
  7421. } else {
  7422. var primitiveBucket;
  7423. primitiveBucket=$receiver;
  7424. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7425. }
  7426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7427. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket})});
  7428. //>>excludeEnd("ctx");
  7429. },
  7430. //>>excludeStart("ide", pragmas.excludeIdeData);
  7431. args: ["anObject"],
  7432. 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 ]",
  7433. referencedClasses: [],
  7434. //>>excludeEnd("ide");
  7435. pragmas: [],
  7436. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7437. }),
  7438. $globals.Set);
  7439. $core.addMethod(
  7440. $core.method({
  7441. selector: "includes:in:",
  7442. protocol: "private",
  7443. fn: function (anObject,anotherObject){
  7444. var self=this,$self=this;
  7445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7446. return $core.withContext(function($ctx1) {
  7447. //>>excludeEnd("ctx");
  7448. return anObject in anotherObject.store;
  7449. return self;
  7450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7451. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject})});
  7452. //>>excludeEnd("ctx");
  7453. },
  7454. //>>excludeStart("ide", pragmas.excludeIdeData);
  7455. args: ["anObject", "anotherObject"],
  7456. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  7457. referencedClasses: [],
  7458. //>>excludeEnd("ide");
  7459. pragmas: [["inlineJS:", ["return anObject in anotherObject.store"]]],
  7460. messageSends: []
  7461. }),
  7462. $globals.Set);
  7463. $core.addMethod(
  7464. $core.method({
  7465. selector: "initialize",
  7466. protocol: "initialization",
  7467. fn: function (){
  7468. var self=this,$self=this;
  7469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7470. return $core.withContext(function($ctx1) {
  7471. //>>excludeEnd("ctx");
  7472. (
  7473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7474. $ctx1.supercall = true,
  7475. //>>excludeEnd("ctx");
  7476. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  7477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7478. $ctx1.supercall = false;
  7479. //>>excludeEnd("ctx");;
  7480. $self.defaultBucket=[];
  7481. $self._initializeSlowBucketStores();
  7482. $self._removeAll();
  7483. return self;
  7484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7485. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  7486. //>>excludeEnd("ctx");
  7487. },
  7488. //>>excludeStart("ide", pragmas.excludeIdeData);
  7489. args: [],
  7490. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7491. referencedClasses: [],
  7492. //>>excludeEnd("ide");
  7493. pragmas: [],
  7494. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7495. }),
  7496. $globals.Set);
  7497. $core.addMethod(
  7498. $core.method({
  7499. selector: "initializeSlowBucketStores",
  7500. protocol: "initialization",
  7501. fn: function (){
  7502. var self=this,$self=this;
  7503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7504. return $core.withContext(function($ctx1) {
  7505. //>>excludeEnd("ctx");
  7506. var $1;
  7507. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7509. return $core.withContext(function($ctx2) {
  7510. //>>excludeEnd("ctx");
  7511. return $self._classNameOf_(x);
  7512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7513. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7514. //>>excludeEnd("ctx");
  7515. }));
  7516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7517. $ctx1.sendIdx["hashBlock:"]=1;
  7518. //>>excludeEnd("ctx");
  7519. $self.slowBucketStores=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7521. return $core.withContext(function($ctx2) {
  7522. //>>excludeEnd("ctx");
  7523. return $self._jsConstructorNameOf_(x);
  7524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7525. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7526. //>>excludeEnd("ctx");
  7527. }))];
  7528. return self;
  7529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7530. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{})});
  7531. //>>excludeEnd("ctx");
  7532. },
  7533. //>>excludeStart("ide", pragmas.excludeIdeData);
  7534. args: [],
  7535. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7536. referencedClasses: ["ArrayBucketStore"],
  7537. //>>excludeEnd("ide");
  7538. pragmas: [],
  7539. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  7540. }),
  7541. $globals.Set);
  7542. $core.addMethod(
  7543. $core.method({
  7544. selector: "jsConstructorNameOf:",
  7545. protocol: "private",
  7546. fn: function (anObject){
  7547. var self=this,$self=this;
  7548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7549. return $core.withContext(function($ctx1) {
  7550. //>>excludeEnd("ctx");
  7551. return anObject.constructor && anObject.constructor.name;
  7552. return self;
  7553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7554. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject})});
  7555. //>>excludeEnd("ctx");
  7556. },
  7557. //>>excludeStart("ide", pragmas.excludeIdeData);
  7558. args: ["anObject"],
  7559. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  7560. referencedClasses: [],
  7561. //>>excludeEnd("ide");
  7562. pragmas: [["inlineJS:", ["return anObject.constructor && anObject.constructor.name"]]],
  7563. messageSends: []
  7564. }),
  7565. $globals.Set);
  7566. $core.addMethod(
  7567. $core.method({
  7568. selector: "printOn:",
  7569. protocol: "printing",
  7570. fn: function (aStream){
  7571. var self=this,$self=this;
  7572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7573. return $core.withContext(function($ctx1) {
  7574. //>>excludeEnd("ctx");
  7575. (
  7576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7577. $ctx1.supercall = true,
  7578. //>>excludeEnd("ctx");
  7579. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  7580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7581. $ctx1.supercall = false;
  7582. //>>excludeEnd("ctx");;
  7583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7584. $ctx1.sendIdx["printOn:"]=1;
  7585. //>>excludeEnd("ctx");
  7586. $recv(aStream)._nextPutAll_(" (");
  7587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7588. $ctx1.sendIdx["nextPutAll:"]=1;
  7589. //>>excludeEnd("ctx");
  7590. $self._do_separatedBy_((function(each){
  7591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7592. return $core.withContext(function($ctx2) {
  7593. //>>excludeEnd("ctx");
  7594. return $recv(each)._printOn_(aStream);
  7595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7596. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7597. //>>excludeEnd("ctx");
  7598. }),(function(){
  7599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7600. return $core.withContext(function($ctx2) {
  7601. //>>excludeEnd("ctx");
  7602. return $recv(aStream)._nextPutAll_(" ");
  7603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7604. $ctx2.sendIdx["nextPutAll:"]=2;
  7605. //>>excludeEnd("ctx");
  7606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7607. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7608. //>>excludeEnd("ctx");
  7609. }));
  7610. $recv(aStream)._nextPutAll_(")");
  7611. return self;
  7612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7613. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  7614. //>>excludeEnd("ctx");
  7615. },
  7616. //>>excludeStart("ide", pragmas.excludeIdeData);
  7617. args: ["aStream"],
  7618. 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: ')'",
  7619. referencedClasses: [],
  7620. //>>excludeEnd("ide");
  7621. pragmas: [],
  7622. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  7623. }),
  7624. $globals.Set);
  7625. $core.addMethod(
  7626. $core.method({
  7627. selector: "remove:ifAbsent:",
  7628. protocol: "adding/removing",
  7629. fn: function (anObject,aBlock){
  7630. var self=this,$self=this;
  7631. var bucket;
  7632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7633. return $core.withContext(function($ctx1) {
  7634. //>>excludeEnd("ctx");
  7635. var $1,$2,$3,$receiver;
  7636. var $early={};
  7637. try {
  7638. bucket=$self._bucketsOfElement_(anObject);
  7639. $1=$recv(bucket)._second();
  7640. if(($receiver = $1) == null || $receiver.a$nil){
  7641. $2=$recv(bucket)._third();
  7642. $3=$recv(bucket)._first();
  7643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7644. $ctx1.sendIdx["first"]=1;
  7645. //>>excludeEnd("ctx");
  7646. $recv($2)._remove_ifAbsent_($3,(function(){
  7647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7648. return $core.withContext(function($ctx2) {
  7649. //>>excludeEnd("ctx");
  7650. throw $early=[$recv(aBlock)._value()];
  7651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7652. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7653. //>>excludeEnd("ctx");
  7654. }));
  7655. $self.size=$recv($self.size).__minus((1));
  7656. return $self.size;
  7657. } else {
  7658. var primitiveBucket;
  7659. primitiveBucket=$receiver;
  7660. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  7661. }
  7662. }
  7663. catch(e) {if(e===$early)return e[0]; throw e}
  7664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7665. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket})});
  7666. //>>excludeEnd("ctx");
  7667. },
  7668. //>>excludeStart("ide", pragmas.excludeIdeData);
  7669. args: ["anObject", "aBlock"],
  7670. source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third remove: bucket first ifAbsent: [ ^aBlock value ]. size := size - 1 ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ifAbsent: aBlock ]",
  7671. referencedClasses: [],
  7672. //>>excludeEnd("ide");
  7673. pragmas: [],
  7674. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:ifAbsent:"]
  7675. }),
  7676. $globals.Set);
  7677. $core.addMethod(
  7678. $core.method({
  7679. selector: "remove:in:ifAbsent:",
  7680. protocol: "private",
  7681. fn: function (anObject,anotherObject,aBlock){
  7682. var self=this,$self=this;
  7683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7684. return $core.withContext(function($ctx1) {
  7685. //>>excludeEnd("ctx");
  7686. if (anObject in anotherObject.store) {
  7687. delete anotherObject.store[anObject];
  7688. $self.size--;
  7689. return anObject;
  7690. } else {
  7691. return aBlock._value();
  7692. };
  7693. return self;
  7694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7695. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock})});
  7696. //>>excludeEnd("ctx");
  7697. },
  7698. //>>excludeStart("ide", pragmas.excludeIdeData);
  7699. args: ["anObject", "anotherObject", "aBlock"],
  7700. source: "remove: anObject in: anotherObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) {\x0a\x09\x09\x09delete anotherObject.store[anObject];\x0a\x09\x09\x09$self.size--;\x0a\x09\x09\x09return anObject;\x0a\x09\x09} else {\x0a\x09\x09\x09return aBlock._value();\x0a\x09\x09}'>",
  7701. referencedClasses: [],
  7702. //>>excludeEnd("ide");
  7703. pragmas: [["inlineJS:", ["\x0a\x09\x09if (anObject in anotherObject.store) {\x0a\x09\x09\x09delete anotherObject.store[anObject];\x0a\x09\x09\x09$self.size--;\x0a\x09\x09\x09return anObject;\x0a\x09\x09} else {\x0a\x09\x09\x09return aBlock._value();\x0a\x09\x09}"]]],
  7704. messageSends: []
  7705. }),
  7706. $globals.Set);
  7707. $core.addMethod(
  7708. $core.method({
  7709. selector: "removeAll",
  7710. protocol: "adding/removing",
  7711. fn: function (){
  7712. var self=this,$self=this;
  7713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7714. return $core.withContext(function($ctx1) {
  7715. //>>excludeEnd("ctx");
  7716. $self.fastBuckets = {
  7717. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  7718. "number": { store: Object.create(null), fn: Number },
  7719. "string": { store: Object.create(null) }
  7720. };
  7721. $self.slowBucketStores.forEach(function (x) { x._removeAll(); });
  7722. $self.defaultBucket._removeAll();
  7723. $self.size = 0;
  7724. ;
  7725. return self;
  7726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7727. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  7728. //>>excludeEnd("ctx");
  7729. },
  7730. //>>excludeStart("ide", pragmas.excludeIdeData);
  7731. args: [],
  7732. 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'>",
  7733. referencedClasses: [],
  7734. //>>excludeEnd("ide");
  7735. pragmas: [["inlineJS:", ["\x0a\x09\x09$self.fastBuckets = {\x0a\x09\x09\x09\x22boolean\x22: { store: Object.create(null), fn: function (x) { return {\x22true\x22: true, \x22false\x22: false, \x22null\x22: null}[x]; } },\x0a\x09\x09\x09\x22number\x22: { store: Object.create(null), fn: Number },\x0a\x09\x09\x09\x22string\x22: { store: Object.create(null) }\x0a\x09\x09};\x0a\x09\x09$self.slowBucketStores.forEach(function (x) { x._removeAll(); });\x0a\x09\x09$self.defaultBucket._removeAll();\x0a\x09\x09$self.size = 0;\x0a\x09"]]],
  7736. messageSends: []
  7737. }),
  7738. $globals.Set);
  7739. $core.addMethod(
  7740. $core.method({
  7741. selector: "select:",
  7742. protocol: "enumerating",
  7743. fn: function (aBlock){
  7744. var self=this,$self=this;
  7745. var collection;
  7746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7747. return $core.withContext(function($ctx1) {
  7748. //>>excludeEnd("ctx");
  7749. var $1;
  7750. collection=$recv($self._class())._new();
  7751. $self._do_((function(each){
  7752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7753. return $core.withContext(function($ctx2) {
  7754. //>>excludeEnd("ctx");
  7755. $1=$recv(aBlock)._value_(each);
  7756. if($core.assert($1)){
  7757. return $recv(collection)._add_(each);
  7758. }
  7759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7760. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7761. //>>excludeEnd("ctx");
  7762. }));
  7763. return collection;
  7764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7765. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection})});
  7766. //>>excludeEnd("ctx");
  7767. },
  7768. //>>excludeStart("ide", pragmas.excludeIdeData);
  7769. args: ["aBlock"],
  7770. 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",
  7771. referencedClasses: [],
  7772. //>>excludeEnd("ide");
  7773. pragmas: [],
  7774. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7775. }),
  7776. $globals.Set);
  7777. $core.addMethod(
  7778. $core.method({
  7779. selector: "select:thenCollect:",
  7780. protocol: "enumerating",
  7781. fn: function (selectBlock,collectBlock){
  7782. var self=this,$self=this;
  7783. var collection;
  7784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7785. return $core.withContext(function($ctx1) {
  7786. //>>excludeEnd("ctx");
  7787. var $1;
  7788. collection=$recv($self._class())._new();
  7789. $self._do_((function(each){
  7790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7791. return $core.withContext(function($ctx2) {
  7792. //>>excludeEnd("ctx");
  7793. $1=$recv(selectBlock)._value_(each);
  7794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7795. $ctx2.sendIdx["value:"]=1;
  7796. //>>excludeEnd("ctx");
  7797. if($core.assert($1)){
  7798. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  7799. }
  7800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7801. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7802. //>>excludeEnd("ctx");
  7803. }));
  7804. return collection;
  7805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7806. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection})});
  7807. //>>excludeEnd("ctx");
  7808. },
  7809. //>>excludeStart("ide", pragmas.excludeIdeData);
  7810. args: ["selectBlock", "collectBlock"],
  7811. 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",
  7812. referencedClasses: [],
  7813. //>>excludeEnd("ide");
  7814. pragmas: [],
  7815. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7816. }),
  7817. $globals.Set);
  7818. $core.addMethod(
  7819. $core.method({
  7820. selector: "size",
  7821. protocol: "accessing",
  7822. fn: function (){
  7823. var self=this,$self=this;
  7824. return $self.size;
  7825. },
  7826. //>>excludeStart("ide", pragmas.excludeIdeData);
  7827. args: [],
  7828. source: "size\x0a\x09^ size",
  7829. referencedClasses: [],
  7830. //>>excludeEnd("ide");
  7831. pragmas: [],
  7832. messageSends: []
  7833. }),
  7834. $globals.Set);
  7835. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  7836. //>>excludeStart("ide", pragmas.excludeIdeData);
  7837. $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.";
  7838. //>>excludeEnd("ide");
  7839. $core.addMethod(
  7840. $core.method({
  7841. selector: "<<",
  7842. protocol: "writing",
  7843. fn: function (anObject){
  7844. var self=this,$self=this;
  7845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7846. return $core.withContext(function($ctx1) {
  7847. //>>excludeEnd("ctx");
  7848. $self._write_(anObject);
  7849. return self;
  7850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7851. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject})});
  7852. //>>excludeEnd("ctx");
  7853. },
  7854. //>>excludeStart("ide", pragmas.excludeIdeData);
  7855. args: ["anObject"],
  7856. source: "<< anObject\x0a\x09self write: anObject",
  7857. referencedClasses: [],
  7858. //>>excludeEnd("ide");
  7859. pragmas: [],
  7860. messageSends: ["write:"]
  7861. }),
  7862. $globals.ProtoStream);
  7863. $core.addMethod(
  7864. $core.method({
  7865. selector: "atEnd",
  7866. protocol: "testing",
  7867. fn: function (){
  7868. var self=this,$self=this;
  7869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7870. return $core.withContext(function($ctx1) {
  7871. //>>excludeEnd("ctx");
  7872. $self._subclassResponsibility();
  7873. return self;
  7874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7875. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  7876. //>>excludeEnd("ctx");
  7877. },
  7878. //>>excludeStart("ide", pragmas.excludeIdeData);
  7879. args: [],
  7880. source: "atEnd\x0a\x09self subclassResponsibility",
  7881. referencedClasses: [],
  7882. //>>excludeEnd("ide");
  7883. pragmas: [],
  7884. messageSends: ["subclassResponsibility"]
  7885. }),
  7886. $globals.ProtoStream);
  7887. $core.addMethod(
  7888. $core.method({
  7889. selector: "atStart",
  7890. protocol: "testing",
  7891. fn: function (){
  7892. var self=this,$self=this;
  7893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7894. return $core.withContext(function($ctx1) {
  7895. //>>excludeEnd("ctx");
  7896. $self._subclassResponsibility();
  7897. return self;
  7898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7899. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  7900. //>>excludeEnd("ctx");
  7901. },
  7902. //>>excludeStart("ide", pragmas.excludeIdeData);
  7903. args: [],
  7904. source: "atStart\x0a\x09self subclassResponsibility",
  7905. referencedClasses: [],
  7906. //>>excludeEnd("ide");
  7907. pragmas: [],
  7908. messageSends: ["subclassResponsibility"]
  7909. }),
  7910. $globals.ProtoStream);
  7911. $core.addMethod(
  7912. $core.method({
  7913. selector: "contents",
  7914. protocol: "accessing",
  7915. fn: function (){
  7916. var self=this,$self=this;
  7917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7918. return $core.withContext(function($ctx1) {
  7919. //>>excludeEnd("ctx");
  7920. $self._subclassResponsibility();
  7921. return self;
  7922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7923. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  7924. //>>excludeEnd("ctx");
  7925. },
  7926. //>>excludeStart("ide", pragmas.excludeIdeData);
  7927. args: [],
  7928. source: "contents\x0a\x09self subclassResponsibility",
  7929. referencedClasses: [],
  7930. //>>excludeEnd("ide");
  7931. pragmas: [],
  7932. messageSends: ["subclassResponsibility"]
  7933. }),
  7934. $globals.ProtoStream);
  7935. $core.addMethod(
  7936. $core.method({
  7937. selector: "do:",
  7938. protocol: "enumerating",
  7939. fn: function (aBlock){
  7940. var self=this,$self=this;
  7941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7942. return $core.withContext(function($ctx1) {
  7943. //>>excludeEnd("ctx");
  7944. $recv((function(){
  7945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7946. return $core.withContext(function($ctx2) {
  7947. //>>excludeEnd("ctx");
  7948. return $self._atEnd();
  7949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7951. //>>excludeEnd("ctx");
  7952. }))._whileFalse_((function(){
  7953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7954. return $core.withContext(function($ctx2) {
  7955. //>>excludeEnd("ctx");
  7956. return $recv(aBlock)._value_($self._next());
  7957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7958. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7959. //>>excludeEnd("ctx");
  7960. }));
  7961. return self;
  7962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7963. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7964. //>>excludeEnd("ctx");
  7965. },
  7966. //>>excludeStart("ide", pragmas.excludeIdeData);
  7967. args: ["aBlock"],
  7968. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  7969. referencedClasses: [],
  7970. //>>excludeEnd("ide");
  7971. pragmas: [],
  7972. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  7973. }),
  7974. $globals.ProtoStream);
  7975. $core.addMethod(
  7976. $core.method({
  7977. selector: "isEmpty",
  7978. protocol: "testing",
  7979. fn: function (){
  7980. var self=this,$self=this;
  7981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7982. return $core.withContext(function($ctx1) {
  7983. //>>excludeEnd("ctx");
  7984. return $recv($self._atStart())._and_((function(){
  7985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7986. return $core.withContext(function($ctx2) {
  7987. //>>excludeEnd("ctx");
  7988. return $self._atEnd();
  7989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7991. //>>excludeEnd("ctx");
  7992. }));
  7993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7994. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  7995. //>>excludeEnd("ctx");
  7996. },
  7997. //>>excludeStart("ide", pragmas.excludeIdeData);
  7998. args: [],
  7999. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  8000. referencedClasses: [],
  8001. //>>excludeEnd("ide");
  8002. pragmas: [],
  8003. messageSends: ["and:", "atStart", "atEnd"]
  8004. }),
  8005. $globals.ProtoStream);
  8006. $core.addMethod(
  8007. $core.method({
  8008. selector: "next",
  8009. protocol: "reading",
  8010. fn: function (){
  8011. var self=this,$self=this;
  8012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8013. return $core.withContext(function($ctx1) {
  8014. //>>excludeEnd("ctx");
  8015. var $1;
  8016. $1=$self._atEnd();
  8017. if($core.assert($1)){
  8018. return nil;
  8019. } else {
  8020. return $self._subclassResponsibility();
  8021. }
  8022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8023. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  8024. //>>excludeEnd("ctx");
  8025. },
  8026. //>>excludeStart("ide", pragmas.excludeIdeData);
  8027. args: [],
  8028. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8029. referencedClasses: [],
  8030. //>>excludeEnd("ide");
  8031. pragmas: [],
  8032. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8033. }),
  8034. $globals.ProtoStream);
  8035. $core.addMethod(
  8036. $core.method({
  8037. selector: "nextPut:",
  8038. protocol: "writing",
  8039. fn: function (anObject){
  8040. var self=this,$self=this;
  8041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8042. return $core.withContext(function($ctx1) {
  8043. //>>excludeEnd("ctx");
  8044. $self._subclassResponsibility();
  8045. return self;
  8046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8047. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  8048. //>>excludeEnd("ctx");
  8049. },
  8050. //>>excludeStart("ide", pragmas.excludeIdeData);
  8051. args: ["anObject"],
  8052. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  8053. referencedClasses: [],
  8054. //>>excludeEnd("ide");
  8055. pragmas: [],
  8056. messageSends: ["subclassResponsibility"]
  8057. }),
  8058. $globals.ProtoStream);
  8059. $core.addMethod(
  8060. $core.method({
  8061. selector: "nextPutAll:",
  8062. protocol: "writing",
  8063. fn: function (aCollection){
  8064. var self=this,$self=this;
  8065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8066. return $core.withContext(function($ctx1) {
  8067. //>>excludeEnd("ctx");
  8068. $recv(aCollection)._do_((function(each){
  8069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8070. return $core.withContext(function($ctx2) {
  8071. //>>excludeEnd("ctx");
  8072. return $self._nextPut_(each);
  8073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8074. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8075. //>>excludeEnd("ctx");
  8076. }));
  8077. return self;
  8078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8079. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection})});
  8080. //>>excludeEnd("ctx");
  8081. },
  8082. //>>excludeStart("ide", pragmas.excludeIdeData);
  8083. args: ["aCollection"],
  8084. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  8085. referencedClasses: [],
  8086. //>>excludeEnd("ide");
  8087. pragmas: [],
  8088. messageSends: ["do:", "nextPut:"]
  8089. }),
  8090. $globals.ProtoStream);
  8091. $core.addMethod(
  8092. $core.method({
  8093. selector: "nextPutString:",
  8094. protocol: "writing",
  8095. fn: function (aString){
  8096. var self=this,$self=this;
  8097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8098. return $core.withContext(function($ctx1) {
  8099. //>>excludeEnd("ctx");
  8100. $self._nextPut_(aString);
  8101. return self;
  8102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8103. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  8104. //>>excludeEnd("ctx");
  8105. },
  8106. //>>excludeStart("ide", pragmas.excludeIdeData);
  8107. args: ["aString"],
  8108. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  8109. referencedClasses: [],
  8110. //>>excludeEnd("ide");
  8111. pragmas: [],
  8112. messageSends: ["nextPut:"]
  8113. }),
  8114. $globals.ProtoStream);
  8115. $core.addMethod(
  8116. $core.method({
  8117. selector: "peek",
  8118. protocol: "reading",
  8119. fn: function (){
  8120. var self=this,$self=this;
  8121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8122. return $core.withContext(function($ctx1) {
  8123. //>>excludeEnd("ctx");
  8124. var $1;
  8125. $1=$self._atEnd();
  8126. if($core.assert($1)){
  8127. return nil;
  8128. } else {
  8129. return $self._subclassResponsibility();
  8130. }
  8131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8132. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  8133. //>>excludeEnd("ctx");
  8134. },
  8135. //>>excludeStart("ide", pragmas.excludeIdeData);
  8136. args: [],
  8137. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8138. referencedClasses: [],
  8139. //>>excludeEnd("ide");
  8140. pragmas: [],
  8141. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8142. }),
  8143. $globals.ProtoStream);
  8144. $core.addMethod(
  8145. $core.method({
  8146. selector: "reset",
  8147. protocol: "actions",
  8148. fn: function (){
  8149. var self=this,$self=this;
  8150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8151. return $core.withContext(function($ctx1) {
  8152. //>>excludeEnd("ctx");
  8153. $self._subclassResponsibility();
  8154. return self;
  8155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8156. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  8157. //>>excludeEnd("ctx");
  8158. },
  8159. //>>excludeStart("ide", pragmas.excludeIdeData);
  8160. args: [],
  8161. source: "reset\x0a\x09self subclassResponsibility",
  8162. referencedClasses: [],
  8163. //>>excludeEnd("ide");
  8164. pragmas: [],
  8165. messageSends: ["subclassResponsibility"]
  8166. }),
  8167. $globals.ProtoStream);
  8168. $core.addMethod(
  8169. $core.method({
  8170. selector: "resetContents",
  8171. protocol: "actions",
  8172. fn: function (){
  8173. var self=this,$self=this;
  8174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8175. return $core.withContext(function($ctx1) {
  8176. //>>excludeEnd("ctx");
  8177. $self._subclassResponsibility();
  8178. return self;
  8179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8180. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  8181. //>>excludeEnd("ctx");
  8182. },
  8183. //>>excludeStart("ide", pragmas.excludeIdeData);
  8184. args: [],
  8185. source: "resetContents\x0a\x09self subclassResponsibility",
  8186. referencedClasses: [],
  8187. //>>excludeEnd("ide");
  8188. pragmas: [],
  8189. messageSends: ["subclassResponsibility"]
  8190. }),
  8191. $globals.ProtoStream);
  8192. $core.addMethod(
  8193. $core.method({
  8194. selector: "setToEnd",
  8195. protocol: "positioning",
  8196. fn: function (){
  8197. var self=this,$self=this;
  8198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8199. return $core.withContext(function($ctx1) {
  8200. //>>excludeEnd("ctx");
  8201. $self._subclassResponsibility();
  8202. return self;
  8203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8204. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  8205. //>>excludeEnd("ctx");
  8206. },
  8207. //>>excludeStart("ide", pragmas.excludeIdeData);
  8208. args: [],
  8209. source: "setToEnd\x0a\x09self subclassResponsibility",
  8210. referencedClasses: [],
  8211. //>>excludeEnd("ide");
  8212. pragmas: [],
  8213. messageSends: ["subclassResponsibility"]
  8214. }),
  8215. $globals.ProtoStream);
  8216. $core.addMethod(
  8217. $core.method({
  8218. selector: "setToStart",
  8219. protocol: "positioning",
  8220. fn: function (){
  8221. var self=this,$self=this;
  8222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8223. return $core.withContext(function($ctx1) {
  8224. //>>excludeEnd("ctx");
  8225. $self._reset();
  8226. return self;
  8227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8228. }, function($ctx1) {$ctx1.fill(self,"setToStart",{})});
  8229. //>>excludeEnd("ctx");
  8230. },
  8231. //>>excludeStart("ide", pragmas.excludeIdeData);
  8232. args: [],
  8233. source: "setToStart\x0a\x09self reset",
  8234. referencedClasses: [],
  8235. //>>excludeEnd("ide");
  8236. pragmas: [],
  8237. messageSends: ["reset"]
  8238. }),
  8239. $globals.ProtoStream);
  8240. $core.addMethod(
  8241. $core.method({
  8242. selector: "write:",
  8243. protocol: "writing",
  8244. fn: function (anObject){
  8245. var self=this,$self=this;
  8246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8247. return $core.withContext(function($ctx1) {
  8248. //>>excludeEnd("ctx");
  8249. $recv(anObject)._putOn_(self);
  8250. return self;
  8251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8252. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject})});
  8253. //>>excludeEnd("ctx");
  8254. },
  8255. //>>excludeStart("ide", pragmas.excludeIdeData);
  8256. args: ["anObject"],
  8257. source: "write: anObject\x0a\x09anObject putOn: self",
  8258. referencedClasses: [],
  8259. //>>excludeEnd("ide");
  8260. pragmas: [],
  8261. messageSends: ["putOn:"]
  8262. }),
  8263. $globals.ProtoStream);
  8264. $core.addMethod(
  8265. $core.method({
  8266. selector: "on:",
  8267. protocol: "instance creation",
  8268. fn: function (aCollection){
  8269. var self=this,$self=this;
  8270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8271. return $core.withContext(function($ctx1) {
  8272. //>>excludeEnd("ctx");
  8273. var $1;
  8274. $1=$self._new();
  8275. $recv($1)._setCollection_(aCollection);
  8276. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8277. return $recv($1)._yourself();
  8278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8279. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  8280. //>>excludeEnd("ctx");
  8281. },
  8282. //>>excludeStart("ide", pragmas.excludeIdeData);
  8283. args: ["aCollection"],
  8284. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8285. referencedClasses: [],
  8286. //>>excludeEnd("ide");
  8287. pragmas: [],
  8288. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8289. }),
  8290. $globals.ProtoStream.a$cls);
  8291. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  8292. //>>excludeStart("ide", pragmas.excludeIdeData);
  8293. $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.";
  8294. //>>excludeEnd("ide");
  8295. $core.addMethod(
  8296. $core.method({
  8297. selector: "atEnd",
  8298. protocol: "testing",
  8299. fn: function (){
  8300. var self=this,$self=this;
  8301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8302. return $core.withContext(function($ctx1) {
  8303. //>>excludeEnd("ctx");
  8304. return $recv($self._position()).__eq($self._size());
  8305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8306. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  8307. //>>excludeEnd("ctx");
  8308. },
  8309. //>>excludeStart("ide", pragmas.excludeIdeData);
  8310. args: [],
  8311. source: "atEnd\x0a\x09^ self position = self size",
  8312. referencedClasses: [],
  8313. //>>excludeEnd("ide");
  8314. pragmas: [],
  8315. messageSends: ["=", "position", "size"]
  8316. }),
  8317. $globals.Stream);
  8318. $core.addMethod(
  8319. $core.method({
  8320. selector: "atStart",
  8321. protocol: "testing",
  8322. fn: function (){
  8323. var self=this,$self=this;
  8324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8325. return $core.withContext(function($ctx1) {
  8326. //>>excludeEnd("ctx");
  8327. return $recv($self._position()).__eq((0));
  8328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8329. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  8330. //>>excludeEnd("ctx");
  8331. },
  8332. //>>excludeStart("ide", pragmas.excludeIdeData);
  8333. args: [],
  8334. source: "atStart\x0a\x09^ self position = 0",
  8335. referencedClasses: [],
  8336. //>>excludeEnd("ide");
  8337. pragmas: [],
  8338. messageSends: ["=", "position"]
  8339. }),
  8340. $globals.Stream);
  8341. $core.addMethod(
  8342. $core.method({
  8343. selector: "close",
  8344. protocol: "actions",
  8345. fn: function (){
  8346. var self=this,$self=this;
  8347. return self;
  8348. },
  8349. //>>excludeStart("ide", pragmas.excludeIdeData);
  8350. args: [],
  8351. source: "close",
  8352. referencedClasses: [],
  8353. //>>excludeEnd("ide");
  8354. pragmas: [],
  8355. messageSends: []
  8356. }),
  8357. $globals.Stream);
  8358. $core.addMethod(
  8359. $core.method({
  8360. selector: "collection",
  8361. protocol: "accessing",
  8362. fn: function (){
  8363. var self=this,$self=this;
  8364. return $self.collection;
  8365. },
  8366. //>>excludeStart("ide", pragmas.excludeIdeData);
  8367. args: [],
  8368. source: "collection\x0a\x09^ collection",
  8369. referencedClasses: [],
  8370. //>>excludeEnd("ide");
  8371. pragmas: [],
  8372. messageSends: []
  8373. }),
  8374. $globals.Stream);
  8375. $core.addMethod(
  8376. $core.method({
  8377. selector: "contents",
  8378. protocol: "accessing",
  8379. fn: function (){
  8380. var self=this,$self=this;
  8381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8382. return $core.withContext(function($ctx1) {
  8383. //>>excludeEnd("ctx");
  8384. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  8385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8386. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  8387. //>>excludeEnd("ctx");
  8388. },
  8389. //>>excludeStart("ide", pragmas.excludeIdeData);
  8390. args: [],
  8391. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8392. referencedClasses: [],
  8393. //>>excludeEnd("ide");
  8394. pragmas: [],
  8395. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8396. }),
  8397. $globals.Stream);
  8398. $core.addMethod(
  8399. $core.method({
  8400. selector: "flush",
  8401. protocol: "actions",
  8402. fn: function (){
  8403. var self=this,$self=this;
  8404. return self;
  8405. },
  8406. //>>excludeStart("ide", pragmas.excludeIdeData);
  8407. args: [],
  8408. source: "flush",
  8409. referencedClasses: [],
  8410. //>>excludeEnd("ide");
  8411. pragmas: [],
  8412. messageSends: []
  8413. }),
  8414. $globals.Stream);
  8415. $core.addMethod(
  8416. $core.method({
  8417. selector: "isEmpty",
  8418. protocol: "testing",
  8419. fn: function (){
  8420. var self=this,$self=this;
  8421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8422. return $core.withContext(function($ctx1) {
  8423. //>>excludeEnd("ctx");
  8424. return $recv($self._size()).__eq((0));
  8425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8426. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  8427. //>>excludeEnd("ctx");
  8428. },
  8429. //>>excludeStart("ide", pragmas.excludeIdeData);
  8430. args: [],
  8431. source: "isEmpty\x0a\x09^ self size = 0",
  8432. referencedClasses: [],
  8433. //>>excludeEnd("ide");
  8434. pragmas: [],
  8435. messageSends: ["=", "size"]
  8436. }),
  8437. $globals.Stream);
  8438. $core.addMethod(
  8439. $core.method({
  8440. selector: "next",
  8441. protocol: "reading",
  8442. fn: function (){
  8443. var self=this,$self=this;
  8444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8445. return $core.withContext(function($ctx1) {
  8446. //>>excludeEnd("ctx");
  8447. var $1,$3,$2;
  8448. $1=$self._atEnd();
  8449. if($core.assert($1)){
  8450. return nil;
  8451. } else {
  8452. $3=$self._position();
  8453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8454. $ctx1.sendIdx["position"]=1;
  8455. //>>excludeEnd("ctx");
  8456. $2=$recv($3).__plus((1));
  8457. $self._position_($2);
  8458. return $recv($self.collection)._at_($self._position());
  8459. }
  8460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8461. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  8462. //>>excludeEnd("ctx");
  8463. },
  8464. //>>excludeStart("ide", pragmas.excludeIdeData);
  8465. args: [],
  8466. 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 ]",
  8467. referencedClasses: [],
  8468. //>>excludeEnd("ide");
  8469. pragmas: [],
  8470. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8471. }),
  8472. $globals.Stream);
  8473. $core.addMethod(
  8474. $core.method({
  8475. selector: "next:",
  8476. protocol: "reading",
  8477. fn: function (anInteger){
  8478. var self=this,$self=this;
  8479. var tempCollection;
  8480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8481. return $core.withContext(function($ctx1) {
  8482. //>>excludeEnd("ctx");
  8483. var $1;
  8484. tempCollection=$recv($recv($self._collection())._class())._new();
  8485. $recv(anInteger)._timesRepeat_((function(){
  8486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8487. return $core.withContext(function($ctx2) {
  8488. //>>excludeEnd("ctx");
  8489. $1=$self._atEnd();
  8490. if(!$core.assert($1)){
  8491. return $recv(tempCollection)._add_($self._next());
  8492. }
  8493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8494. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8495. //>>excludeEnd("ctx");
  8496. }));
  8497. return tempCollection;
  8498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8499. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8500. //>>excludeEnd("ctx");
  8501. },
  8502. //>>excludeStart("ide", pragmas.excludeIdeData);
  8503. args: ["anInteger"],
  8504. 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",
  8505. referencedClasses: [],
  8506. //>>excludeEnd("ide");
  8507. pragmas: [],
  8508. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8509. }),
  8510. $globals.Stream);
  8511. $core.addMethod(
  8512. $core.method({
  8513. selector: "nextPut:",
  8514. protocol: "writing",
  8515. fn: function (anObject){
  8516. var self=this,$self=this;
  8517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8518. return $core.withContext(function($ctx1) {
  8519. //>>excludeEnd("ctx");
  8520. var $2,$1,$3,$4;
  8521. $2=$self._position();
  8522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8523. $ctx1.sendIdx["position"]=1;
  8524. //>>excludeEnd("ctx");
  8525. $1=$recv($2).__plus((1));
  8526. $self._position_($1);
  8527. $3=$self._collection();
  8528. $4=$self._position();
  8529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8530. $ctx1.sendIdx["position"]=2;
  8531. //>>excludeEnd("ctx");
  8532. $recv($3)._at_put_($4,anObject);
  8533. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8534. return self;
  8535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8536. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  8537. //>>excludeEnd("ctx");
  8538. },
  8539. //>>excludeStart("ide", pragmas.excludeIdeData);
  8540. args: ["anObject"],
  8541. 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)",
  8542. referencedClasses: [],
  8543. //>>excludeEnd("ide");
  8544. pragmas: [],
  8545. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8546. }),
  8547. $globals.Stream);
  8548. $core.addMethod(
  8549. $core.method({
  8550. selector: "peek",
  8551. protocol: "reading",
  8552. fn: function (){
  8553. var self=this,$self=this;
  8554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8555. return $core.withContext(function($ctx1) {
  8556. //>>excludeEnd("ctx");
  8557. var $1;
  8558. $1=$self._atEnd();
  8559. if(!$core.assert($1)){
  8560. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  8561. }
  8562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8563. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  8564. //>>excludeEnd("ctx");
  8565. },
  8566. //>>excludeStart("ide", pragmas.excludeIdeData);
  8567. args: [],
  8568. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8569. referencedClasses: [],
  8570. //>>excludeEnd("ide");
  8571. pragmas: [],
  8572. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8573. }),
  8574. $globals.Stream);
  8575. $core.addMethod(
  8576. $core.method({
  8577. selector: "position",
  8578. protocol: "accessing",
  8579. fn: function (){
  8580. var self=this,$self=this;
  8581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8582. return $core.withContext(function($ctx1) {
  8583. //>>excludeEnd("ctx");
  8584. var $1,$receiver;
  8585. $1=$self.position;
  8586. if(($receiver = $1) == null || $receiver.a$nil){
  8587. $self.position=(0);
  8588. return $self.position;
  8589. } else {
  8590. return $1;
  8591. }
  8592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8593. }, function($ctx1) {$ctx1.fill(self,"position",{})});
  8594. //>>excludeEnd("ctx");
  8595. },
  8596. //>>excludeStart("ide", pragmas.excludeIdeData);
  8597. args: [],
  8598. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  8599. referencedClasses: [],
  8600. //>>excludeEnd("ide");
  8601. pragmas: [],
  8602. messageSends: ["ifNil:"]
  8603. }),
  8604. $globals.Stream);
  8605. $core.addMethod(
  8606. $core.method({
  8607. selector: "position:",
  8608. protocol: "accessing",
  8609. fn: function (anInteger){
  8610. var self=this,$self=this;
  8611. $self.position=anInteger;
  8612. return self;
  8613. },
  8614. //>>excludeStart("ide", pragmas.excludeIdeData);
  8615. args: ["anInteger"],
  8616. source: "position: anInteger\x0a\x09position := anInteger",
  8617. referencedClasses: [],
  8618. //>>excludeEnd("ide");
  8619. pragmas: [],
  8620. messageSends: []
  8621. }),
  8622. $globals.Stream);
  8623. $core.addMethod(
  8624. $core.method({
  8625. selector: "reset",
  8626. protocol: "actions",
  8627. fn: function (){
  8628. var self=this,$self=this;
  8629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8630. return $core.withContext(function($ctx1) {
  8631. //>>excludeEnd("ctx");
  8632. $self._position_((0));
  8633. return self;
  8634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8635. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  8636. //>>excludeEnd("ctx");
  8637. },
  8638. //>>excludeStart("ide", pragmas.excludeIdeData);
  8639. args: [],
  8640. source: "reset\x0a\x09self position: 0",
  8641. referencedClasses: [],
  8642. //>>excludeEnd("ide");
  8643. pragmas: [],
  8644. messageSends: ["position:"]
  8645. }),
  8646. $globals.Stream);
  8647. $core.addMethod(
  8648. $core.method({
  8649. selector: "resetContents",
  8650. protocol: "actions",
  8651. fn: function (){
  8652. var self=this,$self=this;
  8653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8654. return $core.withContext(function($ctx1) {
  8655. //>>excludeEnd("ctx");
  8656. $self._reset();
  8657. $self._setStreamSize_((0));
  8658. return self;
  8659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8660. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  8661. //>>excludeEnd("ctx");
  8662. },
  8663. //>>excludeStart("ide", pragmas.excludeIdeData);
  8664. args: [],
  8665. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  8666. referencedClasses: [],
  8667. //>>excludeEnd("ide");
  8668. pragmas: [],
  8669. messageSends: ["reset", "setStreamSize:"]
  8670. }),
  8671. $globals.Stream);
  8672. $core.addMethod(
  8673. $core.method({
  8674. selector: "setCollection:",
  8675. protocol: "accessing",
  8676. fn: function (aCollection){
  8677. var self=this,$self=this;
  8678. $self.collection=aCollection;
  8679. return self;
  8680. },
  8681. //>>excludeStart("ide", pragmas.excludeIdeData);
  8682. args: ["aCollection"],
  8683. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  8684. referencedClasses: [],
  8685. //>>excludeEnd("ide");
  8686. pragmas: [],
  8687. messageSends: []
  8688. }),
  8689. $globals.Stream);
  8690. $core.addMethod(
  8691. $core.method({
  8692. selector: "setStreamSize:",
  8693. protocol: "accessing",
  8694. fn: function (anInteger){
  8695. var self=this,$self=this;
  8696. $self.streamSize=anInteger;
  8697. return self;
  8698. },
  8699. //>>excludeStart("ide", pragmas.excludeIdeData);
  8700. args: ["anInteger"],
  8701. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  8702. referencedClasses: [],
  8703. //>>excludeEnd("ide");
  8704. pragmas: [],
  8705. messageSends: []
  8706. }),
  8707. $globals.Stream);
  8708. $core.addMethod(
  8709. $core.method({
  8710. selector: "setToEnd",
  8711. protocol: "positioning",
  8712. fn: function (){
  8713. var self=this,$self=this;
  8714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8715. return $core.withContext(function($ctx1) {
  8716. //>>excludeEnd("ctx");
  8717. $self._position_($self._size());
  8718. return self;
  8719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8720. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  8721. //>>excludeEnd("ctx");
  8722. },
  8723. //>>excludeStart("ide", pragmas.excludeIdeData);
  8724. args: [],
  8725. source: "setToEnd\x0a\x09self position: self size",
  8726. referencedClasses: [],
  8727. //>>excludeEnd("ide");
  8728. pragmas: [],
  8729. messageSends: ["position:", "size"]
  8730. }),
  8731. $globals.Stream);
  8732. $core.addMethod(
  8733. $core.method({
  8734. selector: "size",
  8735. protocol: "accessing",
  8736. fn: function (){
  8737. var self=this,$self=this;
  8738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8739. return $core.withContext(function($ctx1) {
  8740. //>>excludeEnd("ctx");
  8741. return $self._streamSize();
  8742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8743. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  8744. //>>excludeEnd("ctx");
  8745. },
  8746. //>>excludeStart("ide", pragmas.excludeIdeData);
  8747. args: [],
  8748. source: "size\x0a\x09^ self streamSize",
  8749. referencedClasses: [],
  8750. //>>excludeEnd("ide");
  8751. pragmas: [],
  8752. messageSends: ["streamSize"]
  8753. }),
  8754. $globals.Stream);
  8755. $core.addMethod(
  8756. $core.method({
  8757. selector: "skip:",
  8758. protocol: "positioning",
  8759. fn: function (anInteger){
  8760. var self=this,$self=this;
  8761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8762. return $core.withContext(function($ctx1) {
  8763. //>>excludeEnd("ctx");
  8764. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  8765. return self;
  8766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8767. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger})});
  8768. //>>excludeEnd("ctx");
  8769. },
  8770. //>>excludeStart("ide", pragmas.excludeIdeData);
  8771. args: ["anInteger"],
  8772. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  8773. referencedClasses: [],
  8774. //>>excludeEnd("ide");
  8775. pragmas: [],
  8776. messageSends: ["position:", "min:max:", "+", "position", "size"]
  8777. }),
  8778. $globals.Stream);
  8779. $core.addMethod(
  8780. $core.method({
  8781. selector: "streamSize",
  8782. protocol: "accessing",
  8783. fn: function (){
  8784. var self=this,$self=this;
  8785. return $self.streamSize;
  8786. },
  8787. //>>excludeStart("ide", pragmas.excludeIdeData);
  8788. args: [],
  8789. source: "streamSize\x0a\x09^ streamSize",
  8790. referencedClasses: [],
  8791. //>>excludeEnd("ide");
  8792. pragmas: [],
  8793. messageSends: []
  8794. }),
  8795. $globals.Stream);
  8796. $core.addMethod(
  8797. $core.method({
  8798. selector: "on:",
  8799. protocol: "instance creation",
  8800. fn: function (aCollection){
  8801. var self=this,$self=this;
  8802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8803. return $core.withContext(function($ctx1) {
  8804. //>>excludeEnd("ctx");
  8805. var $1;
  8806. $1=$self._new();
  8807. $recv($1)._setCollection_(aCollection);
  8808. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8809. return $recv($1)._yourself();
  8810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8811. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  8812. //>>excludeEnd("ctx");
  8813. },
  8814. //>>excludeStart("ide", pragmas.excludeIdeData);
  8815. args: ["aCollection"],
  8816. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8817. referencedClasses: [],
  8818. //>>excludeEnd("ide");
  8819. pragmas: [],
  8820. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8821. }),
  8822. $globals.Stream.a$cls);
  8823. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  8824. //>>excludeStart("ide", pragmas.excludeIdeData);
  8825. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  8826. //>>excludeEnd("ide");
  8827. $core.addMethod(
  8828. $core.method({
  8829. selector: "cr",
  8830. protocol: "writing",
  8831. fn: function (){
  8832. var self=this,$self=this;
  8833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8834. return $core.withContext(function($ctx1) {
  8835. //>>excludeEnd("ctx");
  8836. return $self._nextPutAll_($recv($globals.String)._cr());
  8837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8838. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  8839. //>>excludeEnd("ctx");
  8840. },
  8841. //>>excludeStart("ide", pragmas.excludeIdeData);
  8842. args: [],
  8843. source: "cr\x0a\x09^ self nextPutAll: String cr",
  8844. referencedClasses: ["String"],
  8845. //>>excludeEnd("ide");
  8846. pragmas: [],
  8847. messageSends: ["nextPutAll:", "cr"]
  8848. }),
  8849. $globals.StringStream);
  8850. $core.addMethod(
  8851. $core.method({
  8852. selector: "crlf",
  8853. protocol: "writing",
  8854. fn: function (){
  8855. var self=this,$self=this;
  8856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8857. return $core.withContext(function($ctx1) {
  8858. //>>excludeEnd("ctx");
  8859. return $self._nextPutAll_($recv($globals.String)._crlf());
  8860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8861. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  8862. //>>excludeEnd("ctx");
  8863. },
  8864. //>>excludeStart("ide", pragmas.excludeIdeData);
  8865. args: [],
  8866. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  8867. referencedClasses: ["String"],
  8868. //>>excludeEnd("ide");
  8869. pragmas: [],
  8870. messageSends: ["nextPutAll:", "crlf"]
  8871. }),
  8872. $globals.StringStream);
  8873. $core.addMethod(
  8874. $core.method({
  8875. selector: "lf",
  8876. protocol: "writing",
  8877. fn: function (){
  8878. var self=this,$self=this;
  8879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8880. return $core.withContext(function($ctx1) {
  8881. //>>excludeEnd("ctx");
  8882. return $self._nextPutAll_($recv($globals.String)._lf());
  8883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8884. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  8885. //>>excludeEnd("ctx");
  8886. },
  8887. //>>excludeStart("ide", pragmas.excludeIdeData);
  8888. args: [],
  8889. source: "lf\x0a\x09^ self nextPutAll: String lf",
  8890. referencedClasses: ["String"],
  8891. //>>excludeEnd("ide");
  8892. pragmas: [],
  8893. messageSends: ["nextPutAll:", "lf"]
  8894. }),
  8895. $globals.StringStream);
  8896. $core.addMethod(
  8897. $core.method({
  8898. selector: "next:",
  8899. protocol: "reading",
  8900. fn: function (anInteger){
  8901. var self=this,$self=this;
  8902. var tempCollection;
  8903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8904. return $core.withContext(function($ctx1) {
  8905. //>>excludeEnd("ctx");
  8906. var $1;
  8907. tempCollection=$recv($recv($self._collection())._class())._new();
  8908. $recv(anInteger)._timesRepeat_((function(){
  8909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8910. return $core.withContext(function($ctx2) {
  8911. //>>excludeEnd("ctx");
  8912. $1=$self._atEnd();
  8913. if(!$core.assert($1)){
  8914. tempCollection=$recv(tempCollection).__comma($self._next());
  8915. return tempCollection;
  8916. }
  8917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8919. //>>excludeEnd("ctx");
  8920. }));
  8921. return tempCollection;
  8922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8923. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8924. //>>excludeEnd("ctx");
  8925. },
  8926. //>>excludeStart("ide", pragmas.excludeIdeData);
  8927. args: ["anInteger"],
  8928. 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",
  8929. referencedClasses: [],
  8930. //>>excludeEnd("ide");
  8931. pragmas: [],
  8932. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  8933. }),
  8934. $globals.StringStream);
  8935. $core.addMethod(
  8936. $core.method({
  8937. selector: "nextPut:",
  8938. protocol: "writing",
  8939. fn: function (aString){
  8940. var self=this,$self=this;
  8941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8942. return $core.withContext(function($ctx1) {
  8943. //>>excludeEnd("ctx");
  8944. $self._nextPutAll_(aString);
  8945. return self;
  8946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8947. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString})});
  8948. //>>excludeEnd("ctx");
  8949. },
  8950. //>>excludeStart("ide", pragmas.excludeIdeData);
  8951. args: ["aString"],
  8952. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  8953. referencedClasses: [],
  8954. //>>excludeEnd("ide");
  8955. pragmas: [],
  8956. messageSends: ["nextPutAll:"]
  8957. }),
  8958. $globals.StringStream);
  8959. $core.addMethod(
  8960. $core.method({
  8961. selector: "nextPutAll:",
  8962. protocol: "writing",
  8963. fn: function (aString){
  8964. var self=this,$self=this;
  8965. var pre,post;
  8966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8967. return $core.withContext(function($ctx1) {
  8968. //>>excludeEnd("ctx");
  8969. var $2,$4,$3,$1,$6,$5,$7,$8,$9,$12,$11,$13,$10,$14,$15,$17,$16;
  8970. $2=$self._position();
  8971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8972. $ctx1.sendIdx["position"]=1;
  8973. //>>excludeEnd("ctx");
  8974. $4=$self._collection();
  8975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8976. $ctx1.sendIdx["collection"]=1;
  8977. //>>excludeEnd("ctx");
  8978. $3=$recv($4)._size();
  8979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8980. $ctx1.sendIdx["size"]=1;
  8981. //>>excludeEnd("ctx");
  8982. $1=$recv($2).__eq($3);
  8983. if($core.assert($1)){
  8984. $6=$self._collection();
  8985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8986. $ctx1.sendIdx["collection"]=2;
  8987. //>>excludeEnd("ctx");
  8988. $5=$recv($6).__comma(aString);
  8989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8990. $ctx1.sendIdx[","]=1;
  8991. //>>excludeEnd("ctx");
  8992. $self._setCollection_($5);
  8993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8994. $ctx1.sendIdx["setCollection:"]=1;
  8995. //>>excludeEnd("ctx");
  8996. } else {
  8997. $7=$self._collection();
  8998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8999. $ctx1.sendIdx["collection"]=3;
  9000. //>>excludeEnd("ctx");
  9001. $8=$self._position();
  9002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9003. $ctx1.sendIdx["position"]=2;
  9004. //>>excludeEnd("ctx");
  9005. pre=$recv($7)._copyFrom_to_((1),$8);
  9006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9007. $ctx1.sendIdx["copyFrom:to:"]=1;
  9008. //>>excludeEnd("ctx");
  9009. $9=$self._collection();
  9010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9011. $ctx1.sendIdx["collection"]=4;
  9012. //>>excludeEnd("ctx");
  9013. $12=$self._position();
  9014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9015. $ctx1.sendIdx["position"]=3;
  9016. //>>excludeEnd("ctx");
  9017. $11=$recv($12).__plus((1));
  9018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9019. $ctx1.sendIdx["+"]=2;
  9020. //>>excludeEnd("ctx");
  9021. $13=$recv(aString)._size();
  9022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9023. $ctx1.sendIdx["size"]=2;
  9024. //>>excludeEnd("ctx");
  9025. $10=$recv($11).__plus($13);
  9026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9027. $ctx1.sendIdx["+"]=1;
  9028. //>>excludeEnd("ctx");
  9029. $14=$recv($self._collection())._size();
  9030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9031. $ctx1.sendIdx["size"]=3;
  9032. //>>excludeEnd("ctx");
  9033. post=$recv($9)._copyFrom_to_($10,$14);
  9034. $15=$recv($recv(pre).__comma(aString)).__comma(post);
  9035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9036. $ctx1.sendIdx[","]=2;
  9037. //>>excludeEnd("ctx");
  9038. $self._setCollection_($15);
  9039. }
  9040. $17=$self._position();
  9041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9042. $ctx1.sendIdx["position"]=4;
  9043. //>>excludeEnd("ctx");
  9044. $16=$recv($17).__plus($recv(aString)._size());
  9045. $self._position_($16);
  9046. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  9047. return self;
  9048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9049. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post})});
  9050. //>>excludeEnd("ctx");
  9051. },
  9052. //>>excludeStart("ide", pragmas.excludeIdeData);
  9053. args: ["aString"],
  9054. source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self position = self collection size ifTrue: [ self setCollection: self collection, aString ] ifFalse: [\x0a\x09\x09pre := self collection copyFrom: 1 to: self position.\x0a\x09\x09post := self collection copyFrom: (self position + 1 + aString size) to: self collection size.\x0a\x09\x09self setCollection: pre, aString, post\x0a\x09].\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  9055. referencedClasses: [],
  9056. //>>excludeEnd("ide");
  9057. pragmas: [],
  9058. messageSends: ["ifTrue:ifFalse:", "=", "position", "size", "collection", "setCollection:", ",", "copyFrom:to:", "+", "position:", "setStreamSize:", "max:", "streamSize"]
  9059. }),
  9060. $globals.StringStream);
  9061. $core.addMethod(
  9062. $core.method({
  9063. selector: "nextPutString:",
  9064. protocol: "writing",
  9065. fn: function (aString){
  9066. var self=this,$self=this;
  9067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9068. return $core.withContext(function($ctx1) {
  9069. //>>excludeEnd("ctx");
  9070. $self._nextPutAll_(aString);
  9071. return self;
  9072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9073. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  9074. //>>excludeEnd("ctx");
  9075. },
  9076. //>>excludeStart("ide", pragmas.excludeIdeData);
  9077. args: ["aString"],
  9078. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  9079. referencedClasses: [],
  9080. //>>excludeEnd("ide");
  9081. pragmas: [],
  9082. messageSends: ["nextPutAll:"]
  9083. }),
  9084. $globals.StringStream);
  9085. $core.addMethod(
  9086. $core.method({
  9087. selector: "print:",
  9088. protocol: "writing",
  9089. fn: function (anObject){
  9090. var self=this,$self=this;
  9091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9092. return $core.withContext(function($ctx1) {
  9093. //>>excludeEnd("ctx");
  9094. $recv(anObject)._printOn_(self);
  9095. return self;
  9096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9097. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject})});
  9098. //>>excludeEnd("ctx");
  9099. },
  9100. //>>excludeStart("ide", pragmas.excludeIdeData);
  9101. args: ["anObject"],
  9102. source: "print: anObject\x0a\x09anObject printOn: self",
  9103. referencedClasses: [],
  9104. //>>excludeEnd("ide");
  9105. pragmas: [],
  9106. messageSends: ["printOn:"]
  9107. }),
  9108. $globals.StringStream);
  9109. $core.addMethod(
  9110. $core.method({
  9111. selector: "printSymbol:",
  9112. protocol: "writing",
  9113. fn: function (anObject){
  9114. var self=this,$self=this;
  9115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9116. return $core.withContext(function($ctx1) {
  9117. //>>excludeEnd("ctx");
  9118. $recv(anObject)._asSymbolPrintOn_(self);
  9119. return self;
  9120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9121. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject})});
  9122. //>>excludeEnd("ctx");
  9123. },
  9124. //>>excludeStart("ide", pragmas.excludeIdeData);
  9125. args: ["anObject"],
  9126. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  9127. referencedClasses: [],
  9128. //>>excludeEnd("ide");
  9129. pragmas: [],
  9130. messageSends: ["asSymbolPrintOn:"]
  9131. }),
  9132. $globals.StringStream);
  9133. $core.addMethod(
  9134. $core.method({
  9135. selector: "space",
  9136. protocol: "writing",
  9137. fn: function (){
  9138. var self=this,$self=this;
  9139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9140. return $core.withContext(function($ctx1) {
  9141. //>>excludeEnd("ctx");
  9142. $self._nextPut_(" ");
  9143. return self;
  9144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9145. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  9146. //>>excludeEnd("ctx");
  9147. },
  9148. //>>excludeStart("ide", pragmas.excludeIdeData);
  9149. args: [],
  9150. source: "space\x0a\x09self nextPut: ' '",
  9151. referencedClasses: [],
  9152. //>>excludeEnd("ide");
  9153. pragmas: [],
  9154. messageSends: ["nextPut:"]
  9155. }),
  9156. $globals.StringStream);
  9157. $core.addMethod(
  9158. $core.method({
  9159. selector: "tab",
  9160. protocol: "writing",
  9161. fn: function (){
  9162. var self=this,$self=this;
  9163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9164. return $core.withContext(function($ctx1) {
  9165. //>>excludeEnd("ctx");
  9166. return $self._nextPutAll_($recv($globals.String)._tab());
  9167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9168. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  9169. //>>excludeEnd("ctx");
  9170. },
  9171. //>>excludeStart("ide", pragmas.excludeIdeData);
  9172. args: [],
  9173. source: "tab\x0a\x09^ self nextPutAll: String tab",
  9174. referencedClasses: ["String"],
  9175. //>>excludeEnd("ide");
  9176. pragmas: [],
  9177. messageSends: ["nextPutAll:", "tab"]
  9178. }),
  9179. $globals.StringStream);
  9180. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  9181. //>>excludeStart("ide", pragmas.excludeIdeData);
  9182. $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.";
  9183. //>>excludeEnd("ide");
  9184. $core.addMethod(
  9185. $core.method({
  9186. selector: "initialize",
  9187. protocol: "initialization",
  9188. fn: function (){
  9189. var self=this,$self=this;
  9190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9191. return $core.withContext(function($ctx1) {
  9192. //>>excludeEnd("ctx");
  9193. (
  9194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9195. $ctx1.supercall = true,
  9196. //>>excludeEnd("ctx");
  9197. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  9198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9199. $ctx1.supercall = false;
  9200. //>>excludeEnd("ctx");;
  9201. $self.read=$recv($globals.OrderedCollection)._new();
  9202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9203. $ctx1.sendIdx["new"]=1;
  9204. //>>excludeEnd("ctx");
  9205. $self.write=$recv($globals.OrderedCollection)._new();
  9206. $self.readIndex=(1);
  9207. return self;
  9208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9209. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  9210. //>>excludeEnd("ctx");
  9211. },
  9212. //>>excludeStart("ide", pragmas.excludeIdeData);
  9213. args: [],
  9214. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  9215. referencedClasses: ["OrderedCollection"],
  9216. //>>excludeEnd("ide");
  9217. pragmas: [],
  9218. messageSends: ["initialize", "new"]
  9219. }),
  9220. $globals.Queue);
  9221. $core.addMethod(
  9222. $core.method({
  9223. selector: "next",
  9224. protocol: "accessing",
  9225. fn: function (){
  9226. var self=this,$self=this;
  9227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9228. return $core.withContext(function($ctx1) {
  9229. //>>excludeEnd("ctx");
  9230. return $self._nextIfAbsent_((function(){
  9231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9232. return $core.withContext(function($ctx2) {
  9233. //>>excludeEnd("ctx");
  9234. return $self._error_("Cannot read from empty Queue.");
  9235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9236. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9237. //>>excludeEnd("ctx");
  9238. }));
  9239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9240. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  9241. //>>excludeEnd("ctx");
  9242. },
  9243. //>>excludeStart("ide", pragmas.excludeIdeData);
  9244. args: [],
  9245. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  9246. referencedClasses: [],
  9247. //>>excludeEnd("ide");
  9248. pragmas: [],
  9249. messageSends: ["nextIfAbsent:", "error:"]
  9250. }),
  9251. $globals.Queue);
  9252. $core.addMethod(
  9253. $core.method({
  9254. selector: "nextIfAbsent:",
  9255. protocol: "accessing",
  9256. fn: function (aBlock){
  9257. var self=this,$self=this;
  9258. var result;
  9259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9260. return $core.withContext(function($ctx1) {
  9261. //>>excludeEnd("ctx");
  9262. var $1;
  9263. var $early={};
  9264. try {
  9265. result=$recv($self.read)._at_ifAbsent_($self.readIndex,(function(){
  9266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9267. return $core.withContext(function($ctx2) {
  9268. //>>excludeEnd("ctx");
  9269. $recv($self.write)._ifEmpty_((function(){
  9270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9271. return $core.withContext(function($ctx3) {
  9272. //>>excludeEnd("ctx");
  9273. $1=$recv($self.readIndex).__gt((1));
  9274. if($core.assert($1)){
  9275. $self.read=[];
  9276. $self.readIndex=(1);
  9277. $self.readIndex;
  9278. }
  9279. throw $early=[$recv(aBlock)._value()];
  9280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9281. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  9282. //>>excludeEnd("ctx");
  9283. }));
  9284. $self.read=$self.write;
  9285. $self.readIndex=(1);
  9286. $self.write=$recv($globals.OrderedCollection)._new();
  9287. return $recv($self.read)._first();
  9288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9289. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9290. //>>excludeEnd("ctx");
  9291. }));
  9292. $recv($self.read)._at_put_($self.readIndex,nil);
  9293. $self.readIndex=$recv($self.readIndex).__plus((1));
  9294. return result;
  9295. }
  9296. catch(e) {if(e===$early)return e[0]; throw e}
  9297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9298. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result})});
  9299. //>>excludeEnd("ctx");
  9300. },
  9301. //>>excludeStart("ide", pragmas.excludeIdeData);
  9302. args: ["aBlock"],
  9303. 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",
  9304. referencedClasses: ["OrderedCollection"],
  9305. //>>excludeEnd("ide");
  9306. pragmas: [],
  9307. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  9308. }),
  9309. $globals.Queue);
  9310. $core.addMethod(
  9311. $core.method({
  9312. selector: "nextPut:",
  9313. protocol: "accessing",
  9314. fn: function (anObject){
  9315. var self=this,$self=this;
  9316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9317. return $core.withContext(function($ctx1) {
  9318. //>>excludeEnd("ctx");
  9319. $recv($self.write)._add_(anObject);
  9320. return self;
  9321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9322. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  9323. //>>excludeEnd("ctx");
  9324. },
  9325. //>>excludeStart("ide", pragmas.excludeIdeData);
  9326. args: ["anObject"],
  9327. source: "nextPut: anObject\x0a\x09write add: anObject",
  9328. referencedClasses: [],
  9329. //>>excludeEnd("ide");
  9330. pragmas: [],
  9331. messageSends: ["add:"]
  9332. }),
  9333. $globals.Queue);
  9334. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  9335. //>>excludeStart("ide", pragmas.excludeIdeData);
  9336. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9337. //>>excludeEnd("ide");
  9338. $core.addMethod(
  9339. $core.method({
  9340. selector: "compile:",
  9341. protocol: "evaluating",
  9342. fn: function (aString){
  9343. var self=this,$self=this;
  9344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9345. return $core.withContext(function($ctx1) {
  9346. //>>excludeEnd("ctx");
  9347. return self.compile(aString);
  9348. return self;
  9349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9350. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString})});
  9351. //>>excludeEnd("ctx");
  9352. },
  9353. //>>excludeStart("ide", pragmas.excludeIdeData);
  9354. args: ["aString"],
  9355. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  9356. referencedClasses: [],
  9357. //>>excludeEnd("ide");
  9358. pragmas: [["inlineJS:", ["return self.compile(aString)"]]],
  9359. messageSends: []
  9360. }),
  9361. $globals.RegularExpression);
  9362. $core.addMethod(
  9363. $core.method({
  9364. selector: "exec:",
  9365. protocol: "evaluating",
  9366. fn: function (aString){
  9367. var self=this,$self=this;
  9368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9369. return $core.withContext(function($ctx1) {
  9370. //>>excludeEnd("ctx");
  9371. return self.exec(aString) || nil;
  9372. return self;
  9373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9374. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString})});
  9375. //>>excludeEnd("ctx");
  9376. },
  9377. //>>excludeStart("ide", pragmas.excludeIdeData);
  9378. args: ["aString"],
  9379. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  9380. referencedClasses: [],
  9381. //>>excludeEnd("ide");
  9382. pragmas: [["inlineJS:", ["return self.exec(aString) || nil"]]],
  9383. messageSends: []
  9384. }),
  9385. $globals.RegularExpression);
  9386. $core.addMethod(
  9387. $core.method({
  9388. selector: "test:",
  9389. protocol: "evaluating",
  9390. fn: function (aString){
  9391. var self=this,$self=this;
  9392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9393. return $core.withContext(function($ctx1) {
  9394. //>>excludeEnd("ctx");
  9395. return self.test(aString);
  9396. return self;
  9397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9398. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString})});
  9399. //>>excludeEnd("ctx");
  9400. },
  9401. //>>excludeStart("ide", pragmas.excludeIdeData);
  9402. args: ["aString"],
  9403. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  9404. referencedClasses: [],
  9405. //>>excludeEnd("ide");
  9406. pragmas: [["inlineJS:", ["return self.test(aString)"]]],
  9407. messageSends: []
  9408. }),
  9409. $globals.RegularExpression);
  9410. $core.addMethod(
  9411. $core.method({
  9412. selector: "fromString:",
  9413. protocol: "instance creation",
  9414. fn: function (aString){
  9415. var self=this,$self=this;
  9416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9417. return $core.withContext(function($ctx1) {
  9418. //>>excludeEnd("ctx");
  9419. return $self._fromString_flag_(aString,"");
  9420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9421. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  9422. //>>excludeEnd("ctx");
  9423. },
  9424. //>>excludeStart("ide", pragmas.excludeIdeData);
  9425. args: ["aString"],
  9426. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9427. referencedClasses: [],
  9428. //>>excludeEnd("ide");
  9429. pragmas: [],
  9430. messageSends: ["fromString:flag:"]
  9431. }),
  9432. $globals.RegularExpression.a$cls);
  9433. $core.addMethod(
  9434. $core.method({
  9435. selector: "fromString:flag:",
  9436. protocol: "instance creation",
  9437. fn: function (aString,anotherString){
  9438. var self=this,$self=this;
  9439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9440. return $core.withContext(function($ctx1) {
  9441. //>>excludeEnd("ctx");
  9442. return new RegExp(aString, anotherString);
  9443. return self;
  9444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9445. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString})});
  9446. //>>excludeEnd("ctx");
  9447. },
  9448. //>>excludeStart("ide", pragmas.excludeIdeData);
  9449. args: ["aString", "anotherString"],
  9450. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  9451. referencedClasses: [],
  9452. //>>excludeEnd("ide");
  9453. pragmas: [["inlineJS:", ["return new RegExp(aString, anotherString)"]]],
  9454. messageSends: []
  9455. }),
  9456. $globals.RegularExpression.a$cls);
  9457. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  9458. $core.addMethod(
  9459. $core.method({
  9460. selector: "at:",
  9461. protocol: "accessing",
  9462. fn: function (anIndex){
  9463. var self=this,$self=this;
  9464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9465. return $core.withContext(function($ctx1) {
  9466. //>>excludeEnd("ctx");
  9467. return $self._at_ifAbsent_(anIndex,(function(){
  9468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9469. return $core.withContext(function($ctx2) {
  9470. //>>excludeEnd("ctx");
  9471. return $self._errorNotFound();
  9472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9474. //>>excludeEnd("ctx");
  9475. }));
  9476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9477. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex})});
  9478. //>>excludeEnd("ctx");
  9479. },
  9480. //>>excludeStart("ide", pragmas.excludeIdeData);
  9481. args: ["anIndex"],
  9482. 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 ]",
  9483. referencedClasses: [],
  9484. //>>excludeEnd("ide");
  9485. pragmas: [],
  9486. messageSends: ["at:ifAbsent:", "errorNotFound"]
  9487. }),
  9488. $globals.TKeyValueCollection);
  9489. $core.addMethod(
  9490. $core.method({
  9491. selector: "at:ifAbsent:",
  9492. protocol: "accessing",
  9493. fn: function (anIndex,aBlock){
  9494. var self=this,$self=this;
  9495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9496. return $core.withContext(function($ctx1) {
  9497. //>>excludeEnd("ctx");
  9498. $self._subclassResponsibility();
  9499. return self;
  9500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9501. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9502. //>>excludeEnd("ctx");
  9503. },
  9504. //>>excludeStart("ide", pragmas.excludeIdeData);
  9505. args: ["anIndex", "aBlock"],
  9506. 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",
  9507. referencedClasses: [],
  9508. //>>excludeEnd("ide");
  9509. pragmas: [],
  9510. messageSends: ["subclassResponsibility"]
  9511. }),
  9512. $globals.TKeyValueCollection);
  9513. $core.addMethod(
  9514. $core.method({
  9515. selector: "at:ifAbsentPut:",
  9516. protocol: "accessing",
  9517. fn: function (aKey,aBlock){
  9518. var self=this,$self=this;
  9519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9520. return $core.withContext(function($ctx1) {
  9521. //>>excludeEnd("ctx");
  9522. return $self._at_ifAbsent_(aKey,(function(){
  9523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9524. return $core.withContext(function($ctx2) {
  9525. //>>excludeEnd("ctx");
  9526. return $self._at_put_(aKey,$recv(aBlock)._value());
  9527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9528. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9529. //>>excludeEnd("ctx");
  9530. }));
  9531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9532. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock})});
  9533. //>>excludeEnd("ctx");
  9534. },
  9535. //>>excludeStart("ide", pragmas.excludeIdeData);
  9536. args: ["aKey", "aBlock"],
  9537. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  9538. referencedClasses: [],
  9539. //>>excludeEnd("ide");
  9540. pragmas: [],
  9541. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  9542. }),
  9543. $globals.TKeyValueCollection);
  9544. $core.addMethod(
  9545. $core.method({
  9546. selector: "at:ifPresent:",
  9547. protocol: "accessing",
  9548. fn: function (anIndex,aBlock){
  9549. var self=this,$self=this;
  9550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9551. return $core.withContext(function($ctx1) {
  9552. //>>excludeEnd("ctx");
  9553. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  9554. return nil;
  9555. }));
  9556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9557. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock})});
  9558. //>>excludeEnd("ctx");
  9559. },
  9560. //>>excludeStart("ide", pragmas.excludeIdeData);
  9561. args: ["anIndex", "aBlock"],
  9562. 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 ]",
  9563. referencedClasses: [],
  9564. //>>excludeEnd("ide");
  9565. pragmas: [],
  9566. messageSends: ["at:ifPresent:ifAbsent:"]
  9567. }),
  9568. $globals.TKeyValueCollection);
  9569. $core.addMethod(
  9570. $core.method({
  9571. selector: "at:ifPresent:ifAbsent:",
  9572. protocol: "accessing",
  9573. fn: function (anIndex,aBlock,anotherBlock){
  9574. var self=this,$self=this;
  9575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9576. return $core.withContext(function($ctx1) {
  9577. //>>excludeEnd("ctx");
  9578. $self._subclassResponsibility();
  9579. return self;
  9580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9581. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9582. //>>excludeEnd("ctx");
  9583. },
  9584. //>>excludeStart("ide", pragmas.excludeIdeData);
  9585. args: ["anIndex", "aBlock", "anotherBlock"],
  9586. 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",
  9587. referencedClasses: [],
  9588. //>>excludeEnd("ide");
  9589. pragmas: [],
  9590. messageSends: ["subclassResponsibility"]
  9591. }),
  9592. $globals.TKeyValueCollection);
  9593. $core.addMethod(
  9594. $core.method({
  9595. selector: "at:put:",
  9596. protocol: "accessing",
  9597. fn: function (anIndex,anObject){
  9598. var self=this,$self=this;
  9599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9600. return $core.withContext(function($ctx1) {
  9601. //>>excludeEnd("ctx");
  9602. $self._subclassResponsibility();
  9603. return self;
  9604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9605. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  9606. //>>excludeEnd("ctx");
  9607. },
  9608. //>>excludeStart("ide", pragmas.excludeIdeData);
  9609. args: ["anIndex", "anObject"],
  9610. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  9611. referencedClasses: [],
  9612. //>>excludeEnd("ide");
  9613. pragmas: [],
  9614. messageSends: ["subclassResponsibility"]
  9615. }),
  9616. $globals.TKeyValueCollection);
  9617. $core.addMethod(
  9618. $core.method({
  9619. selector: "indexOf:",
  9620. protocol: "accessing",
  9621. fn: function (anObject){
  9622. var self=this,$self=this;
  9623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9624. return $core.withContext(function($ctx1) {
  9625. //>>excludeEnd("ctx");
  9626. return $self._indexOf_ifAbsent_(anObject,(function(){
  9627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9628. return $core.withContext(function($ctx2) {
  9629. //>>excludeEnd("ctx");
  9630. return $self._errorNotFound();
  9631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9632. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9633. //>>excludeEnd("ctx");
  9634. }));
  9635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9636. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject})});
  9637. //>>excludeEnd("ctx");
  9638. },
  9639. //>>excludeStart("ide", pragmas.excludeIdeData);
  9640. args: ["anObject"],
  9641. 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 ]",
  9642. referencedClasses: [],
  9643. //>>excludeEnd("ide");
  9644. pragmas: [],
  9645. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  9646. }),
  9647. $globals.TKeyValueCollection);
  9648. $core.addMethod(
  9649. $core.method({
  9650. selector: "indexOf:ifAbsent:",
  9651. protocol: "accessing",
  9652. fn: function (anObject,aBlock){
  9653. var self=this,$self=this;
  9654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9655. return $core.withContext(function($ctx1) {
  9656. //>>excludeEnd("ctx");
  9657. $self._subclassResponsibility();
  9658. return self;
  9659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9660. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9661. //>>excludeEnd("ctx");
  9662. },
  9663. //>>excludeStart("ide", pragmas.excludeIdeData);
  9664. args: ["anObject", "aBlock"],
  9665. 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",
  9666. referencedClasses: [],
  9667. //>>excludeEnd("ide");
  9668. pragmas: [],
  9669. messageSends: ["subclassResponsibility"]
  9670. }),
  9671. $globals.TKeyValueCollection);
  9672. $core.addMethod(
  9673. $core.method({
  9674. selector: "with:do:",
  9675. protocol: "enumerating",
  9676. fn: function (anotherCollection,aBlock){
  9677. var self=this,$self=this;
  9678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9679. return $core.withContext(function($ctx1) {
  9680. //>>excludeEnd("ctx");
  9681. $self._withIndexDo_((function(each,index){
  9682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9683. return $core.withContext(function($ctx2) {
  9684. //>>excludeEnd("ctx");
  9685. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  9686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9687. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  9688. //>>excludeEnd("ctx");
  9689. }));
  9690. return self;
  9691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9692. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9693. //>>excludeEnd("ctx");
  9694. },
  9695. //>>excludeStart("ide", pragmas.excludeIdeData);
  9696. args: ["anotherCollection", "aBlock"],
  9697. 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) ]",
  9698. referencedClasses: [],
  9699. //>>excludeEnd("ide");
  9700. pragmas: [],
  9701. messageSends: ["withIndexDo:", "value:value:", "at:"]
  9702. }),
  9703. $globals.TKeyValueCollection);
  9704. $core.addMethod(
  9705. $core.method({
  9706. selector: "withIndexDo:",
  9707. protocol: "enumerating",
  9708. fn: function (aBlock){
  9709. var self=this,$self=this;
  9710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9711. return $core.withContext(function($ctx1) {
  9712. //>>excludeEnd("ctx");
  9713. $self._subclassResponsibility();
  9714. return self;
  9715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9716. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9717. //>>excludeEnd("ctx");
  9718. },
  9719. //>>excludeStart("ide", pragmas.excludeIdeData);
  9720. args: ["aBlock"],
  9721. 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",
  9722. referencedClasses: [],
  9723. //>>excludeEnd("ide");
  9724. pragmas: [],
  9725. messageSends: ["subclassResponsibility"]
  9726. }),
  9727. $globals.TKeyValueCollection);
  9728. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  9729. $core.addMethod(
  9730. $core.method({
  9731. selector: "at:ifAbsent:",
  9732. protocol: "accessing",
  9733. fn: function (anIndex,aBlock){
  9734. var self=this,$self=this;
  9735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9736. return $core.withContext(function($ctx1) {
  9737. //>>excludeEnd("ctx");
  9738. return anIndex >= 1 && anIndex <= self.length
  9739. ? self[anIndex - 1]
  9740. : aBlock._value()
  9741. ;
  9742. return self;
  9743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9744. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9745. //>>excludeEnd("ctx");
  9746. },
  9747. //>>excludeStart("ide", pragmas.excludeIdeData);
  9748. args: ["anIndex", "aBlock"],
  9749. 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'>",
  9750. referencedClasses: [],
  9751. //>>excludeEnd("ide");
  9752. pragmas: [["inlineJS:", ["\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09"]]],
  9753. messageSends: []
  9754. }),
  9755. $globals.TNativeZeroBasedCollection);
  9756. $core.addMethod(
  9757. $core.method({
  9758. selector: "at:ifPresent:ifAbsent:",
  9759. protocol: "accessing",
  9760. fn: function (anIndex,aBlock,anotherBlock){
  9761. var self=this,$self=this;
  9762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9763. return $core.withContext(function($ctx1) {
  9764. //>>excludeEnd("ctx");
  9765. return anIndex >= 1 && anIndex <= self.length
  9766. ? aBlock._value_(self[anIndex - 1])
  9767. : anotherBlock._value()
  9768. ;
  9769. return self;
  9770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9771. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9772. //>>excludeEnd("ctx");
  9773. },
  9774. //>>excludeStart("ide", pragmas.excludeIdeData);
  9775. args: ["anIndex", "aBlock", "anotherBlock"],
  9776. 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'>",
  9777. referencedClasses: [],
  9778. //>>excludeEnd("ide");
  9779. pragmas: [["inlineJS:", ["\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? aBlock._value_(self[anIndex - 1])\x0a\x09\x09\x09: anotherBlock._value()\x0a\x09"]]],
  9780. messageSends: []
  9781. }),
  9782. $globals.TNativeZeroBasedCollection);
  9783. $core.addMethod(
  9784. $core.method({
  9785. selector: "detect:ifNone:",
  9786. protocol: "enumerating",
  9787. fn: function (aBlock,anotherBlock){
  9788. var self=this,$self=this;
  9789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9790. return $core.withContext(function($ctx1) {
  9791. //>>excludeEnd("ctx");
  9792. for(var i = 0; i < self.length; i++)
  9793. if(aBlock._value_(self[i]))
  9794. return self[i];
  9795. return anotherBlock._value();
  9796. ;
  9797. return self;
  9798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9799. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  9800. //>>excludeEnd("ctx");
  9801. },
  9802. //>>excludeStart("ide", pragmas.excludeIdeData);
  9803. args: ["aBlock", "anotherBlock"],
  9804. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock._value_(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09'>",
  9805. referencedClasses: [],
  9806. //>>excludeEnd("ide");
  9807. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock._value_(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09"]]],
  9808. messageSends: []
  9809. }),
  9810. $globals.TNativeZeroBasedCollection);
  9811. $core.addMethod(
  9812. $core.method({
  9813. selector: "do:",
  9814. protocol: "enumerating",
  9815. fn: function (aBlock){
  9816. var self=this,$self=this;
  9817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9818. return $core.withContext(function($ctx1) {
  9819. //>>excludeEnd("ctx");
  9820. for(var i=0; i < self.length; i++) {
  9821. aBlock._value_(self[i]);
  9822. }
  9823. ;
  9824. return self;
  9825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9826. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  9827. //>>excludeEnd("ctx");
  9828. },
  9829. //>>excludeStart("ide", pragmas.excludeIdeData);
  9830. args: ["aBlock"],
  9831. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09'>",
  9832. referencedClasses: [],
  9833. //>>excludeEnd("ide");
  9834. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09"]]],
  9835. messageSends: []
  9836. }),
  9837. $globals.TNativeZeroBasedCollection);
  9838. $core.addMethod(
  9839. $core.method({
  9840. selector: "indexOf:ifAbsent:",
  9841. protocol: "accessing",
  9842. fn: function (anObject,aBlock){
  9843. var self=this,$self=this;
  9844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9845. return $core.withContext(function($ctx1) {
  9846. //>>excludeEnd("ctx");
  9847. for(var i=0; i < self.length; i++) {
  9848. if($recv(self[i]).__eq(anObject)) {return i+1}
  9849. };
  9850. return aBlock._value();
  9851. ;
  9852. return self;
  9853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9854. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9855. //>>excludeEnd("ctx");
  9856. },
  9857. //>>excludeStart("ide", pragmas.excludeIdeData);
  9858. args: ["anObject", "aBlock"],
  9859. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  9860. referencedClasses: [],
  9861. //>>excludeEnd("ide");
  9862. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09"]]],
  9863. messageSends: []
  9864. }),
  9865. $globals.TNativeZeroBasedCollection);
  9866. $core.addMethod(
  9867. $core.method({
  9868. selector: "indexOf:startingAt:ifAbsent:",
  9869. protocol: "accessing",
  9870. fn: function (anObject,start,aBlock){
  9871. var self=this,$self=this;
  9872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9873. return $core.withContext(function($ctx1) {
  9874. //>>excludeEnd("ctx");
  9875. for(var i=start - 1; i < self.length; i++){
  9876. if($recv(self[i]).__eq(anObject)) {return i+1}
  9877. }
  9878. return aBlock._value();
  9879. ;
  9880. return self;
  9881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9882. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  9883. //>>excludeEnd("ctx");
  9884. },
  9885. //>>excludeStart("ide", pragmas.excludeIdeData);
  9886. args: ["anObject", "start", "aBlock"],
  9887. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=start - 1; i < self.length; i++){\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  9888. referencedClasses: [],
  9889. //>>excludeEnd("ide");
  9890. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=start - 1; i < self.length; i++){\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09"]]],
  9891. messageSends: []
  9892. }),
  9893. $globals.TNativeZeroBasedCollection);
  9894. $core.addMethod(
  9895. $core.method({
  9896. selector: "single",
  9897. protocol: "accessing",
  9898. fn: function (){
  9899. var self=this,$self=this;
  9900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9901. return $core.withContext(function($ctx1) {
  9902. //>>excludeEnd("ctx");
  9903. if (self.length == 0) throw new Error("Collection is empty");
  9904. if (self.length > 1) throw new Error("Collection holds more than one element.");
  9905. return self[0];;
  9906. return self;
  9907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9908. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  9909. //>>excludeEnd("ctx");
  9910. },
  9911. //>>excludeStart("ide", pragmas.excludeIdeData);
  9912. args: [],
  9913. source: "single\x0a<inlineJS: '\x0a\x09if (self.length == 0) throw new Error(\x22Collection is empty\x22);\x0a\x09if (self.length > 1) throw new Error(\x22Collection holds more than one element.\x22);\x0a\x09return self[0];\x0a'>",
  9914. referencedClasses: [],
  9915. //>>excludeEnd("ide");
  9916. pragmas: [["inlineJS:", ["\x0a\x09if (self.length == 0) throw new Error(\x22Collection is empty\x22);\x0a\x09if (self.length > 1) throw new Error(\x22Collection holds more than one element.\x22);\x0a\x09return self[0];"]]],
  9917. messageSends: []
  9918. }),
  9919. $globals.TNativeZeroBasedCollection);
  9920. $core.addMethod(
  9921. $core.method({
  9922. selector: "size",
  9923. protocol: "accessing",
  9924. fn: function (){
  9925. var self=this,$self=this;
  9926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9927. return $core.withContext(function($ctx1) {
  9928. //>>excludeEnd("ctx");
  9929. return self.length;
  9930. return self;
  9931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9932. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  9933. //>>excludeEnd("ctx");
  9934. },
  9935. //>>excludeStart("ide", pragmas.excludeIdeData);
  9936. args: [],
  9937. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  9938. referencedClasses: [],
  9939. //>>excludeEnd("ide");
  9940. pragmas: [["inlineJS:", ["return self.length"]]],
  9941. messageSends: []
  9942. }),
  9943. $globals.TNativeZeroBasedCollection);
  9944. $core.addMethod(
  9945. $core.method({
  9946. selector: "with:do:",
  9947. protocol: "enumerating",
  9948. fn: function (anotherCollection,aBlock){
  9949. var self=this,$self=this;
  9950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9951. return $core.withContext(function($ctx1) {
  9952. //>>excludeEnd("ctx");
  9953. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  9954. for(var i=0; i<self.length; i++) {
  9955. aBlock._value_value_(self[i], anotherCollection[i]);
  9956. }
  9957. ;
  9958. return self;
  9959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9960. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9961. //>>excludeEnd("ctx");
  9962. },
  9963. //>>excludeStart("ide", pragmas.excludeIdeData);
  9964. args: ["anotherCollection", "aBlock"],
  9965. source: "with: anotherCollection do: aBlock\x0a\x09<inlineJS: '\x0a\x09 $recv(anotherCollection)._first_(0); // #guardSequenceableCollection\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09'>",
  9966. referencedClasses: [],
  9967. //>>excludeEnd("ide");
  9968. pragmas: [["inlineJS:", ["\x0a\x09 $recv(anotherCollection)._first_(0); // #guardSequenceableCollection\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09"]]],
  9969. messageSends: []
  9970. }),
  9971. $globals.TNativeZeroBasedCollection);
  9972. $core.addMethod(
  9973. $core.method({
  9974. selector: "withIndexDo:",
  9975. protocol: "enumerating",
  9976. fn: function (aBlock){
  9977. var self=this,$self=this;
  9978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9979. return $core.withContext(function($ctx1) {
  9980. //>>excludeEnd("ctx");
  9981. for(var i=0; i < self.length; i++) {
  9982. aBlock._value_value_(self[i], i+1);
  9983. }
  9984. ;
  9985. return self;
  9986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9987. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9988. //>>excludeEnd("ctx");
  9989. },
  9990. //>>excludeStart("ide", pragmas.excludeIdeData);
  9991. args: ["aBlock"],
  9992. source: "withIndexDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], i+1);\x0a\x09\x09}\x0a\x09'>",
  9993. referencedClasses: [],
  9994. //>>excludeEnd("ide");
  9995. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], i+1);\x0a\x09\x09}\x0a\x09"]]],
  9996. messageSends: []
  9997. }),
  9998. $globals.TNativeZeroBasedCollection);
  9999. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  10000. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  10001. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  10002. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  10003. });