Kernel-Collections.js 328 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091
  1. define(["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  2. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  3. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  4. $core.addPackage("Kernel-Collections");
  5. ($core.packageDescriptors||$core.packages)["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  6. ($core.packageDescriptors||$core.packages)["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  8. //>>excludeStart("ide", pragmas.excludeIdeData);
  9. $globals.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`";
  10. //>>excludeEnd("ide");
  11. $core.addMethod(
  12. $core.method({
  13. selector: "=",
  14. protocol: "comparing",
  15. fn: function (anAssociation){
  16. var self=this,$self=this;
  17. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18. return $core.withContext(function($ctx1) {
  19. //>>excludeEnd("ctx");
  20. var $3,$2,$5,$4,$6,$1;
  21. $3=$self._class();
  22. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23. $ctx1.sendIdx["class"]=1;
  24. //>>excludeEnd("ctx");
  25. $2=$recv($3).__eq($recv(anAssociation)._class());
  26. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27. $ctx1.sendIdx["="]=1;
  28. //>>excludeEnd("ctx");
  29. $1=$recv($2)._and_((function(){
  30. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31. return $core.withContext(function($ctx2) {
  32. //>>excludeEnd("ctx");
  33. $5=$self._key();
  34. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35. $ctx2.sendIdx["key"]=1;
  36. //>>excludeEnd("ctx");
  37. $4=$recv($5).__eq($recv(anAssociation)._key());
  38. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39. $ctx2.sendIdx["="]=2;
  40. //>>excludeEnd("ctx");
  41. return $recv($4)._and_((function(){
  42. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43. return $core.withContext(function($ctx3) {
  44. //>>excludeEnd("ctx");
  45. $6=$self._value();
  46. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47. $ctx3.sendIdx["value"]=1;
  48. //>>excludeEnd("ctx");
  49. return $recv($6).__eq($recv(anAssociation)._value());
  50. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  51. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  52. //>>excludeEnd("ctx");
  53. }));
  54. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56. //>>excludeEnd("ctx");
  57. }));
  58. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59. $ctx1.sendIdx["and:"]=1;
  60. //>>excludeEnd("ctx");
  61. return $1;
  62. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  64. //>>excludeEnd("ctx");
  65. },
  66. //>>excludeStart("ide", pragmas.excludeIdeData);
  67. args: ["anAssociation"],
  68. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  69. referencedClasses: [],
  70. //>>excludeEnd("ide");
  71. messageSends: ["and:", "=", "class", "key", "value"]
  72. }),
  73. $globals.Association);
  74. $core.addMethod(
  75. $core.method({
  76. selector: "key",
  77. protocol: "accessing",
  78. fn: function (){
  79. var self=this,$self=this;
  80. return $self["@key"];
  81. },
  82. //>>excludeStart("ide", pragmas.excludeIdeData);
  83. args: [],
  84. source: "key\x0a\x09^ key",
  85. referencedClasses: [],
  86. //>>excludeEnd("ide");
  87. messageSends: []
  88. }),
  89. $globals.Association);
  90. $core.addMethod(
  91. $core.method({
  92. selector: "key:",
  93. protocol: "accessing",
  94. fn: function (aKey){
  95. var self=this,$self=this;
  96. $self["@key"]=aKey;
  97. return self;
  98. },
  99. //>>excludeStart("ide", pragmas.excludeIdeData);
  100. args: ["aKey"],
  101. source: "key: aKey\x0a\x09key := aKey",
  102. referencedClasses: [],
  103. //>>excludeEnd("ide");
  104. messageSends: []
  105. }),
  106. $globals.Association);
  107. $core.addMethod(
  108. $core.method({
  109. selector: "printOn:",
  110. protocol: "printing",
  111. fn: function (aStream){
  112. var self=this,$self=this;
  113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  114. return $core.withContext(function($ctx1) {
  115. //>>excludeEnd("ctx");
  116. $recv($self._key())._printOn_(aStream);
  117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  118. $ctx1.sendIdx["printOn:"]=1;
  119. //>>excludeEnd("ctx");
  120. $recv(aStream)._nextPutAll_(" -> ");
  121. $recv($self._value())._printOn_(aStream);
  122. return self;
  123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  124. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  125. //>>excludeEnd("ctx");
  126. },
  127. //>>excludeStart("ide", pragmas.excludeIdeData);
  128. args: ["aStream"],
  129. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  130. referencedClasses: [],
  131. //>>excludeEnd("ide");
  132. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  133. }),
  134. $globals.Association);
  135. $core.addMethod(
  136. $core.method({
  137. selector: "value",
  138. protocol: "accessing",
  139. fn: function (){
  140. var self=this,$self=this;
  141. return $self["@value"];
  142. },
  143. //>>excludeStart("ide", pragmas.excludeIdeData);
  144. args: [],
  145. source: "value\x0a\x09^ value",
  146. referencedClasses: [],
  147. //>>excludeEnd("ide");
  148. messageSends: []
  149. }),
  150. $globals.Association);
  151. $core.addMethod(
  152. $core.method({
  153. selector: "value:",
  154. protocol: "accessing",
  155. fn: function (aValue){
  156. var self=this,$self=this;
  157. $self["@value"]=aValue;
  158. return self;
  159. },
  160. //>>excludeStart("ide", pragmas.excludeIdeData);
  161. args: ["aValue"],
  162. source: "value: aValue\x0a\x09value := aValue",
  163. referencedClasses: [],
  164. //>>excludeEnd("ide");
  165. messageSends: []
  166. }),
  167. $globals.Association);
  168. $core.addMethod(
  169. $core.method({
  170. selector: "key:value:",
  171. protocol: "instance creation",
  172. fn: function (aKey,aValue){
  173. var self=this,$self=this;
  174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  175. return $core.withContext(function($ctx1) {
  176. //>>excludeEnd("ctx");
  177. var $1;
  178. $1=$self._new();
  179. $recv($1)._key_(aKey);
  180. $recv($1)._value_(aValue);
  181. return $recv($1)._yourself();
  182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  183. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.a$cls)});
  184. //>>excludeEnd("ctx");
  185. },
  186. //>>excludeStart("ide", pragmas.excludeIdeData);
  187. args: ["aKey", "aValue"],
  188. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  189. referencedClasses: [],
  190. //>>excludeEnd("ide");
  191. messageSends: ["key:", "new", "value:", "yourself"]
  192. }),
  193. $globals.Association.a$cls);
  194. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  195. //>>excludeStart("ide", pragmas.excludeIdeData);
  196. $globals.BucketStore.comment="I am an helper class for hash-based stores.\x0a\x0aI hold buckets which are selected by a hash, specified using `#hashBlock:`.\x0aThe hash can be any object, and\x0ait is used as a JS property (that is, in ES5\x0aits toString() value counts).\x0a\x0a## API\x0aI maintain a list of buckets. Client code can use this API:\x0a - `#bucketOfElement:` (to ask a bucket for element, I can return JS null if n/a)\x0a - `#do:` (to enumerate all elements of all buckets)\x0a - `#removeAll` (to remove all buckets)\x0a\x0aClient code itself should add/remove elements\x0ain a bucket. The `nil` object should not be put into any bucket.\x0a\x0aTypes of buckets are the responsibility of subclasses via `#newBucket`.";
  197. //>>excludeEnd("ide");
  198. $core.addMethod(
  199. $core.method({
  200. selector: "bucketOfElement:",
  201. protocol: "accessing",
  202. fn: function (anObject){
  203. var self=this,$self=this;
  204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  205. return $core.withContext(function($ctx1) {
  206. //>>excludeEnd("ctx");
  207. var hash = $self['@hashBlock'](anObject);
  208. if (!hash) return null;
  209. var buckets = $self['@buckets'],
  210. bucket = buckets[hash];
  211. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  212. return bucket;
  213. ;
  214. return self;
  215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  216. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  217. //>>excludeEnd("ctx");
  218. },
  219. //>>excludeStart("ide", pragmas.excludeIdeData);
  220. args: ["anObject"],
  221. source: "bucketOfElement: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var hash = $self[''@hashBlock''](anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = $self[''@buckets''],\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09'>",
  222. referencedClasses: [],
  223. //>>excludeEnd("ide");
  224. messageSends: []
  225. }),
  226. $globals.BucketStore);
  227. $core.addMethod(
  228. $core.method({
  229. selector: "do:",
  230. protocol: "enumerating",
  231. fn: function (aBlock){
  232. var self=this,$self=this;
  233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  234. return $core.withContext(function($ctx1) {
  235. //>>excludeEnd("ctx");
  236. var buckets = $self['@buckets'];
  237. var keys = Object.keys(buckets);
  238. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  239. ;
  240. return self;
  241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  242. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  243. //>>excludeEnd("ctx");
  244. },
  245. //>>excludeStart("ide", pragmas.excludeIdeData);
  246. args: ["aBlock"],
  247. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var buckets = $self[''@buckets''];\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09'>",
  248. referencedClasses: [],
  249. //>>excludeEnd("ide");
  250. messageSends: []
  251. }),
  252. $globals.BucketStore);
  253. $core.addMethod(
  254. $core.method({
  255. selector: "hashBlock:",
  256. protocol: "accessing",
  257. fn: function (aBlock){
  258. var self=this,$self=this;
  259. $self["@hashBlock"]=aBlock;
  260. return self;
  261. },
  262. //>>excludeStart("ide", pragmas.excludeIdeData);
  263. args: ["aBlock"],
  264. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  265. referencedClasses: [],
  266. //>>excludeEnd("ide");
  267. messageSends: []
  268. }),
  269. $globals.BucketStore);
  270. $core.addMethod(
  271. $core.method({
  272. selector: "initialize",
  273. protocol: "initialization",
  274. fn: function (){
  275. var self=this,$self=this;
  276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  277. return $core.withContext(function($ctx1) {
  278. //>>excludeEnd("ctx");
  279. (
  280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  281. $ctx1.supercall = true,
  282. //>>excludeEnd("ctx");
  283. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  285. $ctx1.supercall = false;
  286. //>>excludeEnd("ctx");;
  287. $self._removeAll();
  288. return self;
  289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  290. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  291. //>>excludeEnd("ctx");
  292. },
  293. //>>excludeStart("ide", pragmas.excludeIdeData);
  294. args: [],
  295. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  296. referencedClasses: [],
  297. //>>excludeEnd("ide");
  298. messageSends: ["initialize", "removeAll"]
  299. }),
  300. $globals.BucketStore);
  301. $core.addMethod(
  302. $core.method({
  303. selector: "newBucket",
  304. protocol: "private",
  305. fn: function (){
  306. var self=this,$self=this;
  307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  308. return $core.withContext(function($ctx1) {
  309. //>>excludeEnd("ctx");
  310. $self._subclassResponsibility();
  311. return self;
  312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  313. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  314. //>>excludeEnd("ctx");
  315. },
  316. //>>excludeStart("ide", pragmas.excludeIdeData);
  317. args: [],
  318. source: "newBucket\x0a\x09self subclassResponsibility",
  319. referencedClasses: [],
  320. //>>excludeEnd("ide");
  321. messageSends: ["subclassResponsibility"]
  322. }),
  323. $globals.BucketStore);
  324. $core.addMethod(
  325. $core.method({
  326. selector: "removeAll",
  327. protocol: "adding/removing",
  328. fn: function (){
  329. var self=this,$self=this;
  330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  331. return $core.withContext(function($ctx1) {
  332. //>>excludeEnd("ctx");
  333. $self['@buckets'] = Object.create(null);;
  334. return self;
  335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  336. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  337. //>>excludeEnd("ctx");
  338. },
  339. //>>excludeStart("ide", pragmas.excludeIdeData);
  340. args: [],
  341. source: "removeAll\x0a\x09<inlineJS: '$self[''@buckets''] = Object.create(null);'>",
  342. referencedClasses: [],
  343. //>>excludeEnd("ide");
  344. messageSends: []
  345. }),
  346. $globals.BucketStore);
  347. $core.addMethod(
  348. $core.method({
  349. selector: "hashBlock:",
  350. protocol: "instance creation",
  351. fn: function (aBlock){
  352. var self=this,$self=this;
  353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  354. return $core.withContext(function($ctx1) {
  355. //>>excludeEnd("ctx");
  356. var $1;
  357. $1=$self._new();
  358. $recv($1)._hashBlock_(aBlock);
  359. return $recv($1)._yourself();
  360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  361. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.a$cls)});
  362. //>>excludeEnd("ctx");
  363. },
  364. //>>excludeStart("ide", pragmas.excludeIdeData);
  365. args: ["aBlock"],
  366. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  367. referencedClasses: [],
  368. //>>excludeEnd("ide");
  369. messageSends: ["hashBlock:", "new", "yourself"]
  370. }),
  371. $globals.BucketStore.a$cls);
  372. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  373. //>>excludeStart("ide", pragmas.excludeIdeData);
  374. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  375. //>>excludeEnd("ide");
  376. $core.addMethod(
  377. $core.method({
  378. selector: "newBucket",
  379. protocol: "private",
  380. fn: function (){
  381. var self=this,$self=this;
  382. return [];
  383. },
  384. //>>excludeStart("ide", pragmas.excludeIdeData);
  385. args: [],
  386. source: "newBucket\x0a\x09^ #()",
  387. referencedClasses: [],
  388. //>>excludeEnd("ide");
  389. messageSends: []
  390. }),
  391. $globals.ArrayBucketStore);
  392. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  393. //>>excludeStart("ide", pragmas.excludeIdeData);
  394. $globals.Collection.comment="I am the abstract superclass of all classes that represent a group of elements.\x0a\x0aI provide a set of useful methods to the Collection hierarchy such as enumerating and converting methods.";
  395. //>>excludeEnd("ide");
  396. $core.addMethod(
  397. $core.method({
  398. selector: ",",
  399. protocol: "copying",
  400. fn: function (aCollection){
  401. var self=this,$self=this;
  402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  403. return $core.withContext(function($ctx1) {
  404. //>>excludeEnd("ctx");
  405. var $1;
  406. $1=$self._copy();
  407. $recv($1)._addAll_(aCollection);
  408. return $recv($1)._yourself();
  409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  410. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  411. //>>excludeEnd("ctx");
  412. },
  413. //>>excludeStart("ide", pragmas.excludeIdeData);
  414. args: ["aCollection"],
  415. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  416. referencedClasses: [],
  417. //>>excludeEnd("ide");
  418. messageSends: ["addAll:", "copy", "yourself"]
  419. }),
  420. $globals.Collection);
  421. $core.addMethod(
  422. $core.method({
  423. selector: "add:",
  424. protocol: "adding/removing",
  425. fn: function (anObject){
  426. var self=this,$self=this;
  427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  428. return $core.withContext(function($ctx1) {
  429. //>>excludeEnd("ctx");
  430. $self._subclassResponsibility();
  431. return self;
  432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  433. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  434. //>>excludeEnd("ctx");
  435. },
  436. //>>excludeStart("ide", pragmas.excludeIdeData);
  437. args: ["anObject"],
  438. source: "add: anObject\x0a\x09self subclassResponsibility",
  439. referencedClasses: [],
  440. //>>excludeEnd("ide");
  441. messageSends: ["subclassResponsibility"]
  442. }),
  443. $globals.Collection);
  444. $core.addMethod(
  445. $core.method({
  446. selector: "addAll:",
  447. protocol: "adding/removing",
  448. fn: function (aCollection){
  449. var self=this,$self=this;
  450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  451. return $core.withContext(function($ctx1) {
  452. //>>excludeEnd("ctx");
  453. $recv(aCollection)._do_((function(each){
  454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  455. return $core.withContext(function($ctx2) {
  456. //>>excludeEnd("ctx");
  457. return $self._add_(each);
  458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  459. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  460. //>>excludeEnd("ctx");
  461. }));
  462. return aCollection;
  463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  464. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  465. //>>excludeEnd("ctx");
  466. },
  467. //>>excludeStart("ide", pragmas.excludeIdeData);
  468. args: ["aCollection"],
  469. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  470. referencedClasses: [],
  471. //>>excludeEnd("ide");
  472. messageSends: ["do:", "add:"]
  473. }),
  474. $globals.Collection);
  475. $core.addMethod(
  476. $core.method({
  477. selector: "allSatisfy:",
  478. protocol: "enumerating",
  479. fn: function (aBlock){
  480. var self=this,$self=this;
  481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  482. return $core.withContext(function($ctx1) {
  483. //>>excludeEnd("ctx");
  484. var $1;
  485. var $early={};
  486. try {
  487. $self._do_((function(each){
  488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  489. return $core.withContext(function($ctx2) {
  490. //>>excludeEnd("ctx");
  491. $1=$recv(aBlock)._value_(each);
  492. if(!$core.assert($1)){
  493. throw $early=[false];
  494. }
  495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  496. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  497. //>>excludeEnd("ctx");
  498. }));
  499. return true;
  500. }
  501. catch(e) {if(e===$early)return e[0]; throw e}
  502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  503. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  504. //>>excludeEnd("ctx");
  505. },
  506. //>>excludeStart("ide", pragmas.excludeIdeData);
  507. args: ["aBlock"],
  508. source: "allSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for any element return false.\x0a\x09Otherwise return true.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  509. referencedClasses: [],
  510. //>>excludeEnd("ide");
  511. messageSends: ["do:", "ifFalse:", "value:"]
  512. }),
  513. $globals.Collection);
  514. $core.addMethod(
  515. $core.method({
  516. selector: "anyOne",
  517. protocol: "accessing",
  518. fn: function (){
  519. var self=this,$self=this;
  520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  521. return $core.withContext(function($ctx1) {
  522. //>>excludeEnd("ctx");
  523. var $early={};
  524. try {
  525. $self._ifEmpty_((function(){
  526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  527. return $core.withContext(function($ctx2) {
  528. //>>excludeEnd("ctx");
  529. return $self._error_("Collection is empty");
  530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  532. //>>excludeEnd("ctx");
  533. }));
  534. $self._do_((function(each){
  535. throw $early=[each];
  536. }));
  537. return self;
  538. }
  539. catch(e) {if(e===$early)return e[0]; throw e}
  540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  541. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  542. //>>excludeEnd("ctx");
  543. },
  544. //>>excludeStart("ide", pragmas.excludeIdeData);
  545. args: [],
  546. source: "anyOne\x0a\x09\x22Answer a representative sample of the receiver. This method can\x0a\x09be helpful when needing to preinfer the nature of the contents of \x0a\x09semi-homogeneous collections.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self do: [ :each | ^ each ]",
  547. referencedClasses: [],
  548. //>>excludeEnd("ide");
  549. messageSends: ["ifEmpty:", "error:", "do:"]
  550. }),
  551. $globals.Collection);
  552. $core.addMethod(
  553. $core.method({
  554. selector: "anySatisfy:",
  555. protocol: "enumerating",
  556. fn: function (aBlock){
  557. var self=this,$self=this;
  558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  559. return $core.withContext(function($ctx1) {
  560. //>>excludeEnd("ctx");
  561. var $1;
  562. var $early={};
  563. try {
  564. $self._do_((function(each){
  565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  566. return $core.withContext(function($ctx2) {
  567. //>>excludeEnd("ctx");
  568. $1=$recv(aBlock)._value_(each);
  569. if($core.assert($1)){
  570. throw $early=[true];
  571. }
  572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  573. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  574. //>>excludeEnd("ctx");
  575. }));
  576. return false;
  577. }
  578. catch(e) {if(e===$early)return e[0]; throw e}
  579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  580. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  581. //>>excludeEnd("ctx");
  582. },
  583. //>>excludeStart("ide", pragmas.excludeIdeData);
  584. args: ["aBlock"],
  585. source: "anySatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns true for any element return true.\x0a\x09Otherwise return false.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^ true ] ].\x0a\x09^ false",
  586. referencedClasses: [],
  587. //>>excludeEnd("ide");
  588. messageSends: ["do:", "ifTrue:", "value:"]
  589. }),
  590. $globals.Collection);
  591. $core.addMethod(
  592. $core.method({
  593. selector: "asArray",
  594. protocol: "converting",
  595. fn: function (){
  596. var self=this,$self=this;
  597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  598. return $core.withContext(function($ctx1) {
  599. //>>excludeEnd("ctx");
  600. return $recv($globals.Array)._withAll_(self);
  601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  602. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  603. //>>excludeEnd("ctx");
  604. },
  605. //>>excludeStart("ide", pragmas.excludeIdeData);
  606. args: [],
  607. source: "asArray\x0a\x09^ Array withAll: self",
  608. referencedClasses: ["Array"],
  609. //>>excludeEnd("ide");
  610. messageSends: ["withAll:"]
  611. }),
  612. $globals.Collection);
  613. $core.addMethod(
  614. $core.method({
  615. selector: "asJavaScriptObject",
  616. protocol: "converting",
  617. fn: function (){
  618. var self=this,$self=this;
  619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  620. return $core.withContext(function($ctx1) {
  621. //>>excludeEnd("ctx");
  622. return $recv($self._asArray())._collect_((function(each){
  623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  624. return $core.withContext(function($ctx2) {
  625. //>>excludeEnd("ctx");
  626. return $recv(each)._asJavaScriptObject();
  627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  628. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  629. //>>excludeEnd("ctx");
  630. }));
  631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  632. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.Collection)});
  633. //>>excludeEnd("ctx");
  634. },
  635. //>>excludeStart("ide", pragmas.excludeIdeData);
  636. args: [],
  637. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  638. referencedClasses: [],
  639. //>>excludeEnd("ide");
  640. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  641. }),
  642. $globals.Collection);
  643. $core.addMethod(
  644. $core.method({
  645. selector: "asOrderedCollection",
  646. protocol: "converting",
  647. fn: function (){
  648. var self=this,$self=this;
  649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  650. return $core.withContext(function($ctx1) {
  651. //>>excludeEnd("ctx");
  652. return $self._asArray();
  653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  654. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  655. //>>excludeEnd("ctx");
  656. },
  657. //>>excludeStart("ide", pragmas.excludeIdeData);
  658. args: [],
  659. source: "asOrderedCollection\x0a\x09^ self asArray",
  660. referencedClasses: [],
  661. //>>excludeEnd("ide");
  662. messageSends: ["asArray"]
  663. }),
  664. $globals.Collection);
  665. $core.addMethod(
  666. $core.method({
  667. selector: "asSet",
  668. protocol: "converting",
  669. fn: function (){
  670. var self=this,$self=this;
  671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  672. return $core.withContext(function($ctx1) {
  673. //>>excludeEnd("ctx");
  674. return $recv($globals.Set)._withAll_(self);
  675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  676. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  677. //>>excludeEnd("ctx");
  678. },
  679. //>>excludeStart("ide", pragmas.excludeIdeData);
  680. args: [],
  681. source: "asSet\x0a\x09^ Set withAll: self",
  682. referencedClasses: ["Set"],
  683. //>>excludeEnd("ide");
  684. messageSends: ["withAll:"]
  685. }),
  686. $globals.Collection);
  687. $core.addMethod(
  688. $core.method({
  689. selector: "collect:",
  690. protocol: "enumerating",
  691. fn: function (aBlock){
  692. var self=this,$self=this;
  693. var stream;
  694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  695. return $core.withContext(function($ctx1) {
  696. //>>excludeEnd("ctx");
  697. stream=$recv($recv($self._class())._new())._writeStream();
  698. $self._do_((function(each){
  699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  700. return $core.withContext(function($ctx2) {
  701. //>>excludeEnd("ctx");
  702. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  704. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  705. //>>excludeEnd("ctx");
  706. }));
  707. return $recv(stream)._contents();
  708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  709. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  710. //>>excludeEnd("ctx");
  711. },
  712. //>>excludeStart("ide", pragmas.excludeIdeData);
  713. args: ["aBlock"],
  714. source: "collect: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09stream nextPut: (aBlock value: each) ].\x0a\x09^ stream contents",
  715. referencedClasses: [],
  716. //>>excludeEnd("ide");
  717. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  718. }),
  719. $globals.Collection);
  720. $core.addMethod(
  721. $core.method({
  722. selector: "copyWith:",
  723. protocol: "copying",
  724. fn: function (anObject){
  725. var self=this,$self=this;
  726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  727. return $core.withContext(function($ctx1) {
  728. //>>excludeEnd("ctx");
  729. var $1;
  730. $1=$self._copy();
  731. $recv($1)._add_(anObject);
  732. return $recv($1)._yourself();
  733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  734. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  735. //>>excludeEnd("ctx");
  736. },
  737. //>>excludeStart("ide", pragmas.excludeIdeData);
  738. args: ["anObject"],
  739. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  740. referencedClasses: [],
  741. //>>excludeEnd("ide");
  742. messageSends: ["add:", "copy", "yourself"]
  743. }),
  744. $globals.Collection);
  745. $core.addMethod(
  746. $core.method({
  747. selector: "copyWithAll:",
  748. protocol: "copying",
  749. fn: function (aCollection){
  750. var self=this,$self=this;
  751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  752. return $core.withContext(function($ctx1) {
  753. //>>excludeEnd("ctx");
  754. var $1;
  755. $1=$self._copy();
  756. $recv($1)._addAll_(aCollection);
  757. return $recv($1)._yourself();
  758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  759. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  760. //>>excludeEnd("ctx");
  761. },
  762. //>>excludeStart("ide", pragmas.excludeIdeData);
  763. args: ["aCollection"],
  764. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  765. referencedClasses: [],
  766. //>>excludeEnd("ide");
  767. messageSends: ["addAll:", "copy", "yourself"]
  768. }),
  769. $globals.Collection);
  770. $core.addMethod(
  771. $core.method({
  772. selector: "copyWithout:",
  773. protocol: "copying",
  774. fn: function (anObject){
  775. var self=this,$self=this;
  776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  777. return $core.withContext(function($ctx1) {
  778. //>>excludeEnd("ctx");
  779. return $self._reject_((function(each){
  780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  781. return $core.withContext(function($ctx2) {
  782. //>>excludeEnd("ctx");
  783. return $recv(each).__eq(anObject);
  784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  785. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  786. //>>excludeEnd("ctx");
  787. }));
  788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  789. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject},$globals.Collection)});
  790. //>>excludeEnd("ctx");
  791. },
  792. //>>excludeStart("ide", pragmas.excludeIdeData);
  793. args: ["anObject"],
  794. source: "copyWithout: anObject\x0a\x09\x22Answer a copy of the receiver that does not contain\x0a\x09any occurrences of anObject.\x22\x0a\x0a\x09^ self reject: [ :each | each = anObject ]",
  795. referencedClasses: [],
  796. //>>excludeEnd("ide");
  797. messageSends: ["reject:", "="]
  798. }),
  799. $globals.Collection);
  800. $core.addMethod(
  801. $core.method({
  802. selector: "copyWithoutAll:",
  803. protocol: "copying",
  804. fn: function (aCollection){
  805. var self=this,$self=this;
  806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  807. return $core.withContext(function($ctx1) {
  808. //>>excludeEnd("ctx");
  809. return $self._reject_((function(each){
  810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  811. return $core.withContext(function($ctx2) {
  812. //>>excludeEnd("ctx");
  813. return $recv(aCollection)._includes_(each);
  814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  815. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  816. //>>excludeEnd("ctx");
  817. }));
  818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  819. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  820. //>>excludeEnd("ctx");
  821. },
  822. //>>excludeStart("ide", pragmas.excludeIdeData);
  823. args: ["aCollection"],
  824. source: "copyWithoutAll: aCollection\x0a\x09\x22Answer a copy of the receiver that does not contain any elements\x0a\x09equal to those in aCollection.\x22\x0a\x0a\x09^ self reject: [ :each | aCollection includes: each ]",
  825. referencedClasses: [],
  826. //>>excludeEnd("ide");
  827. messageSends: ["reject:", "includes:"]
  828. }),
  829. $globals.Collection);
  830. $core.addMethod(
  831. $core.method({
  832. selector: "deepCopy",
  833. protocol: "copying",
  834. fn: function (){
  835. var self=this,$self=this;
  836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  837. return $core.withContext(function($ctx1) {
  838. //>>excludeEnd("ctx");
  839. return $self._collect_((function(each){
  840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  841. return $core.withContext(function($ctx2) {
  842. //>>excludeEnd("ctx");
  843. return $recv(each)._deepCopy();
  844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  845. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  846. //>>excludeEnd("ctx");
  847. }));
  848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  849. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  850. //>>excludeEnd("ctx");
  851. },
  852. //>>excludeStart("ide", pragmas.excludeIdeData);
  853. args: [],
  854. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  855. referencedClasses: [],
  856. //>>excludeEnd("ide");
  857. messageSends: ["collect:", "deepCopy"]
  858. }),
  859. $globals.Collection);
  860. $core.addMethod(
  861. $core.method({
  862. selector: "detect:",
  863. protocol: "enumerating",
  864. fn: function (aBlock){
  865. var self=this,$self=this;
  866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  867. return $core.withContext(function($ctx1) {
  868. //>>excludeEnd("ctx");
  869. return $self._detect_ifNone_(aBlock,(function(){
  870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  871. return $core.withContext(function($ctx2) {
  872. //>>excludeEnd("ctx");
  873. return $self._errorNotFound();
  874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  876. //>>excludeEnd("ctx");
  877. }));
  878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  879. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  880. //>>excludeEnd("ctx");
  881. },
  882. //>>excludeStart("ide", pragmas.excludeIdeData);
  883. args: ["aBlock"],
  884. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  885. referencedClasses: [],
  886. //>>excludeEnd("ide");
  887. messageSends: ["detect:ifNone:", "errorNotFound"]
  888. }),
  889. $globals.Collection);
  890. $core.addMethod(
  891. $core.method({
  892. selector: "detect:ifNone:",
  893. protocol: "enumerating",
  894. fn: function (aBlock,anotherBlock){
  895. var self=this,$self=this;
  896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  897. return $core.withContext(function($ctx1) {
  898. //>>excludeEnd("ctx");
  899. var $1;
  900. var $early={};
  901. try {
  902. $self._do_((function(each){
  903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  904. return $core.withContext(function($ctx2) {
  905. //>>excludeEnd("ctx");
  906. $1=$recv(aBlock)._value_(each);
  907. if($core.assert($1)){
  908. throw $early=[each];
  909. }
  910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  911. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  912. //>>excludeEnd("ctx");
  913. }));
  914. return $recv(anotherBlock)._value();
  915. }
  916. catch(e) {if(e===$early)return e[0]; throw e}
  917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  918. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  919. //>>excludeEnd("ctx");
  920. },
  921. //>>excludeStart("ide", pragmas.excludeIdeData);
  922. args: ["aBlock", "anotherBlock"],
  923. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  924. referencedClasses: [],
  925. //>>excludeEnd("ide");
  926. messageSends: ["do:", "ifTrue:", "value:", "value"]
  927. }),
  928. $globals.Collection);
  929. $core.addMethod(
  930. $core.method({
  931. selector: "do:",
  932. protocol: "enumerating",
  933. fn: function (aBlock){
  934. var self=this,$self=this;
  935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  936. return $core.withContext(function($ctx1) {
  937. //>>excludeEnd("ctx");
  938. $self._subclassResponsibility();
  939. return self;
  940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  941. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  942. //>>excludeEnd("ctx");
  943. },
  944. //>>excludeStart("ide", pragmas.excludeIdeData);
  945. args: ["aBlock"],
  946. source: "do: aBlock\x0a\x09self subclassResponsibility",
  947. referencedClasses: [],
  948. //>>excludeEnd("ide");
  949. messageSends: ["subclassResponsibility"]
  950. }),
  951. $globals.Collection);
  952. $core.addMethod(
  953. $core.method({
  954. selector: "do:separatedBy:",
  955. protocol: "enumerating",
  956. fn: function (aBlock,anotherBlock){
  957. var self=this,$self=this;
  958. var actionBeforeElement;
  959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  960. return $core.withContext(function($ctx1) {
  961. //>>excludeEnd("ctx");
  962. actionBeforeElement=(function(){
  963. actionBeforeElement=anotherBlock;
  964. return actionBeforeElement;
  965. });
  966. $self._do_((function(each){
  967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  968. return $core.withContext(function($ctx2) {
  969. //>>excludeEnd("ctx");
  970. $recv(actionBeforeElement)._value();
  971. return $recv(aBlock)._value_(each);
  972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  973. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  974. //>>excludeEnd("ctx");
  975. }));
  976. return self;
  977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  978. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  979. //>>excludeEnd("ctx");
  980. },
  981. //>>excludeStart("ide", pragmas.excludeIdeData);
  982. args: ["aBlock", "anotherBlock"],
  983. 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 ]",
  984. referencedClasses: [],
  985. //>>excludeEnd("ide");
  986. messageSends: ["do:", "value", "value:"]
  987. }),
  988. $globals.Collection);
  989. $core.addMethod(
  990. $core.method({
  991. selector: "errorNotFound",
  992. protocol: "error handling",
  993. fn: function (){
  994. var self=this,$self=this;
  995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  996. return $core.withContext(function($ctx1) {
  997. //>>excludeEnd("ctx");
  998. $self._error_("Object is not in the collection");
  999. return self;
  1000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1001. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  1002. //>>excludeEnd("ctx");
  1003. },
  1004. //>>excludeStart("ide", pragmas.excludeIdeData);
  1005. args: [],
  1006. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  1007. referencedClasses: [],
  1008. //>>excludeEnd("ide");
  1009. messageSends: ["error:"]
  1010. }),
  1011. $globals.Collection);
  1012. $core.addMethod(
  1013. $core.method({
  1014. selector: "ifEmpty:",
  1015. protocol: "testing",
  1016. fn: function (aBlock){
  1017. var self=this,$self=this;
  1018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1019. return $core.withContext(function($ctx1) {
  1020. //>>excludeEnd("ctx");
  1021. var $1;
  1022. $1=$self._isEmpty();
  1023. if($core.assert($1)){
  1024. return $recv(aBlock)._value();
  1025. } else {
  1026. return self;
  1027. }
  1028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1029. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  1030. //>>excludeEnd("ctx");
  1031. },
  1032. //>>excludeStart("ide", pragmas.excludeIdeData);
  1033. args: ["aBlock"],
  1034. 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 ]",
  1035. referencedClasses: [],
  1036. //>>excludeEnd("ide");
  1037. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  1038. }),
  1039. $globals.Collection);
  1040. $core.addMethod(
  1041. $core.method({
  1042. selector: "ifEmpty:ifNotEmpty:",
  1043. protocol: "testing",
  1044. fn: function (aBlock,anotherBlock){
  1045. var self=this,$self=this;
  1046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1047. return $core.withContext(function($ctx1) {
  1048. //>>excludeEnd("ctx");
  1049. var $1;
  1050. $1=$self._isEmpty();
  1051. if($core.assert($1)){
  1052. return $recv(aBlock)._value();
  1053. } else {
  1054. return $recv(anotherBlock)._value_(self);
  1055. }
  1056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1057. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  1058. //>>excludeEnd("ctx");
  1059. },
  1060. //>>excludeStart("ide", pragmas.excludeIdeData);
  1061. args: ["aBlock", "anotherBlock"],
  1062. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  1063. referencedClasses: [],
  1064. //>>excludeEnd("ide");
  1065. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  1066. }),
  1067. $globals.Collection);
  1068. $core.addMethod(
  1069. $core.method({
  1070. selector: "ifNotEmpty:",
  1071. protocol: "testing",
  1072. fn: function (aBlock){
  1073. var self=this,$self=this;
  1074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1075. return $core.withContext(function($ctx1) {
  1076. //>>excludeEnd("ctx");
  1077. var $1;
  1078. $1=$self._notEmpty();
  1079. if($core.assert($1)){
  1080. return $recv(aBlock)._value_(self);
  1081. } else {
  1082. return self;
  1083. }
  1084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1085. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  1086. //>>excludeEnd("ctx");
  1087. },
  1088. //>>excludeStart("ide", pragmas.excludeIdeData);
  1089. args: ["aBlock"],
  1090. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  1091. referencedClasses: [],
  1092. //>>excludeEnd("ide");
  1093. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1094. }),
  1095. $globals.Collection);
  1096. $core.addMethod(
  1097. $core.method({
  1098. selector: "ifNotEmpty:ifEmpty:",
  1099. protocol: "testing",
  1100. fn: function (aBlock,anotherBlock){
  1101. var self=this,$self=this;
  1102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1103. return $core.withContext(function($ctx1) {
  1104. //>>excludeEnd("ctx");
  1105. var $1;
  1106. $1=$self._notEmpty();
  1107. if($core.assert($1)){
  1108. return $recv(aBlock)._value_(self);
  1109. } else {
  1110. return $recv(anotherBlock)._value();
  1111. }
  1112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1113. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  1114. //>>excludeEnd("ctx");
  1115. },
  1116. //>>excludeStart("ide", pragmas.excludeIdeData);
  1117. args: ["aBlock", "anotherBlock"],
  1118. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  1119. referencedClasses: [],
  1120. //>>excludeEnd("ide");
  1121. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  1122. }),
  1123. $globals.Collection);
  1124. $core.addMethod(
  1125. $core.method({
  1126. selector: "includes:",
  1127. protocol: "testing",
  1128. fn: function (anObject){
  1129. var self=this,$self=this;
  1130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1131. return $core.withContext(function($ctx1) {
  1132. //>>excludeEnd("ctx");
  1133. return $self._anySatisfy_((function(each){
  1134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1135. return $core.withContext(function($ctx2) {
  1136. //>>excludeEnd("ctx");
  1137. return $recv(each).__eq(anObject);
  1138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1139. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1140. //>>excludeEnd("ctx");
  1141. }));
  1142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1143. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  1144. //>>excludeEnd("ctx");
  1145. },
  1146. //>>excludeStart("ide", pragmas.excludeIdeData);
  1147. args: ["anObject"],
  1148. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  1149. referencedClasses: [],
  1150. //>>excludeEnd("ide");
  1151. messageSends: ["anySatisfy:", "="]
  1152. }),
  1153. $globals.Collection);
  1154. $core.addMethod(
  1155. $core.method({
  1156. selector: "inject:into:",
  1157. protocol: "enumerating",
  1158. fn: function (anObject,aBlock){
  1159. var self=this,$self=this;
  1160. var result;
  1161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1162. return $core.withContext(function($ctx1) {
  1163. //>>excludeEnd("ctx");
  1164. result=anObject;
  1165. $self._do_((function(each){
  1166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1167. return $core.withContext(function($ctx2) {
  1168. //>>excludeEnd("ctx");
  1169. result=$recv(aBlock)._value_value_(result,each);
  1170. return result;
  1171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1172. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1173. //>>excludeEnd("ctx");
  1174. }));
  1175. return result;
  1176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1177. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  1178. //>>excludeEnd("ctx");
  1179. },
  1180. //>>excludeStart("ide", pragmas.excludeIdeData);
  1181. args: ["anObject", "aBlock"],
  1182. 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",
  1183. referencedClasses: [],
  1184. //>>excludeEnd("ide");
  1185. messageSends: ["do:", "value:value:"]
  1186. }),
  1187. $globals.Collection);
  1188. $core.addMethod(
  1189. $core.method({
  1190. selector: "intersection:",
  1191. protocol: "enumerating",
  1192. fn: function (aCollection){
  1193. var self=this,$self=this;
  1194. var set,outputSet;
  1195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1196. return $core.withContext(function($ctx1) {
  1197. //>>excludeEnd("ctx");
  1198. var $2,$1;
  1199. set=$self._asSet();
  1200. outputSet=$recv($globals.Set)._new();
  1201. $recv(aCollection)._do_((function(each){
  1202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1203. return $core.withContext(function($ctx2) {
  1204. //>>excludeEnd("ctx");
  1205. $2=$recv(set)._includes_(each);
  1206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1207. $ctx2.sendIdx["includes:"]=1;
  1208. //>>excludeEnd("ctx");
  1209. $1=$recv($2)._and_((function(){
  1210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1211. return $core.withContext(function($ctx3) {
  1212. //>>excludeEnd("ctx");
  1213. return $recv($recv(outputSet)._includes_(each))._not();
  1214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1215. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1216. //>>excludeEnd("ctx");
  1217. }));
  1218. if($core.assert($1)){
  1219. return $recv(outputSet)._add_(each);
  1220. }
  1221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1222. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1223. //>>excludeEnd("ctx");
  1224. }));
  1225. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  1226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1227. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  1228. //>>excludeEnd("ctx");
  1229. },
  1230. //>>excludeStart("ide", pragmas.excludeIdeData);
  1231. args: ["aCollection"],
  1232. 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",
  1233. referencedClasses: ["Set"],
  1234. //>>excludeEnd("ide");
  1235. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  1236. }),
  1237. $globals.Collection);
  1238. $core.addMethod(
  1239. $core.method({
  1240. selector: "isEmpty",
  1241. protocol: "testing",
  1242. fn: function (){
  1243. var self=this,$self=this;
  1244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1245. return $core.withContext(function($ctx1) {
  1246. //>>excludeEnd("ctx");
  1247. return $recv($self._size()).__eq((0));
  1248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1249. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  1250. //>>excludeEnd("ctx");
  1251. },
  1252. //>>excludeStart("ide", pragmas.excludeIdeData);
  1253. args: [],
  1254. source: "isEmpty\x0a\x09^ self size = 0",
  1255. referencedClasses: [],
  1256. //>>excludeEnd("ide");
  1257. messageSends: ["=", "size"]
  1258. }),
  1259. $globals.Collection);
  1260. $core.addMethod(
  1261. $core.method({
  1262. selector: "noneSatisfy:",
  1263. protocol: "enumerating",
  1264. fn: function (aBlock){
  1265. var self=this,$self=this;
  1266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1267. return $core.withContext(function($ctx1) {
  1268. //>>excludeEnd("ctx");
  1269. var $1;
  1270. var $early={};
  1271. try {
  1272. $self._do_((function(item){
  1273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1274. return $core.withContext(function($ctx2) {
  1275. //>>excludeEnd("ctx");
  1276. $1=$recv(aBlock)._value_(item);
  1277. if($core.assert($1)){
  1278. throw $early=[false];
  1279. }
  1280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1281. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  1282. //>>excludeEnd("ctx");
  1283. }));
  1284. return true;
  1285. }
  1286. catch(e) {if(e===$early)return e[0]; throw e}
  1287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1288. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  1289. //>>excludeEnd("ctx");
  1290. },
  1291. //>>excludeStart("ide", pragmas.excludeIdeData);
  1292. args: ["aBlock"],
  1293. 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",
  1294. referencedClasses: [],
  1295. //>>excludeEnd("ide");
  1296. messageSends: ["do:", "ifTrue:", "value:"]
  1297. }),
  1298. $globals.Collection);
  1299. $core.addMethod(
  1300. $core.method({
  1301. selector: "notEmpty",
  1302. protocol: "testing",
  1303. fn: function (){
  1304. var self=this,$self=this;
  1305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1306. return $core.withContext(function($ctx1) {
  1307. //>>excludeEnd("ctx");
  1308. return $recv($self._isEmpty())._not();
  1309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1310. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  1311. //>>excludeEnd("ctx");
  1312. },
  1313. //>>excludeStart("ide", pragmas.excludeIdeData);
  1314. args: [],
  1315. source: "notEmpty\x0a\x09^ self isEmpty not",
  1316. referencedClasses: [],
  1317. //>>excludeEnd("ide");
  1318. messageSends: ["not", "isEmpty"]
  1319. }),
  1320. $globals.Collection);
  1321. $core.addMethod(
  1322. $core.method({
  1323. selector: "occurrencesOf:",
  1324. protocol: "accessing",
  1325. fn: function (anObject){
  1326. var self=this,$self=this;
  1327. var tally;
  1328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1329. return $core.withContext(function($ctx1) {
  1330. //>>excludeEnd("ctx");
  1331. var $1;
  1332. tally=(0);
  1333. $self._do_((function(each){
  1334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1335. return $core.withContext(function($ctx2) {
  1336. //>>excludeEnd("ctx");
  1337. $1=$recv(anObject).__eq(each);
  1338. if($core.assert($1)){
  1339. tally=$recv(tally).__plus((1));
  1340. return tally;
  1341. }
  1342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1343. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1344. //>>excludeEnd("ctx");
  1345. }));
  1346. return tally;
  1347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1348. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  1349. //>>excludeEnd("ctx");
  1350. },
  1351. //>>excludeStart("ide", pragmas.excludeIdeData);
  1352. args: ["anObject"],
  1353. 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",
  1354. referencedClasses: [],
  1355. //>>excludeEnd("ide");
  1356. messageSends: ["do:", "ifTrue:", "=", "+"]
  1357. }),
  1358. $globals.Collection);
  1359. $core.addMethod(
  1360. $core.method({
  1361. selector: "putOn:",
  1362. protocol: "streaming",
  1363. fn: function (aStream){
  1364. var self=this,$self=this;
  1365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1366. return $core.withContext(function($ctx1) {
  1367. //>>excludeEnd("ctx");
  1368. $self._do_((function(each){
  1369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1370. return $core.withContext(function($ctx2) {
  1371. //>>excludeEnd("ctx");
  1372. return $recv(each)._putOn_(aStream);
  1373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1374. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1375. //>>excludeEnd("ctx");
  1376. }));
  1377. return self;
  1378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1379. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  1380. //>>excludeEnd("ctx");
  1381. },
  1382. //>>excludeStart("ide", pragmas.excludeIdeData);
  1383. args: ["aStream"],
  1384. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  1385. referencedClasses: [],
  1386. //>>excludeEnd("ide");
  1387. messageSends: ["do:", "putOn:"]
  1388. }),
  1389. $globals.Collection);
  1390. $core.addMethod(
  1391. $core.method({
  1392. selector: "reject:",
  1393. protocol: "enumerating",
  1394. fn: function (aBlock){
  1395. var self=this,$self=this;
  1396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1397. return $core.withContext(function($ctx1) {
  1398. //>>excludeEnd("ctx");
  1399. return $self._select_((function(each){
  1400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1401. return $core.withContext(function($ctx2) {
  1402. //>>excludeEnd("ctx");
  1403. return $recv($recv(aBlock)._value_(each)).__eq(false);
  1404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1405. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1406. //>>excludeEnd("ctx");
  1407. }));
  1408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1409. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  1410. //>>excludeEnd("ctx");
  1411. },
  1412. //>>excludeStart("ide", pragmas.excludeIdeData);
  1413. args: ["aBlock"],
  1414. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  1415. referencedClasses: [],
  1416. //>>excludeEnd("ide");
  1417. messageSends: ["select:", "=", "value:"]
  1418. }),
  1419. $globals.Collection);
  1420. $core.addMethod(
  1421. $core.method({
  1422. selector: "remove:",
  1423. protocol: "adding/removing",
  1424. fn: function (anObject){
  1425. var self=this,$self=this;
  1426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1427. return $core.withContext(function($ctx1) {
  1428. //>>excludeEnd("ctx");
  1429. return $self._remove_ifAbsent_(anObject,(function(){
  1430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1431. return $core.withContext(function($ctx2) {
  1432. //>>excludeEnd("ctx");
  1433. return $self._errorNotFound();
  1434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1435. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1436. //>>excludeEnd("ctx");
  1437. }));
  1438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1439. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  1440. //>>excludeEnd("ctx");
  1441. },
  1442. //>>excludeStart("ide", pragmas.excludeIdeData);
  1443. args: ["anObject"],
  1444. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  1445. referencedClasses: [],
  1446. //>>excludeEnd("ide");
  1447. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  1448. }),
  1449. $globals.Collection);
  1450. $core.addMethod(
  1451. $core.method({
  1452. selector: "remove:ifAbsent:",
  1453. protocol: "adding/removing",
  1454. fn: function (anObject,aBlock){
  1455. var self=this,$self=this;
  1456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1457. return $core.withContext(function($ctx1) {
  1458. //>>excludeEnd("ctx");
  1459. $self._subclassResponsibility();
  1460. return self;
  1461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1462. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  1463. //>>excludeEnd("ctx");
  1464. },
  1465. //>>excludeStart("ide", pragmas.excludeIdeData);
  1466. args: ["anObject", "aBlock"],
  1467. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1468. referencedClasses: [],
  1469. //>>excludeEnd("ide");
  1470. messageSends: ["subclassResponsibility"]
  1471. }),
  1472. $globals.Collection);
  1473. $core.addMethod(
  1474. $core.method({
  1475. selector: "removeAll",
  1476. protocol: "adding/removing",
  1477. fn: function (){
  1478. var self=this,$self=this;
  1479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1480. return $core.withContext(function($ctx1) {
  1481. //>>excludeEnd("ctx");
  1482. $self._subclassResponsibility();
  1483. return self;
  1484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1485. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  1486. //>>excludeEnd("ctx");
  1487. },
  1488. //>>excludeStart("ide", pragmas.excludeIdeData);
  1489. args: [],
  1490. source: "removeAll\x0a\x09self subclassResponsibility",
  1491. referencedClasses: [],
  1492. //>>excludeEnd("ide");
  1493. messageSends: ["subclassResponsibility"]
  1494. }),
  1495. $globals.Collection);
  1496. $core.addMethod(
  1497. $core.method({
  1498. selector: "select:",
  1499. protocol: "enumerating",
  1500. fn: function (aBlock){
  1501. var self=this,$self=this;
  1502. var stream;
  1503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1504. return $core.withContext(function($ctx1) {
  1505. //>>excludeEnd("ctx");
  1506. var $1;
  1507. stream=$recv($recv($self._class())._new())._writeStream();
  1508. $self._do_((function(each){
  1509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1510. return $core.withContext(function($ctx2) {
  1511. //>>excludeEnd("ctx");
  1512. $1=$recv(aBlock)._value_(each);
  1513. if($core.assert($1)){
  1514. return $recv(stream)._nextPut_(each);
  1515. }
  1516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1517. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1518. //>>excludeEnd("ctx");
  1519. }));
  1520. return $recv(stream)._contents();
  1521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1522. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  1523. //>>excludeEnd("ctx");
  1524. },
  1525. //>>excludeStart("ide", pragmas.excludeIdeData);
  1526. args: ["aBlock"],
  1527. 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",
  1528. referencedClasses: [],
  1529. //>>excludeEnd("ide");
  1530. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1531. }),
  1532. $globals.Collection);
  1533. $core.addMethod(
  1534. $core.method({
  1535. selector: "select:thenCollect:",
  1536. protocol: "enumerating",
  1537. fn: function (selectBlock,collectBlock){
  1538. var self=this,$self=this;
  1539. var stream;
  1540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1541. return $core.withContext(function($ctx1) {
  1542. //>>excludeEnd("ctx");
  1543. var $1;
  1544. stream=$recv($recv($self._class())._new())._writeStream();
  1545. $self._do_((function(each){
  1546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1547. return $core.withContext(function($ctx2) {
  1548. //>>excludeEnd("ctx");
  1549. $1=$recv(selectBlock)._value_(each);
  1550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1551. $ctx2.sendIdx["value:"]=1;
  1552. //>>excludeEnd("ctx");
  1553. if($core.assert($1)){
  1554. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  1555. }
  1556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1557. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1558. //>>excludeEnd("ctx");
  1559. }));
  1560. return $recv(stream)._contents();
  1561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1562. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  1563. //>>excludeEnd("ctx");
  1564. },
  1565. //>>excludeStart("ide", pragmas.excludeIdeData);
  1566. args: ["selectBlock", "collectBlock"],
  1567. 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",
  1568. referencedClasses: [],
  1569. //>>excludeEnd("ide");
  1570. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1571. }),
  1572. $globals.Collection);
  1573. $core.addMethod(
  1574. $core.method({
  1575. selector: "shallowCopy",
  1576. protocol: "copying",
  1577. fn: function (){
  1578. var self=this,$self=this;
  1579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1580. return $core.withContext(function($ctx1) {
  1581. //>>excludeEnd("ctx");
  1582. return $self._collect_((function(each){
  1583. return each;
  1584. }));
  1585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1586. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  1587. //>>excludeEnd("ctx");
  1588. },
  1589. //>>excludeStart("ide", pragmas.excludeIdeData);
  1590. args: [],
  1591. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  1592. referencedClasses: [],
  1593. //>>excludeEnd("ide");
  1594. messageSends: ["collect:"]
  1595. }),
  1596. $globals.Collection);
  1597. $core.addMethod(
  1598. $core.method({
  1599. selector: "single",
  1600. protocol: "accessing",
  1601. fn: function (){
  1602. var self=this,$self=this;
  1603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1604. return $core.withContext(function($ctx1) {
  1605. //>>excludeEnd("ctx");
  1606. var $1;
  1607. $self._ifEmpty_((function(){
  1608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1609. return $core.withContext(function($ctx2) {
  1610. //>>excludeEnd("ctx");
  1611. return $self._error_("Collection is empty");
  1612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1613. $ctx2.sendIdx["error:"]=1;
  1614. //>>excludeEnd("ctx");
  1615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1616. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1617. //>>excludeEnd("ctx");
  1618. }));
  1619. $1=$recv($self._size()).__gt((1));
  1620. if($core.assert($1)){
  1621. $self._error_("Collection holds more than one element");
  1622. }
  1623. return $self._anyOne();
  1624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1625. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  1626. //>>excludeEnd("ctx");
  1627. },
  1628. //>>excludeStart("ide", pragmas.excludeIdeData);
  1629. args: [],
  1630. 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",
  1631. referencedClasses: [],
  1632. //>>excludeEnd("ide");
  1633. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  1634. }),
  1635. $globals.Collection);
  1636. $core.addMethod(
  1637. $core.method({
  1638. selector: "size",
  1639. protocol: "accessing",
  1640. fn: function (){
  1641. var self=this,$self=this;
  1642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1643. return $core.withContext(function($ctx1) {
  1644. //>>excludeEnd("ctx");
  1645. $self._subclassResponsibility();
  1646. return self;
  1647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1648. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  1649. //>>excludeEnd("ctx");
  1650. },
  1651. //>>excludeStart("ide", pragmas.excludeIdeData);
  1652. args: [],
  1653. source: "size\x0a\x09self subclassResponsibility",
  1654. referencedClasses: [],
  1655. //>>excludeEnd("ide");
  1656. messageSends: ["subclassResponsibility"]
  1657. }),
  1658. $globals.Collection);
  1659. $core.addMethod(
  1660. $core.method({
  1661. selector: "classTag",
  1662. protocol: "accessing",
  1663. fn: function (){
  1664. var self=this,$self=this;
  1665. return "collection";
  1666. },
  1667. //>>excludeStart("ide", pragmas.excludeIdeData);
  1668. args: [],
  1669. 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'",
  1670. referencedClasses: [],
  1671. //>>excludeEnd("ide");
  1672. messageSends: []
  1673. }),
  1674. $globals.Collection.a$cls);
  1675. $core.addMethod(
  1676. $core.method({
  1677. selector: "new:",
  1678. protocol: "instance creation",
  1679. fn: function (anInteger){
  1680. var self=this,$self=this;
  1681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1682. return $core.withContext(function($ctx1) {
  1683. //>>excludeEnd("ctx");
  1684. return $self._new();
  1685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1686. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.a$cls)});
  1687. //>>excludeEnd("ctx");
  1688. },
  1689. //>>excludeStart("ide", pragmas.excludeIdeData);
  1690. args: ["anInteger"],
  1691. source: "new: anInteger\x0a\x09^ self new",
  1692. referencedClasses: [],
  1693. //>>excludeEnd("ide");
  1694. messageSends: ["new"]
  1695. }),
  1696. $globals.Collection.a$cls);
  1697. $core.addMethod(
  1698. $core.method({
  1699. selector: "with:",
  1700. protocol: "instance creation",
  1701. fn: function (anObject){
  1702. var self=this,$self=this;
  1703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1704. return $core.withContext(function($ctx1) {
  1705. //>>excludeEnd("ctx");
  1706. var $1;
  1707. $1=$self._new();
  1708. $recv($1)._add_(anObject);
  1709. return $recv($1)._yourself();
  1710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1711. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.a$cls)});
  1712. //>>excludeEnd("ctx");
  1713. },
  1714. //>>excludeStart("ide", pragmas.excludeIdeData);
  1715. args: ["anObject"],
  1716. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1717. referencedClasses: [],
  1718. //>>excludeEnd("ide");
  1719. messageSends: ["add:", "new", "yourself"]
  1720. }),
  1721. $globals.Collection.a$cls);
  1722. $core.addMethod(
  1723. $core.method({
  1724. selector: "with:with:",
  1725. protocol: "instance creation",
  1726. fn: function (anObject,anotherObject){
  1727. var self=this,$self=this;
  1728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1729. return $core.withContext(function($ctx1) {
  1730. //>>excludeEnd("ctx");
  1731. var $1;
  1732. $1=$self._new();
  1733. $recv($1)._add_(anObject);
  1734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1735. $ctx1.sendIdx["add:"]=1;
  1736. //>>excludeEnd("ctx");
  1737. $recv($1)._add_(anotherObject);
  1738. return $recv($1)._yourself();
  1739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1740. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.a$cls)});
  1741. //>>excludeEnd("ctx");
  1742. },
  1743. //>>excludeStart("ide", pragmas.excludeIdeData);
  1744. args: ["anObject", "anotherObject"],
  1745. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1746. referencedClasses: [],
  1747. //>>excludeEnd("ide");
  1748. messageSends: ["add:", "new", "yourself"]
  1749. }),
  1750. $globals.Collection.a$cls);
  1751. $core.addMethod(
  1752. $core.method({
  1753. selector: "with:with:with:",
  1754. protocol: "instance creation",
  1755. fn: function (firstObject,secondObject,thirdObject){
  1756. var self=this,$self=this;
  1757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1758. return $core.withContext(function($ctx1) {
  1759. //>>excludeEnd("ctx");
  1760. var $1;
  1761. $1=$self._new();
  1762. $recv($1)._add_(firstObject);
  1763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1764. $ctx1.sendIdx["add:"]=1;
  1765. //>>excludeEnd("ctx");
  1766. $recv($1)._add_(secondObject);
  1767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1768. $ctx1.sendIdx["add:"]=2;
  1769. //>>excludeEnd("ctx");
  1770. $recv($1)._add_(thirdObject);
  1771. return $recv($1)._yourself();
  1772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1773. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.a$cls)});
  1774. //>>excludeEnd("ctx");
  1775. },
  1776. //>>excludeStart("ide", pragmas.excludeIdeData);
  1777. args: ["firstObject", "secondObject", "thirdObject"],
  1778. 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",
  1779. referencedClasses: [],
  1780. //>>excludeEnd("ide");
  1781. messageSends: ["add:", "new", "yourself"]
  1782. }),
  1783. $globals.Collection.a$cls);
  1784. $core.addMethod(
  1785. $core.method({
  1786. selector: "withAll:",
  1787. protocol: "instance creation",
  1788. fn: function (aCollection){
  1789. var self=this,$self=this;
  1790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1791. return $core.withContext(function($ctx1) {
  1792. //>>excludeEnd("ctx");
  1793. var $1;
  1794. $1=$self._new();
  1795. $recv($1)._addAll_(aCollection);
  1796. return $recv($1)._yourself();
  1797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1798. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.a$cls)});
  1799. //>>excludeEnd("ctx");
  1800. },
  1801. //>>excludeStart("ide", pragmas.excludeIdeData);
  1802. args: ["aCollection"],
  1803. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1804. referencedClasses: [],
  1805. //>>excludeEnd("ide");
  1806. messageSends: ["addAll:", "new", "yourself"]
  1807. }),
  1808. $globals.Collection.a$cls);
  1809. $core.addClass("AssociativeCollection", $globals.Collection, [], "Kernel-Collections");
  1810. //>>excludeStart("ide", pragmas.excludeIdeData);
  1811. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  1812. //>>excludeEnd("ide");
  1813. $core.addMethod(
  1814. $core.method({
  1815. selector: "=",
  1816. protocol: "comparing",
  1817. fn: function (anAssocitativeCollection){
  1818. var self=this,$self=this;
  1819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1820. return $core.withContext(function($ctx1) {
  1821. //>>excludeEnd("ctx");
  1822. var $2,$1,$4,$3,$5;
  1823. $2=$self._class();
  1824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1825. $ctx1.sendIdx["class"]=1;
  1826. //>>excludeEnd("ctx");
  1827. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  1828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1829. $ctx1.sendIdx["="]=1;
  1830. //>>excludeEnd("ctx");
  1831. if(!$core.assert($1)){
  1832. return false;
  1833. }
  1834. $4=$self._size();
  1835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1836. $ctx1.sendIdx["size"]=1;
  1837. //>>excludeEnd("ctx");
  1838. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  1839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1840. $ctx1.sendIdx["="]=2;
  1841. //>>excludeEnd("ctx");
  1842. if(!$core.assert($3)){
  1843. return false;
  1844. }
  1845. $5=$self._associations();
  1846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1847. $ctx1.sendIdx["associations"]=1;
  1848. //>>excludeEnd("ctx");
  1849. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  1850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1851. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  1852. //>>excludeEnd("ctx");
  1853. },
  1854. //>>excludeStart("ide", pragmas.excludeIdeData);
  1855. args: ["anAssocitativeCollection"],
  1856. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  1857. referencedClasses: [],
  1858. //>>excludeEnd("ide");
  1859. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  1860. }),
  1861. $globals.AssociativeCollection);
  1862. $core.addMethod(
  1863. $core.method({
  1864. selector: "add:",
  1865. protocol: "adding/removing",
  1866. fn: function (anAssociation){
  1867. var self=this,$self=this;
  1868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1869. return $core.withContext(function($ctx1) {
  1870. //>>excludeEnd("ctx");
  1871. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  1872. return self;
  1873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1874. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  1875. //>>excludeEnd("ctx");
  1876. },
  1877. //>>excludeStart("ide", pragmas.excludeIdeData);
  1878. args: ["anAssociation"],
  1879. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  1880. referencedClasses: [],
  1881. //>>excludeEnd("ide");
  1882. messageSends: ["at:put:", "key", "value"]
  1883. }),
  1884. $globals.AssociativeCollection);
  1885. $core.addMethod(
  1886. $core.method({
  1887. selector: "addAll:",
  1888. protocol: "adding/removing",
  1889. fn: function (anAssociativeCollection){
  1890. var self=this,$self=this;
  1891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1892. return $core.withContext(function($ctx1) {
  1893. //>>excludeEnd("ctx");
  1894. (
  1895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1896. $ctx1.supercall = true,
  1897. //>>excludeEnd("ctx");
  1898. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  1899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1900. $ctx1.supercall = false;
  1901. //>>excludeEnd("ctx");;
  1902. return anAssociativeCollection;
  1903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1904. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  1905. //>>excludeEnd("ctx");
  1906. },
  1907. //>>excludeStart("ide", pragmas.excludeIdeData);
  1908. args: ["anAssociativeCollection"],
  1909. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  1910. referencedClasses: [],
  1911. //>>excludeEnd("ide");
  1912. messageSends: ["addAll:", "associations"]
  1913. }),
  1914. $globals.AssociativeCollection);
  1915. $core.addMethod(
  1916. $core.method({
  1917. selector: "asDictionary",
  1918. protocol: "converting",
  1919. fn: function (){
  1920. var self=this,$self=this;
  1921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1922. return $core.withContext(function($ctx1) {
  1923. //>>excludeEnd("ctx");
  1924. return $recv($globals.Dictionary)._from_($self._associations());
  1925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1926. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  1927. //>>excludeEnd("ctx");
  1928. },
  1929. //>>excludeStart("ide", pragmas.excludeIdeData);
  1930. args: [],
  1931. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  1932. referencedClasses: ["Dictionary"],
  1933. //>>excludeEnd("ide");
  1934. messageSends: ["from:", "associations"]
  1935. }),
  1936. $globals.AssociativeCollection);
  1937. $core.addMethod(
  1938. $core.method({
  1939. selector: "asHashedCollection",
  1940. protocol: "converting",
  1941. fn: function (){
  1942. var self=this,$self=this;
  1943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1944. return $core.withContext(function($ctx1) {
  1945. //>>excludeEnd("ctx");
  1946. return $recv($globals.HashedCollection)._from_($self._associations());
  1947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1948. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  1949. //>>excludeEnd("ctx");
  1950. },
  1951. //>>excludeStart("ide", pragmas.excludeIdeData);
  1952. args: [],
  1953. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  1954. referencedClasses: ["HashedCollection"],
  1955. //>>excludeEnd("ide");
  1956. messageSends: ["from:", "associations"]
  1957. }),
  1958. $globals.AssociativeCollection);
  1959. $core.addMethod(
  1960. $core.method({
  1961. selector: "asJavaScriptObject",
  1962. protocol: "converting",
  1963. fn: function (){
  1964. var self=this,$self=this;
  1965. var hash;
  1966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1967. return $core.withContext(function($ctx1) {
  1968. //>>excludeEnd("ctx");
  1969. hash=$recv($globals.HashedCollection)._new();
  1970. $self._keysAndValuesDo_((function(key,value){
  1971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1972. return $core.withContext(function($ctx2) {
  1973. //>>excludeEnd("ctx");
  1974. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  1975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1976. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  1977. //>>excludeEnd("ctx");
  1978. }));
  1979. return hash;
  1980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1981. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash},$globals.AssociativeCollection)});
  1982. //>>excludeEnd("ctx");
  1983. },
  1984. //>>excludeStart("ide", pragmas.excludeIdeData);
  1985. args: [],
  1986. 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",
  1987. referencedClasses: ["HashedCollection"],
  1988. //>>excludeEnd("ide");
  1989. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  1990. }),
  1991. $globals.AssociativeCollection);
  1992. $core.addMethod(
  1993. $core.method({
  1994. selector: "associations",
  1995. protocol: "accessing",
  1996. fn: function (){
  1997. var self=this,$self=this;
  1998. var associations;
  1999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2000. return $core.withContext(function($ctx1) {
  2001. //>>excludeEnd("ctx");
  2002. associations=[];
  2003. $self._associationsDo_((function(each){
  2004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2005. return $core.withContext(function($ctx2) {
  2006. //>>excludeEnd("ctx");
  2007. return $recv(associations)._add_(each);
  2008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2009. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2010. //>>excludeEnd("ctx");
  2011. }));
  2012. return associations;
  2013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2014. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  2015. //>>excludeEnd("ctx");
  2016. },
  2017. //>>excludeStart("ide", pragmas.excludeIdeData);
  2018. args: [],
  2019. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  2020. referencedClasses: [],
  2021. //>>excludeEnd("ide");
  2022. messageSends: ["associationsDo:", "add:"]
  2023. }),
  2024. $globals.AssociativeCollection);
  2025. $core.addMethod(
  2026. $core.method({
  2027. selector: "associationsDo:",
  2028. protocol: "enumerating",
  2029. fn: function (aBlock){
  2030. var self=this,$self=this;
  2031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2032. return $core.withContext(function($ctx1) {
  2033. //>>excludeEnd("ctx");
  2034. $self._keysAndValuesDo_((function(key,value){
  2035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2036. return $core.withContext(function($ctx2) {
  2037. //>>excludeEnd("ctx");
  2038. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  2039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2040. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2041. //>>excludeEnd("ctx");
  2042. }));
  2043. return self;
  2044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2045. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2046. //>>excludeEnd("ctx");
  2047. },
  2048. //>>excludeStart("ide", pragmas.excludeIdeData);
  2049. args: ["aBlock"],
  2050. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2051. referencedClasses: ["Association"],
  2052. //>>excludeEnd("ide");
  2053. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2054. }),
  2055. $globals.AssociativeCollection);
  2056. $core.addMethod(
  2057. $core.method({
  2058. selector: "at:ifPresent:ifAbsent:",
  2059. protocol: "accessing",
  2060. fn: function (aKey,aBlock,anotherBlock){
  2061. var self=this,$self=this;
  2062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2063. return $core.withContext(function($ctx1) {
  2064. //>>excludeEnd("ctx");
  2065. var $1;
  2066. $1=$self._includesKey_(aKey);
  2067. if($core.assert($1)){
  2068. return $recv(aBlock)._value_($self._at_(aKey));
  2069. } else {
  2070. return $recv(anotherBlock)._value();
  2071. }
  2072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2073. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  2074. //>>excludeEnd("ctx");
  2075. },
  2076. //>>excludeStart("ide", pragmas.excludeIdeData);
  2077. args: ["aKey", "aBlock", "anotherBlock"],
  2078. 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 ]",
  2079. referencedClasses: [],
  2080. //>>excludeEnd("ide");
  2081. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2082. }),
  2083. $globals.AssociativeCollection);
  2084. $core.addMethod(
  2085. $core.method({
  2086. selector: "collect:",
  2087. protocol: "enumerating",
  2088. fn: function (aBlock){
  2089. var self=this,$self=this;
  2090. var newDict;
  2091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2092. return $core.withContext(function($ctx1) {
  2093. //>>excludeEnd("ctx");
  2094. newDict=$recv($self._class())._new();
  2095. $self._keysAndValuesDo_((function(key,value){
  2096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2097. return $core.withContext(function($ctx2) {
  2098. //>>excludeEnd("ctx");
  2099. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  2100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2101. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2102. //>>excludeEnd("ctx");
  2103. }));
  2104. return newDict;
  2105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2106. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  2107. //>>excludeEnd("ctx");
  2108. },
  2109. //>>excludeStart("ide", pragmas.excludeIdeData);
  2110. args: ["aBlock"],
  2111. 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",
  2112. referencedClasses: [],
  2113. //>>excludeEnd("ide");
  2114. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  2115. }),
  2116. $globals.AssociativeCollection);
  2117. $core.addMethod(
  2118. $core.method({
  2119. selector: "deepCopy",
  2120. protocol: "copying",
  2121. fn: function (){
  2122. var self=this,$self=this;
  2123. var copy;
  2124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2125. return $core.withContext(function($ctx1) {
  2126. //>>excludeEnd("ctx");
  2127. copy=$recv($self._class())._new();
  2128. $self._keysAndValuesDo_((function(key,value){
  2129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2130. return $core.withContext(function($ctx2) {
  2131. //>>excludeEnd("ctx");
  2132. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  2133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2134. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2135. //>>excludeEnd("ctx");
  2136. }));
  2137. return copy;
  2138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2139. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  2140. //>>excludeEnd("ctx");
  2141. },
  2142. //>>excludeStart("ide", pragmas.excludeIdeData);
  2143. args: [],
  2144. 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",
  2145. referencedClasses: [],
  2146. //>>excludeEnd("ide");
  2147. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  2148. }),
  2149. $globals.AssociativeCollection);
  2150. $core.addMethod(
  2151. $core.method({
  2152. selector: "detect:ifNone:",
  2153. protocol: "enumerating",
  2154. fn: function (aBlock,anotherBlock){
  2155. var self=this,$self=this;
  2156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2157. return $core.withContext(function($ctx1) {
  2158. //>>excludeEnd("ctx");
  2159. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  2160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2161. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  2162. //>>excludeEnd("ctx");
  2163. },
  2164. //>>excludeStart("ide", pragmas.excludeIdeData);
  2165. args: ["aBlock", "anotherBlock"],
  2166. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  2167. referencedClasses: [],
  2168. //>>excludeEnd("ide");
  2169. messageSends: ["detect:ifNone:", "values"]
  2170. }),
  2171. $globals.AssociativeCollection);
  2172. $core.addMethod(
  2173. $core.method({
  2174. selector: "do:",
  2175. protocol: "enumerating",
  2176. fn: function (aBlock){
  2177. var self=this,$self=this;
  2178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2179. return $core.withContext(function($ctx1) {
  2180. //>>excludeEnd("ctx");
  2181. $self._valuesDo_(aBlock);
  2182. return self;
  2183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2184. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2185. //>>excludeEnd("ctx");
  2186. },
  2187. //>>excludeStart("ide", pragmas.excludeIdeData);
  2188. args: ["aBlock"],
  2189. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  2190. referencedClasses: [],
  2191. //>>excludeEnd("ide");
  2192. messageSends: ["valuesDo:"]
  2193. }),
  2194. $globals.AssociativeCollection);
  2195. $core.addMethod(
  2196. $core.method({
  2197. selector: "includes:",
  2198. protocol: "enumerating",
  2199. fn: function (anObject){
  2200. var self=this,$self=this;
  2201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2202. return $core.withContext(function($ctx1) {
  2203. //>>excludeEnd("ctx");
  2204. return $recv($self._values())._includes_(anObject);
  2205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2206. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  2207. //>>excludeEnd("ctx");
  2208. },
  2209. //>>excludeStart("ide", pragmas.excludeIdeData);
  2210. args: ["anObject"],
  2211. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  2212. referencedClasses: [],
  2213. //>>excludeEnd("ide");
  2214. messageSends: ["includes:", "values"]
  2215. }),
  2216. $globals.AssociativeCollection);
  2217. $core.addMethod(
  2218. $core.method({
  2219. selector: "includesKey:",
  2220. protocol: "testing",
  2221. fn: function (aKey){
  2222. var self=this,$self=this;
  2223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2224. return $core.withContext(function($ctx1) {
  2225. //>>excludeEnd("ctx");
  2226. $self._subclassResponsibility();
  2227. return self;
  2228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2229. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  2230. //>>excludeEnd("ctx");
  2231. },
  2232. //>>excludeStart("ide", pragmas.excludeIdeData);
  2233. args: ["aKey"],
  2234. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  2235. referencedClasses: [],
  2236. //>>excludeEnd("ide");
  2237. messageSends: ["subclassResponsibility"]
  2238. }),
  2239. $globals.AssociativeCollection);
  2240. $core.addMethod(
  2241. $core.method({
  2242. selector: "indexOf:ifAbsent:",
  2243. protocol: "accessing",
  2244. fn: function (anObject,aBlock){
  2245. var self=this,$self=this;
  2246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2247. return $core.withContext(function($ctx1) {
  2248. //>>excludeEnd("ctx");
  2249. return $recv($self._keys())._detect_ifNone_((function(each){
  2250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2251. return $core.withContext(function($ctx2) {
  2252. //>>excludeEnd("ctx");
  2253. return $recv($self._at_(each)).__eq(anObject);
  2254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2255. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2256. //>>excludeEnd("ctx");
  2257. }),aBlock);
  2258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2259. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  2260. //>>excludeEnd("ctx");
  2261. },
  2262. //>>excludeStart("ide", pragmas.excludeIdeData);
  2263. args: ["anObject", "aBlock"],
  2264. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  2265. referencedClasses: [],
  2266. //>>excludeEnd("ide");
  2267. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  2268. }),
  2269. $globals.AssociativeCollection);
  2270. $core.addMethod(
  2271. $core.method({
  2272. selector: "keyAtValue:",
  2273. protocol: "accessing",
  2274. fn: function (anObject){
  2275. var self=this,$self=this;
  2276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2277. return $core.withContext(function($ctx1) {
  2278. //>>excludeEnd("ctx");
  2279. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  2280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2281. return $core.withContext(function($ctx2) {
  2282. //>>excludeEnd("ctx");
  2283. return $self._errorNotFound();
  2284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2285. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2286. //>>excludeEnd("ctx");
  2287. }));
  2288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2289. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  2290. //>>excludeEnd("ctx");
  2291. },
  2292. //>>excludeStart("ide", pragmas.excludeIdeData);
  2293. args: ["anObject"],
  2294. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  2295. referencedClasses: [],
  2296. //>>excludeEnd("ide");
  2297. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  2298. }),
  2299. $globals.AssociativeCollection);
  2300. $core.addMethod(
  2301. $core.method({
  2302. selector: "keyAtValue:ifAbsent:",
  2303. protocol: "accessing",
  2304. fn: function (anObject,aBlock){
  2305. var self=this,$self=this;
  2306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2307. return $core.withContext(function($ctx1) {
  2308. //>>excludeEnd("ctx");
  2309. return $self._indexOf_ifAbsent_(anObject,aBlock);
  2310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2311. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  2312. //>>excludeEnd("ctx");
  2313. },
  2314. //>>excludeStart("ide", pragmas.excludeIdeData);
  2315. args: ["anObject", "aBlock"],
  2316. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  2317. referencedClasses: [],
  2318. //>>excludeEnd("ide");
  2319. messageSends: ["indexOf:ifAbsent:"]
  2320. }),
  2321. $globals.AssociativeCollection);
  2322. $core.addMethod(
  2323. $core.method({
  2324. selector: "keys",
  2325. protocol: "accessing",
  2326. fn: function (){
  2327. var self=this,$self=this;
  2328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2329. return $core.withContext(function($ctx1) {
  2330. //>>excludeEnd("ctx");
  2331. $self._subclassResponsibility();
  2332. return self;
  2333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2334. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  2335. //>>excludeEnd("ctx");
  2336. },
  2337. //>>excludeStart("ide", pragmas.excludeIdeData);
  2338. args: [],
  2339. source: "keys\x0a\x09self subclassResponsibility",
  2340. referencedClasses: [],
  2341. //>>excludeEnd("ide");
  2342. messageSends: ["subclassResponsibility"]
  2343. }),
  2344. $globals.AssociativeCollection);
  2345. $core.addMethod(
  2346. $core.method({
  2347. selector: "keysAndValuesDo:",
  2348. protocol: "enumerating",
  2349. fn: function (aBlock){
  2350. var self=this,$self=this;
  2351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2352. return $core.withContext(function($ctx1) {
  2353. //>>excludeEnd("ctx");
  2354. $self._keysDo_((function(each){
  2355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2356. return $core.withContext(function($ctx2) {
  2357. //>>excludeEnd("ctx");
  2358. return $recv(aBlock)._value_value_(each,$self._at_(each));
  2359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2360. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2361. //>>excludeEnd("ctx");
  2362. }));
  2363. return self;
  2364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2365. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2366. //>>excludeEnd("ctx");
  2367. },
  2368. //>>excludeStart("ide", pragmas.excludeIdeData);
  2369. args: ["aBlock"],
  2370. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  2371. referencedClasses: [],
  2372. //>>excludeEnd("ide");
  2373. messageSends: ["keysDo:", "value:value:", "at:"]
  2374. }),
  2375. $globals.AssociativeCollection);
  2376. $core.addMethod(
  2377. $core.method({
  2378. selector: "keysDo:",
  2379. protocol: "enumerating",
  2380. fn: function (aBlock){
  2381. var self=this,$self=this;
  2382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2383. return $core.withContext(function($ctx1) {
  2384. //>>excludeEnd("ctx");
  2385. $self._subclassResponsibility();
  2386. return self;
  2387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2388. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2389. //>>excludeEnd("ctx");
  2390. },
  2391. //>>excludeStart("ide", pragmas.excludeIdeData);
  2392. args: ["aBlock"],
  2393. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  2394. referencedClasses: [],
  2395. //>>excludeEnd("ide");
  2396. messageSends: ["subclassResponsibility"]
  2397. }),
  2398. $globals.AssociativeCollection);
  2399. $core.addMethod(
  2400. $core.method({
  2401. selector: "printOn:",
  2402. protocol: "printing",
  2403. fn: function (aStream){
  2404. var self=this,$self=this;
  2405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2406. return $core.withContext(function($ctx1) {
  2407. //>>excludeEnd("ctx");
  2408. (
  2409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2410. $ctx1.supercall = true,
  2411. //>>excludeEnd("ctx");
  2412. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  2413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2414. $ctx1.supercall = false;
  2415. //>>excludeEnd("ctx");;
  2416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2417. $ctx1.sendIdx["printOn:"]=1;
  2418. //>>excludeEnd("ctx");
  2419. $recv(aStream)._nextPutAll_(" (");
  2420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2421. $ctx1.sendIdx["nextPutAll:"]=1;
  2422. //>>excludeEnd("ctx");
  2423. $recv($self._associations())._do_separatedBy_((function(each){
  2424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2425. return $core.withContext(function($ctx2) {
  2426. //>>excludeEnd("ctx");
  2427. return $recv(each)._printOn_(aStream);
  2428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2429. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2430. //>>excludeEnd("ctx");
  2431. }),(function(){
  2432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2433. return $core.withContext(function($ctx2) {
  2434. //>>excludeEnd("ctx");
  2435. return $recv(aStream)._nextPutAll_(" , ");
  2436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2437. $ctx2.sendIdx["nextPutAll:"]=2;
  2438. //>>excludeEnd("ctx");
  2439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2440. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2441. //>>excludeEnd("ctx");
  2442. }));
  2443. $recv(aStream)._nextPutAll_(")");
  2444. return self;
  2445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2446. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  2447. //>>excludeEnd("ctx");
  2448. },
  2449. //>>excludeStart("ide", pragmas.excludeIdeData);
  2450. args: ["aStream"],
  2451. 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: ')'",
  2452. referencedClasses: [],
  2453. //>>excludeEnd("ide");
  2454. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  2455. }),
  2456. $globals.AssociativeCollection);
  2457. $core.addMethod(
  2458. $core.method({
  2459. selector: "remove:ifAbsent:",
  2460. protocol: "adding/removing",
  2461. fn: function (aKey,aBlock){
  2462. var self=this,$self=this;
  2463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2464. return $core.withContext(function($ctx1) {
  2465. //>>excludeEnd("ctx");
  2466. return $self._removeKey_ifAbsent_(aKey,aBlock);
  2467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2468. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  2469. //>>excludeEnd("ctx");
  2470. },
  2471. //>>excludeStart("ide", pragmas.excludeIdeData);
  2472. args: ["aKey", "aBlock"],
  2473. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  2474. referencedClasses: [],
  2475. //>>excludeEnd("ide");
  2476. messageSends: ["removeKey:ifAbsent:"]
  2477. }),
  2478. $globals.AssociativeCollection);
  2479. $core.addMethod(
  2480. $core.method({
  2481. selector: "removeAll",
  2482. protocol: "adding/removing",
  2483. fn: function (){
  2484. var self=this,$self=this;
  2485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2486. return $core.withContext(function($ctx1) {
  2487. //>>excludeEnd("ctx");
  2488. return $recv($self._keys())._do_((function(each){
  2489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2490. return $core.withContext(function($ctx2) {
  2491. //>>excludeEnd("ctx");
  2492. return $self._removeKey_(each);
  2493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2494. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2495. //>>excludeEnd("ctx");
  2496. }));
  2497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2498. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  2499. //>>excludeEnd("ctx");
  2500. },
  2501. //>>excludeStart("ide", pragmas.excludeIdeData);
  2502. args: [],
  2503. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  2504. referencedClasses: [],
  2505. //>>excludeEnd("ide");
  2506. messageSends: ["do:", "keys", "removeKey:"]
  2507. }),
  2508. $globals.AssociativeCollection);
  2509. $core.addMethod(
  2510. $core.method({
  2511. selector: "removeKey:",
  2512. protocol: "adding/removing",
  2513. fn: function (aKey){
  2514. var self=this,$self=this;
  2515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2516. return $core.withContext(function($ctx1) {
  2517. //>>excludeEnd("ctx");
  2518. return $self._remove_(aKey);
  2519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2520. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  2521. //>>excludeEnd("ctx");
  2522. },
  2523. //>>excludeStart("ide", pragmas.excludeIdeData);
  2524. args: ["aKey"],
  2525. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  2526. referencedClasses: [],
  2527. //>>excludeEnd("ide");
  2528. messageSends: ["remove:"]
  2529. }),
  2530. $globals.AssociativeCollection);
  2531. $core.addMethod(
  2532. $core.method({
  2533. selector: "removeKey:ifAbsent:",
  2534. protocol: "adding/removing",
  2535. fn: function (aKey,aBlock){
  2536. var self=this,$self=this;
  2537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2538. return $core.withContext(function($ctx1) {
  2539. //>>excludeEnd("ctx");
  2540. $self._subclassResponsibility();
  2541. return self;
  2542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2543. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  2544. //>>excludeEnd("ctx");
  2545. },
  2546. //>>excludeStart("ide", pragmas.excludeIdeData);
  2547. args: ["aKey", "aBlock"],
  2548. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2549. referencedClasses: [],
  2550. //>>excludeEnd("ide");
  2551. messageSends: ["subclassResponsibility"]
  2552. }),
  2553. $globals.AssociativeCollection);
  2554. $core.addMethod(
  2555. $core.method({
  2556. selector: "select:",
  2557. protocol: "enumerating",
  2558. fn: function (aBlock){
  2559. var self=this,$self=this;
  2560. var newDict;
  2561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2562. return $core.withContext(function($ctx1) {
  2563. //>>excludeEnd("ctx");
  2564. var $1;
  2565. newDict=$recv($self._class())._new();
  2566. $self._keysAndValuesDo_((function(key,value){
  2567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2568. return $core.withContext(function($ctx2) {
  2569. //>>excludeEnd("ctx");
  2570. $1=$recv(aBlock)._value_(value);
  2571. if($core.assert($1)){
  2572. return $recv(newDict)._at_put_(key,value);
  2573. }
  2574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2575. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2576. //>>excludeEnd("ctx");
  2577. }));
  2578. return newDict;
  2579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2580. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  2581. //>>excludeEnd("ctx");
  2582. },
  2583. //>>excludeStart("ide", pragmas.excludeIdeData);
  2584. args: ["aBlock"],
  2585. 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",
  2586. referencedClasses: [],
  2587. //>>excludeEnd("ide");
  2588. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2589. }),
  2590. $globals.AssociativeCollection);
  2591. $core.addMethod(
  2592. $core.method({
  2593. selector: "select:thenCollect:",
  2594. protocol: "enumerating",
  2595. fn: function (selectBlock,collectBlock){
  2596. var self=this,$self=this;
  2597. var newDict;
  2598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2599. return $core.withContext(function($ctx1) {
  2600. //>>excludeEnd("ctx");
  2601. var $1;
  2602. newDict=$recv($self._class())._new();
  2603. $self._keysAndValuesDo_((function(key,value){
  2604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2605. return $core.withContext(function($ctx2) {
  2606. //>>excludeEnd("ctx");
  2607. $1=$recv(selectBlock)._value_(value);
  2608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2609. $ctx2.sendIdx["value:"]=1;
  2610. //>>excludeEnd("ctx");
  2611. if($core.assert($1)){
  2612. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  2613. }
  2614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2615. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2616. //>>excludeEnd("ctx");
  2617. }));
  2618. return newDict;
  2619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2620. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict},$globals.AssociativeCollection)});
  2621. //>>excludeEnd("ctx");
  2622. },
  2623. //>>excludeStart("ide", pragmas.excludeIdeData);
  2624. args: ["selectBlock", "collectBlock"],
  2625. 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",
  2626. referencedClasses: [],
  2627. //>>excludeEnd("ide");
  2628. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2629. }),
  2630. $globals.AssociativeCollection);
  2631. $core.addMethod(
  2632. $core.method({
  2633. selector: "shallowCopy",
  2634. protocol: "copying",
  2635. fn: function (){
  2636. var self=this,$self=this;
  2637. var copy;
  2638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2639. return $core.withContext(function($ctx1) {
  2640. //>>excludeEnd("ctx");
  2641. copy=$recv($self._class())._new();
  2642. $self._keysAndValuesDo_((function(key,value){
  2643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2644. return $core.withContext(function($ctx2) {
  2645. //>>excludeEnd("ctx");
  2646. return $recv(copy)._at_put_(key,value);
  2647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2648. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2649. //>>excludeEnd("ctx");
  2650. }));
  2651. return copy;
  2652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2653. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  2654. //>>excludeEnd("ctx");
  2655. },
  2656. //>>excludeStart("ide", pragmas.excludeIdeData);
  2657. args: [],
  2658. 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",
  2659. referencedClasses: [],
  2660. //>>excludeEnd("ide");
  2661. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2662. }),
  2663. $globals.AssociativeCollection);
  2664. $core.addMethod(
  2665. $core.method({
  2666. selector: "size",
  2667. protocol: "accessing",
  2668. fn: function (){
  2669. var self=this,$self=this;
  2670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2671. return $core.withContext(function($ctx1) {
  2672. //>>excludeEnd("ctx");
  2673. return $recv($self._keys())._size();
  2674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2675. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  2676. //>>excludeEnd("ctx");
  2677. },
  2678. //>>excludeStart("ide", pragmas.excludeIdeData);
  2679. args: [],
  2680. source: "size\x0a\x09^ self keys size",
  2681. referencedClasses: [],
  2682. //>>excludeEnd("ide");
  2683. messageSends: ["size", "keys"]
  2684. }),
  2685. $globals.AssociativeCollection);
  2686. $core.addMethod(
  2687. $core.method({
  2688. selector: "values",
  2689. protocol: "accessing",
  2690. fn: function (){
  2691. var self=this,$self=this;
  2692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2693. return $core.withContext(function($ctx1) {
  2694. //>>excludeEnd("ctx");
  2695. $self._subclassResponsibility();
  2696. return self;
  2697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2698. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  2699. //>>excludeEnd("ctx");
  2700. },
  2701. //>>excludeStart("ide", pragmas.excludeIdeData);
  2702. args: [],
  2703. source: "values\x0a\x09self subclassResponsibility",
  2704. referencedClasses: [],
  2705. //>>excludeEnd("ide");
  2706. messageSends: ["subclassResponsibility"]
  2707. }),
  2708. $globals.AssociativeCollection);
  2709. $core.addMethod(
  2710. $core.method({
  2711. selector: "valuesDo:",
  2712. protocol: "enumerating",
  2713. fn: function (aBlock){
  2714. var self=this,$self=this;
  2715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2716. return $core.withContext(function($ctx1) {
  2717. //>>excludeEnd("ctx");
  2718. $self._subclassResponsibility();
  2719. return self;
  2720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2721. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2722. //>>excludeEnd("ctx");
  2723. },
  2724. //>>excludeStart("ide", pragmas.excludeIdeData);
  2725. args: ["aBlock"],
  2726. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2727. referencedClasses: [],
  2728. //>>excludeEnd("ide");
  2729. messageSends: ["subclassResponsibility"]
  2730. }),
  2731. $globals.AssociativeCollection);
  2732. $core.addMethod(
  2733. $core.method({
  2734. selector: "withIndexDo:",
  2735. protocol: "enumerating",
  2736. fn: function (aBlock){
  2737. var self=this,$self=this;
  2738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2739. return $core.withContext(function($ctx1) {
  2740. //>>excludeEnd("ctx");
  2741. $self._keysAndValuesDo_((function(key,value){
  2742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2743. return $core.withContext(function($ctx2) {
  2744. //>>excludeEnd("ctx");
  2745. return $recv(aBlock)._value_value_(value,key);
  2746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2747. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2748. //>>excludeEnd("ctx");
  2749. }));
  2750. return self;
  2751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2752. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2753. //>>excludeEnd("ctx");
  2754. },
  2755. //>>excludeStart("ide", pragmas.excludeIdeData);
  2756. args: ["aBlock"],
  2757. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  2758. referencedClasses: [],
  2759. //>>excludeEnd("ide");
  2760. messageSends: ["keysAndValuesDo:", "value:value:"]
  2761. }),
  2762. $globals.AssociativeCollection);
  2763. $core.addMethod(
  2764. $core.method({
  2765. selector: "from:",
  2766. protocol: "instance creation",
  2767. fn: function (aCollection){
  2768. var self=this,$self=this;
  2769. var newCollection;
  2770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2771. return $core.withContext(function($ctx1) {
  2772. //>>excludeEnd("ctx");
  2773. newCollection=$self._new();
  2774. $recv(aCollection)._do_((function(each){
  2775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2776. return $core.withContext(function($ctx2) {
  2777. //>>excludeEnd("ctx");
  2778. return $recv(newCollection)._add_(each);
  2779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2780. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2781. //>>excludeEnd("ctx");
  2782. }));
  2783. return newCollection;
  2784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2785. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  2786. //>>excludeEnd("ctx");
  2787. },
  2788. //>>excludeStart("ide", pragmas.excludeIdeData);
  2789. args: ["aCollection"],
  2790. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  2791. referencedClasses: [],
  2792. //>>excludeEnd("ide");
  2793. messageSends: ["new", "do:", "add:"]
  2794. }),
  2795. $globals.AssociativeCollection.a$cls);
  2796. $core.addMethod(
  2797. $core.method({
  2798. selector: "fromPairs:",
  2799. protocol: "instance creation",
  2800. fn: function (aCollection){
  2801. var self=this,$self=this;
  2802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2803. return $core.withContext(function($ctx1) {
  2804. //>>excludeEnd("ctx");
  2805. return $self._from_(aCollection);
  2806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2807. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.a$cls)});
  2808. //>>excludeEnd("ctx");
  2809. },
  2810. //>>excludeStart("ide", pragmas.excludeIdeData);
  2811. args: ["aCollection"],
  2812. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  2813. referencedClasses: [],
  2814. //>>excludeEnd("ide");
  2815. messageSends: ["from:"]
  2816. }),
  2817. $globals.AssociativeCollection.a$cls);
  2818. $core.addMethod(
  2819. $core.method({
  2820. selector: "newFromPairs:",
  2821. protocol: "instance creation",
  2822. fn: function (aCollection){
  2823. var self=this,$self=this;
  2824. var newCollection;
  2825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2826. return $core.withContext(function($ctx1) {
  2827. //>>excludeEnd("ctx");
  2828. var $2,$1,$3,$4;
  2829. $2=$recv(aCollection)._size();
  2830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2831. $ctx1.sendIdx["size"]=1;
  2832. //>>excludeEnd("ctx");
  2833. $1=$recv($2)._even();
  2834. if(!$core.assert($1)){
  2835. $self._error_("#newFromPairs only accepts arrays of an even length");
  2836. }
  2837. newCollection=$self._new();
  2838. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  2839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2840. return $core.withContext(function($ctx2) {
  2841. //>>excludeEnd("ctx");
  2842. $3=newCollection;
  2843. $4=$recv(aCollection)._at_(each);
  2844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2845. $ctx2.sendIdx["at:"]=1;
  2846. //>>excludeEnd("ctx");
  2847. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  2848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2849. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2850. //>>excludeEnd("ctx");
  2851. }));
  2852. return newCollection;
  2853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2854. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  2855. //>>excludeEnd("ctx");
  2856. },
  2857. //>>excludeStart("ide", pragmas.excludeIdeData);
  2858. args: ["aCollection"],
  2859. 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",
  2860. referencedClasses: [],
  2861. //>>excludeEnd("ide");
  2862. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  2863. }),
  2864. $globals.AssociativeCollection.a$cls);
  2865. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  2866. //>>excludeStart("ide", pragmas.excludeIdeData);
  2867. $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.";
  2868. //>>excludeEnd("ide");
  2869. $core.addMethod(
  2870. $core.method({
  2871. selector: "at:ifAbsent:",
  2872. protocol: "accessing",
  2873. fn: function (aKey,aBlock){
  2874. var self=this,$self=this;
  2875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2876. return $core.withContext(function($ctx1) {
  2877. //>>excludeEnd("ctx");
  2878. var index = $self._positionOfKey_(aKey);
  2879. return index >=0 ? $self['@values'][index] : aBlock._value();
  2880. ;
  2881. return self;
  2882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2883. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  2884. //>>excludeEnd("ctx");
  2885. },
  2886. //>>excludeStart("ide", pragmas.excludeIdeData);
  2887. args: ["aKey", "aBlock"],
  2888. 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'>",
  2889. referencedClasses: [],
  2890. //>>excludeEnd("ide");
  2891. messageSends: []
  2892. }),
  2893. $globals.Dictionary);
  2894. $core.addMethod(
  2895. $core.method({
  2896. selector: "at:put:",
  2897. protocol: "accessing",
  2898. fn: function (aKey,aValue){
  2899. var self=this,$self=this;
  2900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2901. return $core.withContext(function($ctx1) {
  2902. //>>excludeEnd("ctx");
  2903. var index = $self._positionOfKey_(aKey);
  2904. if(index === -1) {
  2905. var keys = $self['@keys'];
  2906. index = keys.length;
  2907. keys.push(aKey);
  2908. }
  2909. return $self['@values'][index] = aValue;
  2910. ;
  2911. return self;
  2912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2913. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  2914. //>>excludeEnd("ctx");
  2915. },
  2916. //>>excludeStart("ide", pragmas.excludeIdeData);
  2917. args: ["aKey", "aValue"],
  2918. 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'>",
  2919. referencedClasses: [],
  2920. //>>excludeEnd("ide");
  2921. messageSends: []
  2922. }),
  2923. $globals.Dictionary);
  2924. $core.addMethod(
  2925. $core.method({
  2926. selector: "includesKey:",
  2927. protocol: "testing",
  2928. fn: function (aKey){
  2929. var self=this,$self=this;
  2930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2931. return $core.withContext(function($ctx1) {
  2932. //>>excludeEnd("ctx");
  2933. return $self._positionOfKey_(aKey) >= 0;;
  2934. return self;
  2935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2936. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  2937. //>>excludeEnd("ctx");
  2938. },
  2939. //>>excludeStart("ide", pragmas.excludeIdeData);
  2940. args: ["aKey"],
  2941. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  2942. referencedClasses: [],
  2943. //>>excludeEnd("ide");
  2944. messageSends: []
  2945. }),
  2946. $globals.Dictionary);
  2947. $core.addMethod(
  2948. $core.method({
  2949. selector: "indexOf:ifAbsent:",
  2950. protocol: "accessing",
  2951. fn: function (anObject,aBlock){
  2952. var self=this,$self=this;
  2953. var index;
  2954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2955. return $core.withContext(function($ctx1) {
  2956. //>>excludeEnd("ctx");
  2957. var $1;
  2958. index=$recv($self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  2959. return (0);
  2960. }));
  2961. $1=$recv(index).__eq((0));
  2962. if($core.assert($1)){
  2963. return $recv(aBlock)._value();
  2964. } else {
  2965. return $recv($self["@keys"])._at_(index);
  2966. }
  2967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2968. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  2969. //>>excludeEnd("ctx");
  2970. },
  2971. //>>excludeStart("ide", pragmas.excludeIdeData);
  2972. args: ["anObject", "aBlock"],
  2973. 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 ]",
  2974. referencedClasses: [],
  2975. //>>excludeEnd("ide");
  2976. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  2977. }),
  2978. $globals.Dictionary);
  2979. $core.addMethod(
  2980. $core.method({
  2981. selector: "initialize",
  2982. protocol: "initialization",
  2983. fn: function (){
  2984. var self=this,$self=this;
  2985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2986. return $core.withContext(function($ctx1) {
  2987. //>>excludeEnd("ctx");
  2988. (
  2989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2990. $ctx1.supercall = true,
  2991. //>>excludeEnd("ctx");
  2992. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  2993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2994. $ctx1.supercall = false;
  2995. //>>excludeEnd("ctx");;
  2996. $self["@keys"]=[];
  2997. $self["@values"]=[];
  2998. return self;
  2999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3000. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  3001. //>>excludeEnd("ctx");
  3002. },
  3003. //>>excludeStart("ide", pragmas.excludeIdeData);
  3004. args: [],
  3005. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  3006. referencedClasses: [],
  3007. //>>excludeEnd("ide");
  3008. messageSends: ["initialize"]
  3009. }),
  3010. $globals.Dictionary);
  3011. $core.addMethod(
  3012. $core.method({
  3013. selector: "keys",
  3014. protocol: "accessing",
  3015. fn: function (){
  3016. var self=this,$self=this;
  3017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3018. return $core.withContext(function($ctx1) {
  3019. //>>excludeEnd("ctx");
  3020. return $recv($self["@keys"])._copy();
  3021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3022. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  3023. //>>excludeEnd("ctx");
  3024. },
  3025. //>>excludeStart("ide", pragmas.excludeIdeData);
  3026. args: [],
  3027. source: "keys\x0a\x09^ keys copy",
  3028. referencedClasses: [],
  3029. //>>excludeEnd("ide");
  3030. messageSends: ["copy"]
  3031. }),
  3032. $globals.Dictionary);
  3033. $core.addMethod(
  3034. $core.method({
  3035. selector: "keysAndValuesDo:",
  3036. protocol: "enumerating",
  3037. fn: function (aBlock){
  3038. var self=this,$self=this;
  3039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3040. return $core.withContext(function($ctx1) {
  3041. //>>excludeEnd("ctx");
  3042. return $recv($self["@keys"])._with_do_($self["@values"],aBlock);
  3043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3044. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  3045. //>>excludeEnd("ctx");
  3046. },
  3047. //>>excludeStart("ide", pragmas.excludeIdeData);
  3048. args: ["aBlock"],
  3049. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3050. referencedClasses: [],
  3051. //>>excludeEnd("ide");
  3052. messageSends: ["with:do:"]
  3053. }),
  3054. $globals.Dictionary);
  3055. $core.addMethod(
  3056. $core.method({
  3057. selector: "keysDo:",
  3058. protocol: "enumerating",
  3059. fn: function (aBlock){
  3060. var self=this,$self=this;
  3061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3062. return $core.withContext(function($ctx1) {
  3063. //>>excludeEnd("ctx");
  3064. return $recv($self["@keys"])._do_(aBlock);
  3065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3066. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  3067. //>>excludeEnd("ctx");
  3068. },
  3069. //>>excludeStart("ide", pragmas.excludeIdeData);
  3070. args: ["aBlock"],
  3071. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3072. referencedClasses: [],
  3073. //>>excludeEnd("ide");
  3074. messageSends: ["do:"]
  3075. }),
  3076. $globals.Dictionary);
  3077. $core.addMethod(
  3078. $core.method({
  3079. selector: "positionOfKey:",
  3080. protocol: "private",
  3081. fn: function (anObject){
  3082. var self=this,$self=this;
  3083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3084. return $core.withContext(function($ctx1) {
  3085. //>>excludeEnd("ctx");
  3086. var keys = $self['@keys'];
  3087. for(var i=0;i<keys.length;i++){
  3088. if(keys[i].__eq(anObject)) { return i;}
  3089. }
  3090. return -1;
  3091. ;
  3092. return self;
  3093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3094. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  3095. //>>excludeEnd("ctx");
  3096. },
  3097. //>>excludeStart("ide", pragmas.excludeIdeData);
  3098. args: ["anObject"],
  3099. 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'>",
  3100. referencedClasses: [],
  3101. //>>excludeEnd("ide");
  3102. messageSends: []
  3103. }),
  3104. $globals.Dictionary);
  3105. $core.addMethod(
  3106. $core.method({
  3107. selector: "removeAll",
  3108. protocol: "adding/removing",
  3109. fn: function (){
  3110. var self=this,$self=this;
  3111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3112. return $core.withContext(function($ctx1) {
  3113. //>>excludeEnd("ctx");
  3114. $recv($self["@keys"])._removeAll();
  3115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3116. $ctx1.sendIdx["removeAll"]=1;
  3117. //>>excludeEnd("ctx");
  3118. $recv($self["@values"])._removeAll();
  3119. return self;
  3120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3121. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  3122. //>>excludeEnd("ctx");
  3123. },
  3124. //>>excludeStart("ide", pragmas.excludeIdeData);
  3125. args: [],
  3126. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3127. referencedClasses: [],
  3128. //>>excludeEnd("ide");
  3129. messageSends: ["removeAll"]
  3130. }),
  3131. $globals.Dictionary);
  3132. $core.addMethod(
  3133. $core.method({
  3134. selector: "removeKey:ifAbsent:",
  3135. protocol: "adding/removing",
  3136. fn: function (aKey,aBlock){
  3137. var self=this,$self=this;
  3138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3139. return $core.withContext(function($ctx1) {
  3140. //>>excludeEnd("ctx");
  3141. var index = $self._positionOfKey_(aKey);
  3142. if(index === -1) {
  3143. return aBlock._value()
  3144. } else {
  3145. var keys = $self['@keys'], values = $self['@values'];
  3146. var value = values[index], l = keys.length;
  3147. keys[index] = keys[l-1];
  3148. keys.pop();
  3149. values[index] = values[l-1];
  3150. values.pop();
  3151. return value;
  3152. }
  3153. ;
  3154. return self;
  3155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3156. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  3157. //>>excludeEnd("ctx");
  3158. },
  3159. //>>excludeStart("ide", pragmas.excludeIdeData);
  3160. args: ["aKey", "aBlock"],
  3161. 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'>",
  3162. referencedClasses: [],
  3163. //>>excludeEnd("ide");
  3164. messageSends: []
  3165. }),
  3166. $globals.Dictionary);
  3167. $core.addMethod(
  3168. $core.method({
  3169. selector: "values",
  3170. protocol: "accessing",
  3171. fn: function (){
  3172. var self=this,$self=this;
  3173. return $self["@values"];
  3174. },
  3175. //>>excludeStart("ide", pragmas.excludeIdeData);
  3176. args: [],
  3177. source: "values\x0a\x09^ values",
  3178. referencedClasses: [],
  3179. //>>excludeEnd("ide");
  3180. messageSends: []
  3181. }),
  3182. $globals.Dictionary);
  3183. $core.addMethod(
  3184. $core.method({
  3185. selector: "valuesDo:",
  3186. protocol: "enumerating",
  3187. fn: function (aBlock){
  3188. var self=this,$self=this;
  3189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3190. return $core.withContext(function($ctx1) {
  3191. //>>excludeEnd("ctx");
  3192. return $recv($self["@values"])._do_(aBlock);
  3193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3194. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  3195. //>>excludeEnd("ctx");
  3196. },
  3197. //>>excludeStart("ide", pragmas.excludeIdeData);
  3198. args: ["aBlock"],
  3199. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3200. referencedClasses: [],
  3201. //>>excludeEnd("ide");
  3202. messageSends: ["do:"]
  3203. }),
  3204. $globals.Dictionary);
  3205. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  3206. //>>excludeStart("ide", pragmas.excludeIdeData);
  3207. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3208. //>>excludeEnd("ide");
  3209. $core.addMethod(
  3210. $core.method({
  3211. selector: "at:ifAbsent:",
  3212. protocol: "accessing",
  3213. fn: function (aKey,aBlock){
  3214. var self=this,$self=this;
  3215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3216. return $core.withContext(function($ctx1) {
  3217. //>>excludeEnd("ctx");
  3218. var $1;
  3219. $1=$self._includesKey_(aKey);
  3220. if($core.assert($1)){
  3221. return $self._basicAt_(aKey);
  3222. } else {
  3223. return $recv(aBlock)._value();
  3224. }
  3225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3226. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  3227. //>>excludeEnd("ctx");
  3228. },
  3229. //>>excludeStart("ide", pragmas.excludeIdeData);
  3230. args: ["aKey", "aBlock"],
  3231. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3232. referencedClasses: [],
  3233. //>>excludeEnd("ide");
  3234. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3235. }),
  3236. $globals.HashedCollection);
  3237. $core.addMethod(
  3238. $core.method({
  3239. selector: "at:put:",
  3240. protocol: "accessing",
  3241. fn: function (aKey,aValue){
  3242. var self=this,$self=this;
  3243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3244. return $core.withContext(function($ctx1) {
  3245. //>>excludeEnd("ctx");
  3246. return $self._basicAt_put_(aKey,aValue);
  3247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3248. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  3249. //>>excludeEnd("ctx");
  3250. },
  3251. //>>excludeStart("ide", pragmas.excludeIdeData);
  3252. args: ["aKey", "aValue"],
  3253. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3254. referencedClasses: [],
  3255. //>>excludeEnd("ide");
  3256. messageSends: ["basicAt:put:"]
  3257. }),
  3258. $globals.HashedCollection);
  3259. $core.addMethod(
  3260. $core.method({
  3261. selector: "includesKey:",
  3262. protocol: "testing",
  3263. fn: function (aKey){
  3264. var self=this,$self=this;
  3265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3266. return $core.withContext(function($ctx1) {
  3267. //>>excludeEnd("ctx");
  3268. return self.hasOwnProperty(aKey);
  3269. return self;
  3270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3271. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  3272. //>>excludeEnd("ctx");
  3273. },
  3274. //>>excludeStart("ide", pragmas.excludeIdeData);
  3275. args: ["aKey"],
  3276. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  3277. referencedClasses: [],
  3278. //>>excludeEnd("ide");
  3279. messageSends: []
  3280. }),
  3281. $globals.HashedCollection);
  3282. $core.addMethod(
  3283. $core.method({
  3284. selector: "keys",
  3285. protocol: "accessing",
  3286. fn: function (){
  3287. var self=this,$self=this;
  3288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3289. return $core.withContext(function($ctx1) {
  3290. //>>excludeEnd("ctx");
  3291. return Object.keys(self);
  3292. return self;
  3293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3294. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  3295. //>>excludeEnd("ctx");
  3296. },
  3297. //>>excludeStart("ide", pragmas.excludeIdeData);
  3298. args: [],
  3299. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  3300. referencedClasses: [],
  3301. //>>excludeEnd("ide");
  3302. messageSends: []
  3303. }),
  3304. $globals.HashedCollection);
  3305. $core.addMethod(
  3306. $core.method({
  3307. selector: "keysDo:",
  3308. protocol: "enumerating",
  3309. fn: function (aBlock){
  3310. var self=this,$self=this;
  3311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3312. return $core.withContext(function($ctx1) {
  3313. //>>excludeEnd("ctx");
  3314. $recv($self._keys())._do_(aBlock);
  3315. return self;
  3316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3317. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  3318. //>>excludeEnd("ctx");
  3319. },
  3320. //>>excludeStart("ide", pragmas.excludeIdeData);
  3321. args: ["aBlock"],
  3322. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3323. referencedClasses: [],
  3324. //>>excludeEnd("ide");
  3325. messageSends: ["do:", "keys"]
  3326. }),
  3327. $globals.HashedCollection);
  3328. $core.addMethod(
  3329. $core.method({
  3330. selector: "removeKey:ifAbsent:",
  3331. protocol: "adding/removing",
  3332. fn: function (aKey,aBlock){
  3333. var self=this,$self=this;
  3334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3335. return $core.withContext(function($ctx1) {
  3336. //>>excludeEnd("ctx");
  3337. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3339. return $core.withContext(function($ctx2) {
  3340. //>>excludeEnd("ctx");
  3341. $self._basicDelete_(aKey);
  3342. return removed;
  3343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3344. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3345. //>>excludeEnd("ctx");
  3346. }),(function(){
  3347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3348. return $core.withContext(function($ctx2) {
  3349. //>>excludeEnd("ctx");
  3350. return $recv(aBlock)._value();
  3351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3352. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3353. //>>excludeEnd("ctx");
  3354. }));
  3355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3356. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  3357. //>>excludeEnd("ctx");
  3358. },
  3359. //>>excludeStart("ide", pragmas.excludeIdeData);
  3360. args: ["aKey", "aBlock"],
  3361. 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 ]",
  3362. referencedClasses: [],
  3363. //>>excludeEnd("ide");
  3364. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3365. }),
  3366. $globals.HashedCollection);
  3367. $core.addMethod(
  3368. $core.method({
  3369. selector: "values",
  3370. protocol: "accessing",
  3371. fn: function (){
  3372. var self=this,$self=this;
  3373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3374. return $core.withContext(function($ctx1) {
  3375. //>>excludeEnd("ctx");
  3376. return $self._keys().map(function(key){
  3377. return $self._at_(key);
  3378. });
  3379. ;
  3380. return self;
  3381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3382. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  3383. //>>excludeEnd("ctx");
  3384. },
  3385. //>>excludeStart("ide", pragmas.excludeIdeData);
  3386. args: [],
  3387. 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'>",
  3388. referencedClasses: [],
  3389. //>>excludeEnd("ide");
  3390. messageSends: []
  3391. }),
  3392. $globals.HashedCollection);
  3393. $core.addMethod(
  3394. $core.method({
  3395. selector: "valuesDo:",
  3396. protocol: "enumerating",
  3397. fn: function (aBlock){
  3398. var self=this,$self=this;
  3399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3400. return $core.withContext(function($ctx1) {
  3401. //>>excludeEnd("ctx");
  3402. $recv($self._values())._do_(aBlock);
  3403. return self;
  3404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3405. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  3406. //>>excludeEnd("ctx");
  3407. },
  3408. //>>excludeStart("ide", pragmas.excludeIdeData);
  3409. args: ["aBlock"],
  3410. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3411. referencedClasses: [],
  3412. //>>excludeEnd("ide");
  3413. messageSends: ["do:", "values"]
  3414. }),
  3415. $globals.HashedCollection);
  3416. $core.addClass("SequenceableCollection", $globals.Collection, [], "Kernel-Collections");
  3417. //>>excludeStart("ide", pragmas.excludeIdeData);
  3418. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3419. //>>excludeEnd("ide");
  3420. $core.addMethod(
  3421. $core.method({
  3422. selector: "=",
  3423. protocol: "comparing",
  3424. fn: function (aCollection){
  3425. var self=this,$self=this;
  3426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3427. return $core.withContext(function($ctx1) {
  3428. //>>excludeEnd("ctx");
  3429. var $3,$2,$4,$1,$5;
  3430. var $early={};
  3431. try {
  3432. $3=$self._class();
  3433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3434. $ctx1.sendIdx["class"]=1;
  3435. //>>excludeEnd("ctx");
  3436. $2=$recv($3).__eq($recv(aCollection)._class());
  3437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3438. $ctx1.sendIdx["="]=1;
  3439. //>>excludeEnd("ctx");
  3440. $1=$recv($2)._and_((function(){
  3441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3442. return $core.withContext(function($ctx2) {
  3443. //>>excludeEnd("ctx");
  3444. $4=$self._size();
  3445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3446. $ctx2.sendIdx["size"]=1;
  3447. //>>excludeEnd("ctx");
  3448. return $recv($4).__eq($recv(aCollection)._size());
  3449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3450. $ctx2.sendIdx["="]=2;
  3451. //>>excludeEnd("ctx");
  3452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3453. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3454. //>>excludeEnd("ctx");
  3455. }));
  3456. if(!$core.assert($1)){
  3457. return false;
  3458. }
  3459. $self._withIndexDo_((function(each,i){
  3460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3461. return $core.withContext(function($ctx2) {
  3462. //>>excludeEnd("ctx");
  3463. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  3464. if(!$core.assert($5)){
  3465. throw $early=[false];
  3466. }
  3467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3468. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3469. //>>excludeEnd("ctx");
  3470. }));
  3471. return true;
  3472. }
  3473. catch(e) {if(e===$early)return e[0]; throw e}
  3474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3475. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  3476. //>>excludeEnd("ctx");
  3477. },
  3478. //>>excludeStart("ide", pragmas.excludeIdeData);
  3479. args: ["aCollection"],
  3480. 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",
  3481. referencedClasses: [],
  3482. //>>excludeEnd("ide");
  3483. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3484. }),
  3485. $globals.SequenceableCollection);
  3486. $core.addMethod(
  3487. $core.method({
  3488. selector: "addLast:",
  3489. protocol: "adding/removing",
  3490. fn: function (anObject){
  3491. var self=this,$self=this;
  3492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3493. return $core.withContext(function($ctx1) {
  3494. //>>excludeEnd("ctx");
  3495. $self._add_(anObject);
  3496. return self;
  3497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3498. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  3499. //>>excludeEnd("ctx");
  3500. },
  3501. //>>excludeStart("ide", pragmas.excludeIdeData);
  3502. args: ["anObject"],
  3503. source: "addLast: anObject\x0a\x09self add: anObject",
  3504. referencedClasses: [],
  3505. //>>excludeEnd("ide");
  3506. messageSends: ["add:"]
  3507. }),
  3508. $globals.SequenceableCollection);
  3509. $core.addMethod(
  3510. $core.method({
  3511. selector: "allButFirst",
  3512. protocol: "accessing",
  3513. fn: function (){
  3514. var self=this,$self=this;
  3515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3516. return $core.withContext(function($ctx1) {
  3517. //>>excludeEnd("ctx");
  3518. return $self._copyFrom_to_((2),$self._size());
  3519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3520. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  3521. //>>excludeEnd("ctx");
  3522. },
  3523. //>>excludeStart("ide", pragmas.excludeIdeData);
  3524. args: [],
  3525. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3526. referencedClasses: [],
  3527. //>>excludeEnd("ide");
  3528. messageSends: ["copyFrom:to:", "size"]
  3529. }),
  3530. $globals.SequenceableCollection);
  3531. $core.addMethod(
  3532. $core.method({
  3533. selector: "allButLast",
  3534. protocol: "accessing",
  3535. fn: function (){
  3536. var self=this,$self=this;
  3537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3538. return $core.withContext(function($ctx1) {
  3539. //>>excludeEnd("ctx");
  3540. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  3541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3542. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  3543. //>>excludeEnd("ctx");
  3544. },
  3545. //>>excludeStart("ide", pragmas.excludeIdeData);
  3546. args: [],
  3547. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  3548. referencedClasses: [],
  3549. //>>excludeEnd("ide");
  3550. messageSends: ["copyFrom:to:", "-", "size"]
  3551. }),
  3552. $globals.SequenceableCollection);
  3553. $core.addMethod(
  3554. $core.method({
  3555. selector: "anyOne",
  3556. protocol: "accessing",
  3557. fn: function (){
  3558. var self=this,$self=this;
  3559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3560. return $core.withContext(function($ctx1) {
  3561. //>>excludeEnd("ctx");
  3562. return $self._at_((1));
  3563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3564. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  3565. //>>excludeEnd("ctx");
  3566. },
  3567. //>>excludeStart("ide", pragmas.excludeIdeData);
  3568. args: [],
  3569. source: "anyOne\x0a\x09^ self at: 1",
  3570. referencedClasses: [],
  3571. //>>excludeEnd("ide");
  3572. messageSends: ["at:"]
  3573. }),
  3574. $globals.SequenceableCollection);
  3575. $core.addMethod(
  3576. $core.method({
  3577. selector: "atRandom",
  3578. protocol: "accessing",
  3579. fn: function (){
  3580. var self=this,$self=this;
  3581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3582. return $core.withContext(function($ctx1) {
  3583. //>>excludeEnd("ctx");
  3584. return $self._at_($recv($self._size())._atRandom());
  3585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3586. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  3587. //>>excludeEnd("ctx");
  3588. },
  3589. //>>excludeStart("ide", pragmas.excludeIdeData);
  3590. args: [],
  3591. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3592. referencedClasses: [],
  3593. //>>excludeEnd("ide");
  3594. messageSends: ["at:", "atRandom", "size"]
  3595. }),
  3596. $globals.SequenceableCollection);
  3597. $core.addMethod(
  3598. $core.method({
  3599. selector: "beginsWith:",
  3600. protocol: "testing",
  3601. fn: function (prefix){
  3602. var self=this,$self=this;
  3603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3604. return $core.withContext(function($ctx1) {
  3605. //>>excludeEnd("ctx");
  3606. var $2,$3,$1;
  3607. $2=$self._size();
  3608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3609. $ctx1.sendIdx["size"]=1;
  3610. //>>excludeEnd("ctx");
  3611. $3=$recv(prefix)._size();
  3612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3613. $ctx1.sendIdx["size"]=2;
  3614. //>>excludeEnd("ctx");
  3615. $1=$recv($2).__lt($3);
  3616. if($core.assert($1)){
  3617. return false;
  3618. }
  3619. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  3620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3621. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  3622. //>>excludeEnd("ctx");
  3623. },
  3624. //>>excludeStart("ide", pragmas.excludeIdeData);
  3625. args: ["prefix"],
  3626. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3627. referencedClasses: [],
  3628. //>>excludeEnd("ide");
  3629. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3630. }),
  3631. $globals.SequenceableCollection);
  3632. $core.addMethod(
  3633. $core.method({
  3634. selector: "copyFrom:to:",
  3635. protocol: "copying",
  3636. fn: function (anIndex,anotherIndex){
  3637. var self=this,$self=this;
  3638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3639. return $core.withContext(function($ctx1) {
  3640. //>>excludeEnd("ctx");
  3641. $self._subclassResponsibility();
  3642. return self;
  3643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3644. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  3645. //>>excludeEnd("ctx");
  3646. },
  3647. //>>excludeStart("ide", pragmas.excludeIdeData);
  3648. args: ["anIndex", "anotherIndex"],
  3649. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  3650. referencedClasses: [],
  3651. //>>excludeEnd("ide");
  3652. messageSends: ["subclassResponsibility"]
  3653. }),
  3654. $globals.SequenceableCollection);
  3655. $core.addMethod(
  3656. $core.method({
  3657. selector: "endsWith:",
  3658. protocol: "testing",
  3659. fn: function (suffix){
  3660. var self=this,$self=this;
  3661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3662. return $core.withContext(function($ctx1) {
  3663. //>>excludeEnd("ctx");
  3664. var $2,$3,$1;
  3665. $2=$self._size();
  3666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3667. $ctx1.sendIdx["size"]=1;
  3668. //>>excludeEnd("ctx");
  3669. $3=$recv(suffix)._size();
  3670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3671. $ctx1.sendIdx["size"]=2;
  3672. //>>excludeEnd("ctx");
  3673. $1=$recv($2).__lt($3);
  3674. if($core.assert($1)){
  3675. return false;
  3676. }
  3677. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  3678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3679. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  3680. //>>excludeEnd("ctx");
  3681. },
  3682. //>>excludeStart("ide", pragmas.excludeIdeData);
  3683. args: ["suffix"],
  3684. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  3685. referencedClasses: [],
  3686. //>>excludeEnd("ide");
  3687. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  3688. }),
  3689. $globals.SequenceableCollection);
  3690. $core.addMethod(
  3691. $core.method({
  3692. selector: "first",
  3693. protocol: "accessing",
  3694. fn: function (){
  3695. var self=this,$self=this;
  3696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3697. return $core.withContext(function($ctx1) {
  3698. //>>excludeEnd("ctx");
  3699. return $self._at_((1));
  3700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3701. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  3702. //>>excludeEnd("ctx");
  3703. },
  3704. //>>excludeStart("ide", pragmas.excludeIdeData);
  3705. args: [],
  3706. source: "first\x0a\x09^ self at: 1",
  3707. referencedClasses: [],
  3708. //>>excludeEnd("ide");
  3709. messageSends: ["at:"]
  3710. }),
  3711. $globals.SequenceableCollection);
  3712. $core.addMethod(
  3713. $core.method({
  3714. selector: "first:",
  3715. protocol: "accessing",
  3716. fn: function (aNumber){
  3717. var self=this,$self=this;
  3718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3719. return $core.withContext(function($ctx1) {
  3720. //>>excludeEnd("ctx");
  3721. var $1;
  3722. $1=$recv($self._size()).__lt(aNumber);
  3723. if($core.assert($1)){
  3724. $self._error_("Invalid number of elements");
  3725. }
  3726. return $self._copyFrom_to_((1),aNumber);
  3727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3728. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  3729. //>>excludeEnd("ctx");
  3730. },
  3731. //>>excludeStart("ide", pragmas.excludeIdeData);
  3732. args: ["aNumber"],
  3733. 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",
  3734. referencedClasses: [],
  3735. //>>excludeEnd("ide");
  3736. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  3737. }),
  3738. $globals.SequenceableCollection);
  3739. $core.addMethod(
  3740. $core.method({
  3741. selector: "fourth",
  3742. protocol: "accessing",
  3743. fn: function (){
  3744. var self=this,$self=this;
  3745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3746. return $core.withContext(function($ctx1) {
  3747. //>>excludeEnd("ctx");
  3748. return $self._at_((4));
  3749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3750. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  3751. //>>excludeEnd("ctx");
  3752. },
  3753. //>>excludeStart("ide", pragmas.excludeIdeData);
  3754. args: [],
  3755. source: "fourth\x0a\x09^ self at: 4",
  3756. referencedClasses: [],
  3757. //>>excludeEnd("ide");
  3758. messageSends: ["at:"]
  3759. }),
  3760. $globals.SequenceableCollection);
  3761. $core.addMethod(
  3762. $core.method({
  3763. selector: "includes:",
  3764. protocol: "testing",
  3765. fn: function (anObject){
  3766. var self=this,$self=this;
  3767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3768. return $core.withContext(function($ctx1) {
  3769. //>>excludeEnd("ctx");
  3770. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  3771. return nil;
  3772. })))._notNil();
  3773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3774. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  3775. //>>excludeEnd("ctx");
  3776. },
  3777. //>>excludeStart("ide", pragmas.excludeIdeData);
  3778. args: ["anObject"],
  3779. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  3780. referencedClasses: [],
  3781. //>>excludeEnd("ide");
  3782. messageSends: ["notNil", "indexOf:ifAbsent:"]
  3783. }),
  3784. $globals.SequenceableCollection);
  3785. $core.addMethod(
  3786. $core.method({
  3787. selector: "indexOf:startingAt:",
  3788. protocol: "accessing",
  3789. fn: function (anObject,start){
  3790. var self=this,$self=this;
  3791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3792. return $core.withContext(function($ctx1) {
  3793. //>>excludeEnd("ctx");
  3794. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  3795. return (0);
  3796. }));
  3797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3798. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  3799. //>>excludeEnd("ctx");
  3800. },
  3801. //>>excludeStart("ide", pragmas.excludeIdeData);
  3802. args: ["anObject", "start"],
  3803. 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 ]",
  3804. referencedClasses: [],
  3805. //>>excludeEnd("ide");
  3806. messageSends: ["indexOf:startingAt:ifAbsent:"]
  3807. }),
  3808. $globals.SequenceableCollection);
  3809. $core.addMethod(
  3810. $core.method({
  3811. selector: "indexOf:startingAt:ifAbsent:",
  3812. protocol: "accessing",
  3813. fn: function (anObject,start,aBlock){
  3814. var self=this,$self=this;
  3815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3816. return $core.withContext(function($ctx1) {
  3817. //>>excludeEnd("ctx");
  3818. $self._subclassResponsibility();
  3819. return self;
  3820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3821. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  3822. //>>excludeEnd("ctx");
  3823. },
  3824. //>>excludeStart("ide", pragmas.excludeIdeData);
  3825. args: ["anObject", "start", "aBlock"],
  3826. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  3827. referencedClasses: [],
  3828. //>>excludeEnd("ide");
  3829. messageSends: ["subclassResponsibility"]
  3830. }),
  3831. $globals.SequenceableCollection);
  3832. $core.addMethod(
  3833. $core.method({
  3834. selector: "last",
  3835. protocol: "accessing",
  3836. fn: function (){
  3837. var self=this,$self=this;
  3838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3839. return $core.withContext(function($ctx1) {
  3840. //>>excludeEnd("ctx");
  3841. return $self._at_($self._size());
  3842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3843. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  3844. //>>excludeEnd("ctx");
  3845. },
  3846. //>>excludeStart("ide", pragmas.excludeIdeData);
  3847. args: [],
  3848. source: "last\x0a\x09^ self at: self size",
  3849. referencedClasses: [],
  3850. //>>excludeEnd("ide");
  3851. messageSends: ["at:", "size"]
  3852. }),
  3853. $globals.SequenceableCollection);
  3854. $core.addMethod(
  3855. $core.method({
  3856. selector: "last:",
  3857. protocol: "accessing",
  3858. fn: function (aNumber){
  3859. var self=this,$self=this;
  3860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3861. return $core.withContext(function($ctx1) {
  3862. //>>excludeEnd("ctx");
  3863. var $2,$1,$5,$4,$3;
  3864. $2=$self._size();
  3865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3866. $ctx1.sendIdx["size"]=1;
  3867. //>>excludeEnd("ctx");
  3868. $1=$recv($2).__lt(aNumber);
  3869. if($core.assert($1)){
  3870. $self._error_("Invalid number of elements");
  3871. }
  3872. $5=$self._size();
  3873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3874. $ctx1.sendIdx["size"]=2;
  3875. //>>excludeEnd("ctx");
  3876. $4=$recv($5).__minus(aNumber);
  3877. $3=$recv($4).__plus((1));
  3878. return $self._copyFrom_to_($3,$self._size());
  3879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3880. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  3881. //>>excludeEnd("ctx");
  3882. },
  3883. //>>excludeStart("ide", pragmas.excludeIdeData);
  3884. args: ["aNumber"],
  3885. 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",
  3886. referencedClasses: [],
  3887. //>>excludeEnd("ide");
  3888. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  3889. }),
  3890. $globals.SequenceableCollection);
  3891. $core.addMethod(
  3892. $core.method({
  3893. selector: "newStream",
  3894. protocol: "streaming",
  3895. fn: function (){
  3896. var self=this,$self=this;
  3897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3898. return $core.withContext(function($ctx1) {
  3899. //>>excludeEnd("ctx");
  3900. return $recv($self._streamClass())._on_(self);
  3901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3902. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  3903. //>>excludeEnd("ctx");
  3904. },
  3905. //>>excludeStart("ide", pragmas.excludeIdeData);
  3906. args: [],
  3907. source: "newStream\x0a\x09^ self streamClass on: self",
  3908. referencedClasses: [],
  3909. //>>excludeEnd("ide");
  3910. messageSends: ["on:", "streamClass"]
  3911. }),
  3912. $globals.SequenceableCollection);
  3913. $core.addMethod(
  3914. $core.method({
  3915. selector: "readStream",
  3916. protocol: "streaming",
  3917. fn: function (){
  3918. var self=this,$self=this;
  3919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3920. return $core.withContext(function($ctx1) {
  3921. //>>excludeEnd("ctx");
  3922. return $self._stream();
  3923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3924. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  3925. //>>excludeEnd("ctx");
  3926. },
  3927. //>>excludeStart("ide", pragmas.excludeIdeData);
  3928. args: [],
  3929. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  3930. referencedClasses: [],
  3931. //>>excludeEnd("ide");
  3932. messageSends: ["stream"]
  3933. }),
  3934. $globals.SequenceableCollection);
  3935. $core.addMethod(
  3936. $core.method({
  3937. selector: "removeLast",
  3938. protocol: "adding/removing",
  3939. fn: function (){
  3940. var self=this,$self=this;
  3941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3942. return $core.withContext(function($ctx1) {
  3943. //>>excludeEnd("ctx");
  3944. return $self._remove_($self._last());
  3945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3946. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  3947. //>>excludeEnd("ctx");
  3948. },
  3949. //>>excludeStart("ide", pragmas.excludeIdeData);
  3950. args: [],
  3951. source: "removeLast\x0a\x09^ self remove: self last",
  3952. referencedClasses: [],
  3953. //>>excludeEnd("ide");
  3954. messageSends: ["remove:", "last"]
  3955. }),
  3956. $globals.SequenceableCollection);
  3957. $core.addMethod(
  3958. $core.method({
  3959. selector: "reverseDo:",
  3960. protocol: "enumerating",
  3961. fn: function (aBlock){
  3962. var self=this,$self=this;
  3963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3964. return $core.withContext(function($ctx1) {
  3965. //>>excludeEnd("ctx");
  3966. $recv($self._reversed())._do_(aBlock);
  3967. return self;
  3968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3969. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  3970. //>>excludeEnd("ctx");
  3971. },
  3972. //>>excludeStart("ide", pragmas.excludeIdeData);
  3973. args: ["aBlock"],
  3974. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  3975. referencedClasses: [],
  3976. //>>excludeEnd("ide");
  3977. messageSends: ["do:", "reversed"]
  3978. }),
  3979. $globals.SequenceableCollection);
  3980. $core.addMethod(
  3981. $core.method({
  3982. selector: "reversed",
  3983. protocol: "converting",
  3984. fn: function (){
  3985. var self=this,$self=this;
  3986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3987. return $core.withContext(function($ctx1) {
  3988. //>>excludeEnd("ctx");
  3989. $self._subclassResponsibility();
  3990. return self;
  3991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3992. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  3993. //>>excludeEnd("ctx");
  3994. },
  3995. //>>excludeStart("ide", pragmas.excludeIdeData);
  3996. args: [],
  3997. source: "reversed\x0a\x09self subclassResponsibility",
  3998. referencedClasses: [],
  3999. //>>excludeEnd("ide");
  4000. messageSends: ["subclassResponsibility"]
  4001. }),
  4002. $globals.SequenceableCollection);
  4003. $core.addMethod(
  4004. $core.method({
  4005. selector: "second",
  4006. protocol: "accessing",
  4007. fn: function (){
  4008. var self=this,$self=this;
  4009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4010. return $core.withContext(function($ctx1) {
  4011. //>>excludeEnd("ctx");
  4012. return $self._at_((2));
  4013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4014. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  4015. //>>excludeEnd("ctx");
  4016. },
  4017. //>>excludeStart("ide", pragmas.excludeIdeData);
  4018. args: [],
  4019. source: "second\x0a\x09^ self at: 2",
  4020. referencedClasses: [],
  4021. //>>excludeEnd("ide");
  4022. messageSends: ["at:"]
  4023. }),
  4024. $globals.SequenceableCollection);
  4025. $core.addMethod(
  4026. $core.method({
  4027. selector: "stream",
  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 $self._newStream();
  4035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4036. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  4037. //>>excludeEnd("ctx");
  4038. },
  4039. //>>excludeStart("ide", pragmas.excludeIdeData);
  4040. args: [],
  4041. source: "stream\x0a\x09^ self newStream",
  4042. referencedClasses: [],
  4043. //>>excludeEnd("ide");
  4044. messageSends: ["newStream"]
  4045. }),
  4046. $globals.SequenceableCollection);
  4047. $core.addMethod(
  4048. $core.method({
  4049. selector: "streamClass",
  4050. protocol: "streaming",
  4051. fn: function (){
  4052. var self=this,$self=this;
  4053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4054. return $core.withContext(function($ctx1) {
  4055. //>>excludeEnd("ctx");
  4056. return $recv($self._class())._streamClass();
  4057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4058. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  4059. //>>excludeEnd("ctx");
  4060. },
  4061. //>>excludeStart("ide", pragmas.excludeIdeData);
  4062. args: [],
  4063. source: "streamClass\x0a\x09^ self class streamClass",
  4064. referencedClasses: [],
  4065. //>>excludeEnd("ide");
  4066. messageSends: ["streamClass", "class"]
  4067. }),
  4068. $globals.SequenceableCollection);
  4069. $core.addMethod(
  4070. $core.method({
  4071. selector: "third",
  4072. protocol: "accessing",
  4073. fn: function (){
  4074. var self=this,$self=this;
  4075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4076. return $core.withContext(function($ctx1) {
  4077. //>>excludeEnd("ctx");
  4078. return $self._at_((3));
  4079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4080. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  4081. //>>excludeEnd("ctx");
  4082. },
  4083. //>>excludeStart("ide", pragmas.excludeIdeData);
  4084. args: [],
  4085. source: "third\x0a\x09^ self at: 3",
  4086. referencedClasses: [],
  4087. //>>excludeEnd("ide");
  4088. messageSends: ["at:"]
  4089. }),
  4090. $globals.SequenceableCollection);
  4091. $core.addMethod(
  4092. $core.method({
  4093. selector: "writeStream",
  4094. protocol: "streaming",
  4095. fn: function (){
  4096. var self=this,$self=this;
  4097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4098. return $core.withContext(function($ctx1) {
  4099. //>>excludeEnd("ctx");
  4100. return $self._stream();
  4101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4102. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  4103. //>>excludeEnd("ctx");
  4104. },
  4105. //>>excludeStart("ide", pragmas.excludeIdeData);
  4106. args: [],
  4107. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4108. referencedClasses: [],
  4109. //>>excludeEnd("ide");
  4110. messageSends: ["stream"]
  4111. }),
  4112. $globals.SequenceableCollection);
  4113. $core.addMethod(
  4114. $core.method({
  4115. selector: "streamClass",
  4116. protocol: "accessing",
  4117. fn: function (){
  4118. var self=this,$self=this;
  4119. return $globals.Stream;
  4120. },
  4121. //>>excludeStart("ide", pragmas.excludeIdeData);
  4122. args: [],
  4123. source: "streamClass\x0a\x09\x09^ Stream",
  4124. referencedClasses: ["Stream"],
  4125. //>>excludeEnd("ide");
  4126. messageSends: []
  4127. }),
  4128. $globals.SequenceableCollection.a$cls);
  4129. $core.addMethod(
  4130. $core.method({
  4131. selector: "streamContents:",
  4132. protocol: "streaming",
  4133. fn: function (aBlock){
  4134. var self=this,$self=this;
  4135. var stream;
  4136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4137. return $core.withContext(function($ctx1) {
  4138. //>>excludeEnd("ctx");
  4139. stream=$recv($self._streamClass())._on_($self._new());
  4140. $recv(aBlock)._value_(stream);
  4141. return $recv(stream)._contents();
  4142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4143. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.a$cls)});
  4144. //>>excludeEnd("ctx");
  4145. },
  4146. //>>excludeStart("ide", pragmas.excludeIdeData);
  4147. args: ["aBlock"],
  4148. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4149. referencedClasses: [],
  4150. //>>excludeEnd("ide");
  4151. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4152. }),
  4153. $globals.SequenceableCollection.a$cls);
  4154. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  4155. //>>excludeStart("ide", pragmas.excludeIdeData);
  4156. $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`.";
  4157. //>>excludeEnd("ide");
  4158. $core.addMethod(
  4159. $core.method({
  4160. selector: "add:",
  4161. protocol: "adding/removing",
  4162. fn: function (anObject){
  4163. var self=this,$self=this;
  4164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4165. return $core.withContext(function($ctx1) {
  4166. //>>excludeEnd("ctx");
  4167. self.push(anObject); return anObject;;
  4168. return self;
  4169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4170. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  4171. //>>excludeEnd("ctx");
  4172. },
  4173. //>>excludeStart("ide", pragmas.excludeIdeData);
  4174. args: ["anObject"],
  4175. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  4176. referencedClasses: [],
  4177. //>>excludeEnd("ide");
  4178. messageSends: []
  4179. }),
  4180. $globals.Array);
  4181. $core.addMethod(
  4182. $core.method({
  4183. selector: "addAll:",
  4184. protocol: "adding/removing",
  4185. fn: function (aCollection){
  4186. var self=this,$self=this;
  4187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4188. return $core.withContext(function($ctx1) {
  4189. //>>excludeEnd("ctx");
  4190. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  4191. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  4192. return aCollection;;
  4193. return self;
  4194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4195. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  4196. //>>excludeEnd("ctx");
  4197. },
  4198. //>>excludeStart("ide", pragmas.excludeIdeData);
  4199. args: ["aCollection"],
  4200. 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'>",
  4201. referencedClasses: [],
  4202. //>>excludeEnd("ide");
  4203. messageSends: []
  4204. }),
  4205. $globals.Array);
  4206. $core.addMethod(
  4207. $core.method({
  4208. selector: "addFirst:",
  4209. protocol: "adding/removing",
  4210. fn: function (anObject){
  4211. var self=this,$self=this;
  4212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4213. return $core.withContext(function($ctx1) {
  4214. //>>excludeEnd("ctx");
  4215. self.unshift(anObject); return anObject;;
  4216. return self;
  4217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4218. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  4219. //>>excludeEnd("ctx");
  4220. },
  4221. //>>excludeStart("ide", pragmas.excludeIdeData);
  4222. args: ["anObject"],
  4223. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  4224. referencedClasses: [],
  4225. //>>excludeEnd("ide");
  4226. messageSends: []
  4227. }),
  4228. $globals.Array);
  4229. $core.addMethod(
  4230. $core.method({
  4231. selector: "asJavaScriptSource",
  4232. protocol: "converting",
  4233. fn: function (){
  4234. var self=this,$self=this;
  4235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4236. return $core.withContext(function($ctx1) {
  4237. //>>excludeEnd("ctx");
  4238. var $1;
  4239. $1=$recv("[".__comma($recv($self._collect_((function(each){
  4240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4241. return $core.withContext(function($ctx2) {
  4242. //>>excludeEnd("ctx");
  4243. return $recv(each)._asJavaScriptSource();
  4244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4245. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4246. //>>excludeEnd("ctx");
  4247. })))._join_(", "))).__comma("]");
  4248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4249. $ctx1.sendIdx[","]=1;
  4250. //>>excludeEnd("ctx");
  4251. return $1;
  4252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4253. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Array)});
  4254. //>>excludeEnd("ctx");
  4255. },
  4256. //>>excludeStart("ide", pragmas.excludeIdeData);
  4257. args: [],
  4258. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  4259. referencedClasses: [],
  4260. //>>excludeEnd("ide");
  4261. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  4262. }),
  4263. $globals.Array);
  4264. $core.addMethod(
  4265. $core.method({
  4266. selector: "at:put:",
  4267. protocol: "accessing",
  4268. fn: function (anIndex,anObject){
  4269. var self=this,$self=this;
  4270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4271. return $core.withContext(function($ctx1) {
  4272. //>>excludeEnd("ctx");
  4273. return self[anIndex - 1] = anObject;
  4274. return self;
  4275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4276. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  4277. //>>excludeEnd("ctx");
  4278. },
  4279. //>>excludeStart("ide", pragmas.excludeIdeData);
  4280. args: ["anIndex", "anObject"],
  4281. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  4282. referencedClasses: [],
  4283. //>>excludeEnd("ide");
  4284. messageSends: []
  4285. }),
  4286. $globals.Array);
  4287. $core.addMethod(
  4288. $core.method({
  4289. selector: "collect:",
  4290. protocol: "enumerating",
  4291. fn: function (aBlock){
  4292. var self=this,$self=this;
  4293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4294. return $core.withContext(function($ctx1) {
  4295. //>>excludeEnd("ctx");
  4296. return self.map(function(each) {return aBlock._value_(each)});
  4297. return self;
  4298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4299. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  4300. //>>excludeEnd("ctx");
  4301. },
  4302. //>>excludeStart("ide", pragmas.excludeIdeData);
  4303. args: ["aBlock"],
  4304. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  4305. referencedClasses: [],
  4306. //>>excludeEnd("ide");
  4307. messageSends: []
  4308. }),
  4309. $globals.Array);
  4310. $core.addMethod(
  4311. $core.method({
  4312. selector: "copyFrom:to:",
  4313. protocol: "copying",
  4314. fn: function (anIndex,anotherIndex){
  4315. var self=this,$self=this;
  4316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4317. return $core.withContext(function($ctx1) {
  4318. //>>excludeEnd("ctx");
  4319. if (anIndex >= 1 && anotherIndex <= self.length) {
  4320. return self.slice(anIndex - 1, anotherIndex);
  4321. } else {
  4322. self._at_(anIndex);
  4323. self._at_(self.length + 1);
  4324. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4325. };
  4326. return self;
  4327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4328. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  4329. //>>excludeEnd("ctx");
  4330. },
  4331. //>>excludeStart("ide", pragmas.excludeIdeData);
  4332. args: ["anIndex", "anotherIndex"],
  4333. 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'>",
  4334. referencedClasses: [],
  4335. //>>excludeEnd("ide");
  4336. messageSends: []
  4337. }),
  4338. $globals.Array);
  4339. $core.addMethod(
  4340. $core.method({
  4341. selector: "join:",
  4342. protocol: "enumerating",
  4343. fn: function (aString){
  4344. var self=this,$self=this;
  4345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4346. return $core.withContext(function($ctx1) {
  4347. //>>excludeEnd("ctx");
  4348. return self.join(aString);
  4349. return self;
  4350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4351. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  4352. //>>excludeEnd("ctx");
  4353. },
  4354. //>>excludeStart("ide", pragmas.excludeIdeData);
  4355. args: ["aString"],
  4356. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  4357. referencedClasses: [],
  4358. //>>excludeEnd("ide");
  4359. messageSends: []
  4360. }),
  4361. $globals.Array);
  4362. $core.addMethod(
  4363. $core.method({
  4364. selector: "printOn:",
  4365. protocol: "printing",
  4366. fn: function (aStream){
  4367. var self=this,$self=this;
  4368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4369. return $core.withContext(function($ctx1) {
  4370. //>>excludeEnd("ctx");
  4371. (
  4372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4373. $ctx1.supercall = true,
  4374. //>>excludeEnd("ctx");
  4375. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  4376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4377. $ctx1.supercall = false;
  4378. //>>excludeEnd("ctx");;
  4379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4380. $ctx1.sendIdx["printOn:"]=1;
  4381. //>>excludeEnd("ctx");
  4382. $recv(aStream)._nextPutAll_(" (");
  4383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4384. $ctx1.sendIdx["nextPutAll:"]=1;
  4385. //>>excludeEnd("ctx");
  4386. $self._do_separatedBy_((function(each){
  4387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4388. return $core.withContext(function($ctx2) {
  4389. //>>excludeEnd("ctx");
  4390. return $recv(each)._printOn_(aStream);
  4391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4392. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4393. //>>excludeEnd("ctx");
  4394. }),(function(){
  4395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4396. return $core.withContext(function($ctx2) {
  4397. //>>excludeEnd("ctx");
  4398. return $recv(aStream)._nextPutAll_(" ");
  4399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4400. $ctx2.sendIdx["nextPutAll:"]=2;
  4401. //>>excludeEnd("ctx");
  4402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4403. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4404. //>>excludeEnd("ctx");
  4405. }));
  4406. $recv(aStream)._nextPutAll_(")");
  4407. return self;
  4408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4409. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  4410. //>>excludeEnd("ctx");
  4411. },
  4412. //>>excludeStart("ide", pragmas.excludeIdeData);
  4413. args: ["aStream"],
  4414. 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: ')'",
  4415. referencedClasses: [],
  4416. //>>excludeEnd("ide");
  4417. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4418. }),
  4419. $globals.Array);
  4420. $core.addMethod(
  4421. $core.method({
  4422. selector: "remove:ifAbsent:",
  4423. protocol: "adding/removing",
  4424. fn: function (anObject,aBlock){
  4425. var self=this,$self=this;
  4426. var index;
  4427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4428. return $core.withContext(function($ctx1) {
  4429. //>>excludeEnd("ctx");
  4430. var $1;
  4431. index=$self._indexOf_ifAbsent_(anObject,(function(){
  4432. return (0);
  4433. }));
  4434. $1=$recv(index).__eq((0));
  4435. if($core.assert($1)){
  4436. return $recv(aBlock)._value();
  4437. } else {
  4438. $self._removeIndex_(index);
  4439. return anObject;
  4440. }
  4441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4442. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  4443. //>>excludeEnd("ctx");
  4444. },
  4445. //>>excludeStart("ide", pragmas.excludeIdeData);
  4446. args: ["anObject", "aBlock"],
  4447. 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 ]",
  4448. referencedClasses: [],
  4449. //>>excludeEnd("ide");
  4450. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4451. }),
  4452. $globals.Array);
  4453. $core.addMethod(
  4454. $core.method({
  4455. selector: "removeAll",
  4456. protocol: "adding/removing",
  4457. fn: function (){
  4458. var self=this,$self=this;
  4459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4460. return $core.withContext(function($ctx1) {
  4461. //>>excludeEnd("ctx");
  4462. self.length = 0;
  4463. return self;
  4464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4465. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  4466. //>>excludeEnd("ctx");
  4467. },
  4468. //>>excludeStart("ide", pragmas.excludeIdeData);
  4469. args: [],
  4470. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  4471. referencedClasses: [],
  4472. //>>excludeEnd("ide");
  4473. messageSends: []
  4474. }),
  4475. $globals.Array);
  4476. $core.addMethod(
  4477. $core.method({
  4478. selector: "removeFrom:to:",
  4479. protocol: "adding/removing",
  4480. fn: function (aNumber,anotherNumber){
  4481. var self=this,$self=this;
  4482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4483. return $core.withContext(function($ctx1) {
  4484. //>>excludeEnd("ctx");
  4485. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4486. return self;
  4487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4488. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  4489. //>>excludeEnd("ctx");
  4490. },
  4491. //>>excludeStart("ide", pragmas.excludeIdeData);
  4492. args: ["aNumber", "anotherNumber"],
  4493. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  4494. referencedClasses: [],
  4495. //>>excludeEnd("ide");
  4496. messageSends: []
  4497. }),
  4498. $globals.Array);
  4499. $core.addMethod(
  4500. $core.method({
  4501. selector: "removeIndex:",
  4502. protocol: "adding/removing",
  4503. fn: function (anInteger){
  4504. var self=this,$self=this;
  4505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4506. return $core.withContext(function($ctx1) {
  4507. //>>excludeEnd("ctx");
  4508. self.splice(anInteger - 1, 1);
  4509. return self;
  4510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4511. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  4512. //>>excludeEnd("ctx");
  4513. },
  4514. //>>excludeStart("ide", pragmas.excludeIdeData);
  4515. args: ["anInteger"],
  4516. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  4517. referencedClasses: [],
  4518. //>>excludeEnd("ide");
  4519. messageSends: []
  4520. }),
  4521. $globals.Array);
  4522. $core.addMethod(
  4523. $core.method({
  4524. selector: "removeLast",
  4525. protocol: "adding/removing",
  4526. fn: function (){
  4527. var self=this,$self=this;
  4528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4529. return $core.withContext(function($ctx1) {
  4530. //>>excludeEnd("ctx");
  4531. return self.pop();;
  4532. return self;
  4533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4534. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  4535. //>>excludeEnd("ctx");
  4536. },
  4537. //>>excludeStart("ide", pragmas.excludeIdeData);
  4538. args: [],
  4539. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  4540. referencedClasses: [],
  4541. //>>excludeEnd("ide");
  4542. messageSends: []
  4543. }),
  4544. $globals.Array);
  4545. $core.addMethod(
  4546. $core.method({
  4547. selector: "reversed",
  4548. protocol: "converting",
  4549. fn: function (){
  4550. var self=this,$self=this;
  4551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4552. return $core.withContext(function($ctx1) {
  4553. //>>excludeEnd("ctx");
  4554. return self.slice().reverse();
  4555. return self;
  4556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4557. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  4558. //>>excludeEnd("ctx");
  4559. },
  4560. //>>excludeStart("ide", pragmas.excludeIdeData);
  4561. args: [],
  4562. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  4563. referencedClasses: [],
  4564. //>>excludeEnd("ide");
  4565. messageSends: []
  4566. }),
  4567. $globals.Array);
  4568. $core.addMethod(
  4569. $core.method({
  4570. selector: "select:",
  4571. protocol: "enumerating",
  4572. fn: function (aBlock){
  4573. var self=this,$self=this;
  4574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4575. return $core.withContext(function($ctx1) {
  4576. //>>excludeEnd("ctx");
  4577. return self.filter(function(each) {return aBlock._value_(each)});
  4578. return self;
  4579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4580. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  4581. //>>excludeEnd("ctx");
  4582. },
  4583. //>>excludeStart("ide", pragmas.excludeIdeData);
  4584. args: ["aBlock"],
  4585. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  4586. referencedClasses: [],
  4587. //>>excludeEnd("ide");
  4588. messageSends: []
  4589. }),
  4590. $globals.Array);
  4591. $core.addMethod(
  4592. $core.method({
  4593. selector: "shallowCopy",
  4594. protocol: "copying",
  4595. fn: function (){
  4596. var self=this,$self=this;
  4597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4598. return $core.withContext(function($ctx1) {
  4599. //>>excludeEnd("ctx");
  4600. return self.slice();
  4601. return self;
  4602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4603. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  4604. //>>excludeEnd("ctx");
  4605. },
  4606. //>>excludeStart("ide", pragmas.excludeIdeData);
  4607. args: [],
  4608. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  4609. referencedClasses: [],
  4610. //>>excludeEnd("ide");
  4611. messageSends: []
  4612. }),
  4613. $globals.Array);
  4614. $core.addMethod(
  4615. $core.method({
  4616. selector: "sort",
  4617. protocol: "enumerating",
  4618. fn: function (){
  4619. var self=this,$self=this;
  4620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4621. return $core.withContext(function($ctx1) {
  4622. //>>excludeEnd("ctx");
  4623. return $self._sort_((function(a,b){
  4624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4625. return $core.withContext(function($ctx2) {
  4626. //>>excludeEnd("ctx");
  4627. return $recv(a).__lt(b);
  4628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4629. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  4630. //>>excludeEnd("ctx");
  4631. }));
  4632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4633. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  4634. //>>excludeEnd("ctx");
  4635. },
  4636. //>>excludeStart("ide", pragmas.excludeIdeData);
  4637. args: [],
  4638. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  4639. referencedClasses: [],
  4640. //>>excludeEnd("ide");
  4641. messageSends: ["sort:", "<"]
  4642. }),
  4643. $globals.Array);
  4644. $core.addMethod(
  4645. $core.method({
  4646. selector: "sort:",
  4647. protocol: "enumerating",
  4648. fn: function (aBlock){
  4649. var self=this,$self=this;
  4650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4651. return $core.withContext(function($ctx1) {
  4652. //>>excludeEnd("ctx");
  4653. return self.sort(function(a, b) {
  4654. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  4655. })
  4656. ;
  4657. return self;
  4658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4659. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  4660. //>>excludeEnd("ctx");
  4661. },
  4662. //>>excludeStart("ide", pragmas.excludeIdeData);
  4663. args: ["aBlock"],
  4664. 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'>",
  4665. referencedClasses: [],
  4666. //>>excludeEnd("ide");
  4667. messageSends: []
  4668. }),
  4669. $globals.Array);
  4670. $core.addMethod(
  4671. $core.method({
  4672. selector: "sorted",
  4673. protocol: "enumerating",
  4674. fn: function (){
  4675. var self=this,$self=this;
  4676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4677. return $core.withContext(function($ctx1) {
  4678. //>>excludeEnd("ctx");
  4679. return $recv($self._copy())._sort();
  4680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4681. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  4682. //>>excludeEnd("ctx");
  4683. },
  4684. //>>excludeStart("ide", pragmas.excludeIdeData);
  4685. args: [],
  4686. source: "sorted\x0a\x09^ self copy sort",
  4687. referencedClasses: [],
  4688. //>>excludeEnd("ide");
  4689. messageSends: ["sort", "copy"]
  4690. }),
  4691. $globals.Array);
  4692. $core.addMethod(
  4693. $core.method({
  4694. selector: "sorted:",
  4695. protocol: "enumerating",
  4696. fn: function (aBlock){
  4697. var self=this,$self=this;
  4698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4699. return $core.withContext(function($ctx1) {
  4700. //>>excludeEnd("ctx");
  4701. return $recv($self._copy())._sort_(aBlock);
  4702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4703. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  4704. //>>excludeEnd("ctx");
  4705. },
  4706. //>>excludeStart("ide", pragmas.excludeIdeData);
  4707. args: ["aBlock"],
  4708. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  4709. referencedClasses: [],
  4710. //>>excludeEnd("ide");
  4711. messageSends: ["sort:", "copy"]
  4712. }),
  4713. $globals.Array);
  4714. $core.addMethod(
  4715. $core.method({
  4716. selector: "new:",
  4717. protocol: "instance creation",
  4718. fn: function (anInteger){
  4719. var self=this,$self=this;
  4720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4721. return $core.withContext(function($ctx1) {
  4722. //>>excludeEnd("ctx");
  4723. return new Array(anInteger);
  4724. return self;
  4725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4726. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.a$cls)});
  4727. //>>excludeEnd("ctx");
  4728. },
  4729. //>>excludeStart("ide", pragmas.excludeIdeData);
  4730. args: ["anInteger"],
  4731. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  4732. referencedClasses: [],
  4733. //>>excludeEnd("ide");
  4734. messageSends: []
  4735. }),
  4736. $globals.Array.a$cls);
  4737. $core.addMethod(
  4738. $core.method({
  4739. selector: "with:",
  4740. protocol: "instance creation",
  4741. fn: function (anObject){
  4742. var self=this,$self=this;
  4743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4744. return $core.withContext(function($ctx1) {
  4745. //>>excludeEnd("ctx");
  4746. var $1;
  4747. $1=$self._new_((1));
  4748. $recv($1)._at_put_((1),anObject);
  4749. return $recv($1)._yourself();
  4750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4751. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.a$cls)});
  4752. //>>excludeEnd("ctx");
  4753. },
  4754. //>>excludeStart("ide", pragmas.excludeIdeData);
  4755. args: ["anObject"],
  4756. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  4757. referencedClasses: [],
  4758. //>>excludeEnd("ide");
  4759. messageSends: ["at:put:", "new:", "yourself"]
  4760. }),
  4761. $globals.Array.a$cls);
  4762. $core.addMethod(
  4763. $core.method({
  4764. selector: "with:with:",
  4765. protocol: "instance creation",
  4766. fn: function (anObject,anObject2){
  4767. var self=this,$self=this;
  4768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4769. return $core.withContext(function($ctx1) {
  4770. //>>excludeEnd("ctx");
  4771. var $1;
  4772. $1=$self._new_((2));
  4773. $recv($1)._at_put_((1),anObject);
  4774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4775. $ctx1.sendIdx["at:put:"]=1;
  4776. //>>excludeEnd("ctx");
  4777. $recv($1)._at_put_((2),anObject2);
  4778. return $recv($1)._yourself();
  4779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4780. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.a$cls)});
  4781. //>>excludeEnd("ctx");
  4782. },
  4783. //>>excludeStart("ide", pragmas.excludeIdeData);
  4784. args: ["anObject", "anObject2"],
  4785. 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",
  4786. referencedClasses: [],
  4787. //>>excludeEnd("ide");
  4788. messageSends: ["at:put:", "new:", "yourself"]
  4789. }),
  4790. $globals.Array.a$cls);
  4791. $core.addMethod(
  4792. $core.method({
  4793. selector: "with:with:with:",
  4794. protocol: "instance creation",
  4795. fn: function (anObject,anObject2,anObject3){
  4796. var self=this,$self=this;
  4797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4798. return $core.withContext(function($ctx1) {
  4799. //>>excludeEnd("ctx");
  4800. var $1;
  4801. $1=$self._new_((3));
  4802. $recv($1)._at_put_((1),anObject);
  4803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4804. $ctx1.sendIdx["at:put:"]=1;
  4805. //>>excludeEnd("ctx");
  4806. $recv($1)._at_put_((2),anObject2);
  4807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4808. $ctx1.sendIdx["at:put:"]=2;
  4809. //>>excludeEnd("ctx");
  4810. $recv($1)._at_put_((3),anObject3);
  4811. return $recv($1)._yourself();
  4812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4813. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.a$cls)});
  4814. //>>excludeEnd("ctx");
  4815. },
  4816. //>>excludeStart("ide", pragmas.excludeIdeData);
  4817. args: ["anObject", "anObject2", "anObject3"],
  4818. 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",
  4819. referencedClasses: [],
  4820. //>>excludeEnd("ide");
  4821. messageSends: ["at:put:", "new:", "yourself"]
  4822. }),
  4823. $globals.Array.a$cls);
  4824. $core.addMethod(
  4825. $core.method({
  4826. selector: "withAll:",
  4827. protocol: "instance creation",
  4828. fn: function (aCollection){
  4829. var self=this,$self=this;
  4830. var instance,index;
  4831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4832. return $core.withContext(function($ctx1) {
  4833. //>>excludeEnd("ctx");
  4834. index=(1);
  4835. instance=$self._new_($recv(aCollection)._size());
  4836. $recv(aCollection)._do_((function(each){
  4837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4838. return $core.withContext(function($ctx2) {
  4839. //>>excludeEnd("ctx");
  4840. $recv(instance)._at_put_(index,each);
  4841. index=$recv(index).__plus((1));
  4842. return index;
  4843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4844. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4845. //>>excludeEnd("ctx");
  4846. }));
  4847. return instance;
  4848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4849. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.a$cls)});
  4850. //>>excludeEnd("ctx");
  4851. },
  4852. //>>excludeStart("ide", pragmas.excludeIdeData);
  4853. args: ["aCollection"],
  4854. 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",
  4855. referencedClasses: [],
  4856. //>>excludeEnd("ide");
  4857. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  4858. }),
  4859. $globals.Array.a$cls);
  4860. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  4861. //>>excludeStart("ide", pragmas.excludeIdeData);
  4862. $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 >> #,`";
  4863. //>>excludeEnd("ide");
  4864. $core.addMethod(
  4865. $core.method({
  4866. selector: ",",
  4867. protocol: "copying",
  4868. fn: function (aString){
  4869. var self=this,$self=this;
  4870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4871. return $core.withContext(function($ctx1) {
  4872. //>>excludeEnd("ctx");
  4873. return String(self) + aString;
  4874. return self;
  4875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4876. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  4877. //>>excludeEnd("ctx");
  4878. },
  4879. //>>excludeStart("ide", pragmas.excludeIdeData);
  4880. args: ["aString"],
  4881. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  4882. referencedClasses: [],
  4883. //>>excludeEnd("ide");
  4884. messageSends: []
  4885. }),
  4886. $globals.String);
  4887. $core.addMethod(
  4888. $core.method({
  4889. selector: "<",
  4890. protocol: "comparing",
  4891. fn: function (aString){
  4892. var self=this,$self=this;
  4893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4894. return $core.withContext(function($ctx1) {
  4895. //>>excludeEnd("ctx");
  4896. return String(self) < aString._asString();
  4897. return self;
  4898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4899. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  4900. //>>excludeEnd("ctx");
  4901. },
  4902. //>>excludeStart("ide", pragmas.excludeIdeData);
  4903. args: ["aString"],
  4904. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  4905. referencedClasses: [],
  4906. //>>excludeEnd("ide");
  4907. messageSends: []
  4908. }),
  4909. $globals.String);
  4910. $core.addMethod(
  4911. $core.method({
  4912. selector: "<=",
  4913. protocol: "comparing",
  4914. fn: function (aString){
  4915. var self=this,$self=this;
  4916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4917. return $core.withContext(function($ctx1) {
  4918. //>>excludeEnd("ctx");
  4919. return String(self) <= aString._asString();
  4920. return self;
  4921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4922. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  4923. //>>excludeEnd("ctx");
  4924. },
  4925. //>>excludeStart("ide", pragmas.excludeIdeData);
  4926. args: ["aString"],
  4927. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  4928. referencedClasses: [],
  4929. //>>excludeEnd("ide");
  4930. messageSends: []
  4931. }),
  4932. $globals.String);
  4933. $core.addMethod(
  4934. $core.method({
  4935. selector: "=",
  4936. protocol: "comparing",
  4937. fn: function (aString){
  4938. var self=this,$self=this;
  4939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4940. return $core.withContext(function($ctx1) {
  4941. //>>excludeEnd("ctx");
  4942. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  4943. return self;
  4944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4945. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  4946. //>>excludeEnd("ctx");
  4947. },
  4948. //>>excludeStart("ide", pragmas.excludeIdeData);
  4949. args: ["aString"],
  4950. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  4951. referencedClasses: [],
  4952. //>>excludeEnd("ide");
  4953. messageSends: []
  4954. }),
  4955. $globals.String);
  4956. $core.addMethod(
  4957. $core.method({
  4958. selector: "==",
  4959. protocol: "comparing",
  4960. fn: function (aString){
  4961. var self=this,$self=this;
  4962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4963. return $core.withContext(function($ctx1) {
  4964. //>>excludeEnd("ctx");
  4965. if (typeof aString === "string") return String(self) === aString;
  4966. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  4967. else return false;;
  4968. return self;
  4969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4970. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  4971. //>>excludeEnd("ctx");
  4972. },
  4973. //>>excludeStart("ide", pragmas.excludeIdeData);
  4974. args: ["aString"],
  4975. 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'>",
  4976. referencedClasses: [],
  4977. //>>excludeEnd("ide");
  4978. messageSends: []
  4979. }),
  4980. $globals.String);
  4981. $core.addMethod(
  4982. $core.method({
  4983. selector: ">",
  4984. protocol: "comparing",
  4985. fn: function (aString){
  4986. var self=this,$self=this;
  4987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4988. return $core.withContext(function($ctx1) {
  4989. //>>excludeEnd("ctx");
  4990. return String(self) > aString._asString();
  4991. return self;
  4992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4993. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  4994. //>>excludeEnd("ctx");
  4995. },
  4996. //>>excludeStart("ide", pragmas.excludeIdeData);
  4997. args: ["aString"],
  4998. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  4999. referencedClasses: [],
  5000. //>>excludeEnd("ide");
  5001. messageSends: []
  5002. }),
  5003. $globals.String);
  5004. $core.addMethod(
  5005. $core.method({
  5006. selector: ">=",
  5007. protocol: "comparing",
  5008. fn: function (aString){
  5009. var self=this,$self=this;
  5010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5011. return $core.withContext(function($ctx1) {
  5012. //>>excludeEnd("ctx");
  5013. return String(self) >= aString._asString();
  5014. return self;
  5015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5016. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  5017. //>>excludeEnd("ctx");
  5018. },
  5019. //>>excludeStart("ide", pragmas.excludeIdeData);
  5020. args: ["aString"],
  5021. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  5022. referencedClasses: [],
  5023. //>>excludeEnd("ide");
  5024. messageSends: []
  5025. }),
  5026. $globals.String);
  5027. $core.addMethod(
  5028. $core.method({
  5029. selector: "add:",
  5030. protocol: "adding/removing",
  5031. fn: function (anObject){
  5032. var self=this,$self=this;
  5033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5034. return $core.withContext(function($ctx1) {
  5035. //>>excludeEnd("ctx");
  5036. $self._errorReadOnly();
  5037. return self;
  5038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5039. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.String)});
  5040. //>>excludeEnd("ctx");
  5041. },
  5042. //>>excludeStart("ide", pragmas.excludeIdeData);
  5043. args: ["anObject"],
  5044. source: "add: anObject\x0a\x09self errorReadOnly",
  5045. referencedClasses: [],
  5046. //>>excludeEnd("ide");
  5047. messageSends: ["errorReadOnly"]
  5048. }),
  5049. $globals.String);
  5050. $core.addMethod(
  5051. $core.method({
  5052. selector: "asJavaScriptMethodName",
  5053. protocol: "converting",
  5054. fn: function (){
  5055. var self=this,$self=this;
  5056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5057. return $core.withContext(function($ctx1) {
  5058. //>>excludeEnd("ctx");
  5059. return $core.st2js(self);
  5060. return self;
  5061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5062. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  5063. //>>excludeEnd("ctx");
  5064. },
  5065. //>>excludeStart("ide", pragmas.excludeIdeData);
  5066. args: [],
  5067. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  5068. referencedClasses: [],
  5069. //>>excludeEnd("ide");
  5070. messageSends: []
  5071. }),
  5072. $globals.String);
  5073. $core.addMethod(
  5074. $core.method({
  5075. selector: "asJavaScriptObject",
  5076. protocol: "converting",
  5077. fn: function (){
  5078. var self=this,$self=this;
  5079. return self;
  5080. },
  5081. //>>excludeStart("ide", pragmas.excludeIdeData);
  5082. args: [],
  5083. source: "asJavaScriptObject\x0a\x09^ self",
  5084. referencedClasses: [],
  5085. //>>excludeEnd("ide");
  5086. messageSends: []
  5087. }),
  5088. $globals.String);
  5089. $core.addMethod(
  5090. $core.method({
  5091. selector: "asJavaScriptSource",
  5092. protocol: "converting",
  5093. fn: function (){
  5094. var self=this,$self=this;
  5095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5096. return $core.withContext(function($ctx1) {
  5097. //>>excludeEnd("ctx");
  5098. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5099. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5100. else
  5101. return "\"" + self + "\"";
  5102. ;
  5103. return self;
  5104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5105. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  5106. //>>excludeEnd("ctx");
  5107. },
  5108. //>>excludeStart("ide", pragmas.excludeIdeData);
  5109. args: [],
  5110. 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'>",
  5111. referencedClasses: [],
  5112. //>>excludeEnd("ide");
  5113. messageSends: []
  5114. }),
  5115. $globals.String);
  5116. $core.addMethod(
  5117. $core.method({
  5118. selector: "asLowercase",
  5119. protocol: "converting",
  5120. fn: function (){
  5121. var self=this,$self=this;
  5122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5123. return $core.withContext(function($ctx1) {
  5124. //>>excludeEnd("ctx");
  5125. return self.toLowerCase();
  5126. return self;
  5127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5128. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  5129. //>>excludeEnd("ctx");
  5130. },
  5131. //>>excludeStart("ide", pragmas.excludeIdeData);
  5132. args: [],
  5133. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  5134. referencedClasses: [],
  5135. //>>excludeEnd("ide");
  5136. messageSends: []
  5137. }),
  5138. $globals.String);
  5139. $core.addMethod(
  5140. $core.method({
  5141. selector: "asMutator",
  5142. protocol: "converting",
  5143. fn: function (){
  5144. var self=this,$self=this;
  5145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5146. return $core.withContext(function($ctx1) {
  5147. //>>excludeEnd("ctx");
  5148. var $1;
  5149. $1=$recv($self._last()).__eq(":");
  5150. if(!$core.assert($1)){
  5151. return $self.__comma(":");
  5152. }
  5153. return self;
  5154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5155. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  5156. //>>excludeEnd("ctx");
  5157. },
  5158. //>>excludeStart("ide", pragmas.excludeIdeData);
  5159. args: [],
  5160. 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",
  5161. referencedClasses: [],
  5162. //>>excludeEnd("ide");
  5163. messageSends: ["ifFalse:", "=", "last", ","]
  5164. }),
  5165. $globals.String);
  5166. $core.addMethod(
  5167. $core.method({
  5168. selector: "asNumber",
  5169. protocol: "converting",
  5170. fn: function (){
  5171. var self=this,$self=this;
  5172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5173. return $core.withContext(function($ctx1) {
  5174. //>>excludeEnd("ctx");
  5175. return Number(self);
  5176. return self;
  5177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5178. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  5179. //>>excludeEnd("ctx");
  5180. },
  5181. //>>excludeStart("ide", pragmas.excludeIdeData);
  5182. args: [],
  5183. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  5184. referencedClasses: [],
  5185. //>>excludeEnd("ide");
  5186. messageSends: []
  5187. }),
  5188. $globals.String);
  5189. $core.addMethod(
  5190. $core.method({
  5191. selector: "asRegexp",
  5192. protocol: "converting",
  5193. fn: function (){
  5194. var self=this,$self=this;
  5195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5196. return $core.withContext(function($ctx1) {
  5197. //>>excludeEnd("ctx");
  5198. return $recv($globals.RegularExpression)._fromString_(self);
  5199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5200. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  5201. //>>excludeEnd("ctx");
  5202. },
  5203. //>>excludeStart("ide", pragmas.excludeIdeData);
  5204. args: [],
  5205. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  5206. referencedClasses: ["RegularExpression"],
  5207. //>>excludeEnd("ide");
  5208. messageSends: ["fromString:"]
  5209. }),
  5210. $globals.String);
  5211. $core.addMethod(
  5212. $core.method({
  5213. selector: "asString",
  5214. protocol: "converting",
  5215. fn: function (){
  5216. var self=this,$self=this;
  5217. return self;
  5218. },
  5219. //>>excludeStart("ide", pragmas.excludeIdeData);
  5220. args: [],
  5221. source: "asString\x0a\x09^ self",
  5222. referencedClasses: [],
  5223. //>>excludeEnd("ide");
  5224. messageSends: []
  5225. }),
  5226. $globals.String);
  5227. $core.addMethod(
  5228. $core.method({
  5229. selector: "asSymbol",
  5230. protocol: "converting",
  5231. fn: function (){
  5232. var self=this,$self=this;
  5233. return self;
  5234. },
  5235. //>>excludeStart("ide", pragmas.excludeIdeData);
  5236. args: [],
  5237. source: "asSymbol\x0a\x09^ self",
  5238. referencedClasses: [],
  5239. //>>excludeEnd("ide");
  5240. messageSends: []
  5241. }),
  5242. $globals.String);
  5243. $core.addMethod(
  5244. $core.method({
  5245. selector: "asSymbolPrintOn:",
  5246. protocol: "printing",
  5247. fn: function (aStream){
  5248. var self=this,$self=this;
  5249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5250. return $core.withContext(function($ctx1) {
  5251. //>>excludeEnd("ctx");
  5252. var $1;
  5253. $recv(aStream)._nextPutAll_("#");
  5254. $1=$recv($self._asString())._isSelector();
  5255. if($core.assert($1)){
  5256. $recv(aStream)._nextPut_(self);
  5257. } else {
  5258. $self._printOn_(aStream);
  5259. }
  5260. return self;
  5261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5262. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.String)});
  5263. //>>excludeEnd("ctx");
  5264. },
  5265. //>>excludeStart("ide", pragmas.excludeIdeData);
  5266. args: ["aStream"],
  5267. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  5268. referencedClasses: [],
  5269. //>>excludeEnd("ide");
  5270. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  5271. }),
  5272. $globals.String);
  5273. $core.addMethod(
  5274. $core.method({
  5275. selector: "asUppercase",
  5276. protocol: "converting",
  5277. fn: function (){
  5278. var self=this,$self=this;
  5279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5280. return $core.withContext(function($ctx1) {
  5281. //>>excludeEnd("ctx");
  5282. return self.toUpperCase();
  5283. return self;
  5284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5285. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  5286. //>>excludeEnd("ctx");
  5287. },
  5288. //>>excludeStart("ide", pragmas.excludeIdeData);
  5289. args: [],
  5290. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  5291. referencedClasses: [],
  5292. //>>excludeEnd("ide");
  5293. messageSends: []
  5294. }),
  5295. $globals.String);
  5296. $core.addMethod(
  5297. $core.method({
  5298. selector: "asciiValue",
  5299. protocol: "accessing",
  5300. fn: function (){
  5301. var self=this,$self=this;
  5302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5303. return $core.withContext(function($ctx1) {
  5304. //>>excludeEnd("ctx");
  5305. return self.charCodeAt(0);;
  5306. return self;
  5307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5308. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  5309. //>>excludeEnd("ctx");
  5310. },
  5311. //>>excludeStart("ide", pragmas.excludeIdeData);
  5312. args: [],
  5313. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  5314. referencedClasses: [],
  5315. //>>excludeEnd("ide");
  5316. messageSends: []
  5317. }),
  5318. $globals.String);
  5319. $core.addMethod(
  5320. $core.method({
  5321. selector: "at:ifAbsent:",
  5322. protocol: "accessing",
  5323. fn: function (anIndex,aBlock){
  5324. var self=this,$self=this;
  5325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5326. return $core.withContext(function($ctx1) {
  5327. //>>excludeEnd("ctx");
  5328. return String(self)[anIndex - 1] || aBlock._value();
  5329. return self;
  5330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5331. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  5332. //>>excludeEnd("ctx");
  5333. },
  5334. //>>excludeStart("ide", pragmas.excludeIdeData);
  5335. args: ["anIndex", "aBlock"],
  5336. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  5337. referencedClasses: [],
  5338. //>>excludeEnd("ide");
  5339. messageSends: []
  5340. }),
  5341. $globals.String);
  5342. $core.addMethod(
  5343. $core.method({
  5344. selector: "at:ifPresent:ifAbsent:",
  5345. protocol: "accessing",
  5346. fn: function (anIndex,aBlock,anotherBlock){
  5347. var self=this,$self=this;
  5348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5349. return $core.withContext(function($ctx1) {
  5350. //>>excludeEnd("ctx");
  5351. var result = String(self)[anIndex - 1];
  5352. return result ? aBlock._value_(result) : anotherBlock._value();
  5353. ;
  5354. return self;
  5355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5356. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  5357. //>>excludeEnd("ctx");
  5358. },
  5359. //>>excludeStart("ide", pragmas.excludeIdeData);
  5360. args: ["anIndex", "aBlock", "anotherBlock"],
  5361. 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'>",
  5362. referencedClasses: [],
  5363. //>>excludeEnd("ide");
  5364. messageSends: []
  5365. }),
  5366. $globals.String);
  5367. $core.addMethod(
  5368. $core.method({
  5369. selector: "at:put:",
  5370. protocol: "accessing",
  5371. fn: function (anIndex,anObject){
  5372. var self=this,$self=this;
  5373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5374. return $core.withContext(function($ctx1) {
  5375. //>>excludeEnd("ctx");
  5376. $self._errorReadOnly();
  5377. return self;
  5378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5379. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.String)});
  5380. //>>excludeEnd("ctx");
  5381. },
  5382. //>>excludeStart("ide", pragmas.excludeIdeData);
  5383. args: ["anIndex", "anObject"],
  5384. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5385. referencedClasses: [],
  5386. //>>excludeEnd("ide");
  5387. messageSends: ["errorReadOnly"]
  5388. }),
  5389. $globals.String);
  5390. $core.addMethod(
  5391. $core.method({
  5392. selector: "capitalized",
  5393. protocol: "converting",
  5394. fn: function (){
  5395. var self=this,$self=this;
  5396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5397. return $core.withContext(function($ctx1) {
  5398. //>>excludeEnd("ctx");
  5399. return $self._ifNotEmpty_((function(){
  5400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5401. return $core.withContext(function($ctx2) {
  5402. //>>excludeEnd("ctx");
  5403. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  5404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5405. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5406. //>>excludeEnd("ctx");
  5407. }));
  5408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5409. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  5410. //>>excludeEnd("ctx");
  5411. },
  5412. //>>excludeStart("ide", pragmas.excludeIdeData);
  5413. args: [],
  5414. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  5415. referencedClasses: [],
  5416. //>>excludeEnd("ide");
  5417. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  5418. }),
  5419. $globals.String);
  5420. $core.addMethod(
  5421. $core.method({
  5422. selector: "charCodeAt:",
  5423. protocol: "accessing",
  5424. fn: function (anInteger){
  5425. var self=this,$self=this;
  5426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5427. return $core.withContext(function($ctx1) {
  5428. //>>excludeEnd("ctx");
  5429. return self.charCodeAt(anInteger - 1);
  5430. return self;
  5431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5432. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  5433. //>>excludeEnd("ctx");
  5434. },
  5435. //>>excludeStart("ide", pragmas.excludeIdeData);
  5436. args: ["anInteger"],
  5437. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  5438. referencedClasses: [],
  5439. //>>excludeEnd("ide");
  5440. messageSends: []
  5441. }),
  5442. $globals.String);
  5443. $core.addMethod(
  5444. $core.method({
  5445. selector: "copyFrom:to:",
  5446. protocol: "copying",
  5447. fn: function (anIndex,anotherIndex){
  5448. var self=this,$self=this;
  5449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5450. return $core.withContext(function($ctx1) {
  5451. //>>excludeEnd("ctx");
  5452. return self.substring(anIndex - 1, anotherIndex);
  5453. return self;
  5454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5455. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  5456. //>>excludeEnd("ctx");
  5457. },
  5458. //>>excludeStart("ide", pragmas.excludeIdeData);
  5459. args: ["anIndex", "anotherIndex"],
  5460. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  5461. referencedClasses: [],
  5462. //>>excludeEnd("ide");
  5463. messageSends: []
  5464. }),
  5465. $globals.String);
  5466. $core.addMethod(
  5467. $core.method({
  5468. selector: "crlfSanitized",
  5469. protocol: "converting",
  5470. fn: function (){
  5471. var self=this,$self=this;
  5472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5473. return $core.withContext(function($ctx1) {
  5474. //>>excludeEnd("ctx");
  5475. return $recv($self._lines())._join_($recv($globals.String)._lf());
  5476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5477. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  5478. //>>excludeEnd("ctx");
  5479. },
  5480. //>>excludeStart("ide", pragmas.excludeIdeData);
  5481. args: [],
  5482. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  5483. referencedClasses: ["String"],
  5484. //>>excludeEnd("ide");
  5485. messageSends: ["join:", "lines", "lf"]
  5486. }),
  5487. $globals.String);
  5488. $core.addMethod(
  5489. $core.method({
  5490. selector: "deepCopy",
  5491. protocol: "copying",
  5492. fn: function (){
  5493. var self=this,$self=this;
  5494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5495. return $core.withContext(function($ctx1) {
  5496. //>>excludeEnd("ctx");
  5497. return $self._shallowCopy();
  5498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5499. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  5500. //>>excludeEnd("ctx");
  5501. },
  5502. //>>excludeStart("ide", pragmas.excludeIdeData);
  5503. args: [],
  5504. source: "deepCopy\x0a\x09^ self shallowCopy",
  5505. referencedClasses: [],
  5506. //>>excludeEnd("ide");
  5507. messageSends: ["shallowCopy"]
  5508. }),
  5509. $globals.String);
  5510. $core.addMethod(
  5511. $core.method({
  5512. selector: "errorReadOnly",
  5513. protocol: "error handling",
  5514. fn: function (){
  5515. var self=this,$self=this;
  5516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5517. return $core.withContext(function($ctx1) {
  5518. //>>excludeEnd("ctx");
  5519. $self._error_("Object is read-only");
  5520. return self;
  5521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5522. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.String)});
  5523. //>>excludeEnd("ctx");
  5524. },
  5525. //>>excludeStart("ide", pragmas.excludeIdeData);
  5526. args: [],
  5527. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5528. referencedClasses: [],
  5529. //>>excludeEnd("ide");
  5530. messageSends: ["error:"]
  5531. }),
  5532. $globals.String);
  5533. $core.addMethod(
  5534. $core.method({
  5535. selector: "escaped",
  5536. protocol: "converting",
  5537. fn: function (){
  5538. var self=this,$self=this;
  5539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5540. return $core.withContext(function($ctx1) {
  5541. //>>excludeEnd("ctx");
  5542. return escape(self);
  5543. return self;
  5544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5545. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  5546. //>>excludeEnd("ctx");
  5547. },
  5548. //>>excludeStart("ide", pragmas.excludeIdeData);
  5549. args: [],
  5550. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  5551. referencedClasses: [],
  5552. //>>excludeEnd("ide");
  5553. messageSends: []
  5554. }),
  5555. $globals.String);
  5556. $core.addMethod(
  5557. $core.method({
  5558. selector: "includesSubString:",
  5559. protocol: "testing",
  5560. fn: function (subString){
  5561. var self=this,$self=this;
  5562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5563. return $core.withContext(function($ctx1) {
  5564. //>>excludeEnd("ctx");
  5565. return self.indexOf(subString) != -1;
  5566. return self;
  5567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5568. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  5569. //>>excludeEnd("ctx");
  5570. },
  5571. //>>excludeStart("ide", pragmas.excludeIdeData);
  5572. args: ["subString"],
  5573. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  5574. referencedClasses: [],
  5575. //>>excludeEnd("ide");
  5576. messageSends: []
  5577. }),
  5578. $globals.String);
  5579. $core.addMethod(
  5580. $core.method({
  5581. selector: "isCapitalized",
  5582. protocol: "testing",
  5583. fn: function (){
  5584. var self=this,$self=this;
  5585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5586. return $core.withContext(function($ctx1) {
  5587. //>>excludeEnd("ctx");
  5588. var $2,$1;
  5589. $2=$self._first();
  5590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5591. $ctx1.sendIdx["first"]=1;
  5592. //>>excludeEnd("ctx");
  5593. $1=$recv($2)._asUppercase();
  5594. return $recv($1).__eq_eq($self._first());
  5595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5596. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  5597. //>>excludeEnd("ctx");
  5598. },
  5599. //>>excludeStart("ide", pragmas.excludeIdeData);
  5600. args: [],
  5601. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  5602. referencedClasses: [],
  5603. //>>excludeEnd("ide");
  5604. messageSends: ["==", "asUppercase", "first"]
  5605. }),
  5606. $globals.String);
  5607. $core.addMethod(
  5608. $core.method({
  5609. selector: "isImmutable",
  5610. protocol: "testing",
  5611. fn: function (){
  5612. var self=this,$self=this;
  5613. return true;
  5614. },
  5615. //>>excludeStart("ide", pragmas.excludeIdeData);
  5616. args: [],
  5617. source: "isImmutable\x0a\x09^ true",
  5618. referencedClasses: [],
  5619. //>>excludeEnd("ide");
  5620. messageSends: []
  5621. }),
  5622. $globals.String);
  5623. $core.addMethod(
  5624. $core.method({
  5625. selector: "isSelector",
  5626. protocol: "testing",
  5627. fn: function (){
  5628. var self=this,$self=this;
  5629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5630. return $core.withContext(function($ctx1) {
  5631. //>>excludeEnd("ctx");
  5632. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  5633. return self;
  5634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5635. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  5636. //>>excludeEnd("ctx");
  5637. },
  5638. //>>excludeStart("ide", pragmas.excludeIdeData);
  5639. args: [],
  5640. 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>",
  5641. referencedClasses: [],
  5642. //>>excludeEnd("ide");
  5643. messageSends: []
  5644. }),
  5645. $globals.String);
  5646. $core.addMethod(
  5647. $core.method({
  5648. selector: "isString",
  5649. protocol: "testing",
  5650. fn: function (){
  5651. var self=this,$self=this;
  5652. return true;
  5653. },
  5654. //>>excludeStart("ide", pragmas.excludeIdeData);
  5655. args: [],
  5656. source: "isString\x0a\x09^ true",
  5657. referencedClasses: [],
  5658. //>>excludeEnd("ide");
  5659. messageSends: []
  5660. }),
  5661. $globals.String);
  5662. $core.addMethod(
  5663. $core.method({
  5664. selector: "isVowel",
  5665. protocol: "testing",
  5666. fn: function (){
  5667. var self=this,$self=this;
  5668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5669. return $core.withContext(function($ctx1) {
  5670. //>>excludeEnd("ctx");
  5671. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  5672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5673. return $core.withContext(function($ctx2) {
  5674. //>>excludeEnd("ctx");
  5675. return "aeiou"._includes_($self._asLowercase());
  5676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5677. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5678. //>>excludeEnd("ctx");
  5679. }));
  5680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5681. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  5682. //>>excludeEnd("ctx");
  5683. },
  5684. //>>excludeStart("ide", pragmas.excludeIdeData);
  5685. args: [],
  5686. 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 ]",
  5687. referencedClasses: [],
  5688. //>>excludeEnd("ide");
  5689. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  5690. }),
  5691. $globals.String);
  5692. $core.addMethod(
  5693. $core.method({
  5694. selector: "join:",
  5695. protocol: "split join",
  5696. fn: function (aCollection){
  5697. var self=this,$self=this;
  5698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5699. return $core.withContext(function($ctx1) {
  5700. //>>excludeEnd("ctx");
  5701. return $recv($globals.String)._streamContents_((function(stream){
  5702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5703. return $core.withContext(function($ctx2) {
  5704. //>>excludeEnd("ctx");
  5705. return $recv(aCollection)._do_separatedBy_((function(each){
  5706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5707. return $core.withContext(function($ctx3) {
  5708. //>>excludeEnd("ctx");
  5709. return $recv(stream)._nextPutAll_($recv(each)._asString());
  5710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5711. $ctx3.sendIdx["nextPutAll:"]=1;
  5712. //>>excludeEnd("ctx");
  5713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5714. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  5715. //>>excludeEnd("ctx");
  5716. }),(function(){
  5717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5718. return $core.withContext(function($ctx3) {
  5719. //>>excludeEnd("ctx");
  5720. return $recv(stream)._nextPutAll_(self);
  5721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5722. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5723. //>>excludeEnd("ctx");
  5724. }));
  5725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5726. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  5727. //>>excludeEnd("ctx");
  5728. }));
  5729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5730. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  5731. //>>excludeEnd("ctx");
  5732. },
  5733. //>>excludeStart("ide", pragmas.excludeIdeData);
  5734. args: ["aCollection"],
  5735. 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 ]]",
  5736. referencedClasses: ["String"],
  5737. //>>excludeEnd("ide");
  5738. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  5739. }),
  5740. $globals.String);
  5741. $core.addMethod(
  5742. $core.method({
  5743. selector: "lineIndicesDo:",
  5744. protocol: "split join",
  5745. fn: function (aBlock){
  5746. var self=this,$self=this;
  5747. var cr,lf,start,sz,nextLF,nextCR;
  5748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5749. return $core.withContext(function($ctx1) {
  5750. //>>excludeEnd("ctx");
  5751. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  5752. var $early={};
  5753. try {
  5754. start=(1);
  5755. sz=$self._size();
  5756. cr=$recv($globals.String)._cr();
  5757. nextCR=$self._indexOf_startingAt_(cr,(1));
  5758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5759. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  5760. //>>excludeEnd("ctx");
  5761. lf=$recv($globals.String)._lf();
  5762. nextLF=$self._indexOf_startingAt_(lf,(1));
  5763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5764. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  5765. //>>excludeEnd("ctx");
  5766. $recv((function(){
  5767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5768. return $core.withContext(function($ctx2) {
  5769. //>>excludeEnd("ctx");
  5770. return $recv(start).__lt_eq(sz);
  5771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5772. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5773. //>>excludeEnd("ctx");
  5774. }))._whileTrue_((function(){
  5775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5776. return $core.withContext(function($ctx2) {
  5777. //>>excludeEnd("ctx");
  5778. $2=$recv(nextLF).__eq((0));
  5779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5780. $ctx2.sendIdx["="]=1;
  5781. //>>excludeEnd("ctx");
  5782. $1=$recv($2)._and_((function(){
  5783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5784. return $core.withContext(function($ctx3) {
  5785. //>>excludeEnd("ctx");
  5786. return $recv(nextCR).__eq((0));
  5787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5788. $ctx3.sendIdx["="]=2;
  5789. //>>excludeEnd("ctx");
  5790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5791. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5792. //>>excludeEnd("ctx");
  5793. }));
  5794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5795. $ctx2.sendIdx["and:"]=1;
  5796. //>>excludeEnd("ctx");
  5797. if($core.assert($1)){
  5798. $recv(aBlock)._value_value_value_(start,sz,sz);
  5799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5800. $ctx2.sendIdx["value:value:value:"]=1;
  5801. //>>excludeEnd("ctx");
  5802. throw $early=[self];
  5803. }
  5804. $4=$recv(nextCR).__eq((0));
  5805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5806. $ctx2.sendIdx["="]=3;
  5807. //>>excludeEnd("ctx");
  5808. $3=$recv($4)._or_((function(){
  5809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5810. return $core.withContext(function($ctx3) {
  5811. //>>excludeEnd("ctx");
  5812. $5=(0).__lt(nextLF);
  5813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5814. $ctx3.sendIdx["<"]=1;
  5815. //>>excludeEnd("ctx");
  5816. return $recv($5)._and_((function(){
  5817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5818. return $core.withContext(function($ctx4) {
  5819. //>>excludeEnd("ctx");
  5820. return $recv(nextLF).__lt(nextCR);
  5821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5822. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  5823. //>>excludeEnd("ctx");
  5824. }));
  5825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5826. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  5827. //>>excludeEnd("ctx");
  5828. }));
  5829. if($core.assert($3)){
  5830. $6=start;
  5831. $7=$recv(nextLF).__minus((1));
  5832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5833. $ctx2.sendIdx["-"]=1;
  5834. //>>excludeEnd("ctx");
  5835. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  5836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5837. $ctx2.sendIdx["value:value:value:"]=2;
  5838. //>>excludeEnd("ctx");
  5839. start=(1).__plus(nextLF);
  5840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5841. $ctx2.sendIdx["+"]=1;
  5842. //>>excludeEnd("ctx");
  5843. nextLF=$self._indexOf_startingAt_(lf,start);
  5844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5845. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  5846. //>>excludeEnd("ctx");
  5847. return nextLF;
  5848. } else {
  5849. $9=(1).__plus(nextCR);
  5850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5851. $ctx2.sendIdx["+"]=2;
  5852. //>>excludeEnd("ctx");
  5853. $8=$recv($9).__eq(nextLF);
  5854. if($core.assert($8)){
  5855. $10=start;
  5856. $11=$recv(nextCR).__minus((1));
  5857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5858. $ctx2.sendIdx["-"]=2;
  5859. //>>excludeEnd("ctx");
  5860. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  5861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5862. $ctx2.sendIdx["value:value:value:"]=3;
  5863. //>>excludeEnd("ctx");
  5864. start=(1).__plus(nextLF);
  5865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5866. $ctx2.sendIdx["+"]=3;
  5867. //>>excludeEnd("ctx");
  5868. nextCR=$self._indexOf_startingAt_(cr,start);
  5869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5870. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  5871. //>>excludeEnd("ctx");
  5872. nextLF=$self._indexOf_startingAt_(lf,start);
  5873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5874. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  5875. //>>excludeEnd("ctx");
  5876. return nextLF;
  5877. } else {
  5878. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  5879. start=(1).__plus(nextCR);
  5880. nextCR=$self._indexOf_startingAt_(cr,start);
  5881. return nextCR;
  5882. }
  5883. }
  5884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5886. //>>excludeEnd("ctx");
  5887. }));
  5888. return self;
  5889. }
  5890. catch(e) {if(e===$early)return e[0]; throw e}
  5891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5892. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  5893. //>>excludeEnd("ctx");
  5894. },
  5895. //>>excludeStart("ide", pragmas.excludeIdeData);
  5896. args: ["aBlock"],
  5897. 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 ] ]]",
  5898. referencedClasses: ["String"],
  5899. //>>excludeEnd("ide");
  5900. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  5901. }),
  5902. $globals.String);
  5903. $core.addMethod(
  5904. $core.method({
  5905. selector: "lineNumber:",
  5906. protocol: "split join",
  5907. fn: function (anIndex){
  5908. var self=this,$self=this;
  5909. var lineCount;
  5910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5911. return $core.withContext(function($ctx1) {
  5912. //>>excludeEnd("ctx");
  5913. var $2,$1;
  5914. var $early={};
  5915. try {
  5916. lineCount=(0);
  5917. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  5918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5919. return $core.withContext(function($ctx2) {
  5920. //>>excludeEnd("ctx");
  5921. lineCount=$recv(lineCount).__plus((1));
  5922. $2=lineCount;
  5923. $1=$recv($2).__eq(anIndex);
  5924. if($core.assert($1)){
  5925. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  5926. }
  5927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5928. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  5929. //>>excludeEnd("ctx");
  5930. }));
  5931. return nil;
  5932. }
  5933. catch(e) {if(e===$early)return e[0]; throw e}
  5934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5935. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  5936. //>>excludeEnd("ctx");
  5937. },
  5938. //>>excludeStart("ide", pragmas.excludeIdeData);
  5939. args: ["anIndex"],
  5940. 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",
  5941. referencedClasses: [],
  5942. //>>excludeEnd("ide");
  5943. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  5944. }),
  5945. $globals.String);
  5946. $core.addMethod(
  5947. $core.method({
  5948. selector: "lines",
  5949. protocol: "split join",
  5950. fn: function (){
  5951. var self=this,$self=this;
  5952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5953. return $core.withContext(function($ctx1) {
  5954. //>>excludeEnd("ctx");
  5955. var result = self.split(/\r\n|\r|\n/);
  5956. if (!result[result.length-1]) result.pop();
  5957. return result;;
  5958. return self;
  5959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5960. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  5961. //>>excludeEnd("ctx");
  5962. },
  5963. //>>excludeStart("ide", pragmas.excludeIdeData);
  5964. args: [],
  5965. 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'>",
  5966. referencedClasses: [],
  5967. //>>excludeEnd("ide");
  5968. messageSends: []
  5969. }),
  5970. $globals.String);
  5971. $core.addMethod(
  5972. $core.method({
  5973. selector: "linesDo:",
  5974. protocol: "split join",
  5975. fn: function (aBlock){
  5976. var self=this,$self=this;
  5977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5978. return $core.withContext(function($ctx1) {
  5979. //>>excludeEnd("ctx");
  5980. $recv($self._lines())._do_(aBlock);
  5981. return self;
  5982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5983. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  5984. //>>excludeEnd("ctx");
  5985. },
  5986. //>>excludeStart("ide", pragmas.excludeIdeData);
  5987. args: ["aBlock"],
  5988. 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",
  5989. referencedClasses: [],
  5990. //>>excludeEnd("ide");
  5991. messageSends: ["do:", "lines"]
  5992. }),
  5993. $globals.String);
  5994. $core.addMethod(
  5995. $core.method({
  5996. selector: "match:",
  5997. protocol: "regular expressions",
  5998. fn: function (aRegexp){
  5999. var self=this,$self=this;
  6000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6001. return $core.withContext(function($ctx1) {
  6002. //>>excludeEnd("ctx");
  6003. return self.search(aRegexp) != -1;
  6004. return self;
  6005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6006. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  6007. //>>excludeEnd("ctx");
  6008. },
  6009. //>>excludeStart("ide", pragmas.excludeIdeData);
  6010. args: ["aRegexp"],
  6011. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  6012. referencedClasses: [],
  6013. //>>excludeEnd("ide");
  6014. messageSends: []
  6015. }),
  6016. $globals.String);
  6017. $core.addMethod(
  6018. $core.method({
  6019. selector: "matchesOf:",
  6020. protocol: "regular expressions",
  6021. fn: function (aRegularExpression){
  6022. var self=this,$self=this;
  6023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6024. return $core.withContext(function($ctx1) {
  6025. //>>excludeEnd("ctx");
  6026. return self.match(aRegularExpression);
  6027. return self;
  6028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6029. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  6030. //>>excludeEnd("ctx");
  6031. },
  6032. //>>excludeStart("ide", pragmas.excludeIdeData);
  6033. args: ["aRegularExpression"],
  6034. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  6035. referencedClasses: [],
  6036. //>>excludeEnd("ide");
  6037. messageSends: []
  6038. }),
  6039. $globals.String);
  6040. $core.addMethod(
  6041. $core.method({
  6042. selector: "printNl",
  6043. protocol: "printing",
  6044. fn: function (){
  6045. var self=this,$self=this;
  6046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6047. return $core.withContext(function($ctx1) {
  6048. //>>excludeEnd("ctx");
  6049. console.log(self);
  6050. return self;
  6051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6052. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  6053. //>>excludeEnd("ctx");
  6054. },
  6055. //>>excludeStart("ide", pragmas.excludeIdeData);
  6056. args: [],
  6057. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  6058. referencedClasses: [],
  6059. //>>excludeEnd("ide");
  6060. messageSends: []
  6061. }),
  6062. $globals.String);
  6063. $core.addMethod(
  6064. $core.method({
  6065. selector: "printOn:",
  6066. protocol: "printing",
  6067. fn: function (aStream){
  6068. var self=this,$self=this;
  6069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6070. return $core.withContext(function($ctx1) {
  6071. //>>excludeEnd("ctx");
  6072. $recv(aStream)._nextPutAll_("'");
  6073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6074. $ctx1.sendIdx["nextPutAll:"]=1;
  6075. //>>excludeEnd("ctx");
  6076. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  6077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6078. $ctx1.sendIdx["nextPutAll:"]=2;
  6079. //>>excludeEnd("ctx");
  6080. $recv(aStream)._nextPutAll_("'");
  6081. return self;
  6082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6083. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  6084. //>>excludeEnd("ctx");
  6085. },
  6086. //>>excludeStart("ide", pragmas.excludeIdeData);
  6087. args: ["aStream"],
  6088. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  6089. referencedClasses: [],
  6090. //>>excludeEnd("ide");
  6091. messageSends: ["nextPutAll:", "replace:with:"]
  6092. }),
  6093. $globals.String);
  6094. $core.addMethod(
  6095. $core.method({
  6096. selector: "putOn:",
  6097. protocol: "streaming",
  6098. fn: function (aStream){
  6099. var self=this,$self=this;
  6100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6101. return $core.withContext(function($ctx1) {
  6102. //>>excludeEnd("ctx");
  6103. $recv(aStream)._nextPutString_(self);
  6104. return self;
  6105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6106. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.String)});
  6107. //>>excludeEnd("ctx");
  6108. },
  6109. //>>excludeStart("ide", pragmas.excludeIdeData);
  6110. args: ["aStream"],
  6111. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  6112. referencedClasses: [],
  6113. //>>excludeEnd("ide");
  6114. messageSends: ["nextPutString:"]
  6115. }),
  6116. $globals.String);
  6117. $core.addMethod(
  6118. $core.method({
  6119. selector: "remove:",
  6120. protocol: "adding/removing",
  6121. fn: function (anObject){
  6122. var self=this,$self=this;
  6123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6124. return $core.withContext(function($ctx1) {
  6125. //>>excludeEnd("ctx");
  6126. $self._errorReadOnly();
  6127. return self;
  6128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6129. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.String)});
  6130. //>>excludeEnd("ctx");
  6131. },
  6132. //>>excludeStart("ide", pragmas.excludeIdeData);
  6133. args: ["anObject"],
  6134. source: "remove: anObject\x0a\x09self errorReadOnly",
  6135. referencedClasses: [],
  6136. //>>excludeEnd("ide");
  6137. messageSends: ["errorReadOnly"]
  6138. }),
  6139. $globals.String);
  6140. $core.addMethod(
  6141. $core.method({
  6142. selector: "remove:ifAbsent:",
  6143. protocol: "adding/removing",
  6144. fn: function (anObject,aBlock){
  6145. var self=this,$self=this;
  6146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6147. return $core.withContext(function($ctx1) {
  6148. //>>excludeEnd("ctx");
  6149. $self._errorReadOnly();
  6150. return self;
  6151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6152. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.String)});
  6153. //>>excludeEnd("ctx");
  6154. },
  6155. //>>excludeStart("ide", pragmas.excludeIdeData);
  6156. args: ["anObject", "aBlock"],
  6157. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  6158. referencedClasses: [],
  6159. //>>excludeEnd("ide");
  6160. messageSends: ["errorReadOnly"]
  6161. }),
  6162. $globals.String);
  6163. $core.addMethod(
  6164. $core.method({
  6165. selector: "replace:with:",
  6166. protocol: "regular expressions",
  6167. fn: function (aString,anotherString){
  6168. var self=this,$self=this;
  6169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6170. return $core.withContext(function($ctx1) {
  6171. //>>excludeEnd("ctx");
  6172. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6174. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  6175. //>>excludeEnd("ctx");
  6176. },
  6177. //>>excludeStart("ide", pragmas.excludeIdeData);
  6178. args: ["aString", "anotherString"],
  6179. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6180. referencedClasses: ["RegularExpression"],
  6181. //>>excludeEnd("ide");
  6182. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6183. }),
  6184. $globals.String);
  6185. $core.addMethod(
  6186. $core.method({
  6187. selector: "replaceRegexp:with:",
  6188. protocol: "regular expressions",
  6189. fn: function (aRegexp,aString){
  6190. var self=this,$self=this;
  6191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6192. return $core.withContext(function($ctx1) {
  6193. //>>excludeEnd("ctx");
  6194. return self.replace(aRegexp, aString);
  6195. return self;
  6196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6197. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  6198. //>>excludeEnd("ctx");
  6199. },
  6200. //>>excludeStart("ide", pragmas.excludeIdeData);
  6201. args: ["aRegexp", "aString"],
  6202. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  6203. referencedClasses: [],
  6204. //>>excludeEnd("ide");
  6205. messageSends: []
  6206. }),
  6207. $globals.String);
  6208. $core.addMethod(
  6209. $core.method({
  6210. selector: "reversed",
  6211. protocol: "converting",
  6212. fn: function (){
  6213. var self=this,$self=this;
  6214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6215. return $core.withContext(function($ctx1) {
  6216. //>>excludeEnd("ctx");
  6217. return self.split("").reverse().join("");
  6218. return self;
  6219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6220. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  6221. //>>excludeEnd("ctx");
  6222. },
  6223. //>>excludeStart("ide", pragmas.excludeIdeData);
  6224. args: [],
  6225. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  6226. referencedClasses: [],
  6227. //>>excludeEnd("ide");
  6228. messageSends: []
  6229. }),
  6230. $globals.String);
  6231. $core.addMethod(
  6232. $core.method({
  6233. selector: "shallowCopy",
  6234. protocol: "copying",
  6235. fn: function (){
  6236. var self=this,$self=this;
  6237. return self;
  6238. },
  6239. //>>excludeStart("ide", pragmas.excludeIdeData);
  6240. args: [],
  6241. source: "shallowCopy\x0a\x09^ self",
  6242. referencedClasses: [],
  6243. //>>excludeEnd("ide");
  6244. messageSends: []
  6245. }),
  6246. $globals.String);
  6247. $core.addMethod(
  6248. $core.method({
  6249. selector: "subStrings:",
  6250. protocol: "split join",
  6251. fn: function (aString){
  6252. var self=this,$self=this;
  6253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6254. return $core.withContext(function($ctx1) {
  6255. //>>excludeEnd("ctx");
  6256. return $self._tokenize_(aString);
  6257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6258. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  6259. //>>excludeEnd("ctx");
  6260. },
  6261. //>>excludeStart("ide", pragmas.excludeIdeData);
  6262. args: ["aString"],
  6263. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6264. referencedClasses: [],
  6265. //>>excludeEnd("ide");
  6266. messageSends: ["tokenize:"]
  6267. }),
  6268. $globals.String);
  6269. $core.addMethod(
  6270. $core.method({
  6271. selector: "symbolPrintString",
  6272. protocol: "printing",
  6273. fn: function (){
  6274. var self=this,$self=this;
  6275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6276. return $core.withContext(function($ctx1) {
  6277. //>>excludeEnd("ctx");
  6278. return $recv($globals.String)._streamContents_((function(str){
  6279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6280. return $core.withContext(function($ctx2) {
  6281. //>>excludeEnd("ctx");
  6282. return $self._asSymbolPrintOn_(str);
  6283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6284. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  6285. //>>excludeEnd("ctx");
  6286. }));
  6287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6288. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.String)});
  6289. //>>excludeEnd("ctx");
  6290. },
  6291. //>>excludeStart("ide", pragmas.excludeIdeData);
  6292. args: [],
  6293. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  6294. referencedClasses: ["String"],
  6295. //>>excludeEnd("ide");
  6296. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  6297. }),
  6298. $globals.String);
  6299. $core.addMethod(
  6300. $core.method({
  6301. selector: "tokenize:",
  6302. protocol: "split join",
  6303. fn: function (aString){
  6304. var self=this,$self=this;
  6305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6306. return $core.withContext(function($ctx1) {
  6307. //>>excludeEnd("ctx");
  6308. return self.split(aString);
  6309. return self;
  6310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6311. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  6312. //>>excludeEnd("ctx");
  6313. },
  6314. //>>excludeStart("ide", pragmas.excludeIdeData);
  6315. args: ["aString"],
  6316. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  6317. referencedClasses: [],
  6318. //>>excludeEnd("ide");
  6319. messageSends: []
  6320. }),
  6321. $globals.String);
  6322. $core.addMethod(
  6323. $core.method({
  6324. selector: "trimBoth",
  6325. protocol: "regular expressions",
  6326. fn: function (){
  6327. var self=this,$self=this;
  6328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6329. return $core.withContext(function($ctx1) {
  6330. //>>excludeEnd("ctx");
  6331. return $self._trimBoth_("\x5cs");
  6332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6333. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  6334. //>>excludeEnd("ctx");
  6335. },
  6336. //>>excludeStart("ide", pragmas.excludeIdeData);
  6337. args: [],
  6338. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  6339. referencedClasses: [],
  6340. //>>excludeEnd("ide");
  6341. messageSends: ["trimBoth:"]
  6342. }),
  6343. $globals.String);
  6344. $core.addMethod(
  6345. $core.method({
  6346. selector: "trimBoth:",
  6347. protocol: "regular expressions",
  6348. fn: function (separators){
  6349. var self=this,$self=this;
  6350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6351. return $core.withContext(function($ctx1) {
  6352. //>>excludeEnd("ctx");
  6353. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  6354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6355. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  6356. //>>excludeEnd("ctx");
  6357. },
  6358. //>>excludeStart("ide", pragmas.excludeIdeData);
  6359. args: ["separators"],
  6360. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  6361. referencedClasses: [],
  6362. //>>excludeEnd("ide");
  6363. messageSends: ["trimRight:", "trimLeft:"]
  6364. }),
  6365. $globals.String);
  6366. $core.addMethod(
  6367. $core.method({
  6368. selector: "trimLeft",
  6369. protocol: "regular expressions",
  6370. fn: function (){
  6371. var self=this,$self=this;
  6372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6373. return $core.withContext(function($ctx1) {
  6374. //>>excludeEnd("ctx");
  6375. return $self._trimLeft_("\x5cs");
  6376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6377. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  6378. //>>excludeEnd("ctx");
  6379. },
  6380. //>>excludeStart("ide", pragmas.excludeIdeData);
  6381. args: [],
  6382. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  6383. referencedClasses: [],
  6384. //>>excludeEnd("ide");
  6385. messageSends: ["trimLeft:"]
  6386. }),
  6387. $globals.String);
  6388. $core.addMethod(
  6389. $core.method({
  6390. selector: "trimLeft:",
  6391. protocol: "regular expressions",
  6392. fn: function (separators){
  6393. var self=this,$self=this;
  6394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6395. return $core.withContext(function($ctx1) {
  6396. //>>excludeEnd("ctx");
  6397. var $2,$1;
  6398. $2=$recv("^[".__comma(separators)).__comma("]+");
  6399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6400. $ctx1.sendIdx[","]=1;
  6401. //>>excludeEnd("ctx");
  6402. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6403. return $self._replaceRegexp_with_($1,"");
  6404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6405. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  6406. //>>excludeEnd("ctx");
  6407. },
  6408. //>>excludeStart("ide", pragmas.excludeIdeData);
  6409. args: ["separators"],
  6410. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  6411. referencedClasses: ["RegularExpression"],
  6412. //>>excludeEnd("ide");
  6413. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6414. }),
  6415. $globals.String);
  6416. $core.addMethod(
  6417. $core.method({
  6418. selector: "trimRight",
  6419. protocol: "regular expressions",
  6420. fn: function (){
  6421. var self=this,$self=this;
  6422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6423. return $core.withContext(function($ctx1) {
  6424. //>>excludeEnd("ctx");
  6425. return $self._trimRight_("\x5cs");
  6426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6427. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  6428. //>>excludeEnd("ctx");
  6429. },
  6430. //>>excludeStart("ide", pragmas.excludeIdeData);
  6431. args: [],
  6432. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  6433. referencedClasses: [],
  6434. //>>excludeEnd("ide");
  6435. messageSends: ["trimRight:"]
  6436. }),
  6437. $globals.String);
  6438. $core.addMethod(
  6439. $core.method({
  6440. selector: "trimRight:",
  6441. protocol: "regular expressions",
  6442. fn: function (separators){
  6443. var self=this,$self=this;
  6444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6445. return $core.withContext(function($ctx1) {
  6446. //>>excludeEnd("ctx");
  6447. var $2,$1;
  6448. $2=$recv("[".__comma(separators)).__comma("]+$");
  6449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6450. $ctx1.sendIdx[","]=1;
  6451. //>>excludeEnd("ctx");
  6452. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6453. return $self._replaceRegexp_with_($1,"");
  6454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6455. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  6456. //>>excludeEnd("ctx");
  6457. },
  6458. //>>excludeStart("ide", pragmas.excludeIdeData);
  6459. args: ["separators"],
  6460. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  6461. referencedClasses: ["RegularExpression"],
  6462. //>>excludeEnd("ide");
  6463. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6464. }),
  6465. $globals.String);
  6466. $core.addMethod(
  6467. $core.method({
  6468. selector: "unescaped",
  6469. protocol: "converting",
  6470. fn: function (){
  6471. var self=this,$self=this;
  6472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6473. return $core.withContext(function($ctx1) {
  6474. //>>excludeEnd("ctx");
  6475. return unescape(self);
  6476. return self;
  6477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6478. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  6479. //>>excludeEnd("ctx");
  6480. },
  6481. //>>excludeStart("ide", pragmas.excludeIdeData);
  6482. args: [],
  6483. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  6484. referencedClasses: [],
  6485. //>>excludeEnd("ide");
  6486. messageSends: []
  6487. }),
  6488. $globals.String);
  6489. $core.addMethod(
  6490. $core.method({
  6491. selector: "uriComponentDecoded",
  6492. protocol: "converting",
  6493. fn: function (){
  6494. var self=this,$self=this;
  6495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6496. return $core.withContext(function($ctx1) {
  6497. //>>excludeEnd("ctx");
  6498. return decodeURIComponent(self);
  6499. return self;
  6500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6501. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  6502. //>>excludeEnd("ctx");
  6503. },
  6504. //>>excludeStart("ide", pragmas.excludeIdeData);
  6505. args: [],
  6506. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  6507. referencedClasses: [],
  6508. //>>excludeEnd("ide");
  6509. messageSends: []
  6510. }),
  6511. $globals.String);
  6512. $core.addMethod(
  6513. $core.method({
  6514. selector: "uriComponentEncoded",
  6515. protocol: "converting",
  6516. fn: function (){
  6517. var self=this,$self=this;
  6518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6519. return $core.withContext(function($ctx1) {
  6520. //>>excludeEnd("ctx");
  6521. return encodeURIComponent(self);
  6522. return self;
  6523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6524. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  6525. //>>excludeEnd("ctx");
  6526. },
  6527. //>>excludeStart("ide", pragmas.excludeIdeData);
  6528. args: [],
  6529. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  6530. referencedClasses: [],
  6531. //>>excludeEnd("ide");
  6532. messageSends: []
  6533. }),
  6534. $globals.String);
  6535. $core.addMethod(
  6536. $core.method({
  6537. selector: "uriDecoded",
  6538. protocol: "converting",
  6539. fn: function (){
  6540. var self=this,$self=this;
  6541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6542. return $core.withContext(function($ctx1) {
  6543. //>>excludeEnd("ctx");
  6544. return decodeURI(self);
  6545. return self;
  6546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6547. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  6548. //>>excludeEnd("ctx");
  6549. },
  6550. //>>excludeStart("ide", pragmas.excludeIdeData);
  6551. args: [],
  6552. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  6553. referencedClasses: [],
  6554. //>>excludeEnd("ide");
  6555. messageSends: []
  6556. }),
  6557. $globals.String);
  6558. $core.addMethod(
  6559. $core.method({
  6560. selector: "uriEncoded",
  6561. protocol: "converting",
  6562. fn: function (){
  6563. var self=this,$self=this;
  6564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6565. return $core.withContext(function($ctx1) {
  6566. //>>excludeEnd("ctx");
  6567. return encodeURI(self);
  6568. return self;
  6569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6570. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  6571. //>>excludeEnd("ctx");
  6572. },
  6573. //>>excludeStart("ide", pragmas.excludeIdeData);
  6574. args: [],
  6575. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  6576. referencedClasses: [],
  6577. //>>excludeEnd("ide");
  6578. messageSends: []
  6579. }),
  6580. $globals.String);
  6581. $core.addMethod(
  6582. $core.method({
  6583. selector: "value:",
  6584. protocol: "evaluating",
  6585. fn: function (anObject){
  6586. var self=this,$self=this;
  6587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6588. return $core.withContext(function($ctx1) {
  6589. //>>excludeEnd("ctx");
  6590. return $recv(anObject)._perform_(self);
  6591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6592. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  6593. //>>excludeEnd("ctx");
  6594. },
  6595. //>>excludeStart("ide", pragmas.excludeIdeData);
  6596. args: ["anObject"],
  6597. source: "value: anObject \x0a\x09^ anObject perform: self",
  6598. referencedClasses: [],
  6599. //>>excludeEnd("ide");
  6600. messageSends: ["perform:"]
  6601. }),
  6602. $globals.String);
  6603. $core.addMethod(
  6604. $core.method({
  6605. selector: "cr",
  6606. protocol: "accessing",
  6607. fn: function (){
  6608. var self=this,$self=this;
  6609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6610. return $core.withContext(function($ctx1) {
  6611. //>>excludeEnd("ctx");
  6612. return "\r";
  6613. return self;
  6614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6615. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.a$cls)});
  6616. //>>excludeEnd("ctx");
  6617. },
  6618. //>>excludeStart("ide", pragmas.excludeIdeData);
  6619. args: [],
  6620. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  6621. referencedClasses: [],
  6622. //>>excludeEnd("ide");
  6623. messageSends: []
  6624. }),
  6625. $globals.String.a$cls);
  6626. $core.addMethod(
  6627. $core.method({
  6628. selector: "crlf",
  6629. protocol: "accessing",
  6630. fn: function (){
  6631. var self=this,$self=this;
  6632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6633. return $core.withContext(function($ctx1) {
  6634. //>>excludeEnd("ctx");
  6635. return "\r\n";
  6636. return self;
  6637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6638. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.a$cls)});
  6639. //>>excludeEnd("ctx");
  6640. },
  6641. //>>excludeStart("ide", pragmas.excludeIdeData);
  6642. args: [],
  6643. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  6644. referencedClasses: [],
  6645. //>>excludeEnd("ide");
  6646. messageSends: []
  6647. }),
  6648. $globals.String.a$cls);
  6649. $core.addMethod(
  6650. $core.method({
  6651. selector: "esc",
  6652. protocol: "accessing",
  6653. fn: function (){
  6654. var self=this,$self=this;
  6655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6656. return $core.withContext(function($ctx1) {
  6657. //>>excludeEnd("ctx");
  6658. return $self._fromCharCode_((27));
  6659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6660. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.a$cls)});
  6661. //>>excludeEnd("ctx");
  6662. },
  6663. //>>excludeStart("ide", pragmas.excludeIdeData);
  6664. args: [],
  6665. source: "esc\x0a\x09^ self fromCharCode: 27",
  6666. referencedClasses: [],
  6667. //>>excludeEnd("ide");
  6668. messageSends: ["fromCharCode:"]
  6669. }),
  6670. $globals.String.a$cls);
  6671. $core.addMethod(
  6672. $core.method({
  6673. selector: "fromCharCode:",
  6674. protocol: "instance creation",
  6675. fn: function (anInteger){
  6676. var self=this,$self=this;
  6677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6678. return $core.withContext(function($ctx1) {
  6679. //>>excludeEnd("ctx");
  6680. return String.fromCharCode(anInteger);
  6681. return self;
  6682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6683. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.a$cls)});
  6684. //>>excludeEnd("ctx");
  6685. },
  6686. //>>excludeStart("ide", pragmas.excludeIdeData);
  6687. args: ["anInteger"],
  6688. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  6689. referencedClasses: [],
  6690. //>>excludeEnd("ide");
  6691. messageSends: []
  6692. }),
  6693. $globals.String.a$cls);
  6694. $core.addMethod(
  6695. $core.method({
  6696. selector: "fromString:",
  6697. protocol: "instance creation",
  6698. fn: function (aString){
  6699. var self=this,$self=this;
  6700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6701. return $core.withContext(function($ctx1) {
  6702. //>>excludeEnd("ctx");
  6703. return String(aString);
  6704. return self;
  6705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6706. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.a$cls)});
  6707. //>>excludeEnd("ctx");
  6708. },
  6709. //>>excludeStart("ide", pragmas.excludeIdeData);
  6710. args: ["aString"],
  6711. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  6712. referencedClasses: [],
  6713. //>>excludeEnd("ide");
  6714. messageSends: []
  6715. }),
  6716. $globals.String.a$cls);
  6717. $core.addMethod(
  6718. $core.method({
  6719. selector: "lf",
  6720. protocol: "accessing",
  6721. fn: function (){
  6722. var self=this,$self=this;
  6723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6724. return $core.withContext(function($ctx1) {
  6725. //>>excludeEnd("ctx");
  6726. return "\n";
  6727. return self;
  6728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6729. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.a$cls)});
  6730. //>>excludeEnd("ctx");
  6731. },
  6732. //>>excludeStart("ide", pragmas.excludeIdeData);
  6733. args: [],
  6734. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  6735. referencedClasses: [],
  6736. //>>excludeEnd("ide");
  6737. messageSends: []
  6738. }),
  6739. $globals.String.a$cls);
  6740. $core.addMethod(
  6741. $core.method({
  6742. selector: "random",
  6743. protocol: "random",
  6744. fn: function (){
  6745. var self=this,$self=this;
  6746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6747. return $core.withContext(function($ctx1) {
  6748. //>>excludeEnd("ctx");
  6749. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  6750. return self;
  6751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6752. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.a$cls)});
  6753. //>>excludeEnd("ctx");
  6754. },
  6755. //>>excludeStart("ide", pragmas.excludeIdeData);
  6756. args: [],
  6757. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);'>",
  6758. referencedClasses: [],
  6759. //>>excludeEnd("ide");
  6760. messageSends: []
  6761. }),
  6762. $globals.String.a$cls);
  6763. $core.addMethod(
  6764. $core.method({
  6765. selector: "randomNotIn:",
  6766. protocol: "random",
  6767. fn: function (aString){
  6768. var self=this,$self=this;
  6769. var result;
  6770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6771. return $core.withContext(function($ctx1) {
  6772. //>>excludeEnd("ctx");
  6773. $recv((function(){
  6774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6775. return $core.withContext(function($ctx2) {
  6776. //>>excludeEnd("ctx");
  6777. result=$self._random();
  6778. return $recv(aString)._includesSubString_(result);
  6779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6780. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6781. //>>excludeEnd("ctx");
  6782. }))._whileTrue();
  6783. return result;
  6784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6785. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.a$cls)});
  6786. //>>excludeEnd("ctx");
  6787. },
  6788. //>>excludeStart("ide", pragmas.excludeIdeData);
  6789. args: ["aString"],
  6790. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  6791. referencedClasses: [],
  6792. //>>excludeEnd("ide");
  6793. messageSends: ["whileTrue", "random", "includesSubString:"]
  6794. }),
  6795. $globals.String.a$cls);
  6796. $core.addMethod(
  6797. $core.method({
  6798. selector: "space",
  6799. protocol: "accessing",
  6800. fn: function (){
  6801. var self=this,$self=this;
  6802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6803. return $core.withContext(function($ctx1) {
  6804. //>>excludeEnd("ctx");
  6805. return " ";
  6806. return self;
  6807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6808. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.a$cls)});
  6809. //>>excludeEnd("ctx");
  6810. },
  6811. //>>excludeStart("ide", pragmas.excludeIdeData);
  6812. args: [],
  6813. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  6814. referencedClasses: [],
  6815. //>>excludeEnd("ide");
  6816. messageSends: []
  6817. }),
  6818. $globals.String.a$cls);
  6819. $core.addMethod(
  6820. $core.method({
  6821. selector: "streamClass",
  6822. protocol: "accessing",
  6823. fn: function (){
  6824. var self=this,$self=this;
  6825. return $globals.StringStream;
  6826. },
  6827. //>>excludeStart("ide", pragmas.excludeIdeData);
  6828. args: [],
  6829. source: "streamClass\x0a\x09\x09^ StringStream",
  6830. referencedClasses: ["StringStream"],
  6831. //>>excludeEnd("ide");
  6832. messageSends: []
  6833. }),
  6834. $globals.String.a$cls);
  6835. $core.addMethod(
  6836. $core.method({
  6837. selector: "tab",
  6838. protocol: "accessing",
  6839. fn: function (){
  6840. var self=this,$self=this;
  6841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6842. return $core.withContext(function($ctx1) {
  6843. //>>excludeEnd("ctx");
  6844. return "\t";
  6845. return self;
  6846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6847. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.a$cls)});
  6848. //>>excludeEnd("ctx");
  6849. },
  6850. //>>excludeStart("ide", pragmas.excludeIdeData);
  6851. args: [],
  6852. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  6853. referencedClasses: [],
  6854. //>>excludeEnd("ide");
  6855. messageSends: []
  6856. }),
  6857. $globals.String.a$cls);
  6858. $core.addMethod(
  6859. $core.method({
  6860. selector: "value:",
  6861. protocol: "instance creation",
  6862. fn: function (aUTFCharCode){
  6863. var self=this,$self=this;
  6864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6865. return $core.withContext(function($ctx1) {
  6866. //>>excludeEnd("ctx");
  6867. return String.fromCharCode(aUTFCharCode);;
  6868. return self;
  6869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6870. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.a$cls)});
  6871. //>>excludeEnd("ctx");
  6872. },
  6873. //>>excludeStart("ide", pragmas.excludeIdeData);
  6874. args: ["aUTFCharCode"],
  6875. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  6876. referencedClasses: [],
  6877. //>>excludeEnd("ide");
  6878. messageSends: []
  6879. }),
  6880. $globals.String.a$cls);
  6881. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  6882. //>>excludeStart("ide", pragmas.excludeIdeData);
  6883. $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`.";
  6884. //>>excludeEnd("ide");
  6885. $core.addMethod(
  6886. $core.method({
  6887. selector: "=",
  6888. protocol: "comparing",
  6889. fn: function (aCollection){
  6890. var self=this,$self=this;
  6891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6892. return $core.withContext(function($ctx1) {
  6893. //>>excludeEnd("ctx");
  6894. var $2,$1,$4,$3,$5;
  6895. var $early={};
  6896. try {
  6897. $2=$self._class();
  6898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6899. $ctx1.sendIdx["class"]=1;
  6900. //>>excludeEnd("ctx");
  6901. $1=$recv($2).__eq($recv(aCollection)._class());
  6902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6903. $ctx1.sendIdx["="]=1;
  6904. //>>excludeEnd("ctx");
  6905. if(!$core.assert($1)){
  6906. return false;
  6907. }
  6908. $4=$self._size();
  6909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6910. $ctx1.sendIdx["size"]=1;
  6911. //>>excludeEnd("ctx");
  6912. $3=$recv($4).__eq($recv(aCollection)._size());
  6913. if(!$core.assert($3)){
  6914. return false;
  6915. }
  6916. $self._do_((function(each){
  6917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6918. return $core.withContext(function($ctx2) {
  6919. //>>excludeEnd("ctx");
  6920. $5=$recv(aCollection)._includes_(each);
  6921. if(!$core.assert($5)){
  6922. throw $early=[false];
  6923. }
  6924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6925. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  6926. //>>excludeEnd("ctx");
  6927. }));
  6928. return true;
  6929. }
  6930. catch(e) {if(e===$early)return e[0]; throw e}
  6931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6932. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  6933. //>>excludeEnd("ctx");
  6934. },
  6935. //>>excludeStart("ide", pragmas.excludeIdeData);
  6936. args: ["aCollection"],
  6937. 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",
  6938. referencedClasses: [],
  6939. //>>excludeEnd("ide");
  6940. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  6941. }),
  6942. $globals.Set);
  6943. $core.addMethod(
  6944. $core.method({
  6945. selector: "add:",
  6946. protocol: "adding/removing",
  6947. fn: function (anObject){
  6948. var self=this,$self=this;
  6949. var bucket;
  6950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6951. return $core.withContext(function($ctx1) {
  6952. //>>excludeEnd("ctx");
  6953. var $1,$receiver;
  6954. bucket=$self._bucketsOfElement_(anObject);
  6955. $1=$recv(bucket)._second();
  6956. if(($receiver = $1) == null || $receiver.a$nil){
  6957. var object,slowBucket;
  6958. object=$recv(bucket)._first();
  6959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6960. $ctx1.sendIdx["first"]=1;
  6961. //>>excludeEnd("ctx");
  6962. slowBucket=$recv(bucket)._third();
  6963. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  6964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6965. return $core.withContext(function($ctx2) {
  6966. //>>excludeEnd("ctx");
  6967. $recv(slowBucket)._add_(object);
  6968. $self["@size"]=$recv($self["@size"]).__plus((1));
  6969. return $self["@size"];
  6970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6972. //>>excludeEnd("ctx");
  6973. }));
  6974. return object;
  6975. } else {
  6976. var primitiveBucket;
  6977. primitiveBucket=$receiver;
  6978. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  6979. }
  6980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6981. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  6982. //>>excludeEnd("ctx");
  6983. },
  6984. //>>excludeStart("ide", pragmas.excludeIdeData);
  6985. args: ["anObject"],
  6986. 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 ]",
  6987. referencedClasses: [],
  6988. //>>excludeEnd("ide");
  6989. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  6990. }),
  6991. $globals.Set);
  6992. $core.addMethod(
  6993. $core.method({
  6994. selector: "add:in:",
  6995. protocol: "private",
  6996. fn: function (anObject,anotherObject){
  6997. var self=this,$self=this;
  6998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6999. return $core.withContext(function($ctx1) {
  7000. //>>excludeEnd("ctx");
  7001. if (anObject in anotherObject.store) { return anObject; }
  7002. $self['@size']++;
  7003. anotherObject.store[anObject] = true;
  7004. return anObject;
  7005. ;
  7006. return self;
  7007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7008. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7009. //>>excludeEnd("ctx");
  7010. },
  7011. //>>excludeStart("ide", pragmas.excludeIdeData);
  7012. args: ["anObject", "anotherObject"],
  7013. 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'>",
  7014. referencedClasses: [],
  7015. //>>excludeEnd("ide");
  7016. messageSends: []
  7017. }),
  7018. $globals.Set);
  7019. $core.addMethod(
  7020. $core.method({
  7021. selector: "bucketsOfElement:",
  7022. protocol: "private",
  7023. fn: function (anObject){
  7024. var self=this,$self=this;
  7025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7026. return $core.withContext(function($ctx1) {
  7027. //>>excludeEnd("ctx");
  7028. // include nil to well-known objects under "boolean" fastBucket
  7029. if (anObject == null || anObject.a$nil) return [ null, $self['@fastBuckets'].boolean ];
  7030. var prim = anObject.valueOf();
  7031. if (typeof prim === "object" || typeof prim === "function" || !$self['@fastBuckets'][typeof prim]) {
  7032. var bucket = null;
  7033. $self['@slowBucketStores'].some(function (store) {
  7034. return bucket = store._bucketOfElement_(anObject);
  7035. });
  7036. return [ anObject, null, bucket || $self['@defaultBucket'] ];
  7037. }
  7038. return [ prim, $self['@fastBuckets'][typeof prim] ];
  7039. ;
  7040. return self;
  7041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7042. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  7043. //>>excludeEnd("ctx");
  7044. },
  7045. //>>excludeStart("ide", pragmas.excludeIdeData);
  7046. args: ["anObject"],
  7047. 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'>",
  7048. referencedClasses: [],
  7049. //>>excludeEnd("ide");
  7050. messageSends: []
  7051. }),
  7052. $globals.Set);
  7053. $core.addMethod(
  7054. $core.method({
  7055. selector: "classNameOf:",
  7056. protocol: "private",
  7057. fn: function (anObject){
  7058. var self=this,$self=this;
  7059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7060. return $core.withContext(function($ctx1) {
  7061. //>>excludeEnd("ctx");
  7062. return anObject.a$cls != null && anObject.a$cls.name;
  7063. return self;
  7064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7065. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  7066. //>>excludeEnd("ctx");
  7067. },
  7068. //>>excludeStart("ide", pragmas.excludeIdeData);
  7069. args: ["anObject"],
  7070. 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'>",
  7071. referencedClasses: [],
  7072. //>>excludeEnd("ide");
  7073. messageSends: []
  7074. }),
  7075. $globals.Set);
  7076. $core.addMethod(
  7077. $core.method({
  7078. selector: "collect:",
  7079. protocol: "enumerating",
  7080. fn: function (aBlock){
  7081. var self=this,$self=this;
  7082. var collection;
  7083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7084. return $core.withContext(function($ctx1) {
  7085. //>>excludeEnd("ctx");
  7086. collection=$recv($self._class())._new();
  7087. $self._do_((function(each){
  7088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7089. return $core.withContext(function($ctx2) {
  7090. //>>excludeEnd("ctx");
  7091. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7093. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7094. //>>excludeEnd("ctx");
  7095. }));
  7096. return collection;
  7097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7098. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  7099. //>>excludeEnd("ctx");
  7100. },
  7101. //>>excludeStart("ide", pragmas.excludeIdeData);
  7102. args: ["aBlock"],
  7103. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7104. referencedClasses: [],
  7105. //>>excludeEnd("ide");
  7106. messageSends: ["new", "class", "do:", "add:", "value:"]
  7107. }),
  7108. $globals.Set);
  7109. $core.addMethod(
  7110. $core.method({
  7111. selector: "do:",
  7112. protocol: "enumerating",
  7113. fn: function (aBlock){
  7114. var self=this,$self=this;
  7115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7116. return $core.withContext(function($ctx1) {
  7117. //>>excludeEnd("ctx");
  7118. var el, keys, i;
  7119. el = $self['@fastBuckets'];
  7120. keys = Object.keys(el);
  7121. for (i = 0; i < keys.length; ++i) {
  7122. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7123. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7124. else { store._do_(aBlock); }
  7125. }
  7126. el = $self['@slowBucketStores'];
  7127. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7128. $self['@defaultBucket']._do_(aBlock);
  7129. ;
  7130. return self;
  7131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7132. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  7133. //>>excludeEnd("ctx");
  7134. },
  7135. //>>excludeStart("ide", pragmas.excludeIdeData);
  7136. args: ["aBlock"],
  7137. 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'>",
  7138. referencedClasses: [],
  7139. //>>excludeEnd("ide");
  7140. messageSends: []
  7141. }),
  7142. $globals.Set);
  7143. $core.addMethod(
  7144. $core.method({
  7145. selector: "includes:",
  7146. protocol: "testing",
  7147. fn: function (anObject){
  7148. var self=this,$self=this;
  7149. var bucket;
  7150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7151. return $core.withContext(function($ctx1) {
  7152. //>>excludeEnd("ctx");
  7153. var $1,$2,$3,$receiver;
  7154. bucket=$self._bucketsOfElement_(anObject);
  7155. $1=$recv(bucket)._second();
  7156. if(($receiver = $1) == null || $receiver.a$nil){
  7157. $2=$recv(bucket)._third();
  7158. $3=$recv(bucket)._first();
  7159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7160. $ctx1.sendIdx["first"]=1;
  7161. //>>excludeEnd("ctx");
  7162. return $recv($2)._includes_($3);
  7163. } else {
  7164. var primitiveBucket;
  7165. primitiveBucket=$receiver;
  7166. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7167. }
  7168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7169. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7170. //>>excludeEnd("ctx");
  7171. },
  7172. //>>excludeStart("ide", pragmas.excludeIdeData);
  7173. args: ["anObject"],
  7174. 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 ]",
  7175. referencedClasses: [],
  7176. //>>excludeEnd("ide");
  7177. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7178. }),
  7179. $globals.Set);
  7180. $core.addMethod(
  7181. $core.method({
  7182. selector: "includes:in:",
  7183. protocol: "private",
  7184. fn: function (anObject,anotherObject){
  7185. var self=this,$self=this;
  7186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7187. return $core.withContext(function($ctx1) {
  7188. //>>excludeEnd("ctx");
  7189. return anObject in anotherObject.store;
  7190. return self;
  7191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7192. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7193. //>>excludeEnd("ctx");
  7194. },
  7195. //>>excludeStart("ide", pragmas.excludeIdeData);
  7196. args: ["anObject", "anotherObject"],
  7197. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  7198. referencedClasses: [],
  7199. //>>excludeEnd("ide");
  7200. messageSends: []
  7201. }),
  7202. $globals.Set);
  7203. $core.addMethod(
  7204. $core.method({
  7205. selector: "initialize",
  7206. protocol: "initialization",
  7207. fn: function (){
  7208. var self=this,$self=this;
  7209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7210. return $core.withContext(function($ctx1) {
  7211. //>>excludeEnd("ctx");
  7212. (
  7213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7214. $ctx1.supercall = true,
  7215. //>>excludeEnd("ctx");
  7216. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  7217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7218. $ctx1.supercall = false;
  7219. //>>excludeEnd("ctx");;
  7220. $self["@defaultBucket"]=[];
  7221. $self._initializeSlowBucketStores();
  7222. $self._removeAll();
  7223. return self;
  7224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7225. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  7226. //>>excludeEnd("ctx");
  7227. },
  7228. //>>excludeStart("ide", pragmas.excludeIdeData);
  7229. args: [],
  7230. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7231. referencedClasses: [],
  7232. //>>excludeEnd("ide");
  7233. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7234. }),
  7235. $globals.Set);
  7236. $core.addMethod(
  7237. $core.method({
  7238. selector: "initializeSlowBucketStores",
  7239. protocol: "initialization",
  7240. fn: function (){
  7241. var self=this,$self=this;
  7242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7243. return $core.withContext(function($ctx1) {
  7244. //>>excludeEnd("ctx");
  7245. var $1;
  7246. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7248. return $core.withContext(function($ctx2) {
  7249. //>>excludeEnd("ctx");
  7250. return $self._classNameOf_(x);
  7251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7252. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7253. //>>excludeEnd("ctx");
  7254. }));
  7255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7256. $ctx1.sendIdx["hashBlock:"]=1;
  7257. //>>excludeEnd("ctx");
  7258. $self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7260. return $core.withContext(function($ctx2) {
  7261. //>>excludeEnd("ctx");
  7262. return $self._jsConstructorNameOf_(x);
  7263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7264. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7265. //>>excludeEnd("ctx");
  7266. }))];
  7267. return self;
  7268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7269. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  7270. //>>excludeEnd("ctx");
  7271. },
  7272. //>>excludeStart("ide", pragmas.excludeIdeData);
  7273. args: [],
  7274. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7275. referencedClasses: ["ArrayBucketStore"],
  7276. //>>excludeEnd("ide");
  7277. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  7278. }),
  7279. $globals.Set);
  7280. $core.addMethod(
  7281. $core.method({
  7282. selector: "jsConstructorNameOf:",
  7283. protocol: "private",
  7284. fn: function (anObject){
  7285. var self=this,$self=this;
  7286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7287. return $core.withContext(function($ctx1) {
  7288. //>>excludeEnd("ctx");
  7289. return anObject.constructor && anObject.constructor.name;
  7290. return self;
  7291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7292. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  7293. //>>excludeEnd("ctx");
  7294. },
  7295. //>>excludeStart("ide", pragmas.excludeIdeData);
  7296. args: ["anObject"],
  7297. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  7298. referencedClasses: [],
  7299. //>>excludeEnd("ide");
  7300. messageSends: []
  7301. }),
  7302. $globals.Set);
  7303. $core.addMethod(
  7304. $core.method({
  7305. selector: "printOn:",
  7306. protocol: "printing",
  7307. fn: function (aStream){
  7308. var self=this,$self=this;
  7309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7310. return $core.withContext(function($ctx1) {
  7311. //>>excludeEnd("ctx");
  7312. (
  7313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7314. $ctx1.supercall = true,
  7315. //>>excludeEnd("ctx");
  7316. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  7317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7318. $ctx1.supercall = false;
  7319. //>>excludeEnd("ctx");;
  7320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7321. $ctx1.sendIdx["printOn:"]=1;
  7322. //>>excludeEnd("ctx");
  7323. $recv(aStream)._nextPutAll_(" (");
  7324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7325. $ctx1.sendIdx["nextPutAll:"]=1;
  7326. //>>excludeEnd("ctx");
  7327. $self._do_separatedBy_((function(each){
  7328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7329. return $core.withContext(function($ctx2) {
  7330. //>>excludeEnd("ctx");
  7331. return $recv(each)._printOn_(aStream);
  7332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7333. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7334. //>>excludeEnd("ctx");
  7335. }),(function(){
  7336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7337. return $core.withContext(function($ctx2) {
  7338. //>>excludeEnd("ctx");
  7339. return $recv(aStream)._nextPutAll_(" ");
  7340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7341. $ctx2.sendIdx["nextPutAll:"]=2;
  7342. //>>excludeEnd("ctx");
  7343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7345. //>>excludeEnd("ctx");
  7346. }));
  7347. $recv(aStream)._nextPutAll_(")");
  7348. return self;
  7349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7350. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  7351. //>>excludeEnd("ctx");
  7352. },
  7353. //>>excludeStart("ide", pragmas.excludeIdeData);
  7354. args: ["aStream"],
  7355. 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: ')'",
  7356. referencedClasses: [],
  7357. //>>excludeEnd("ide");
  7358. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  7359. }),
  7360. $globals.Set);
  7361. $core.addMethod(
  7362. $core.method({
  7363. selector: "remove:ifAbsent:",
  7364. protocol: "adding/removing",
  7365. fn: function (anObject,aBlock){
  7366. var self=this,$self=this;
  7367. var bucket;
  7368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7369. return $core.withContext(function($ctx1) {
  7370. //>>excludeEnd("ctx");
  7371. var $1,$2,$3,$receiver;
  7372. var $early={};
  7373. try {
  7374. bucket=$self._bucketsOfElement_(anObject);
  7375. $1=$recv(bucket)._second();
  7376. if(($receiver = $1) == null || $receiver.a$nil){
  7377. $2=$recv(bucket)._third();
  7378. $3=$recv(bucket)._first();
  7379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7380. $ctx1.sendIdx["first"]=1;
  7381. //>>excludeEnd("ctx");
  7382. $recv($2)._remove_ifAbsent_($3,(function(){
  7383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7384. return $core.withContext(function($ctx2) {
  7385. //>>excludeEnd("ctx");
  7386. throw $early=[$recv(aBlock)._value()];
  7387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7388. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7389. //>>excludeEnd("ctx");
  7390. }));
  7391. $self["@size"]=$recv($self["@size"]).__minus((1));
  7392. return $self["@size"];
  7393. } else {
  7394. var primitiveBucket;
  7395. primitiveBucket=$receiver;
  7396. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  7397. }
  7398. }
  7399. catch(e) {if(e===$early)return e[0]; throw e}
  7400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7401. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  7402. //>>excludeEnd("ctx");
  7403. },
  7404. //>>excludeStart("ide", pragmas.excludeIdeData);
  7405. args: ["anObject", "aBlock"],
  7406. 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 ]",
  7407. referencedClasses: [],
  7408. //>>excludeEnd("ide");
  7409. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:ifAbsent:"]
  7410. }),
  7411. $globals.Set);
  7412. $core.addMethod(
  7413. $core.method({
  7414. selector: "remove:in:ifAbsent:",
  7415. protocol: "private",
  7416. fn: function (anObject,anotherObject,aBlock){
  7417. var self=this,$self=this;
  7418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7419. return $core.withContext(function($ctx1) {
  7420. //>>excludeEnd("ctx");
  7421. if (anObject in anotherObject.store) {
  7422. delete anotherObject.store[anObject];
  7423. $self['@size']--;
  7424. return anObject;
  7425. } else {
  7426. return aBlock._value();
  7427. };
  7428. return self;
  7429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7430. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock},$globals.Set)});
  7431. //>>excludeEnd("ctx");
  7432. },
  7433. //>>excludeStart("ide", pragmas.excludeIdeData);
  7434. args: ["anObject", "anotherObject", "aBlock"],
  7435. 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}'>",
  7436. referencedClasses: [],
  7437. //>>excludeEnd("ide");
  7438. messageSends: []
  7439. }),
  7440. $globals.Set);
  7441. $core.addMethod(
  7442. $core.method({
  7443. selector: "removeAll",
  7444. protocol: "adding/removing",
  7445. fn: function (){
  7446. var self=this,$self=this;
  7447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7448. return $core.withContext(function($ctx1) {
  7449. //>>excludeEnd("ctx");
  7450. $self['@fastBuckets'] = {
  7451. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  7452. "number": { store: Object.create(null), fn: Number },
  7453. "string": { store: Object.create(null) }
  7454. };
  7455. $self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  7456. $self['@defaultBucket']._removeAll();
  7457. $self['@size'] = 0;
  7458. ;
  7459. return self;
  7460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7461. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  7462. //>>excludeEnd("ctx");
  7463. },
  7464. //>>excludeStart("ide", pragmas.excludeIdeData);
  7465. args: [],
  7466. 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'>",
  7467. referencedClasses: [],
  7468. //>>excludeEnd("ide");
  7469. messageSends: []
  7470. }),
  7471. $globals.Set);
  7472. $core.addMethod(
  7473. $core.method({
  7474. selector: "select:",
  7475. protocol: "enumerating",
  7476. fn: function (aBlock){
  7477. var self=this,$self=this;
  7478. var collection;
  7479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7480. return $core.withContext(function($ctx1) {
  7481. //>>excludeEnd("ctx");
  7482. var $1;
  7483. collection=$recv($self._class())._new();
  7484. $self._do_((function(each){
  7485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7486. return $core.withContext(function($ctx2) {
  7487. //>>excludeEnd("ctx");
  7488. $1=$recv(aBlock)._value_(each);
  7489. if($core.assert($1)){
  7490. return $recv(collection)._add_(each);
  7491. }
  7492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7493. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7494. //>>excludeEnd("ctx");
  7495. }));
  7496. return collection;
  7497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7498. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  7499. //>>excludeEnd("ctx");
  7500. },
  7501. //>>excludeStart("ide", pragmas.excludeIdeData);
  7502. args: ["aBlock"],
  7503. 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",
  7504. referencedClasses: [],
  7505. //>>excludeEnd("ide");
  7506. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7507. }),
  7508. $globals.Set);
  7509. $core.addMethod(
  7510. $core.method({
  7511. selector: "select:thenCollect:",
  7512. protocol: "enumerating",
  7513. fn: function (selectBlock,collectBlock){
  7514. var self=this,$self=this;
  7515. var collection;
  7516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7517. return $core.withContext(function($ctx1) {
  7518. //>>excludeEnd("ctx");
  7519. var $1;
  7520. collection=$recv($self._class())._new();
  7521. $self._do_((function(each){
  7522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7523. return $core.withContext(function($ctx2) {
  7524. //>>excludeEnd("ctx");
  7525. $1=$recv(selectBlock)._value_(each);
  7526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7527. $ctx2.sendIdx["value:"]=1;
  7528. //>>excludeEnd("ctx");
  7529. if($core.assert($1)){
  7530. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  7531. }
  7532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7533. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7534. //>>excludeEnd("ctx");
  7535. }));
  7536. return collection;
  7537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7538. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  7539. //>>excludeEnd("ctx");
  7540. },
  7541. //>>excludeStart("ide", pragmas.excludeIdeData);
  7542. args: ["selectBlock", "collectBlock"],
  7543. 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",
  7544. referencedClasses: [],
  7545. //>>excludeEnd("ide");
  7546. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7547. }),
  7548. $globals.Set);
  7549. $core.addMethod(
  7550. $core.method({
  7551. selector: "size",
  7552. protocol: "accessing",
  7553. fn: function (){
  7554. var self=this,$self=this;
  7555. return $self["@size"];
  7556. },
  7557. //>>excludeStart("ide", pragmas.excludeIdeData);
  7558. args: [],
  7559. source: "size\x0a\x09^ size",
  7560. referencedClasses: [],
  7561. //>>excludeEnd("ide");
  7562. messageSends: []
  7563. }),
  7564. $globals.Set);
  7565. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  7566. //>>excludeStart("ide", pragmas.excludeIdeData);
  7567. $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.";
  7568. //>>excludeEnd("ide");
  7569. $core.addMethod(
  7570. $core.method({
  7571. selector: "<<",
  7572. protocol: "writing",
  7573. fn: function (anObject){
  7574. var self=this,$self=this;
  7575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7576. return $core.withContext(function($ctx1) {
  7577. //>>excludeEnd("ctx");
  7578. $self._write_(anObject);
  7579. return self;
  7580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7581. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  7582. //>>excludeEnd("ctx");
  7583. },
  7584. //>>excludeStart("ide", pragmas.excludeIdeData);
  7585. args: ["anObject"],
  7586. source: "<< anObject\x0a\x09self write: anObject",
  7587. referencedClasses: [],
  7588. //>>excludeEnd("ide");
  7589. messageSends: ["write:"]
  7590. }),
  7591. $globals.ProtoStream);
  7592. $core.addMethod(
  7593. $core.method({
  7594. selector: "atEnd",
  7595. protocol: "testing",
  7596. fn: function (){
  7597. var self=this,$self=this;
  7598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7599. return $core.withContext(function($ctx1) {
  7600. //>>excludeEnd("ctx");
  7601. $self._subclassResponsibility();
  7602. return self;
  7603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7604. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  7605. //>>excludeEnd("ctx");
  7606. },
  7607. //>>excludeStart("ide", pragmas.excludeIdeData);
  7608. args: [],
  7609. source: "atEnd\x0a\x09self subclassResponsibility",
  7610. referencedClasses: [],
  7611. //>>excludeEnd("ide");
  7612. messageSends: ["subclassResponsibility"]
  7613. }),
  7614. $globals.ProtoStream);
  7615. $core.addMethod(
  7616. $core.method({
  7617. selector: "atStart",
  7618. protocol: "testing",
  7619. fn: function (){
  7620. var self=this,$self=this;
  7621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7622. return $core.withContext(function($ctx1) {
  7623. //>>excludeEnd("ctx");
  7624. $self._subclassResponsibility();
  7625. return self;
  7626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7627. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  7628. //>>excludeEnd("ctx");
  7629. },
  7630. //>>excludeStart("ide", pragmas.excludeIdeData);
  7631. args: [],
  7632. source: "atStart\x0a\x09self subclassResponsibility",
  7633. referencedClasses: [],
  7634. //>>excludeEnd("ide");
  7635. messageSends: ["subclassResponsibility"]
  7636. }),
  7637. $globals.ProtoStream);
  7638. $core.addMethod(
  7639. $core.method({
  7640. selector: "contents",
  7641. protocol: "accessing",
  7642. fn: function (){
  7643. var self=this,$self=this;
  7644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7645. return $core.withContext(function($ctx1) {
  7646. //>>excludeEnd("ctx");
  7647. $self._subclassResponsibility();
  7648. return self;
  7649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7650. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  7651. //>>excludeEnd("ctx");
  7652. },
  7653. //>>excludeStart("ide", pragmas.excludeIdeData);
  7654. args: [],
  7655. source: "contents\x0a\x09self subclassResponsibility",
  7656. referencedClasses: [],
  7657. //>>excludeEnd("ide");
  7658. messageSends: ["subclassResponsibility"]
  7659. }),
  7660. $globals.ProtoStream);
  7661. $core.addMethod(
  7662. $core.method({
  7663. selector: "do:",
  7664. protocol: "enumerating",
  7665. fn: function (aBlock){
  7666. var self=this,$self=this;
  7667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7668. return $core.withContext(function($ctx1) {
  7669. //>>excludeEnd("ctx");
  7670. $recv((function(){
  7671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7672. return $core.withContext(function($ctx2) {
  7673. //>>excludeEnd("ctx");
  7674. return $self._atEnd();
  7675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7676. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7677. //>>excludeEnd("ctx");
  7678. }))._whileFalse_((function(){
  7679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7680. return $core.withContext(function($ctx2) {
  7681. //>>excludeEnd("ctx");
  7682. return $recv(aBlock)._value_($self._next());
  7683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7684. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7685. //>>excludeEnd("ctx");
  7686. }));
  7687. return self;
  7688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7689. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  7690. //>>excludeEnd("ctx");
  7691. },
  7692. //>>excludeStart("ide", pragmas.excludeIdeData);
  7693. args: ["aBlock"],
  7694. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  7695. referencedClasses: [],
  7696. //>>excludeEnd("ide");
  7697. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  7698. }),
  7699. $globals.ProtoStream);
  7700. $core.addMethod(
  7701. $core.method({
  7702. selector: "isEmpty",
  7703. protocol: "testing",
  7704. fn: function (){
  7705. var self=this,$self=this;
  7706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7707. return $core.withContext(function($ctx1) {
  7708. //>>excludeEnd("ctx");
  7709. return $recv($self._atStart())._and_((function(){
  7710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7711. return $core.withContext(function($ctx2) {
  7712. //>>excludeEnd("ctx");
  7713. return $self._atEnd();
  7714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7715. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7716. //>>excludeEnd("ctx");
  7717. }));
  7718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7719. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  7720. //>>excludeEnd("ctx");
  7721. },
  7722. //>>excludeStart("ide", pragmas.excludeIdeData);
  7723. args: [],
  7724. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  7725. referencedClasses: [],
  7726. //>>excludeEnd("ide");
  7727. messageSends: ["and:", "atStart", "atEnd"]
  7728. }),
  7729. $globals.ProtoStream);
  7730. $core.addMethod(
  7731. $core.method({
  7732. selector: "next",
  7733. protocol: "reading",
  7734. fn: function (){
  7735. var self=this,$self=this;
  7736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7737. return $core.withContext(function($ctx1) {
  7738. //>>excludeEnd("ctx");
  7739. var $1;
  7740. $1=$self._atEnd();
  7741. if($core.assert($1)){
  7742. return nil;
  7743. } else {
  7744. return $self._subclassResponsibility();
  7745. }
  7746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7747. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  7748. //>>excludeEnd("ctx");
  7749. },
  7750. //>>excludeStart("ide", pragmas.excludeIdeData);
  7751. args: [],
  7752. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7753. referencedClasses: [],
  7754. //>>excludeEnd("ide");
  7755. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7756. }),
  7757. $globals.ProtoStream);
  7758. $core.addMethod(
  7759. $core.method({
  7760. selector: "nextPut:",
  7761. protocol: "writing",
  7762. fn: function (anObject){
  7763. var self=this,$self=this;
  7764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7765. return $core.withContext(function($ctx1) {
  7766. //>>excludeEnd("ctx");
  7767. $self._subclassResponsibility();
  7768. return self;
  7769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7770. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  7771. //>>excludeEnd("ctx");
  7772. },
  7773. //>>excludeStart("ide", pragmas.excludeIdeData);
  7774. args: ["anObject"],
  7775. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  7776. referencedClasses: [],
  7777. //>>excludeEnd("ide");
  7778. messageSends: ["subclassResponsibility"]
  7779. }),
  7780. $globals.ProtoStream);
  7781. $core.addMethod(
  7782. $core.method({
  7783. selector: "nextPutAll:",
  7784. protocol: "writing",
  7785. fn: function (aCollection){
  7786. var self=this,$self=this;
  7787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7788. return $core.withContext(function($ctx1) {
  7789. //>>excludeEnd("ctx");
  7790. $recv(aCollection)._do_((function(each){
  7791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7792. return $core.withContext(function($ctx2) {
  7793. //>>excludeEnd("ctx");
  7794. return $self._nextPut_(each);
  7795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7796. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7797. //>>excludeEnd("ctx");
  7798. }));
  7799. return self;
  7800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7801. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  7802. //>>excludeEnd("ctx");
  7803. },
  7804. //>>excludeStart("ide", pragmas.excludeIdeData);
  7805. args: ["aCollection"],
  7806. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  7807. referencedClasses: [],
  7808. //>>excludeEnd("ide");
  7809. messageSends: ["do:", "nextPut:"]
  7810. }),
  7811. $globals.ProtoStream);
  7812. $core.addMethod(
  7813. $core.method({
  7814. selector: "nextPutString:",
  7815. protocol: "writing",
  7816. fn: function (aString){
  7817. var self=this,$self=this;
  7818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7819. return $core.withContext(function($ctx1) {
  7820. //>>excludeEnd("ctx");
  7821. $self._nextPut_(aString);
  7822. return self;
  7823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7824. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  7825. //>>excludeEnd("ctx");
  7826. },
  7827. //>>excludeStart("ide", pragmas.excludeIdeData);
  7828. args: ["aString"],
  7829. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  7830. referencedClasses: [],
  7831. //>>excludeEnd("ide");
  7832. messageSends: ["nextPut:"]
  7833. }),
  7834. $globals.ProtoStream);
  7835. $core.addMethod(
  7836. $core.method({
  7837. selector: "peek",
  7838. protocol: "reading",
  7839. fn: function (){
  7840. var self=this,$self=this;
  7841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7842. return $core.withContext(function($ctx1) {
  7843. //>>excludeEnd("ctx");
  7844. var $1;
  7845. $1=$self._atEnd();
  7846. if($core.assert($1)){
  7847. return nil;
  7848. } else {
  7849. return $self._subclassResponsibility();
  7850. }
  7851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7852. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  7853. //>>excludeEnd("ctx");
  7854. },
  7855. //>>excludeStart("ide", pragmas.excludeIdeData);
  7856. args: [],
  7857. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7858. referencedClasses: [],
  7859. //>>excludeEnd("ide");
  7860. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7861. }),
  7862. $globals.ProtoStream);
  7863. $core.addMethod(
  7864. $core.method({
  7865. selector: "reset",
  7866. protocol: "actions",
  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,"reset",{},$globals.ProtoStream)});
  7876. //>>excludeEnd("ctx");
  7877. },
  7878. //>>excludeStart("ide", pragmas.excludeIdeData);
  7879. args: [],
  7880. source: "reset\x0a\x09self subclassResponsibility",
  7881. referencedClasses: [],
  7882. //>>excludeEnd("ide");
  7883. messageSends: ["subclassResponsibility"]
  7884. }),
  7885. $globals.ProtoStream);
  7886. $core.addMethod(
  7887. $core.method({
  7888. selector: "resetContents",
  7889. protocol: "actions",
  7890. fn: function (){
  7891. var self=this,$self=this;
  7892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7893. return $core.withContext(function($ctx1) {
  7894. //>>excludeEnd("ctx");
  7895. $self._subclassResponsibility();
  7896. return self;
  7897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7898. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  7899. //>>excludeEnd("ctx");
  7900. },
  7901. //>>excludeStart("ide", pragmas.excludeIdeData);
  7902. args: [],
  7903. source: "resetContents\x0a\x09self subclassResponsibility",
  7904. referencedClasses: [],
  7905. //>>excludeEnd("ide");
  7906. messageSends: ["subclassResponsibility"]
  7907. }),
  7908. $globals.ProtoStream);
  7909. $core.addMethod(
  7910. $core.method({
  7911. selector: "setToEnd",
  7912. protocol: "positioning",
  7913. fn: function (){
  7914. var self=this,$self=this;
  7915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7916. return $core.withContext(function($ctx1) {
  7917. //>>excludeEnd("ctx");
  7918. $self._subclassResponsibility();
  7919. return self;
  7920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7921. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  7922. //>>excludeEnd("ctx");
  7923. },
  7924. //>>excludeStart("ide", pragmas.excludeIdeData);
  7925. args: [],
  7926. source: "setToEnd\x0a\x09self subclassResponsibility",
  7927. referencedClasses: [],
  7928. //>>excludeEnd("ide");
  7929. messageSends: ["subclassResponsibility"]
  7930. }),
  7931. $globals.ProtoStream);
  7932. $core.addMethod(
  7933. $core.method({
  7934. selector: "setToStart",
  7935. protocol: "positioning",
  7936. fn: function (){
  7937. var self=this,$self=this;
  7938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7939. return $core.withContext(function($ctx1) {
  7940. //>>excludeEnd("ctx");
  7941. $self._reset();
  7942. return self;
  7943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7944. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  7945. //>>excludeEnd("ctx");
  7946. },
  7947. //>>excludeStart("ide", pragmas.excludeIdeData);
  7948. args: [],
  7949. source: "setToStart\x0a\x09self reset",
  7950. referencedClasses: [],
  7951. //>>excludeEnd("ide");
  7952. messageSends: ["reset"]
  7953. }),
  7954. $globals.ProtoStream);
  7955. $core.addMethod(
  7956. $core.method({
  7957. selector: "write:",
  7958. protocol: "writing",
  7959. fn: function (anObject){
  7960. var self=this,$self=this;
  7961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7962. return $core.withContext(function($ctx1) {
  7963. //>>excludeEnd("ctx");
  7964. $recv(anObject)._putOn_(self);
  7965. return self;
  7966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7967. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  7968. //>>excludeEnd("ctx");
  7969. },
  7970. //>>excludeStart("ide", pragmas.excludeIdeData);
  7971. args: ["anObject"],
  7972. source: "write: anObject\x0a\x09anObject putOn: self",
  7973. referencedClasses: [],
  7974. //>>excludeEnd("ide");
  7975. messageSends: ["putOn:"]
  7976. }),
  7977. $globals.ProtoStream);
  7978. $core.addMethod(
  7979. $core.method({
  7980. selector: "on:",
  7981. protocol: "instance creation",
  7982. fn: function (aCollection){
  7983. var self=this,$self=this;
  7984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7985. return $core.withContext(function($ctx1) {
  7986. //>>excludeEnd("ctx");
  7987. var $1;
  7988. $1=$self._new();
  7989. $recv($1)._setCollection_(aCollection);
  7990. $recv($1)._setStreamSize_($recv(aCollection)._size());
  7991. return $recv($1)._yourself();
  7992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7993. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.a$cls)});
  7994. //>>excludeEnd("ctx");
  7995. },
  7996. //>>excludeStart("ide", pragmas.excludeIdeData);
  7997. args: ["aCollection"],
  7998. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  7999. referencedClasses: [],
  8000. //>>excludeEnd("ide");
  8001. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8002. }),
  8003. $globals.ProtoStream.a$cls);
  8004. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  8005. //>>excludeStart("ide", pragmas.excludeIdeData);
  8006. $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.";
  8007. //>>excludeEnd("ide");
  8008. $core.addMethod(
  8009. $core.method({
  8010. selector: "atEnd",
  8011. protocol: "testing",
  8012. fn: function (){
  8013. var self=this,$self=this;
  8014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8015. return $core.withContext(function($ctx1) {
  8016. //>>excludeEnd("ctx");
  8017. return $recv($self._position()).__eq($self._size());
  8018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8019. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  8020. //>>excludeEnd("ctx");
  8021. },
  8022. //>>excludeStart("ide", pragmas.excludeIdeData);
  8023. args: [],
  8024. source: "atEnd\x0a\x09^ self position = self size",
  8025. referencedClasses: [],
  8026. //>>excludeEnd("ide");
  8027. messageSends: ["=", "position", "size"]
  8028. }),
  8029. $globals.Stream);
  8030. $core.addMethod(
  8031. $core.method({
  8032. selector: "atStart",
  8033. protocol: "testing",
  8034. fn: function (){
  8035. var self=this,$self=this;
  8036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8037. return $core.withContext(function($ctx1) {
  8038. //>>excludeEnd("ctx");
  8039. return $recv($self._position()).__eq((0));
  8040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8041. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  8042. //>>excludeEnd("ctx");
  8043. },
  8044. //>>excludeStart("ide", pragmas.excludeIdeData);
  8045. args: [],
  8046. source: "atStart\x0a\x09^ self position = 0",
  8047. referencedClasses: [],
  8048. //>>excludeEnd("ide");
  8049. messageSends: ["=", "position"]
  8050. }),
  8051. $globals.Stream);
  8052. $core.addMethod(
  8053. $core.method({
  8054. selector: "close",
  8055. protocol: "actions",
  8056. fn: function (){
  8057. var self=this,$self=this;
  8058. return self;
  8059. },
  8060. //>>excludeStart("ide", pragmas.excludeIdeData);
  8061. args: [],
  8062. source: "close",
  8063. referencedClasses: [],
  8064. //>>excludeEnd("ide");
  8065. messageSends: []
  8066. }),
  8067. $globals.Stream);
  8068. $core.addMethod(
  8069. $core.method({
  8070. selector: "collection",
  8071. protocol: "accessing",
  8072. fn: function (){
  8073. var self=this,$self=this;
  8074. return $self["@collection"];
  8075. },
  8076. //>>excludeStart("ide", pragmas.excludeIdeData);
  8077. args: [],
  8078. source: "collection\x0a\x09^ collection",
  8079. referencedClasses: [],
  8080. //>>excludeEnd("ide");
  8081. messageSends: []
  8082. }),
  8083. $globals.Stream);
  8084. $core.addMethod(
  8085. $core.method({
  8086. selector: "contents",
  8087. protocol: "accessing",
  8088. fn: function (){
  8089. var self=this,$self=this;
  8090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8091. return $core.withContext(function($ctx1) {
  8092. //>>excludeEnd("ctx");
  8093. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  8094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8095. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  8096. //>>excludeEnd("ctx");
  8097. },
  8098. //>>excludeStart("ide", pragmas.excludeIdeData);
  8099. args: [],
  8100. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8101. referencedClasses: [],
  8102. //>>excludeEnd("ide");
  8103. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8104. }),
  8105. $globals.Stream);
  8106. $core.addMethod(
  8107. $core.method({
  8108. selector: "flush",
  8109. protocol: "actions",
  8110. fn: function (){
  8111. var self=this,$self=this;
  8112. return self;
  8113. },
  8114. //>>excludeStart("ide", pragmas.excludeIdeData);
  8115. args: [],
  8116. source: "flush",
  8117. referencedClasses: [],
  8118. //>>excludeEnd("ide");
  8119. messageSends: []
  8120. }),
  8121. $globals.Stream);
  8122. $core.addMethod(
  8123. $core.method({
  8124. selector: "isEmpty",
  8125. protocol: "testing",
  8126. fn: function (){
  8127. var self=this,$self=this;
  8128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8129. return $core.withContext(function($ctx1) {
  8130. //>>excludeEnd("ctx");
  8131. return $recv($self._size()).__eq((0));
  8132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8133. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  8134. //>>excludeEnd("ctx");
  8135. },
  8136. //>>excludeStart("ide", pragmas.excludeIdeData);
  8137. args: [],
  8138. source: "isEmpty\x0a\x09^ self size = 0",
  8139. referencedClasses: [],
  8140. //>>excludeEnd("ide");
  8141. messageSends: ["=", "size"]
  8142. }),
  8143. $globals.Stream);
  8144. $core.addMethod(
  8145. $core.method({
  8146. selector: "next",
  8147. protocol: "reading",
  8148. fn: function (){
  8149. var self=this,$self=this;
  8150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8151. return $core.withContext(function($ctx1) {
  8152. //>>excludeEnd("ctx");
  8153. var $1,$3,$2;
  8154. $1=$self._atEnd();
  8155. if($core.assert($1)){
  8156. return nil;
  8157. } else {
  8158. $3=$self._position();
  8159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8160. $ctx1.sendIdx["position"]=1;
  8161. //>>excludeEnd("ctx");
  8162. $2=$recv($3).__plus((1));
  8163. $self._position_($2);
  8164. return $recv($self["@collection"])._at_($self._position());
  8165. }
  8166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8167. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  8168. //>>excludeEnd("ctx");
  8169. },
  8170. //>>excludeStart("ide", pragmas.excludeIdeData);
  8171. args: [],
  8172. 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 ]",
  8173. referencedClasses: [],
  8174. //>>excludeEnd("ide");
  8175. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8176. }),
  8177. $globals.Stream);
  8178. $core.addMethod(
  8179. $core.method({
  8180. selector: "next:",
  8181. protocol: "reading",
  8182. fn: function (anInteger){
  8183. var self=this,$self=this;
  8184. var tempCollection;
  8185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8186. return $core.withContext(function($ctx1) {
  8187. //>>excludeEnd("ctx");
  8188. var $1;
  8189. tempCollection=$recv($recv($self._collection())._class())._new();
  8190. $recv(anInteger)._timesRepeat_((function(){
  8191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8192. return $core.withContext(function($ctx2) {
  8193. //>>excludeEnd("ctx");
  8194. $1=$self._atEnd();
  8195. if(!$core.assert($1)){
  8196. return $recv(tempCollection)._add_($self._next());
  8197. }
  8198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8199. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8200. //>>excludeEnd("ctx");
  8201. }));
  8202. return tempCollection;
  8203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8204. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  8205. //>>excludeEnd("ctx");
  8206. },
  8207. //>>excludeStart("ide", pragmas.excludeIdeData);
  8208. args: ["anInteger"],
  8209. 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",
  8210. referencedClasses: [],
  8211. //>>excludeEnd("ide");
  8212. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8213. }),
  8214. $globals.Stream);
  8215. $core.addMethod(
  8216. $core.method({
  8217. selector: "nextPut:",
  8218. protocol: "writing",
  8219. fn: function (anObject){
  8220. var self=this,$self=this;
  8221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8222. return $core.withContext(function($ctx1) {
  8223. //>>excludeEnd("ctx");
  8224. var $2,$1,$3,$4;
  8225. $2=$self._position();
  8226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8227. $ctx1.sendIdx["position"]=1;
  8228. //>>excludeEnd("ctx");
  8229. $1=$recv($2).__plus((1));
  8230. $self._position_($1);
  8231. $3=$self._collection();
  8232. $4=$self._position();
  8233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8234. $ctx1.sendIdx["position"]=2;
  8235. //>>excludeEnd("ctx");
  8236. $recv($3)._at_put_($4,anObject);
  8237. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8238. return self;
  8239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8240. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  8241. //>>excludeEnd("ctx");
  8242. },
  8243. //>>excludeStart("ide", pragmas.excludeIdeData);
  8244. args: ["anObject"],
  8245. 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)",
  8246. referencedClasses: [],
  8247. //>>excludeEnd("ide");
  8248. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8249. }),
  8250. $globals.Stream);
  8251. $core.addMethod(
  8252. $core.method({
  8253. selector: "peek",
  8254. protocol: "reading",
  8255. fn: function (){
  8256. var self=this,$self=this;
  8257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8258. return $core.withContext(function($ctx1) {
  8259. //>>excludeEnd("ctx");
  8260. var $1;
  8261. $1=$self._atEnd();
  8262. if(!$core.assert($1)){
  8263. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  8264. }
  8265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8266. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  8267. //>>excludeEnd("ctx");
  8268. },
  8269. //>>excludeStart("ide", pragmas.excludeIdeData);
  8270. args: [],
  8271. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8272. referencedClasses: [],
  8273. //>>excludeEnd("ide");
  8274. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8275. }),
  8276. $globals.Stream);
  8277. $core.addMethod(
  8278. $core.method({
  8279. selector: "position",
  8280. protocol: "accessing",
  8281. fn: function (){
  8282. var self=this,$self=this;
  8283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8284. return $core.withContext(function($ctx1) {
  8285. //>>excludeEnd("ctx");
  8286. var $1,$receiver;
  8287. $1=$self["@position"];
  8288. if(($receiver = $1) == null || $receiver.a$nil){
  8289. $self["@position"]=(0);
  8290. return $self["@position"];
  8291. } else {
  8292. return $1;
  8293. }
  8294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8295. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  8296. //>>excludeEnd("ctx");
  8297. },
  8298. //>>excludeStart("ide", pragmas.excludeIdeData);
  8299. args: [],
  8300. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  8301. referencedClasses: [],
  8302. //>>excludeEnd("ide");
  8303. messageSends: ["ifNil:"]
  8304. }),
  8305. $globals.Stream);
  8306. $core.addMethod(
  8307. $core.method({
  8308. selector: "position:",
  8309. protocol: "accessing",
  8310. fn: function (anInteger){
  8311. var self=this,$self=this;
  8312. $self["@position"]=anInteger;
  8313. return self;
  8314. },
  8315. //>>excludeStart("ide", pragmas.excludeIdeData);
  8316. args: ["anInteger"],
  8317. source: "position: anInteger\x0a\x09position := anInteger",
  8318. referencedClasses: [],
  8319. //>>excludeEnd("ide");
  8320. messageSends: []
  8321. }),
  8322. $globals.Stream);
  8323. $core.addMethod(
  8324. $core.method({
  8325. selector: "reset",
  8326. protocol: "actions",
  8327. fn: function (){
  8328. var self=this,$self=this;
  8329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8330. return $core.withContext(function($ctx1) {
  8331. //>>excludeEnd("ctx");
  8332. $self._position_((0));
  8333. return self;
  8334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8335. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  8336. //>>excludeEnd("ctx");
  8337. },
  8338. //>>excludeStart("ide", pragmas.excludeIdeData);
  8339. args: [],
  8340. source: "reset\x0a\x09self position: 0",
  8341. referencedClasses: [],
  8342. //>>excludeEnd("ide");
  8343. messageSends: ["position:"]
  8344. }),
  8345. $globals.Stream);
  8346. $core.addMethod(
  8347. $core.method({
  8348. selector: "resetContents",
  8349. protocol: "actions",
  8350. fn: function (){
  8351. var self=this,$self=this;
  8352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8353. return $core.withContext(function($ctx1) {
  8354. //>>excludeEnd("ctx");
  8355. $self._reset();
  8356. $self._setStreamSize_((0));
  8357. return self;
  8358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8359. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  8360. //>>excludeEnd("ctx");
  8361. },
  8362. //>>excludeStart("ide", pragmas.excludeIdeData);
  8363. args: [],
  8364. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  8365. referencedClasses: [],
  8366. //>>excludeEnd("ide");
  8367. messageSends: ["reset", "setStreamSize:"]
  8368. }),
  8369. $globals.Stream);
  8370. $core.addMethod(
  8371. $core.method({
  8372. selector: "setCollection:",
  8373. protocol: "accessing",
  8374. fn: function (aCollection){
  8375. var self=this,$self=this;
  8376. $self["@collection"]=aCollection;
  8377. return self;
  8378. },
  8379. //>>excludeStart("ide", pragmas.excludeIdeData);
  8380. args: ["aCollection"],
  8381. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  8382. referencedClasses: [],
  8383. //>>excludeEnd("ide");
  8384. messageSends: []
  8385. }),
  8386. $globals.Stream);
  8387. $core.addMethod(
  8388. $core.method({
  8389. selector: "setStreamSize:",
  8390. protocol: "accessing",
  8391. fn: function (anInteger){
  8392. var self=this,$self=this;
  8393. $self["@streamSize"]=anInteger;
  8394. return self;
  8395. },
  8396. //>>excludeStart("ide", pragmas.excludeIdeData);
  8397. args: ["anInteger"],
  8398. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  8399. referencedClasses: [],
  8400. //>>excludeEnd("ide");
  8401. messageSends: []
  8402. }),
  8403. $globals.Stream);
  8404. $core.addMethod(
  8405. $core.method({
  8406. selector: "setToEnd",
  8407. protocol: "positioning",
  8408. fn: function (){
  8409. var self=this,$self=this;
  8410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8411. return $core.withContext(function($ctx1) {
  8412. //>>excludeEnd("ctx");
  8413. $self._position_($self._size());
  8414. return self;
  8415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8416. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  8417. //>>excludeEnd("ctx");
  8418. },
  8419. //>>excludeStart("ide", pragmas.excludeIdeData);
  8420. args: [],
  8421. source: "setToEnd\x0a\x09self position: self size",
  8422. referencedClasses: [],
  8423. //>>excludeEnd("ide");
  8424. messageSends: ["position:", "size"]
  8425. }),
  8426. $globals.Stream);
  8427. $core.addMethod(
  8428. $core.method({
  8429. selector: "size",
  8430. protocol: "accessing",
  8431. fn: function (){
  8432. var self=this,$self=this;
  8433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8434. return $core.withContext(function($ctx1) {
  8435. //>>excludeEnd("ctx");
  8436. return $self._streamSize();
  8437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8438. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  8439. //>>excludeEnd("ctx");
  8440. },
  8441. //>>excludeStart("ide", pragmas.excludeIdeData);
  8442. args: [],
  8443. source: "size\x0a\x09^ self streamSize",
  8444. referencedClasses: [],
  8445. //>>excludeEnd("ide");
  8446. messageSends: ["streamSize"]
  8447. }),
  8448. $globals.Stream);
  8449. $core.addMethod(
  8450. $core.method({
  8451. selector: "skip:",
  8452. protocol: "positioning",
  8453. fn: function (anInteger){
  8454. var self=this,$self=this;
  8455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8456. return $core.withContext(function($ctx1) {
  8457. //>>excludeEnd("ctx");
  8458. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  8459. return self;
  8460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8461. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  8462. //>>excludeEnd("ctx");
  8463. },
  8464. //>>excludeStart("ide", pragmas.excludeIdeData);
  8465. args: ["anInteger"],
  8466. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  8467. referencedClasses: [],
  8468. //>>excludeEnd("ide");
  8469. messageSends: ["position:", "min:max:", "+", "position", "size"]
  8470. }),
  8471. $globals.Stream);
  8472. $core.addMethod(
  8473. $core.method({
  8474. selector: "streamSize",
  8475. protocol: "accessing",
  8476. fn: function (){
  8477. var self=this,$self=this;
  8478. return $self["@streamSize"];
  8479. },
  8480. //>>excludeStart("ide", pragmas.excludeIdeData);
  8481. args: [],
  8482. source: "streamSize\x0a\x09^ streamSize",
  8483. referencedClasses: [],
  8484. //>>excludeEnd("ide");
  8485. messageSends: []
  8486. }),
  8487. $globals.Stream);
  8488. $core.addMethod(
  8489. $core.method({
  8490. selector: "on:",
  8491. protocol: "instance creation",
  8492. fn: function (aCollection){
  8493. var self=this,$self=this;
  8494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8495. return $core.withContext(function($ctx1) {
  8496. //>>excludeEnd("ctx");
  8497. var $1;
  8498. $1=$self._new();
  8499. $recv($1)._setCollection_(aCollection);
  8500. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8501. return $recv($1)._yourself();
  8502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8503. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.a$cls)});
  8504. //>>excludeEnd("ctx");
  8505. },
  8506. //>>excludeStart("ide", pragmas.excludeIdeData);
  8507. args: ["aCollection"],
  8508. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8509. referencedClasses: [],
  8510. //>>excludeEnd("ide");
  8511. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8512. }),
  8513. $globals.Stream.a$cls);
  8514. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  8515. //>>excludeStart("ide", pragmas.excludeIdeData);
  8516. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  8517. //>>excludeEnd("ide");
  8518. $core.addMethod(
  8519. $core.method({
  8520. selector: "cr",
  8521. protocol: "writing",
  8522. fn: function (){
  8523. var self=this,$self=this;
  8524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8525. return $core.withContext(function($ctx1) {
  8526. //>>excludeEnd("ctx");
  8527. return $self._nextPutAll_($recv($globals.String)._cr());
  8528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8529. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  8530. //>>excludeEnd("ctx");
  8531. },
  8532. //>>excludeStart("ide", pragmas.excludeIdeData);
  8533. args: [],
  8534. source: "cr\x0a\x09^ self nextPutAll: String cr",
  8535. referencedClasses: ["String"],
  8536. //>>excludeEnd("ide");
  8537. messageSends: ["nextPutAll:", "cr"]
  8538. }),
  8539. $globals.StringStream);
  8540. $core.addMethod(
  8541. $core.method({
  8542. selector: "crlf",
  8543. protocol: "writing",
  8544. fn: function (){
  8545. var self=this,$self=this;
  8546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8547. return $core.withContext(function($ctx1) {
  8548. //>>excludeEnd("ctx");
  8549. return $self._nextPutAll_($recv($globals.String)._crlf());
  8550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8551. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  8552. //>>excludeEnd("ctx");
  8553. },
  8554. //>>excludeStart("ide", pragmas.excludeIdeData);
  8555. args: [],
  8556. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  8557. referencedClasses: ["String"],
  8558. //>>excludeEnd("ide");
  8559. messageSends: ["nextPutAll:", "crlf"]
  8560. }),
  8561. $globals.StringStream);
  8562. $core.addMethod(
  8563. $core.method({
  8564. selector: "lf",
  8565. protocol: "writing",
  8566. fn: function (){
  8567. var self=this,$self=this;
  8568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8569. return $core.withContext(function($ctx1) {
  8570. //>>excludeEnd("ctx");
  8571. return $self._nextPutAll_($recv($globals.String)._lf());
  8572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8573. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  8574. //>>excludeEnd("ctx");
  8575. },
  8576. //>>excludeStart("ide", pragmas.excludeIdeData);
  8577. args: [],
  8578. source: "lf\x0a\x09^ self nextPutAll: String lf",
  8579. referencedClasses: ["String"],
  8580. //>>excludeEnd("ide");
  8581. messageSends: ["nextPutAll:", "lf"]
  8582. }),
  8583. $globals.StringStream);
  8584. $core.addMethod(
  8585. $core.method({
  8586. selector: "next:",
  8587. protocol: "reading",
  8588. fn: function (anInteger){
  8589. var self=this,$self=this;
  8590. var tempCollection;
  8591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8592. return $core.withContext(function($ctx1) {
  8593. //>>excludeEnd("ctx");
  8594. var $1;
  8595. tempCollection=$recv($recv($self._collection())._class())._new();
  8596. $recv(anInteger)._timesRepeat_((function(){
  8597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8598. return $core.withContext(function($ctx2) {
  8599. //>>excludeEnd("ctx");
  8600. $1=$self._atEnd();
  8601. if(!$core.assert($1)){
  8602. tempCollection=$recv(tempCollection).__comma($self._next());
  8603. return tempCollection;
  8604. }
  8605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8606. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8607. //>>excludeEnd("ctx");
  8608. }));
  8609. return tempCollection;
  8610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8611. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  8612. //>>excludeEnd("ctx");
  8613. },
  8614. //>>excludeStart("ide", pragmas.excludeIdeData);
  8615. args: ["anInteger"],
  8616. 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",
  8617. referencedClasses: [],
  8618. //>>excludeEnd("ide");
  8619. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  8620. }),
  8621. $globals.StringStream);
  8622. $core.addMethod(
  8623. $core.method({
  8624. selector: "nextPut:",
  8625. protocol: "writing",
  8626. fn: function (aString){
  8627. var self=this,$self=this;
  8628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8629. return $core.withContext(function($ctx1) {
  8630. //>>excludeEnd("ctx");
  8631. $self._nextPutAll_(aString);
  8632. return self;
  8633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8634. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  8635. //>>excludeEnd("ctx");
  8636. },
  8637. //>>excludeStart("ide", pragmas.excludeIdeData);
  8638. args: ["aString"],
  8639. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  8640. referencedClasses: [],
  8641. //>>excludeEnd("ide");
  8642. messageSends: ["nextPutAll:"]
  8643. }),
  8644. $globals.StringStream);
  8645. $core.addMethod(
  8646. $core.method({
  8647. selector: "nextPutAll:",
  8648. protocol: "writing",
  8649. fn: function (aString){
  8650. var self=this,$self=this;
  8651. var pre,post;
  8652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8653. return $core.withContext(function($ctx1) {
  8654. //>>excludeEnd("ctx");
  8655. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  8656. $1=$self._atEnd();
  8657. if($core.assert($1)){
  8658. $3=$self._collection();
  8659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8660. $ctx1.sendIdx["collection"]=1;
  8661. //>>excludeEnd("ctx");
  8662. $2=$recv($3).__comma(aString);
  8663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8664. $ctx1.sendIdx[","]=1;
  8665. //>>excludeEnd("ctx");
  8666. $self._setCollection_($2);
  8667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8668. $ctx1.sendIdx["setCollection:"]=1;
  8669. //>>excludeEnd("ctx");
  8670. } else {
  8671. $4=$self._collection();
  8672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8673. $ctx1.sendIdx["collection"]=2;
  8674. //>>excludeEnd("ctx");
  8675. $5=$self._position();
  8676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8677. $ctx1.sendIdx["position"]=1;
  8678. //>>excludeEnd("ctx");
  8679. pre=$recv($4)._copyFrom_to_((1),$5);
  8680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8681. $ctx1.sendIdx["copyFrom:to:"]=1;
  8682. //>>excludeEnd("ctx");
  8683. $6=$self._collection();
  8684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8685. $ctx1.sendIdx["collection"]=3;
  8686. //>>excludeEnd("ctx");
  8687. $9=$self._position();
  8688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8689. $ctx1.sendIdx["position"]=2;
  8690. //>>excludeEnd("ctx");
  8691. $8=$recv($9).__plus((1));
  8692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8693. $ctx1.sendIdx["+"]=2;
  8694. //>>excludeEnd("ctx");
  8695. $10=$recv(aString)._size();
  8696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8697. $ctx1.sendIdx["size"]=1;
  8698. //>>excludeEnd("ctx");
  8699. $7=$recv($8).__plus($10);
  8700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8701. $ctx1.sendIdx["+"]=1;
  8702. //>>excludeEnd("ctx");
  8703. $11=$recv($self._collection())._size();
  8704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8705. $ctx1.sendIdx["size"]=2;
  8706. //>>excludeEnd("ctx");
  8707. post=$recv($6)._copyFrom_to_($7,$11);
  8708. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  8709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8710. $ctx1.sendIdx[","]=2;
  8711. //>>excludeEnd("ctx");
  8712. $self._setCollection_($12);
  8713. }
  8714. $14=$self._position();
  8715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8716. $ctx1.sendIdx["position"]=3;
  8717. //>>excludeEnd("ctx");
  8718. $13=$recv($14).__plus($recv(aString)._size());
  8719. $self._position_($13);
  8720. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8721. return self;
  8722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8723. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  8724. //>>excludeEnd("ctx");
  8725. },
  8726. //>>excludeStart("ide", pragmas.excludeIdeData);
  8727. args: ["aString"],
  8728. source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self atEnd ifTrue: [ self setCollection: self collection, aString ] ifFalse: [\x0a\x09\x09pre := self collection copyFrom: 1 to: self position.\x0a\x09\x09post := self collection copyFrom: (self position + 1 + aString size) to: self collection size.\x0a\x09\x09self setCollection: pre, aString, post\x0a\x09].\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  8729. referencedClasses: [],
  8730. //>>excludeEnd("ide");
  8731. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  8732. }),
  8733. $globals.StringStream);
  8734. $core.addMethod(
  8735. $core.method({
  8736. selector: "nextPutString:",
  8737. protocol: "writing",
  8738. fn: function (aString){
  8739. var self=this,$self=this;
  8740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8741. return $core.withContext(function($ctx1) {
  8742. //>>excludeEnd("ctx");
  8743. $self._nextPutAll_(aString);
  8744. return self;
  8745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8746. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  8747. //>>excludeEnd("ctx");
  8748. },
  8749. //>>excludeStart("ide", pragmas.excludeIdeData);
  8750. args: ["aString"],
  8751. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  8752. referencedClasses: [],
  8753. //>>excludeEnd("ide");
  8754. messageSends: ["nextPutAll:"]
  8755. }),
  8756. $globals.StringStream);
  8757. $core.addMethod(
  8758. $core.method({
  8759. selector: "print:",
  8760. protocol: "writing",
  8761. fn: function (anObject){
  8762. var self=this,$self=this;
  8763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8764. return $core.withContext(function($ctx1) {
  8765. //>>excludeEnd("ctx");
  8766. $recv(anObject)._printOn_(self);
  8767. return self;
  8768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8769. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  8770. //>>excludeEnd("ctx");
  8771. },
  8772. //>>excludeStart("ide", pragmas.excludeIdeData);
  8773. args: ["anObject"],
  8774. source: "print: anObject\x0a\x09anObject printOn: self",
  8775. referencedClasses: [],
  8776. //>>excludeEnd("ide");
  8777. messageSends: ["printOn:"]
  8778. }),
  8779. $globals.StringStream);
  8780. $core.addMethod(
  8781. $core.method({
  8782. selector: "printSymbol:",
  8783. protocol: "writing",
  8784. fn: function (anObject){
  8785. var self=this,$self=this;
  8786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8787. return $core.withContext(function($ctx1) {
  8788. //>>excludeEnd("ctx");
  8789. $recv(anObject)._asSymbolPrintOn_(self);
  8790. return self;
  8791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8792. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  8793. //>>excludeEnd("ctx");
  8794. },
  8795. //>>excludeStart("ide", pragmas.excludeIdeData);
  8796. args: ["anObject"],
  8797. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  8798. referencedClasses: [],
  8799. //>>excludeEnd("ide");
  8800. messageSends: ["asSymbolPrintOn:"]
  8801. }),
  8802. $globals.StringStream);
  8803. $core.addMethod(
  8804. $core.method({
  8805. selector: "space",
  8806. protocol: "writing",
  8807. fn: function (){
  8808. var self=this,$self=this;
  8809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8810. return $core.withContext(function($ctx1) {
  8811. //>>excludeEnd("ctx");
  8812. $self._nextPut_(" ");
  8813. return self;
  8814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8815. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  8816. //>>excludeEnd("ctx");
  8817. },
  8818. //>>excludeStart("ide", pragmas.excludeIdeData);
  8819. args: [],
  8820. source: "space\x0a\x09self nextPut: ' '",
  8821. referencedClasses: [],
  8822. //>>excludeEnd("ide");
  8823. messageSends: ["nextPut:"]
  8824. }),
  8825. $globals.StringStream);
  8826. $core.addMethod(
  8827. $core.method({
  8828. selector: "tab",
  8829. protocol: "writing",
  8830. fn: function (){
  8831. var self=this,$self=this;
  8832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8833. return $core.withContext(function($ctx1) {
  8834. //>>excludeEnd("ctx");
  8835. return $self._nextPutAll_($recv($globals.String)._tab());
  8836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8837. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  8838. //>>excludeEnd("ctx");
  8839. },
  8840. //>>excludeStart("ide", pragmas.excludeIdeData);
  8841. args: [],
  8842. source: "tab\x0a\x09^ self nextPutAll: String tab",
  8843. referencedClasses: ["String"],
  8844. //>>excludeEnd("ide");
  8845. messageSends: ["nextPutAll:", "tab"]
  8846. }),
  8847. $globals.StringStream);
  8848. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  8849. //>>excludeStart("ide", pragmas.excludeIdeData);
  8850. $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.";
  8851. //>>excludeEnd("ide");
  8852. $core.addMethod(
  8853. $core.method({
  8854. selector: "initialize",
  8855. protocol: "initialization",
  8856. fn: function (){
  8857. var self=this,$self=this;
  8858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8859. return $core.withContext(function($ctx1) {
  8860. //>>excludeEnd("ctx");
  8861. (
  8862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8863. $ctx1.supercall = true,
  8864. //>>excludeEnd("ctx");
  8865. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  8866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8867. $ctx1.supercall = false;
  8868. //>>excludeEnd("ctx");;
  8869. $self["@read"]=$recv($globals.OrderedCollection)._new();
  8870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8871. $ctx1.sendIdx["new"]=1;
  8872. //>>excludeEnd("ctx");
  8873. $self["@write"]=$recv($globals.OrderedCollection)._new();
  8874. $self["@readIndex"]=(1);
  8875. return self;
  8876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8877. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  8878. //>>excludeEnd("ctx");
  8879. },
  8880. //>>excludeStart("ide", pragmas.excludeIdeData);
  8881. args: [],
  8882. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  8883. referencedClasses: ["OrderedCollection"],
  8884. //>>excludeEnd("ide");
  8885. messageSends: ["initialize", "new"]
  8886. }),
  8887. $globals.Queue);
  8888. $core.addMethod(
  8889. $core.method({
  8890. selector: "next",
  8891. protocol: "accessing",
  8892. fn: function (){
  8893. var self=this,$self=this;
  8894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8895. return $core.withContext(function($ctx1) {
  8896. //>>excludeEnd("ctx");
  8897. return $self._nextIfAbsent_((function(){
  8898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8899. return $core.withContext(function($ctx2) {
  8900. //>>excludeEnd("ctx");
  8901. return $self._error_("Cannot read from empty Queue.");
  8902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8903. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8904. //>>excludeEnd("ctx");
  8905. }));
  8906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8907. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  8908. //>>excludeEnd("ctx");
  8909. },
  8910. //>>excludeStart("ide", pragmas.excludeIdeData);
  8911. args: [],
  8912. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  8913. referencedClasses: [],
  8914. //>>excludeEnd("ide");
  8915. messageSends: ["nextIfAbsent:", "error:"]
  8916. }),
  8917. $globals.Queue);
  8918. $core.addMethod(
  8919. $core.method({
  8920. selector: "nextIfAbsent:",
  8921. protocol: "accessing",
  8922. fn: function (aBlock){
  8923. var self=this,$self=this;
  8924. var result;
  8925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8926. return $core.withContext(function($ctx1) {
  8927. //>>excludeEnd("ctx");
  8928. var $1;
  8929. var $early={};
  8930. try {
  8931. result=$recv($self["@read"])._at_ifAbsent_($self["@readIndex"],(function(){
  8932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8933. return $core.withContext(function($ctx2) {
  8934. //>>excludeEnd("ctx");
  8935. $recv($self["@write"])._ifEmpty_((function(){
  8936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8937. return $core.withContext(function($ctx3) {
  8938. //>>excludeEnd("ctx");
  8939. $1=$recv($self["@readIndex"]).__gt((1));
  8940. if($core.assert($1)){
  8941. $self["@read"]=[];
  8942. $self["@readIndex"]=(1);
  8943. $self["@readIndex"];
  8944. }
  8945. throw $early=[$recv(aBlock)._value()];
  8946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8947. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  8948. //>>excludeEnd("ctx");
  8949. }));
  8950. $self["@read"]=$self["@write"];
  8951. $self["@readIndex"]=(1);
  8952. $self["@write"]=$recv($globals.OrderedCollection)._new();
  8953. return $recv($self["@read"])._first();
  8954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8956. //>>excludeEnd("ctx");
  8957. }));
  8958. $recv($self["@read"])._at_put_($self["@readIndex"],nil);
  8959. $self["@readIndex"]=$recv($self["@readIndex"]).__plus((1));
  8960. return result;
  8961. }
  8962. catch(e) {if(e===$early)return e[0]; throw e}
  8963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8964. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  8965. //>>excludeEnd("ctx");
  8966. },
  8967. //>>excludeStart("ide", pragmas.excludeIdeData);
  8968. args: ["aBlock"],
  8969. 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",
  8970. referencedClasses: ["OrderedCollection"],
  8971. //>>excludeEnd("ide");
  8972. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  8973. }),
  8974. $globals.Queue);
  8975. $core.addMethod(
  8976. $core.method({
  8977. selector: "nextPut:",
  8978. protocol: "accessing",
  8979. fn: function (anObject){
  8980. var self=this,$self=this;
  8981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8982. return $core.withContext(function($ctx1) {
  8983. //>>excludeEnd("ctx");
  8984. $recv($self["@write"])._add_(anObject);
  8985. return self;
  8986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8987. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  8988. //>>excludeEnd("ctx");
  8989. },
  8990. //>>excludeStart("ide", pragmas.excludeIdeData);
  8991. args: ["anObject"],
  8992. source: "nextPut: anObject\x0a\x09write add: anObject",
  8993. referencedClasses: [],
  8994. //>>excludeEnd("ide");
  8995. messageSends: ["add:"]
  8996. }),
  8997. $globals.Queue);
  8998. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  8999. //>>excludeStart("ide", pragmas.excludeIdeData);
  9000. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9001. //>>excludeEnd("ide");
  9002. $core.addMethod(
  9003. $core.method({
  9004. selector: "compile:",
  9005. protocol: "evaluating",
  9006. fn: function (aString){
  9007. var self=this,$self=this;
  9008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9009. return $core.withContext(function($ctx1) {
  9010. //>>excludeEnd("ctx");
  9011. return self.compile(aString);
  9012. return self;
  9013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9014. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  9015. //>>excludeEnd("ctx");
  9016. },
  9017. //>>excludeStart("ide", pragmas.excludeIdeData);
  9018. args: ["aString"],
  9019. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  9020. referencedClasses: [],
  9021. //>>excludeEnd("ide");
  9022. messageSends: []
  9023. }),
  9024. $globals.RegularExpression);
  9025. $core.addMethod(
  9026. $core.method({
  9027. selector: "exec:",
  9028. protocol: "evaluating",
  9029. fn: function (aString){
  9030. var self=this,$self=this;
  9031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9032. return $core.withContext(function($ctx1) {
  9033. //>>excludeEnd("ctx");
  9034. return self.exec(aString) || nil;
  9035. return self;
  9036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9037. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  9038. //>>excludeEnd("ctx");
  9039. },
  9040. //>>excludeStart("ide", pragmas.excludeIdeData);
  9041. args: ["aString"],
  9042. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  9043. referencedClasses: [],
  9044. //>>excludeEnd("ide");
  9045. messageSends: []
  9046. }),
  9047. $globals.RegularExpression);
  9048. $core.addMethod(
  9049. $core.method({
  9050. selector: "test:",
  9051. protocol: "evaluating",
  9052. fn: function (aString){
  9053. var self=this,$self=this;
  9054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9055. return $core.withContext(function($ctx1) {
  9056. //>>excludeEnd("ctx");
  9057. return self.test(aString);
  9058. return self;
  9059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9060. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  9061. //>>excludeEnd("ctx");
  9062. },
  9063. //>>excludeStart("ide", pragmas.excludeIdeData);
  9064. args: ["aString"],
  9065. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  9066. referencedClasses: [],
  9067. //>>excludeEnd("ide");
  9068. messageSends: []
  9069. }),
  9070. $globals.RegularExpression);
  9071. $core.addMethod(
  9072. $core.method({
  9073. selector: "fromString:",
  9074. protocol: "instance creation",
  9075. fn: function (aString){
  9076. var self=this,$self=this;
  9077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9078. return $core.withContext(function($ctx1) {
  9079. //>>excludeEnd("ctx");
  9080. return $self._fromString_flag_(aString,"");
  9081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9082. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.a$cls)});
  9083. //>>excludeEnd("ctx");
  9084. },
  9085. //>>excludeStart("ide", pragmas.excludeIdeData);
  9086. args: ["aString"],
  9087. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9088. referencedClasses: [],
  9089. //>>excludeEnd("ide");
  9090. messageSends: ["fromString:flag:"]
  9091. }),
  9092. $globals.RegularExpression.a$cls);
  9093. $core.addMethod(
  9094. $core.method({
  9095. selector: "fromString:flag:",
  9096. protocol: "instance creation",
  9097. fn: function (aString,anotherString){
  9098. var self=this,$self=this;
  9099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9100. return $core.withContext(function($ctx1) {
  9101. //>>excludeEnd("ctx");
  9102. return new RegExp(aString, anotherString);
  9103. return self;
  9104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9105. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.a$cls)});
  9106. //>>excludeEnd("ctx");
  9107. },
  9108. //>>excludeStart("ide", pragmas.excludeIdeData);
  9109. args: ["aString", "anotherString"],
  9110. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  9111. referencedClasses: [],
  9112. //>>excludeEnd("ide");
  9113. messageSends: []
  9114. }),
  9115. $globals.RegularExpression.a$cls);
  9116. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  9117. $core.addMethod(
  9118. $core.method({
  9119. selector: "at:",
  9120. protocol: "accessing",
  9121. fn: function (anIndex){
  9122. var self=this,$self=this;
  9123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9124. return $core.withContext(function($ctx1) {
  9125. //>>excludeEnd("ctx");
  9126. return $self._at_ifAbsent_(anIndex,(function(){
  9127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9128. return $core.withContext(function($ctx2) {
  9129. //>>excludeEnd("ctx");
  9130. return $self._errorNotFound();
  9131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9132. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9133. //>>excludeEnd("ctx");
  9134. }));
  9135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9136. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.TKeyValueCollection)});
  9137. //>>excludeEnd("ctx");
  9138. },
  9139. //>>excludeStart("ide", pragmas.excludeIdeData);
  9140. args: ["anIndex"],
  9141. 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 ]",
  9142. referencedClasses: [],
  9143. //>>excludeEnd("ide");
  9144. messageSends: ["at:ifAbsent:", "errorNotFound"]
  9145. }),
  9146. $globals.TKeyValueCollection);
  9147. $core.addMethod(
  9148. $core.method({
  9149. selector: "at:ifAbsent:",
  9150. protocol: "accessing",
  9151. fn: function (anIndex,aBlock){
  9152. var self=this,$self=this;
  9153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9154. return $core.withContext(function($ctx1) {
  9155. //>>excludeEnd("ctx");
  9156. $self._subclassResponsibility();
  9157. return self;
  9158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9159. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.TKeyValueCollection)});
  9160. //>>excludeEnd("ctx");
  9161. },
  9162. //>>excludeStart("ide", pragmas.excludeIdeData);
  9163. args: ["anIndex", "aBlock"],
  9164. 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",
  9165. referencedClasses: [],
  9166. //>>excludeEnd("ide");
  9167. messageSends: ["subclassResponsibility"]
  9168. }),
  9169. $globals.TKeyValueCollection);
  9170. $core.addMethod(
  9171. $core.method({
  9172. selector: "at:ifAbsentPut:",
  9173. protocol: "accessing",
  9174. fn: function (aKey,aBlock){
  9175. var self=this,$self=this;
  9176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9177. return $core.withContext(function($ctx1) {
  9178. //>>excludeEnd("ctx");
  9179. return $self._at_ifAbsent_(aKey,(function(){
  9180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9181. return $core.withContext(function($ctx2) {
  9182. //>>excludeEnd("ctx");
  9183. return $self._at_put_(aKey,$recv(aBlock)._value());
  9184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9185. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9186. //>>excludeEnd("ctx");
  9187. }));
  9188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9189. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.TKeyValueCollection)});
  9190. //>>excludeEnd("ctx");
  9191. },
  9192. //>>excludeStart("ide", pragmas.excludeIdeData);
  9193. args: ["aKey", "aBlock"],
  9194. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  9195. referencedClasses: [],
  9196. //>>excludeEnd("ide");
  9197. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  9198. }),
  9199. $globals.TKeyValueCollection);
  9200. $core.addMethod(
  9201. $core.method({
  9202. selector: "at:ifPresent:",
  9203. protocol: "accessing",
  9204. fn: function (anIndex,aBlock){
  9205. var self=this,$self=this;
  9206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9207. return $core.withContext(function($ctx1) {
  9208. //>>excludeEnd("ctx");
  9209. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  9210. return nil;
  9211. }));
  9212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9213. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.TKeyValueCollection)});
  9214. //>>excludeEnd("ctx");
  9215. },
  9216. //>>excludeStart("ide", pragmas.excludeIdeData);
  9217. args: ["anIndex", "aBlock"],
  9218. 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 ]",
  9219. referencedClasses: [],
  9220. //>>excludeEnd("ide");
  9221. messageSends: ["at:ifPresent:ifAbsent:"]
  9222. }),
  9223. $globals.TKeyValueCollection);
  9224. $core.addMethod(
  9225. $core.method({
  9226. selector: "at:ifPresent:ifAbsent:",
  9227. protocol: "accessing",
  9228. fn: function (anIndex,aBlock,anotherBlock){
  9229. var self=this,$self=this;
  9230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9231. return $core.withContext(function($ctx1) {
  9232. //>>excludeEnd("ctx");
  9233. $self._subclassResponsibility();
  9234. return self;
  9235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9236. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TKeyValueCollection)});
  9237. //>>excludeEnd("ctx");
  9238. },
  9239. //>>excludeStart("ide", pragmas.excludeIdeData);
  9240. args: ["anIndex", "aBlock", "anotherBlock"],
  9241. 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",
  9242. referencedClasses: [],
  9243. //>>excludeEnd("ide");
  9244. messageSends: ["subclassResponsibility"]
  9245. }),
  9246. $globals.TKeyValueCollection);
  9247. $core.addMethod(
  9248. $core.method({
  9249. selector: "at:put:",
  9250. protocol: "accessing",
  9251. fn: function (anIndex,anObject){
  9252. var self=this,$self=this;
  9253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9254. return $core.withContext(function($ctx1) {
  9255. //>>excludeEnd("ctx");
  9256. $self._subclassResponsibility();
  9257. return self;
  9258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9259. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.TKeyValueCollection)});
  9260. //>>excludeEnd("ctx");
  9261. },
  9262. //>>excludeStart("ide", pragmas.excludeIdeData);
  9263. args: ["anIndex", "anObject"],
  9264. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  9265. referencedClasses: [],
  9266. //>>excludeEnd("ide");
  9267. messageSends: ["subclassResponsibility"]
  9268. }),
  9269. $globals.TKeyValueCollection);
  9270. $core.addMethod(
  9271. $core.method({
  9272. selector: "indexOf:",
  9273. protocol: "accessing",
  9274. fn: function (anObject){
  9275. var self=this,$self=this;
  9276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9277. return $core.withContext(function($ctx1) {
  9278. //>>excludeEnd("ctx");
  9279. return $self._indexOf_ifAbsent_(anObject,(function(){
  9280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9281. return $core.withContext(function($ctx2) {
  9282. //>>excludeEnd("ctx");
  9283. return $self._errorNotFound();
  9284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9285. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9286. //>>excludeEnd("ctx");
  9287. }));
  9288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9289. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.TKeyValueCollection)});
  9290. //>>excludeEnd("ctx");
  9291. },
  9292. //>>excludeStart("ide", pragmas.excludeIdeData);
  9293. args: ["anObject"],
  9294. 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 ]",
  9295. referencedClasses: [],
  9296. //>>excludeEnd("ide");
  9297. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  9298. }),
  9299. $globals.TKeyValueCollection);
  9300. $core.addMethod(
  9301. $core.method({
  9302. selector: "indexOf:ifAbsent:",
  9303. protocol: "accessing",
  9304. fn: function (anObject,aBlock){
  9305. var self=this,$self=this;
  9306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9307. return $core.withContext(function($ctx1) {
  9308. //>>excludeEnd("ctx");
  9309. $self._subclassResponsibility();
  9310. return self;
  9311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9312. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.TKeyValueCollection)});
  9313. //>>excludeEnd("ctx");
  9314. },
  9315. //>>excludeStart("ide", pragmas.excludeIdeData);
  9316. args: ["anObject", "aBlock"],
  9317. 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",
  9318. referencedClasses: [],
  9319. //>>excludeEnd("ide");
  9320. messageSends: ["subclassResponsibility"]
  9321. }),
  9322. $globals.TKeyValueCollection);
  9323. $core.addMethod(
  9324. $core.method({
  9325. selector: "with:do:",
  9326. protocol: "enumerating",
  9327. fn: function (anotherCollection,aBlock){
  9328. var self=this,$self=this;
  9329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9330. return $core.withContext(function($ctx1) {
  9331. //>>excludeEnd("ctx");
  9332. $self._withIndexDo_((function(each,index){
  9333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9334. return $core.withContext(function($ctx2) {
  9335. //>>excludeEnd("ctx");
  9336. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  9337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9338. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  9339. //>>excludeEnd("ctx");
  9340. }));
  9341. return self;
  9342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9343. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.TKeyValueCollection)});
  9344. //>>excludeEnd("ctx");
  9345. },
  9346. //>>excludeStart("ide", pragmas.excludeIdeData);
  9347. args: ["anotherCollection", "aBlock"],
  9348. 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) ]",
  9349. referencedClasses: [],
  9350. //>>excludeEnd("ide");
  9351. messageSends: ["withIndexDo:", "value:value:", "at:"]
  9352. }),
  9353. $globals.TKeyValueCollection);
  9354. $core.addMethod(
  9355. $core.method({
  9356. selector: "withIndexDo:",
  9357. protocol: "enumerating",
  9358. fn: function (aBlock){
  9359. var self=this,$self=this;
  9360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9361. return $core.withContext(function($ctx1) {
  9362. //>>excludeEnd("ctx");
  9363. $self._subclassResponsibility();
  9364. return self;
  9365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9366. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.TKeyValueCollection)});
  9367. //>>excludeEnd("ctx");
  9368. },
  9369. //>>excludeStart("ide", pragmas.excludeIdeData);
  9370. args: ["aBlock"],
  9371. 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",
  9372. referencedClasses: [],
  9373. //>>excludeEnd("ide");
  9374. messageSends: ["subclassResponsibility"]
  9375. }),
  9376. $globals.TKeyValueCollection);
  9377. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  9378. $core.addMethod(
  9379. $core.method({
  9380. selector: "at:ifAbsent:",
  9381. protocol: "accessing",
  9382. fn: function (anIndex,aBlock){
  9383. var self=this,$self=this;
  9384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9385. return $core.withContext(function($ctx1) {
  9386. //>>excludeEnd("ctx");
  9387. return anIndex >= 1 && anIndex <= self.length
  9388. ? self[anIndex - 1]
  9389. : aBlock._value()
  9390. ;
  9391. return self;
  9392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9393. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9394. //>>excludeEnd("ctx");
  9395. },
  9396. //>>excludeStart("ide", pragmas.excludeIdeData);
  9397. args: ["anIndex", "aBlock"],
  9398. 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'>",
  9399. referencedClasses: [],
  9400. //>>excludeEnd("ide");
  9401. messageSends: []
  9402. }),
  9403. $globals.TNativeZeroBasedCollection);
  9404. $core.addMethod(
  9405. $core.method({
  9406. selector: "at:ifPresent:ifAbsent:",
  9407. protocol: "accessing",
  9408. fn: function (anIndex,aBlock,anotherBlock){
  9409. var self=this,$self=this;
  9410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9411. return $core.withContext(function($ctx1) {
  9412. //>>excludeEnd("ctx");
  9413. return anIndex >= 1 && anIndex <= self.length
  9414. ? aBlock._value_(self[anIndex - 1])
  9415. : anotherBlock._value()
  9416. ;
  9417. return self;
  9418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9419. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TNativeZeroBasedCollection)});
  9420. //>>excludeEnd("ctx");
  9421. },
  9422. //>>excludeStart("ide", pragmas.excludeIdeData);
  9423. args: ["anIndex", "aBlock", "anotherBlock"],
  9424. 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'>",
  9425. referencedClasses: [],
  9426. //>>excludeEnd("ide");
  9427. messageSends: []
  9428. }),
  9429. $globals.TNativeZeroBasedCollection);
  9430. $core.addMethod(
  9431. $core.method({
  9432. selector: "detect:ifNone:",
  9433. protocol: "enumerating",
  9434. fn: function (aBlock,anotherBlock){
  9435. var self=this,$self=this;
  9436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9437. return $core.withContext(function($ctx1) {
  9438. //>>excludeEnd("ctx");
  9439. for(var i = 0; i < self.length; i++)
  9440. if(aBlock._value_(self[i]))
  9441. return self[i];
  9442. return anotherBlock._value();
  9443. ;
  9444. return self;
  9445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9446. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.TNativeZeroBasedCollection)});
  9447. //>>excludeEnd("ctx");
  9448. },
  9449. //>>excludeStart("ide", pragmas.excludeIdeData);
  9450. args: ["aBlock", "anotherBlock"],
  9451. 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'>",
  9452. referencedClasses: [],
  9453. //>>excludeEnd("ide");
  9454. messageSends: []
  9455. }),
  9456. $globals.TNativeZeroBasedCollection);
  9457. $core.addMethod(
  9458. $core.method({
  9459. selector: "do:",
  9460. protocol: "enumerating",
  9461. fn: function (aBlock){
  9462. var self=this,$self=this;
  9463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9464. return $core.withContext(function($ctx1) {
  9465. //>>excludeEnd("ctx");
  9466. for(var i=0; i < self.length; i++) {
  9467. aBlock._value_(self[i]);
  9468. }
  9469. ;
  9470. return self;
  9471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9472. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9473. //>>excludeEnd("ctx");
  9474. },
  9475. //>>excludeStart("ide", pragmas.excludeIdeData);
  9476. args: ["aBlock"],
  9477. 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'>",
  9478. referencedClasses: [],
  9479. //>>excludeEnd("ide");
  9480. messageSends: []
  9481. }),
  9482. $globals.TNativeZeroBasedCollection);
  9483. $core.addMethod(
  9484. $core.method({
  9485. selector: "indexOf:ifAbsent:",
  9486. protocol: "accessing",
  9487. fn: function (anObject,aBlock){
  9488. var self=this,$self=this;
  9489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9490. return $core.withContext(function($ctx1) {
  9491. //>>excludeEnd("ctx");
  9492. for(var i=0; i < self.length; i++) {
  9493. if($recv(self[i]).__eq(anObject)) {return i+1}
  9494. };
  9495. return aBlock._value();
  9496. ;
  9497. return self;
  9498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9499. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9500. //>>excludeEnd("ctx");
  9501. },
  9502. //>>excludeStart("ide", pragmas.excludeIdeData);
  9503. args: ["anObject", "aBlock"],
  9504. 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'>",
  9505. referencedClasses: [],
  9506. //>>excludeEnd("ide");
  9507. messageSends: []
  9508. }),
  9509. $globals.TNativeZeroBasedCollection);
  9510. $core.addMethod(
  9511. $core.method({
  9512. selector: "indexOf:startingAt:ifAbsent:",
  9513. protocol: "accessing",
  9514. fn: function (anObject,start,aBlock){
  9515. var self=this,$self=this;
  9516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9517. return $core.withContext(function($ctx1) {
  9518. //>>excludeEnd("ctx");
  9519. for(var i=start - 1; i < self.length; i++){
  9520. if($recv(self[i]).__eq(anObject)) {return i+1}
  9521. }
  9522. return aBlock._value();
  9523. ;
  9524. return self;
  9525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9526. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9527. //>>excludeEnd("ctx");
  9528. },
  9529. //>>excludeStart("ide", pragmas.excludeIdeData);
  9530. args: ["anObject", "start", "aBlock"],
  9531. 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'>",
  9532. referencedClasses: [],
  9533. //>>excludeEnd("ide");
  9534. messageSends: []
  9535. }),
  9536. $globals.TNativeZeroBasedCollection);
  9537. $core.addMethod(
  9538. $core.method({
  9539. selector: "single",
  9540. protocol: "accessing",
  9541. fn: function (){
  9542. var self=this,$self=this;
  9543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9544. return $core.withContext(function($ctx1) {
  9545. //>>excludeEnd("ctx");
  9546. if (self.length == 0) throw new Error("Collection is empty");
  9547. if (self.length > 1) throw new Error("Collection holds more than one element.");
  9548. return self[0];;
  9549. return self;
  9550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9551. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.TNativeZeroBasedCollection)});
  9552. //>>excludeEnd("ctx");
  9553. },
  9554. //>>excludeStart("ide", pragmas.excludeIdeData);
  9555. args: [],
  9556. 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'>",
  9557. referencedClasses: [],
  9558. //>>excludeEnd("ide");
  9559. messageSends: []
  9560. }),
  9561. $globals.TNativeZeroBasedCollection);
  9562. $core.addMethod(
  9563. $core.method({
  9564. selector: "size",
  9565. protocol: "accessing",
  9566. fn: function (){
  9567. var self=this,$self=this;
  9568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9569. return $core.withContext(function($ctx1) {
  9570. //>>excludeEnd("ctx");
  9571. return self.length;
  9572. return self;
  9573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9574. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.TNativeZeroBasedCollection)});
  9575. //>>excludeEnd("ctx");
  9576. },
  9577. //>>excludeStart("ide", pragmas.excludeIdeData);
  9578. args: [],
  9579. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  9580. referencedClasses: [],
  9581. //>>excludeEnd("ide");
  9582. messageSends: []
  9583. }),
  9584. $globals.TNativeZeroBasedCollection);
  9585. $core.addMethod(
  9586. $core.method({
  9587. selector: "with:do:",
  9588. protocol: "enumerating",
  9589. fn: function (anotherCollection,aBlock){
  9590. var self=this,$self=this;
  9591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9592. return $core.withContext(function($ctx1) {
  9593. //>>excludeEnd("ctx");
  9594. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  9595. for(var i=0; i<self.length; i++) {
  9596. aBlock._value_value_(self[i], anotherCollection[i]);
  9597. }
  9598. ;
  9599. return self;
  9600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9601. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9602. //>>excludeEnd("ctx");
  9603. },
  9604. //>>excludeStart("ide", pragmas.excludeIdeData);
  9605. args: ["anotherCollection", "aBlock"],
  9606. 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'>",
  9607. referencedClasses: [],
  9608. //>>excludeEnd("ide");
  9609. messageSends: []
  9610. }),
  9611. $globals.TNativeZeroBasedCollection);
  9612. $core.addMethod(
  9613. $core.method({
  9614. selector: "withIndexDo:",
  9615. protocol: "enumerating",
  9616. fn: function (aBlock){
  9617. var self=this,$self=this;
  9618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9619. return $core.withContext(function($ctx1) {
  9620. //>>excludeEnd("ctx");
  9621. for(var i=0; i < self.length; i++) {
  9622. aBlock._value_value_(self[i], i+1);
  9623. }
  9624. ;
  9625. return self;
  9626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9627. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9628. //>>excludeEnd("ctx");
  9629. },
  9630. //>>excludeStart("ide", pragmas.excludeIdeData);
  9631. args: ["aBlock"],
  9632. 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'>",
  9633. referencedClasses: [],
  9634. //>>excludeEnd("ide");
  9635. messageSends: []
  9636. }),
  9637. $globals.TNativeZeroBasedCollection);
  9638. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  9639. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  9640. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  9641. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  9642. });