Kernel-Collections.js 329 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115
  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:ifAbsent:",
  4267. protocol: "accessing",
  4268. fn: function (anIndex,aBlock){
  4269. var self=this,$self=this;
  4270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4271. return $core.withContext(function($ctx1) {
  4272. //>>excludeEnd("ctx");
  4273. return anIndex >= 1 && anIndex <= self.length
  4274. ? self[anIndex - 1]
  4275. : aBlock._value()
  4276. ;
  4277. return self;
  4278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4279. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  4280. //>>excludeEnd("ctx");
  4281. },
  4282. //>>excludeStart("ide", pragmas.excludeIdeData);
  4283. args: ["anIndex", "aBlock"],
  4284. 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'>",
  4285. referencedClasses: [],
  4286. //>>excludeEnd("ide");
  4287. messageSends: []
  4288. }),
  4289. $globals.Array);
  4290. $core.addMethod(
  4291. $core.method({
  4292. selector: "at:ifPresent:ifAbsent:",
  4293. protocol: "accessing",
  4294. fn: function (anIndex,aBlock,anotherBlock){
  4295. var self=this,$self=this;
  4296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4297. return $core.withContext(function($ctx1) {
  4298. //>>excludeEnd("ctx");
  4299. return anIndex >= 1 && anIndex <= self.length
  4300. ? aBlock._value_(self[anIndex - 1])
  4301. : anotherBlock._value()
  4302. ;
  4303. return self;
  4304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4305. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  4306. //>>excludeEnd("ctx");
  4307. },
  4308. //>>excludeStart("ide", pragmas.excludeIdeData);
  4309. args: ["anIndex", "aBlock", "anotherBlock"],
  4310. 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'>",
  4311. referencedClasses: [],
  4312. //>>excludeEnd("ide");
  4313. messageSends: []
  4314. }),
  4315. $globals.Array);
  4316. $core.addMethod(
  4317. $core.method({
  4318. selector: "at:put:",
  4319. protocol: "accessing",
  4320. fn: function (anIndex,anObject){
  4321. var self=this,$self=this;
  4322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4323. return $core.withContext(function($ctx1) {
  4324. //>>excludeEnd("ctx");
  4325. return self[anIndex - 1] = anObject;
  4326. return self;
  4327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4328. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  4329. //>>excludeEnd("ctx");
  4330. },
  4331. //>>excludeStart("ide", pragmas.excludeIdeData);
  4332. args: ["anIndex", "anObject"],
  4333. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  4334. referencedClasses: [],
  4335. //>>excludeEnd("ide");
  4336. messageSends: []
  4337. }),
  4338. $globals.Array);
  4339. $core.addMethod(
  4340. $core.method({
  4341. selector: "collect:",
  4342. protocol: "enumerating",
  4343. fn: function (aBlock){
  4344. var self=this,$self=this;
  4345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4346. return $core.withContext(function($ctx1) {
  4347. //>>excludeEnd("ctx");
  4348. return self.map(function(each) {return aBlock._value_(each)});
  4349. return self;
  4350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4351. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  4352. //>>excludeEnd("ctx");
  4353. },
  4354. //>>excludeStart("ide", pragmas.excludeIdeData);
  4355. args: ["aBlock"],
  4356. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  4357. referencedClasses: [],
  4358. //>>excludeEnd("ide");
  4359. messageSends: []
  4360. }),
  4361. $globals.Array);
  4362. $core.addMethod(
  4363. $core.method({
  4364. selector: "copyFrom:to:",
  4365. protocol: "copying",
  4366. fn: function (anIndex,anotherIndex){
  4367. var self=this,$self=this;
  4368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4369. return $core.withContext(function($ctx1) {
  4370. //>>excludeEnd("ctx");
  4371. if (anIndex >= 1 && anotherIndex <= self.length) {
  4372. return self.slice(anIndex - 1, anotherIndex);
  4373. } else {
  4374. self._at_(anIndex);
  4375. self._at_(self.length + 1);
  4376. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4377. };
  4378. return self;
  4379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4380. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  4381. //>>excludeEnd("ctx");
  4382. },
  4383. //>>excludeStart("ide", pragmas.excludeIdeData);
  4384. args: ["anIndex", "anotherIndex"],
  4385. 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'>",
  4386. referencedClasses: [],
  4387. //>>excludeEnd("ide");
  4388. messageSends: []
  4389. }),
  4390. $globals.Array);
  4391. $core.addMethod(
  4392. $core.method({
  4393. selector: "join:",
  4394. protocol: "enumerating",
  4395. fn: function (aString){
  4396. var self=this,$self=this;
  4397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4398. return $core.withContext(function($ctx1) {
  4399. //>>excludeEnd("ctx");
  4400. return self.join(aString);
  4401. return self;
  4402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4403. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  4404. //>>excludeEnd("ctx");
  4405. },
  4406. //>>excludeStart("ide", pragmas.excludeIdeData);
  4407. args: ["aString"],
  4408. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  4409. referencedClasses: [],
  4410. //>>excludeEnd("ide");
  4411. messageSends: []
  4412. }),
  4413. $globals.Array);
  4414. $core.addMethod(
  4415. $core.method({
  4416. selector: "printOn:",
  4417. protocol: "printing",
  4418. fn: function (aStream){
  4419. var self=this,$self=this;
  4420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4421. return $core.withContext(function($ctx1) {
  4422. //>>excludeEnd("ctx");
  4423. (
  4424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4425. $ctx1.supercall = true,
  4426. //>>excludeEnd("ctx");
  4427. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  4428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4429. $ctx1.supercall = false;
  4430. //>>excludeEnd("ctx");;
  4431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4432. $ctx1.sendIdx["printOn:"]=1;
  4433. //>>excludeEnd("ctx");
  4434. $recv(aStream)._nextPutAll_(" (");
  4435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4436. $ctx1.sendIdx["nextPutAll:"]=1;
  4437. //>>excludeEnd("ctx");
  4438. $self._do_separatedBy_((function(each){
  4439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4440. return $core.withContext(function($ctx2) {
  4441. //>>excludeEnd("ctx");
  4442. return $recv(each)._printOn_(aStream);
  4443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4444. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4445. //>>excludeEnd("ctx");
  4446. }),(function(){
  4447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4448. return $core.withContext(function($ctx2) {
  4449. //>>excludeEnd("ctx");
  4450. return $recv(aStream)._nextPutAll_(" ");
  4451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4452. $ctx2.sendIdx["nextPutAll:"]=2;
  4453. //>>excludeEnd("ctx");
  4454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4455. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4456. //>>excludeEnd("ctx");
  4457. }));
  4458. $recv(aStream)._nextPutAll_(")");
  4459. return self;
  4460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4461. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  4462. //>>excludeEnd("ctx");
  4463. },
  4464. //>>excludeStart("ide", pragmas.excludeIdeData);
  4465. args: ["aStream"],
  4466. 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: ')'",
  4467. referencedClasses: [],
  4468. //>>excludeEnd("ide");
  4469. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4470. }),
  4471. $globals.Array);
  4472. $core.addMethod(
  4473. $core.method({
  4474. selector: "remove:ifAbsent:",
  4475. protocol: "adding/removing",
  4476. fn: function (anObject,aBlock){
  4477. var self=this,$self=this;
  4478. var index;
  4479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4480. return $core.withContext(function($ctx1) {
  4481. //>>excludeEnd("ctx");
  4482. var $1;
  4483. index=$self._indexOf_ifAbsent_(anObject,(function(){
  4484. return (0);
  4485. }));
  4486. $1=$recv(index).__eq((0));
  4487. if($core.assert($1)){
  4488. return $recv(aBlock)._value();
  4489. } else {
  4490. $self._removeIndex_(index);
  4491. return anObject;
  4492. }
  4493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4494. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  4495. //>>excludeEnd("ctx");
  4496. },
  4497. //>>excludeStart("ide", pragmas.excludeIdeData);
  4498. args: ["anObject", "aBlock"],
  4499. 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 ]",
  4500. referencedClasses: [],
  4501. //>>excludeEnd("ide");
  4502. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4503. }),
  4504. $globals.Array);
  4505. $core.addMethod(
  4506. $core.method({
  4507. selector: "removeAll",
  4508. protocol: "adding/removing",
  4509. fn: function (){
  4510. var self=this,$self=this;
  4511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4512. return $core.withContext(function($ctx1) {
  4513. //>>excludeEnd("ctx");
  4514. self.length = 0;
  4515. return self;
  4516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4517. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  4518. //>>excludeEnd("ctx");
  4519. },
  4520. //>>excludeStart("ide", pragmas.excludeIdeData);
  4521. args: [],
  4522. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  4523. referencedClasses: [],
  4524. //>>excludeEnd("ide");
  4525. messageSends: []
  4526. }),
  4527. $globals.Array);
  4528. $core.addMethod(
  4529. $core.method({
  4530. selector: "removeFrom:to:",
  4531. protocol: "adding/removing",
  4532. fn: function (aNumber,anotherNumber){
  4533. var self=this,$self=this;
  4534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4535. return $core.withContext(function($ctx1) {
  4536. //>>excludeEnd("ctx");
  4537. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4538. return self;
  4539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4540. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  4541. //>>excludeEnd("ctx");
  4542. },
  4543. //>>excludeStart("ide", pragmas.excludeIdeData);
  4544. args: ["aNumber", "anotherNumber"],
  4545. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  4546. referencedClasses: [],
  4547. //>>excludeEnd("ide");
  4548. messageSends: []
  4549. }),
  4550. $globals.Array);
  4551. $core.addMethod(
  4552. $core.method({
  4553. selector: "removeIndex:",
  4554. protocol: "adding/removing",
  4555. fn: function (anInteger){
  4556. var self=this,$self=this;
  4557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4558. return $core.withContext(function($ctx1) {
  4559. //>>excludeEnd("ctx");
  4560. self.splice(anInteger - 1, 1);
  4561. return self;
  4562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4563. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  4564. //>>excludeEnd("ctx");
  4565. },
  4566. //>>excludeStart("ide", pragmas.excludeIdeData);
  4567. args: ["anInteger"],
  4568. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  4569. referencedClasses: [],
  4570. //>>excludeEnd("ide");
  4571. messageSends: []
  4572. }),
  4573. $globals.Array);
  4574. $core.addMethod(
  4575. $core.method({
  4576. selector: "removeLast",
  4577. protocol: "adding/removing",
  4578. fn: function (){
  4579. var self=this,$self=this;
  4580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4581. return $core.withContext(function($ctx1) {
  4582. //>>excludeEnd("ctx");
  4583. return self.pop();;
  4584. return self;
  4585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4586. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  4587. //>>excludeEnd("ctx");
  4588. },
  4589. //>>excludeStart("ide", pragmas.excludeIdeData);
  4590. args: [],
  4591. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  4592. referencedClasses: [],
  4593. //>>excludeEnd("ide");
  4594. messageSends: []
  4595. }),
  4596. $globals.Array);
  4597. $core.addMethod(
  4598. $core.method({
  4599. selector: "reversed",
  4600. protocol: "converting",
  4601. fn: function (){
  4602. var self=this,$self=this;
  4603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4604. return $core.withContext(function($ctx1) {
  4605. //>>excludeEnd("ctx");
  4606. return self.slice().reverse();
  4607. return self;
  4608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4609. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  4610. //>>excludeEnd("ctx");
  4611. },
  4612. //>>excludeStart("ide", pragmas.excludeIdeData);
  4613. args: [],
  4614. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  4615. referencedClasses: [],
  4616. //>>excludeEnd("ide");
  4617. messageSends: []
  4618. }),
  4619. $globals.Array);
  4620. $core.addMethod(
  4621. $core.method({
  4622. selector: "select:",
  4623. protocol: "enumerating",
  4624. fn: function (aBlock){
  4625. var self=this,$self=this;
  4626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4627. return $core.withContext(function($ctx1) {
  4628. //>>excludeEnd("ctx");
  4629. return self.filter(function(each) {return aBlock._value_(each)});
  4630. return self;
  4631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4632. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  4633. //>>excludeEnd("ctx");
  4634. },
  4635. //>>excludeStart("ide", pragmas.excludeIdeData);
  4636. args: ["aBlock"],
  4637. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  4638. referencedClasses: [],
  4639. //>>excludeEnd("ide");
  4640. messageSends: []
  4641. }),
  4642. $globals.Array);
  4643. $core.addMethod(
  4644. $core.method({
  4645. selector: "shallowCopy",
  4646. protocol: "copying",
  4647. fn: function (){
  4648. var self=this,$self=this;
  4649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4650. return $core.withContext(function($ctx1) {
  4651. //>>excludeEnd("ctx");
  4652. return self.slice();
  4653. return self;
  4654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4655. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  4656. //>>excludeEnd("ctx");
  4657. },
  4658. //>>excludeStart("ide", pragmas.excludeIdeData);
  4659. args: [],
  4660. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  4661. referencedClasses: [],
  4662. //>>excludeEnd("ide");
  4663. messageSends: []
  4664. }),
  4665. $globals.Array);
  4666. $core.addMethod(
  4667. $core.method({
  4668. selector: "size",
  4669. protocol: "accessing",
  4670. fn: function (){
  4671. var self=this,$self=this;
  4672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4673. return $core.withContext(function($ctx1) {
  4674. //>>excludeEnd("ctx");
  4675. return self.length;
  4676. return self;
  4677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4678. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  4679. //>>excludeEnd("ctx");
  4680. },
  4681. //>>excludeStart("ide", pragmas.excludeIdeData);
  4682. args: [],
  4683. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  4684. referencedClasses: [],
  4685. //>>excludeEnd("ide");
  4686. messageSends: []
  4687. }),
  4688. $globals.Array);
  4689. $core.addMethod(
  4690. $core.method({
  4691. selector: "sort",
  4692. protocol: "enumerating",
  4693. fn: function (){
  4694. var self=this,$self=this;
  4695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4696. return $core.withContext(function($ctx1) {
  4697. //>>excludeEnd("ctx");
  4698. return $self._sort_((function(a,b){
  4699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4700. return $core.withContext(function($ctx2) {
  4701. //>>excludeEnd("ctx");
  4702. return $recv(a).__lt(b);
  4703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4704. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  4705. //>>excludeEnd("ctx");
  4706. }));
  4707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4708. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  4709. //>>excludeEnd("ctx");
  4710. },
  4711. //>>excludeStart("ide", pragmas.excludeIdeData);
  4712. args: [],
  4713. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  4714. referencedClasses: [],
  4715. //>>excludeEnd("ide");
  4716. messageSends: ["sort:", "<"]
  4717. }),
  4718. $globals.Array);
  4719. $core.addMethod(
  4720. $core.method({
  4721. selector: "sort:",
  4722. protocol: "enumerating",
  4723. fn: function (aBlock){
  4724. var self=this,$self=this;
  4725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4726. return $core.withContext(function($ctx1) {
  4727. //>>excludeEnd("ctx");
  4728. return self.sort(function(a, b) {
  4729. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  4730. })
  4731. ;
  4732. return self;
  4733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4734. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  4735. //>>excludeEnd("ctx");
  4736. },
  4737. //>>excludeStart("ide", pragmas.excludeIdeData);
  4738. args: ["aBlock"],
  4739. 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'>",
  4740. referencedClasses: [],
  4741. //>>excludeEnd("ide");
  4742. messageSends: []
  4743. }),
  4744. $globals.Array);
  4745. $core.addMethod(
  4746. $core.method({
  4747. selector: "sorted",
  4748. protocol: "enumerating",
  4749. fn: function (){
  4750. var self=this,$self=this;
  4751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4752. return $core.withContext(function($ctx1) {
  4753. //>>excludeEnd("ctx");
  4754. return $recv($self._copy())._sort();
  4755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4756. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  4757. //>>excludeEnd("ctx");
  4758. },
  4759. //>>excludeStart("ide", pragmas.excludeIdeData);
  4760. args: [],
  4761. source: "sorted\x0a\x09^ self copy sort",
  4762. referencedClasses: [],
  4763. //>>excludeEnd("ide");
  4764. messageSends: ["sort", "copy"]
  4765. }),
  4766. $globals.Array);
  4767. $core.addMethod(
  4768. $core.method({
  4769. selector: "sorted:",
  4770. protocol: "enumerating",
  4771. fn: function (aBlock){
  4772. var self=this,$self=this;
  4773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4774. return $core.withContext(function($ctx1) {
  4775. //>>excludeEnd("ctx");
  4776. return $recv($self._copy())._sort_(aBlock);
  4777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4778. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  4779. //>>excludeEnd("ctx");
  4780. },
  4781. //>>excludeStart("ide", pragmas.excludeIdeData);
  4782. args: ["aBlock"],
  4783. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  4784. referencedClasses: [],
  4785. //>>excludeEnd("ide");
  4786. messageSends: ["sort:", "copy"]
  4787. }),
  4788. $globals.Array);
  4789. $core.addMethod(
  4790. $core.method({
  4791. selector: "new:",
  4792. protocol: "instance creation",
  4793. fn: function (anInteger){
  4794. var self=this,$self=this;
  4795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4796. return $core.withContext(function($ctx1) {
  4797. //>>excludeEnd("ctx");
  4798. return new Array(anInteger);
  4799. return self;
  4800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4801. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.a$cls)});
  4802. //>>excludeEnd("ctx");
  4803. },
  4804. //>>excludeStart("ide", pragmas.excludeIdeData);
  4805. args: ["anInteger"],
  4806. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  4807. referencedClasses: [],
  4808. //>>excludeEnd("ide");
  4809. messageSends: []
  4810. }),
  4811. $globals.Array.a$cls);
  4812. $core.addMethod(
  4813. $core.method({
  4814. selector: "with:",
  4815. protocol: "instance creation",
  4816. fn: function (anObject){
  4817. var self=this,$self=this;
  4818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4819. return $core.withContext(function($ctx1) {
  4820. //>>excludeEnd("ctx");
  4821. var $1;
  4822. $1=$self._new_((1));
  4823. $recv($1)._at_put_((1),anObject);
  4824. return $recv($1)._yourself();
  4825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4826. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.a$cls)});
  4827. //>>excludeEnd("ctx");
  4828. },
  4829. //>>excludeStart("ide", pragmas.excludeIdeData);
  4830. args: ["anObject"],
  4831. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  4832. referencedClasses: [],
  4833. //>>excludeEnd("ide");
  4834. messageSends: ["at:put:", "new:", "yourself"]
  4835. }),
  4836. $globals.Array.a$cls);
  4837. $core.addMethod(
  4838. $core.method({
  4839. selector: "with:with:",
  4840. protocol: "instance creation",
  4841. fn: function (anObject,anObject2){
  4842. var self=this,$self=this;
  4843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4844. return $core.withContext(function($ctx1) {
  4845. //>>excludeEnd("ctx");
  4846. var $1;
  4847. $1=$self._new_((2));
  4848. $recv($1)._at_put_((1),anObject);
  4849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4850. $ctx1.sendIdx["at:put:"]=1;
  4851. //>>excludeEnd("ctx");
  4852. $recv($1)._at_put_((2),anObject2);
  4853. return $recv($1)._yourself();
  4854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4855. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.a$cls)});
  4856. //>>excludeEnd("ctx");
  4857. },
  4858. //>>excludeStart("ide", pragmas.excludeIdeData);
  4859. args: ["anObject", "anObject2"],
  4860. 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",
  4861. referencedClasses: [],
  4862. //>>excludeEnd("ide");
  4863. messageSends: ["at:put:", "new:", "yourself"]
  4864. }),
  4865. $globals.Array.a$cls);
  4866. $core.addMethod(
  4867. $core.method({
  4868. selector: "with:with:with:",
  4869. protocol: "instance creation",
  4870. fn: function (anObject,anObject2,anObject3){
  4871. var self=this,$self=this;
  4872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4873. return $core.withContext(function($ctx1) {
  4874. //>>excludeEnd("ctx");
  4875. var $1;
  4876. $1=$self._new_((3));
  4877. $recv($1)._at_put_((1),anObject);
  4878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4879. $ctx1.sendIdx["at:put:"]=1;
  4880. //>>excludeEnd("ctx");
  4881. $recv($1)._at_put_((2),anObject2);
  4882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4883. $ctx1.sendIdx["at:put:"]=2;
  4884. //>>excludeEnd("ctx");
  4885. $recv($1)._at_put_((3),anObject3);
  4886. return $recv($1)._yourself();
  4887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4888. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.a$cls)});
  4889. //>>excludeEnd("ctx");
  4890. },
  4891. //>>excludeStart("ide", pragmas.excludeIdeData);
  4892. args: ["anObject", "anObject2", "anObject3"],
  4893. 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",
  4894. referencedClasses: [],
  4895. //>>excludeEnd("ide");
  4896. messageSends: ["at:put:", "new:", "yourself"]
  4897. }),
  4898. $globals.Array.a$cls);
  4899. $core.addMethod(
  4900. $core.method({
  4901. selector: "withAll:",
  4902. protocol: "instance creation",
  4903. fn: function (aCollection){
  4904. var self=this,$self=this;
  4905. var instance,index;
  4906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4907. return $core.withContext(function($ctx1) {
  4908. //>>excludeEnd("ctx");
  4909. index=(1);
  4910. instance=$self._new_($recv(aCollection)._size());
  4911. $recv(aCollection)._do_((function(each){
  4912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4913. return $core.withContext(function($ctx2) {
  4914. //>>excludeEnd("ctx");
  4915. $recv(instance)._at_put_(index,each);
  4916. index=$recv(index).__plus((1));
  4917. return index;
  4918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4919. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4920. //>>excludeEnd("ctx");
  4921. }));
  4922. return instance;
  4923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4924. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.a$cls)});
  4925. //>>excludeEnd("ctx");
  4926. },
  4927. //>>excludeStart("ide", pragmas.excludeIdeData);
  4928. args: ["aCollection"],
  4929. 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",
  4930. referencedClasses: [],
  4931. //>>excludeEnd("ide");
  4932. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  4933. }),
  4934. $globals.Array.a$cls);
  4935. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  4936. //>>excludeStart("ide", pragmas.excludeIdeData);
  4937. $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 >> #,`";
  4938. //>>excludeEnd("ide");
  4939. $core.addMethod(
  4940. $core.method({
  4941. selector: ",",
  4942. protocol: "copying",
  4943. fn: function (aString){
  4944. var self=this,$self=this;
  4945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4946. return $core.withContext(function($ctx1) {
  4947. //>>excludeEnd("ctx");
  4948. return String(self) + aString;
  4949. return self;
  4950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4951. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  4952. //>>excludeEnd("ctx");
  4953. },
  4954. //>>excludeStart("ide", pragmas.excludeIdeData);
  4955. args: ["aString"],
  4956. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  4957. referencedClasses: [],
  4958. //>>excludeEnd("ide");
  4959. messageSends: []
  4960. }),
  4961. $globals.String);
  4962. $core.addMethod(
  4963. $core.method({
  4964. selector: "<",
  4965. protocol: "comparing",
  4966. fn: function (aString){
  4967. var self=this,$self=this;
  4968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4969. return $core.withContext(function($ctx1) {
  4970. //>>excludeEnd("ctx");
  4971. return String(self) < aString._asString();
  4972. return self;
  4973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4974. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  4975. //>>excludeEnd("ctx");
  4976. },
  4977. //>>excludeStart("ide", pragmas.excludeIdeData);
  4978. args: ["aString"],
  4979. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  4980. referencedClasses: [],
  4981. //>>excludeEnd("ide");
  4982. messageSends: []
  4983. }),
  4984. $globals.String);
  4985. $core.addMethod(
  4986. $core.method({
  4987. selector: "<=",
  4988. protocol: "comparing",
  4989. fn: function (aString){
  4990. var self=this,$self=this;
  4991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4992. return $core.withContext(function($ctx1) {
  4993. //>>excludeEnd("ctx");
  4994. return String(self) <= aString._asString();
  4995. return self;
  4996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4997. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  4998. //>>excludeEnd("ctx");
  4999. },
  5000. //>>excludeStart("ide", pragmas.excludeIdeData);
  5001. args: ["aString"],
  5002. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  5003. referencedClasses: [],
  5004. //>>excludeEnd("ide");
  5005. messageSends: []
  5006. }),
  5007. $globals.String);
  5008. $core.addMethod(
  5009. $core.method({
  5010. selector: "=",
  5011. protocol: "comparing",
  5012. fn: function (aString){
  5013. var self=this,$self=this;
  5014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5015. return $core.withContext(function($ctx1) {
  5016. //>>excludeEnd("ctx");
  5017. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  5018. return self;
  5019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5020. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  5021. //>>excludeEnd("ctx");
  5022. },
  5023. //>>excludeStart("ide", pragmas.excludeIdeData);
  5024. args: ["aString"],
  5025. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  5026. referencedClasses: [],
  5027. //>>excludeEnd("ide");
  5028. messageSends: []
  5029. }),
  5030. $globals.String);
  5031. $core.addMethod(
  5032. $core.method({
  5033. selector: "==",
  5034. protocol: "comparing",
  5035. fn: function (aString){
  5036. var self=this,$self=this;
  5037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5038. return $core.withContext(function($ctx1) {
  5039. //>>excludeEnd("ctx");
  5040. if (typeof aString === "string") return String(self) === aString;
  5041. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  5042. else return false;;
  5043. return self;
  5044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5045. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  5046. //>>excludeEnd("ctx");
  5047. },
  5048. //>>excludeStart("ide", pragmas.excludeIdeData);
  5049. args: ["aString"],
  5050. 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'>",
  5051. referencedClasses: [],
  5052. //>>excludeEnd("ide");
  5053. messageSends: []
  5054. }),
  5055. $globals.String);
  5056. $core.addMethod(
  5057. $core.method({
  5058. selector: ">",
  5059. protocol: "comparing",
  5060. fn: function (aString){
  5061. var self=this,$self=this;
  5062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5063. return $core.withContext(function($ctx1) {
  5064. //>>excludeEnd("ctx");
  5065. return String(self) > aString._asString();
  5066. return self;
  5067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5068. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  5069. //>>excludeEnd("ctx");
  5070. },
  5071. //>>excludeStart("ide", pragmas.excludeIdeData);
  5072. args: ["aString"],
  5073. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  5074. referencedClasses: [],
  5075. //>>excludeEnd("ide");
  5076. messageSends: []
  5077. }),
  5078. $globals.String);
  5079. $core.addMethod(
  5080. $core.method({
  5081. selector: ">=",
  5082. protocol: "comparing",
  5083. fn: function (aString){
  5084. var self=this,$self=this;
  5085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5086. return $core.withContext(function($ctx1) {
  5087. //>>excludeEnd("ctx");
  5088. return String(self) >= aString._asString();
  5089. return self;
  5090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5091. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  5092. //>>excludeEnd("ctx");
  5093. },
  5094. //>>excludeStart("ide", pragmas.excludeIdeData);
  5095. args: ["aString"],
  5096. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  5097. referencedClasses: [],
  5098. //>>excludeEnd("ide");
  5099. messageSends: []
  5100. }),
  5101. $globals.String);
  5102. $core.addMethod(
  5103. $core.method({
  5104. selector: "add:",
  5105. protocol: "adding/removing",
  5106. fn: function (anObject){
  5107. var self=this,$self=this;
  5108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5109. return $core.withContext(function($ctx1) {
  5110. //>>excludeEnd("ctx");
  5111. $self._errorReadOnly();
  5112. return self;
  5113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5114. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.String)});
  5115. //>>excludeEnd("ctx");
  5116. },
  5117. //>>excludeStart("ide", pragmas.excludeIdeData);
  5118. args: ["anObject"],
  5119. source: "add: anObject\x0a\x09self errorReadOnly",
  5120. referencedClasses: [],
  5121. //>>excludeEnd("ide");
  5122. messageSends: ["errorReadOnly"]
  5123. }),
  5124. $globals.String);
  5125. $core.addMethod(
  5126. $core.method({
  5127. selector: "asJavaScriptMethodName",
  5128. protocol: "converting",
  5129. fn: function (){
  5130. var self=this,$self=this;
  5131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5132. return $core.withContext(function($ctx1) {
  5133. //>>excludeEnd("ctx");
  5134. return $core.st2js(self);
  5135. return self;
  5136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5137. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  5138. //>>excludeEnd("ctx");
  5139. },
  5140. //>>excludeStart("ide", pragmas.excludeIdeData);
  5141. args: [],
  5142. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  5143. referencedClasses: [],
  5144. //>>excludeEnd("ide");
  5145. messageSends: []
  5146. }),
  5147. $globals.String);
  5148. $core.addMethod(
  5149. $core.method({
  5150. selector: "asJavaScriptObject",
  5151. protocol: "converting",
  5152. fn: function (){
  5153. var self=this,$self=this;
  5154. return self;
  5155. },
  5156. //>>excludeStart("ide", pragmas.excludeIdeData);
  5157. args: [],
  5158. source: "asJavaScriptObject\x0a\x09^ self",
  5159. referencedClasses: [],
  5160. //>>excludeEnd("ide");
  5161. messageSends: []
  5162. }),
  5163. $globals.String);
  5164. $core.addMethod(
  5165. $core.method({
  5166. selector: "asJavaScriptSource",
  5167. protocol: "converting",
  5168. fn: function (){
  5169. var self=this,$self=this;
  5170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5171. return $core.withContext(function($ctx1) {
  5172. //>>excludeEnd("ctx");
  5173. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5174. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5175. else
  5176. return "\"" + self + "\"";
  5177. ;
  5178. return self;
  5179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5180. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  5181. //>>excludeEnd("ctx");
  5182. },
  5183. //>>excludeStart("ide", pragmas.excludeIdeData);
  5184. args: [],
  5185. 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'>",
  5186. referencedClasses: [],
  5187. //>>excludeEnd("ide");
  5188. messageSends: []
  5189. }),
  5190. $globals.String);
  5191. $core.addMethod(
  5192. $core.method({
  5193. selector: "asLowercase",
  5194. protocol: "converting",
  5195. fn: function (){
  5196. var self=this,$self=this;
  5197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5198. return $core.withContext(function($ctx1) {
  5199. //>>excludeEnd("ctx");
  5200. return self.toLowerCase();
  5201. return self;
  5202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5203. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  5204. //>>excludeEnd("ctx");
  5205. },
  5206. //>>excludeStart("ide", pragmas.excludeIdeData);
  5207. args: [],
  5208. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  5209. referencedClasses: [],
  5210. //>>excludeEnd("ide");
  5211. messageSends: []
  5212. }),
  5213. $globals.String);
  5214. $core.addMethod(
  5215. $core.method({
  5216. selector: "asMutator",
  5217. protocol: "converting",
  5218. fn: function (){
  5219. var self=this,$self=this;
  5220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5221. return $core.withContext(function($ctx1) {
  5222. //>>excludeEnd("ctx");
  5223. var $1;
  5224. $1=$recv($self._last()).__eq(":");
  5225. if(!$core.assert($1)){
  5226. return $self.__comma(":");
  5227. }
  5228. return self;
  5229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5230. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  5231. //>>excludeEnd("ctx");
  5232. },
  5233. //>>excludeStart("ide", pragmas.excludeIdeData);
  5234. args: [],
  5235. 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",
  5236. referencedClasses: [],
  5237. //>>excludeEnd("ide");
  5238. messageSends: ["ifFalse:", "=", "last", ","]
  5239. }),
  5240. $globals.String);
  5241. $core.addMethod(
  5242. $core.method({
  5243. selector: "asNumber",
  5244. protocol: "converting",
  5245. fn: function (){
  5246. var self=this,$self=this;
  5247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5248. return $core.withContext(function($ctx1) {
  5249. //>>excludeEnd("ctx");
  5250. return Number(self);
  5251. return self;
  5252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5253. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  5254. //>>excludeEnd("ctx");
  5255. },
  5256. //>>excludeStart("ide", pragmas.excludeIdeData);
  5257. args: [],
  5258. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  5259. referencedClasses: [],
  5260. //>>excludeEnd("ide");
  5261. messageSends: []
  5262. }),
  5263. $globals.String);
  5264. $core.addMethod(
  5265. $core.method({
  5266. selector: "asRegexp",
  5267. protocol: "converting",
  5268. fn: function (){
  5269. var self=this,$self=this;
  5270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5271. return $core.withContext(function($ctx1) {
  5272. //>>excludeEnd("ctx");
  5273. return $recv($globals.RegularExpression)._fromString_(self);
  5274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5275. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  5276. //>>excludeEnd("ctx");
  5277. },
  5278. //>>excludeStart("ide", pragmas.excludeIdeData);
  5279. args: [],
  5280. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  5281. referencedClasses: ["RegularExpression"],
  5282. //>>excludeEnd("ide");
  5283. messageSends: ["fromString:"]
  5284. }),
  5285. $globals.String);
  5286. $core.addMethod(
  5287. $core.method({
  5288. selector: "asString",
  5289. protocol: "converting",
  5290. fn: function (){
  5291. var self=this,$self=this;
  5292. return self;
  5293. },
  5294. //>>excludeStart("ide", pragmas.excludeIdeData);
  5295. args: [],
  5296. source: "asString\x0a\x09^ self",
  5297. referencedClasses: [],
  5298. //>>excludeEnd("ide");
  5299. messageSends: []
  5300. }),
  5301. $globals.String);
  5302. $core.addMethod(
  5303. $core.method({
  5304. selector: "asSymbol",
  5305. protocol: "converting",
  5306. fn: function (){
  5307. var self=this,$self=this;
  5308. return self;
  5309. },
  5310. //>>excludeStart("ide", pragmas.excludeIdeData);
  5311. args: [],
  5312. source: "asSymbol\x0a\x09^ self",
  5313. referencedClasses: [],
  5314. //>>excludeEnd("ide");
  5315. messageSends: []
  5316. }),
  5317. $globals.String);
  5318. $core.addMethod(
  5319. $core.method({
  5320. selector: "asSymbolPrintOn:",
  5321. protocol: "printing",
  5322. fn: function (aStream){
  5323. var self=this,$self=this;
  5324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5325. return $core.withContext(function($ctx1) {
  5326. //>>excludeEnd("ctx");
  5327. var $1;
  5328. $recv(aStream)._nextPutAll_("#");
  5329. $1=$recv($self._asString())._isSelector();
  5330. if($core.assert($1)){
  5331. $recv(aStream)._nextPut_(self);
  5332. } else {
  5333. $self._printOn_(aStream);
  5334. }
  5335. return self;
  5336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5337. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.String)});
  5338. //>>excludeEnd("ctx");
  5339. },
  5340. //>>excludeStart("ide", pragmas.excludeIdeData);
  5341. args: ["aStream"],
  5342. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  5343. referencedClasses: [],
  5344. //>>excludeEnd("ide");
  5345. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  5346. }),
  5347. $globals.String);
  5348. $core.addMethod(
  5349. $core.method({
  5350. selector: "asUppercase",
  5351. protocol: "converting",
  5352. fn: function (){
  5353. var self=this,$self=this;
  5354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5355. return $core.withContext(function($ctx1) {
  5356. //>>excludeEnd("ctx");
  5357. return self.toUpperCase();
  5358. return self;
  5359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5360. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  5361. //>>excludeEnd("ctx");
  5362. },
  5363. //>>excludeStart("ide", pragmas.excludeIdeData);
  5364. args: [],
  5365. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  5366. referencedClasses: [],
  5367. //>>excludeEnd("ide");
  5368. messageSends: []
  5369. }),
  5370. $globals.String);
  5371. $core.addMethod(
  5372. $core.method({
  5373. selector: "asciiValue",
  5374. protocol: "accessing",
  5375. fn: function (){
  5376. var self=this,$self=this;
  5377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5378. return $core.withContext(function($ctx1) {
  5379. //>>excludeEnd("ctx");
  5380. return self.charCodeAt(0);;
  5381. return self;
  5382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5383. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  5384. //>>excludeEnd("ctx");
  5385. },
  5386. //>>excludeStart("ide", pragmas.excludeIdeData);
  5387. args: [],
  5388. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  5389. referencedClasses: [],
  5390. //>>excludeEnd("ide");
  5391. messageSends: []
  5392. }),
  5393. $globals.String);
  5394. $core.addMethod(
  5395. $core.method({
  5396. selector: "at:ifAbsent:",
  5397. protocol: "accessing",
  5398. fn: function (anIndex,aBlock){
  5399. var self=this,$self=this;
  5400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5401. return $core.withContext(function($ctx1) {
  5402. //>>excludeEnd("ctx");
  5403. return String(self)[anIndex - 1] || aBlock._value();
  5404. return self;
  5405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5406. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  5407. //>>excludeEnd("ctx");
  5408. },
  5409. //>>excludeStart("ide", pragmas.excludeIdeData);
  5410. args: ["anIndex", "aBlock"],
  5411. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  5412. referencedClasses: [],
  5413. //>>excludeEnd("ide");
  5414. messageSends: []
  5415. }),
  5416. $globals.String);
  5417. $core.addMethod(
  5418. $core.method({
  5419. selector: "at:ifPresent:ifAbsent:",
  5420. protocol: "accessing",
  5421. fn: function (anIndex,aBlock,anotherBlock){
  5422. var self=this,$self=this;
  5423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5424. return $core.withContext(function($ctx1) {
  5425. //>>excludeEnd("ctx");
  5426. var result = String(self)[anIndex - 1];
  5427. return result ? aBlock._value_(result) : anotherBlock._value();
  5428. ;
  5429. return self;
  5430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5431. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  5432. //>>excludeEnd("ctx");
  5433. },
  5434. //>>excludeStart("ide", pragmas.excludeIdeData);
  5435. args: ["anIndex", "aBlock", "anotherBlock"],
  5436. 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'>",
  5437. referencedClasses: [],
  5438. //>>excludeEnd("ide");
  5439. messageSends: []
  5440. }),
  5441. $globals.String);
  5442. $core.addMethod(
  5443. $core.method({
  5444. selector: "at:put:",
  5445. protocol: "accessing",
  5446. fn: function (anIndex,anObject){
  5447. var self=this,$self=this;
  5448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5449. return $core.withContext(function($ctx1) {
  5450. //>>excludeEnd("ctx");
  5451. $self._errorReadOnly();
  5452. return self;
  5453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5454. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.String)});
  5455. //>>excludeEnd("ctx");
  5456. },
  5457. //>>excludeStart("ide", pragmas.excludeIdeData);
  5458. args: ["anIndex", "anObject"],
  5459. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5460. referencedClasses: [],
  5461. //>>excludeEnd("ide");
  5462. messageSends: ["errorReadOnly"]
  5463. }),
  5464. $globals.String);
  5465. $core.addMethod(
  5466. $core.method({
  5467. selector: "capitalized",
  5468. protocol: "converting",
  5469. fn: function (){
  5470. var self=this,$self=this;
  5471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5472. return $core.withContext(function($ctx1) {
  5473. //>>excludeEnd("ctx");
  5474. return $self._ifNotEmpty_((function(){
  5475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5476. return $core.withContext(function($ctx2) {
  5477. //>>excludeEnd("ctx");
  5478. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  5479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5481. //>>excludeEnd("ctx");
  5482. }));
  5483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5484. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  5485. //>>excludeEnd("ctx");
  5486. },
  5487. //>>excludeStart("ide", pragmas.excludeIdeData);
  5488. args: [],
  5489. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  5490. referencedClasses: [],
  5491. //>>excludeEnd("ide");
  5492. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  5493. }),
  5494. $globals.String);
  5495. $core.addMethod(
  5496. $core.method({
  5497. selector: "charCodeAt:",
  5498. protocol: "accessing",
  5499. fn: function (anInteger){
  5500. var self=this,$self=this;
  5501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5502. return $core.withContext(function($ctx1) {
  5503. //>>excludeEnd("ctx");
  5504. return self.charCodeAt(anInteger - 1);
  5505. return self;
  5506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5507. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  5508. //>>excludeEnd("ctx");
  5509. },
  5510. //>>excludeStart("ide", pragmas.excludeIdeData);
  5511. args: ["anInteger"],
  5512. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  5513. referencedClasses: [],
  5514. //>>excludeEnd("ide");
  5515. messageSends: []
  5516. }),
  5517. $globals.String);
  5518. $core.addMethod(
  5519. $core.method({
  5520. selector: "copyFrom:to:",
  5521. protocol: "copying",
  5522. fn: function (anIndex,anotherIndex){
  5523. var self=this,$self=this;
  5524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5525. return $core.withContext(function($ctx1) {
  5526. //>>excludeEnd("ctx");
  5527. return self.substring(anIndex - 1, anotherIndex);
  5528. return self;
  5529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5530. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  5531. //>>excludeEnd("ctx");
  5532. },
  5533. //>>excludeStart("ide", pragmas.excludeIdeData);
  5534. args: ["anIndex", "anotherIndex"],
  5535. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  5536. referencedClasses: [],
  5537. //>>excludeEnd("ide");
  5538. messageSends: []
  5539. }),
  5540. $globals.String);
  5541. $core.addMethod(
  5542. $core.method({
  5543. selector: "crlfSanitized",
  5544. protocol: "converting",
  5545. fn: function (){
  5546. var self=this,$self=this;
  5547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5548. return $core.withContext(function($ctx1) {
  5549. //>>excludeEnd("ctx");
  5550. return $recv($self._lines())._join_($recv($globals.String)._lf());
  5551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5552. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  5553. //>>excludeEnd("ctx");
  5554. },
  5555. //>>excludeStart("ide", pragmas.excludeIdeData);
  5556. args: [],
  5557. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  5558. referencedClasses: ["String"],
  5559. //>>excludeEnd("ide");
  5560. messageSends: ["join:", "lines", "lf"]
  5561. }),
  5562. $globals.String);
  5563. $core.addMethod(
  5564. $core.method({
  5565. selector: "deepCopy",
  5566. protocol: "copying",
  5567. fn: function (){
  5568. var self=this,$self=this;
  5569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5570. return $core.withContext(function($ctx1) {
  5571. //>>excludeEnd("ctx");
  5572. return $self._shallowCopy();
  5573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5574. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  5575. //>>excludeEnd("ctx");
  5576. },
  5577. //>>excludeStart("ide", pragmas.excludeIdeData);
  5578. args: [],
  5579. source: "deepCopy\x0a\x09^ self shallowCopy",
  5580. referencedClasses: [],
  5581. //>>excludeEnd("ide");
  5582. messageSends: ["shallowCopy"]
  5583. }),
  5584. $globals.String);
  5585. $core.addMethod(
  5586. $core.method({
  5587. selector: "errorReadOnly",
  5588. protocol: "error handling",
  5589. fn: function (){
  5590. var self=this,$self=this;
  5591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5592. return $core.withContext(function($ctx1) {
  5593. //>>excludeEnd("ctx");
  5594. $self._error_("Object is read-only");
  5595. return self;
  5596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5597. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.String)});
  5598. //>>excludeEnd("ctx");
  5599. },
  5600. //>>excludeStart("ide", pragmas.excludeIdeData);
  5601. args: [],
  5602. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5603. referencedClasses: [],
  5604. //>>excludeEnd("ide");
  5605. messageSends: ["error:"]
  5606. }),
  5607. $globals.String);
  5608. $core.addMethod(
  5609. $core.method({
  5610. selector: "escaped",
  5611. protocol: "converting",
  5612. fn: function (){
  5613. var self=this,$self=this;
  5614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5615. return $core.withContext(function($ctx1) {
  5616. //>>excludeEnd("ctx");
  5617. return escape(self);
  5618. return self;
  5619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5620. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  5621. //>>excludeEnd("ctx");
  5622. },
  5623. //>>excludeStart("ide", pragmas.excludeIdeData);
  5624. args: [],
  5625. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  5626. referencedClasses: [],
  5627. //>>excludeEnd("ide");
  5628. messageSends: []
  5629. }),
  5630. $globals.String);
  5631. $core.addMethod(
  5632. $core.method({
  5633. selector: "includesSubString:",
  5634. protocol: "testing",
  5635. fn: function (subString){
  5636. var self=this,$self=this;
  5637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5638. return $core.withContext(function($ctx1) {
  5639. //>>excludeEnd("ctx");
  5640. return self.indexOf(subString) != -1;
  5641. return self;
  5642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5643. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  5644. //>>excludeEnd("ctx");
  5645. },
  5646. //>>excludeStart("ide", pragmas.excludeIdeData);
  5647. args: ["subString"],
  5648. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  5649. referencedClasses: [],
  5650. //>>excludeEnd("ide");
  5651. messageSends: []
  5652. }),
  5653. $globals.String);
  5654. $core.addMethod(
  5655. $core.method({
  5656. selector: "isCapitalized",
  5657. protocol: "testing",
  5658. fn: function (){
  5659. var self=this,$self=this;
  5660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5661. return $core.withContext(function($ctx1) {
  5662. //>>excludeEnd("ctx");
  5663. var $2,$1;
  5664. $2=$self._first();
  5665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5666. $ctx1.sendIdx["first"]=1;
  5667. //>>excludeEnd("ctx");
  5668. $1=$recv($2)._asUppercase();
  5669. return $recv($1).__eq_eq($self._first());
  5670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5671. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  5672. //>>excludeEnd("ctx");
  5673. },
  5674. //>>excludeStart("ide", pragmas.excludeIdeData);
  5675. args: [],
  5676. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  5677. referencedClasses: [],
  5678. //>>excludeEnd("ide");
  5679. messageSends: ["==", "asUppercase", "first"]
  5680. }),
  5681. $globals.String);
  5682. $core.addMethod(
  5683. $core.method({
  5684. selector: "isImmutable",
  5685. protocol: "testing",
  5686. fn: function (){
  5687. var self=this,$self=this;
  5688. return true;
  5689. },
  5690. //>>excludeStart("ide", pragmas.excludeIdeData);
  5691. args: [],
  5692. source: "isImmutable\x0a\x09^ true",
  5693. referencedClasses: [],
  5694. //>>excludeEnd("ide");
  5695. messageSends: []
  5696. }),
  5697. $globals.String);
  5698. $core.addMethod(
  5699. $core.method({
  5700. selector: "isSelector",
  5701. protocol: "testing",
  5702. fn: function (){
  5703. var self=this,$self=this;
  5704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5705. return $core.withContext(function($ctx1) {
  5706. //>>excludeEnd("ctx");
  5707. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  5708. return self;
  5709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5710. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  5711. //>>excludeEnd("ctx");
  5712. },
  5713. //>>excludeStart("ide", pragmas.excludeIdeData);
  5714. args: [],
  5715. 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>",
  5716. referencedClasses: [],
  5717. //>>excludeEnd("ide");
  5718. messageSends: []
  5719. }),
  5720. $globals.String);
  5721. $core.addMethod(
  5722. $core.method({
  5723. selector: "isString",
  5724. protocol: "testing",
  5725. fn: function (){
  5726. var self=this,$self=this;
  5727. return true;
  5728. },
  5729. //>>excludeStart("ide", pragmas.excludeIdeData);
  5730. args: [],
  5731. source: "isString\x0a\x09^ true",
  5732. referencedClasses: [],
  5733. //>>excludeEnd("ide");
  5734. messageSends: []
  5735. }),
  5736. $globals.String);
  5737. $core.addMethod(
  5738. $core.method({
  5739. selector: "isVowel",
  5740. protocol: "testing",
  5741. fn: function (){
  5742. var self=this,$self=this;
  5743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5744. return $core.withContext(function($ctx1) {
  5745. //>>excludeEnd("ctx");
  5746. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  5747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5748. return $core.withContext(function($ctx2) {
  5749. //>>excludeEnd("ctx");
  5750. return "aeiou"._includes_($self._asLowercase());
  5751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5753. //>>excludeEnd("ctx");
  5754. }));
  5755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5756. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  5757. //>>excludeEnd("ctx");
  5758. },
  5759. //>>excludeStart("ide", pragmas.excludeIdeData);
  5760. args: [],
  5761. 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 ]",
  5762. referencedClasses: [],
  5763. //>>excludeEnd("ide");
  5764. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  5765. }),
  5766. $globals.String);
  5767. $core.addMethod(
  5768. $core.method({
  5769. selector: "join:",
  5770. protocol: "split join",
  5771. fn: function (aCollection){
  5772. var self=this,$self=this;
  5773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5774. return $core.withContext(function($ctx1) {
  5775. //>>excludeEnd("ctx");
  5776. return $recv($globals.String)._streamContents_((function(stream){
  5777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5778. return $core.withContext(function($ctx2) {
  5779. //>>excludeEnd("ctx");
  5780. return $recv(aCollection)._do_separatedBy_((function(each){
  5781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5782. return $core.withContext(function($ctx3) {
  5783. //>>excludeEnd("ctx");
  5784. return $recv(stream)._nextPutAll_($recv(each)._asString());
  5785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5786. $ctx3.sendIdx["nextPutAll:"]=1;
  5787. //>>excludeEnd("ctx");
  5788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5789. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  5790. //>>excludeEnd("ctx");
  5791. }),(function(){
  5792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5793. return $core.withContext(function($ctx3) {
  5794. //>>excludeEnd("ctx");
  5795. return $recv(stream)._nextPutAll_(self);
  5796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5797. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5798. //>>excludeEnd("ctx");
  5799. }));
  5800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5801. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  5802. //>>excludeEnd("ctx");
  5803. }));
  5804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5805. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  5806. //>>excludeEnd("ctx");
  5807. },
  5808. //>>excludeStart("ide", pragmas.excludeIdeData);
  5809. args: ["aCollection"],
  5810. 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 ]]",
  5811. referencedClasses: ["String"],
  5812. //>>excludeEnd("ide");
  5813. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  5814. }),
  5815. $globals.String);
  5816. $core.addMethod(
  5817. $core.method({
  5818. selector: "lineIndicesDo:",
  5819. protocol: "split join",
  5820. fn: function (aBlock){
  5821. var self=this,$self=this;
  5822. var cr,lf,start,sz,nextLF,nextCR;
  5823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5824. return $core.withContext(function($ctx1) {
  5825. //>>excludeEnd("ctx");
  5826. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  5827. var $early={};
  5828. try {
  5829. start=(1);
  5830. sz=$self._size();
  5831. cr=$recv($globals.String)._cr();
  5832. nextCR=$self._indexOf_startingAt_(cr,(1));
  5833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5834. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  5835. //>>excludeEnd("ctx");
  5836. lf=$recv($globals.String)._lf();
  5837. nextLF=$self._indexOf_startingAt_(lf,(1));
  5838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5839. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  5840. //>>excludeEnd("ctx");
  5841. $recv((function(){
  5842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5843. return $core.withContext(function($ctx2) {
  5844. //>>excludeEnd("ctx");
  5845. return $recv(start).__lt_eq(sz);
  5846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5848. //>>excludeEnd("ctx");
  5849. }))._whileTrue_((function(){
  5850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5851. return $core.withContext(function($ctx2) {
  5852. //>>excludeEnd("ctx");
  5853. $2=$recv(nextLF).__eq((0));
  5854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5855. $ctx2.sendIdx["="]=1;
  5856. //>>excludeEnd("ctx");
  5857. $1=$recv($2)._and_((function(){
  5858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5859. return $core.withContext(function($ctx3) {
  5860. //>>excludeEnd("ctx");
  5861. return $recv(nextCR).__eq((0));
  5862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5863. $ctx3.sendIdx["="]=2;
  5864. //>>excludeEnd("ctx");
  5865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5866. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5867. //>>excludeEnd("ctx");
  5868. }));
  5869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5870. $ctx2.sendIdx["and:"]=1;
  5871. //>>excludeEnd("ctx");
  5872. if($core.assert($1)){
  5873. $recv(aBlock)._value_value_value_(start,sz,sz);
  5874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5875. $ctx2.sendIdx["value:value:value:"]=1;
  5876. //>>excludeEnd("ctx");
  5877. throw $early=[self];
  5878. }
  5879. $4=$recv(nextCR).__eq((0));
  5880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5881. $ctx2.sendIdx["="]=3;
  5882. //>>excludeEnd("ctx");
  5883. $3=$recv($4)._or_((function(){
  5884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5885. return $core.withContext(function($ctx3) {
  5886. //>>excludeEnd("ctx");
  5887. $5=(0).__lt(nextLF);
  5888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5889. $ctx3.sendIdx["<"]=1;
  5890. //>>excludeEnd("ctx");
  5891. return $recv($5)._and_((function(){
  5892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5893. return $core.withContext(function($ctx4) {
  5894. //>>excludeEnd("ctx");
  5895. return $recv(nextLF).__lt(nextCR);
  5896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5897. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  5898. //>>excludeEnd("ctx");
  5899. }));
  5900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5901. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  5902. //>>excludeEnd("ctx");
  5903. }));
  5904. if($core.assert($3)){
  5905. $6=start;
  5906. $7=$recv(nextLF).__minus((1));
  5907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5908. $ctx2.sendIdx["-"]=1;
  5909. //>>excludeEnd("ctx");
  5910. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  5911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5912. $ctx2.sendIdx["value:value:value:"]=2;
  5913. //>>excludeEnd("ctx");
  5914. start=(1).__plus(nextLF);
  5915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5916. $ctx2.sendIdx["+"]=1;
  5917. //>>excludeEnd("ctx");
  5918. nextLF=$self._indexOf_startingAt_(lf,start);
  5919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5920. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  5921. //>>excludeEnd("ctx");
  5922. return nextLF;
  5923. } else {
  5924. $9=(1).__plus(nextCR);
  5925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5926. $ctx2.sendIdx["+"]=2;
  5927. //>>excludeEnd("ctx");
  5928. $8=$recv($9).__eq(nextLF);
  5929. if($core.assert($8)){
  5930. $10=start;
  5931. $11=$recv(nextCR).__minus((1));
  5932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5933. $ctx2.sendIdx["-"]=2;
  5934. //>>excludeEnd("ctx");
  5935. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  5936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5937. $ctx2.sendIdx["value:value:value:"]=3;
  5938. //>>excludeEnd("ctx");
  5939. start=(1).__plus(nextLF);
  5940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5941. $ctx2.sendIdx["+"]=3;
  5942. //>>excludeEnd("ctx");
  5943. nextCR=$self._indexOf_startingAt_(cr,start);
  5944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5945. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  5946. //>>excludeEnd("ctx");
  5947. nextLF=$self._indexOf_startingAt_(lf,start);
  5948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5949. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  5950. //>>excludeEnd("ctx");
  5951. return nextLF;
  5952. } else {
  5953. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  5954. start=(1).__plus(nextCR);
  5955. nextCR=$self._indexOf_startingAt_(cr,start);
  5956. return nextCR;
  5957. }
  5958. }
  5959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5961. //>>excludeEnd("ctx");
  5962. }));
  5963. return self;
  5964. }
  5965. catch(e) {if(e===$early)return e[0]; throw e}
  5966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5967. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  5968. //>>excludeEnd("ctx");
  5969. },
  5970. //>>excludeStart("ide", pragmas.excludeIdeData);
  5971. args: ["aBlock"],
  5972. 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 ] ]]",
  5973. referencedClasses: ["String"],
  5974. //>>excludeEnd("ide");
  5975. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  5976. }),
  5977. $globals.String);
  5978. $core.addMethod(
  5979. $core.method({
  5980. selector: "lineNumber:",
  5981. protocol: "split join",
  5982. fn: function (anIndex){
  5983. var self=this,$self=this;
  5984. var lineCount;
  5985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5986. return $core.withContext(function($ctx1) {
  5987. //>>excludeEnd("ctx");
  5988. var $2,$1;
  5989. var $early={};
  5990. try {
  5991. lineCount=(0);
  5992. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  5993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5994. return $core.withContext(function($ctx2) {
  5995. //>>excludeEnd("ctx");
  5996. lineCount=$recv(lineCount).__plus((1));
  5997. $2=lineCount;
  5998. $1=$recv($2).__eq(anIndex);
  5999. if($core.assert($1)){
  6000. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  6001. }
  6002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6003. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  6004. //>>excludeEnd("ctx");
  6005. }));
  6006. return nil;
  6007. }
  6008. catch(e) {if(e===$early)return e[0]; throw e}
  6009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6010. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  6011. //>>excludeEnd("ctx");
  6012. },
  6013. //>>excludeStart("ide", pragmas.excludeIdeData);
  6014. args: ["anIndex"],
  6015. 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",
  6016. referencedClasses: [],
  6017. //>>excludeEnd("ide");
  6018. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  6019. }),
  6020. $globals.String);
  6021. $core.addMethod(
  6022. $core.method({
  6023. selector: "lines",
  6024. protocol: "split join",
  6025. fn: function (){
  6026. var self=this,$self=this;
  6027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6028. return $core.withContext(function($ctx1) {
  6029. //>>excludeEnd("ctx");
  6030. var result = self.split(/\r\n|\r|\n/);
  6031. if (!result[result.length-1]) result.pop();
  6032. return result;;
  6033. return self;
  6034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6035. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  6036. //>>excludeEnd("ctx");
  6037. },
  6038. //>>excludeStart("ide", pragmas.excludeIdeData);
  6039. args: [],
  6040. 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'>",
  6041. referencedClasses: [],
  6042. //>>excludeEnd("ide");
  6043. messageSends: []
  6044. }),
  6045. $globals.String);
  6046. $core.addMethod(
  6047. $core.method({
  6048. selector: "linesDo:",
  6049. protocol: "split join",
  6050. fn: function (aBlock){
  6051. var self=this,$self=this;
  6052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6053. return $core.withContext(function($ctx1) {
  6054. //>>excludeEnd("ctx");
  6055. $recv($self._lines())._do_(aBlock);
  6056. return self;
  6057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6058. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  6059. //>>excludeEnd("ctx");
  6060. },
  6061. //>>excludeStart("ide", pragmas.excludeIdeData);
  6062. args: ["aBlock"],
  6063. 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",
  6064. referencedClasses: [],
  6065. //>>excludeEnd("ide");
  6066. messageSends: ["do:", "lines"]
  6067. }),
  6068. $globals.String);
  6069. $core.addMethod(
  6070. $core.method({
  6071. selector: "match:",
  6072. protocol: "regular expressions",
  6073. fn: function (aRegexp){
  6074. var self=this,$self=this;
  6075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6076. return $core.withContext(function($ctx1) {
  6077. //>>excludeEnd("ctx");
  6078. return self.search(aRegexp) != -1;
  6079. return self;
  6080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6081. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  6082. //>>excludeEnd("ctx");
  6083. },
  6084. //>>excludeStart("ide", pragmas.excludeIdeData);
  6085. args: ["aRegexp"],
  6086. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  6087. referencedClasses: [],
  6088. //>>excludeEnd("ide");
  6089. messageSends: []
  6090. }),
  6091. $globals.String);
  6092. $core.addMethod(
  6093. $core.method({
  6094. selector: "matchesOf:",
  6095. protocol: "regular expressions",
  6096. fn: function (aRegularExpression){
  6097. var self=this,$self=this;
  6098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6099. return $core.withContext(function($ctx1) {
  6100. //>>excludeEnd("ctx");
  6101. return self.match(aRegularExpression);
  6102. return self;
  6103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6104. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  6105. //>>excludeEnd("ctx");
  6106. },
  6107. //>>excludeStart("ide", pragmas.excludeIdeData);
  6108. args: ["aRegularExpression"],
  6109. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  6110. referencedClasses: [],
  6111. //>>excludeEnd("ide");
  6112. messageSends: []
  6113. }),
  6114. $globals.String);
  6115. $core.addMethod(
  6116. $core.method({
  6117. selector: "printNl",
  6118. protocol: "printing",
  6119. fn: function (){
  6120. var self=this,$self=this;
  6121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6122. return $core.withContext(function($ctx1) {
  6123. //>>excludeEnd("ctx");
  6124. console.log(self);
  6125. return self;
  6126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6127. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  6128. //>>excludeEnd("ctx");
  6129. },
  6130. //>>excludeStart("ide", pragmas.excludeIdeData);
  6131. args: [],
  6132. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  6133. referencedClasses: [],
  6134. //>>excludeEnd("ide");
  6135. messageSends: []
  6136. }),
  6137. $globals.String);
  6138. $core.addMethod(
  6139. $core.method({
  6140. selector: "printOn:",
  6141. protocol: "printing",
  6142. fn: function (aStream){
  6143. var self=this,$self=this;
  6144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6145. return $core.withContext(function($ctx1) {
  6146. //>>excludeEnd("ctx");
  6147. $recv(aStream)._nextPutAll_("'");
  6148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6149. $ctx1.sendIdx["nextPutAll:"]=1;
  6150. //>>excludeEnd("ctx");
  6151. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  6152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6153. $ctx1.sendIdx["nextPutAll:"]=2;
  6154. //>>excludeEnd("ctx");
  6155. $recv(aStream)._nextPutAll_("'");
  6156. return self;
  6157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6158. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  6159. //>>excludeEnd("ctx");
  6160. },
  6161. //>>excludeStart("ide", pragmas.excludeIdeData);
  6162. args: ["aStream"],
  6163. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  6164. referencedClasses: [],
  6165. //>>excludeEnd("ide");
  6166. messageSends: ["nextPutAll:", "replace:with:"]
  6167. }),
  6168. $globals.String);
  6169. $core.addMethod(
  6170. $core.method({
  6171. selector: "putOn:",
  6172. protocol: "streaming",
  6173. fn: function (aStream){
  6174. var self=this,$self=this;
  6175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6176. return $core.withContext(function($ctx1) {
  6177. //>>excludeEnd("ctx");
  6178. $recv(aStream)._nextPutString_(self);
  6179. return self;
  6180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6181. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.String)});
  6182. //>>excludeEnd("ctx");
  6183. },
  6184. //>>excludeStart("ide", pragmas.excludeIdeData);
  6185. args: ["aStream"],
  6186. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  6187. referencedClasses: [],
  6188. //>>excludeEnd("ide");
  6189. messageSends: ["nextPutString:"]
  6190. }),
  6191. $globals.String);
  6192. $core.addMethod(
  6193. $core.method({
  6194. selector: "remove:",
  6195. protocol: "adding/removing",
  6196. fn: function (anObject){
  6197. var self=this,$self=this;
  6198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6199. return $core.withContext(function($ctx1) {
  6200. //>>excludeEnd("ctx");
  6201. $self._errorReadOnly();
  6202. return self;
  6203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6204. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.String)});
  6205. //>>excludeEnd("ctx");
  6206. },
  6207. //>>excludeStart("ide", pragmas.excludeIdeData);
  6208. args: ["anObject"],
  6209. source: "remove: anObject\x0a\x09self errorReadOnly",
  6210. referencedClasses: [],
  6211. //>>excludeEnd("ide");
  6212. messageSends: ["errorReadOnly"]
  6213. }),
  6214. $globals.String);
  6215. $core.addMethod(
  6216. $core.method({
  6217. selector: "remove:ifAbsent:",
  6218. protocol: "adding/removing",
  6219. fn: function (anObject,aBlock){
  6220. var self=this,$self=this;
  6221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6222. return $core.withContext(function($ctx1) {
  6223. //>>excludeEnd("ctx");
  6224. $self._errorReadOnly();
  6225. return self;
  6226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6227. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.String)});
  6228. //>>excludeEnd("ctx");
  6229. },
  6230. //>>excludeStart("ide", pragmas.excludeIdeData);
  6231. args: ["anObject", "aBlock"],
  6232. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  6233. referencedClasses: [],
  6234. //>>excludeEnd("ide");
  6235. messageSends: ["errorReadOnly"]
  6236. }),
  6237. $globals.String);
  6238. $core.addMethod(
  6239. $core.method({
  6240. selector: "replace:with:",
  6241. protocol: "regular expressions",
  6242. fn: function (aString,anotherString){
  6243. var self=this,$self=this;
  6244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6245. return $core.withContext(function($ctx1) {
  6246. //>>excludeEnd("ctx");
  6247. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6249. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  6250. //>>excludeEnd("ctx");
  6251. },
  6252. //>>excludeStart("ide", pragmas.excludeIdeData);
  6253. args: ["aString", "anotherString"],
  6254. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6255. referencedClasses: ["RegularExpression"],
  6256. //>>excludeEnd("ide");
  6257. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6258. }),
  6259. $globals.String);
  6260. $core.addMethod(
  6261. $core.method({
  6262. selector: "replaceRegexp:with:",
  6263. protocol: "regular expressions",
  6264. fn: function (aRegexp,aString){
  6265. var self=this,$self=this;
  6266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6267. return $core.withContext(function($ctx1) {
  6268. //>>excludeEnd("ctx");
  6269. return self.replace(aRegexp, aString);
  6270. return self;
  6271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6272. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  6273. //>>excludeEnd("ctx");
  6274. },
  6275. //>>excludeStart("ide", pragmas.excludeIdeData);
  6276. args: ["aRegexp", "aString"],
  6277. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  6278. referencedClasses: [],
  6279. //>>excludeEnd("ide");
  6280. messageSends: []
  6281. }),
  6282. $globals.String);
  6283. $core.addMethod(
  6284. $core.method({
  6285. selector: "reversed",
  6286. protocol: "converting",
  6287. fn: function (){
  6288. var self=this,$self=this;
  6289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6290. return $core.withContext(function($ctx1) {
  6291. //>>excludeEnd("ctx");
  6292. return self.split("").reverse().join("");
  6293. return self;
  6294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6295. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  6296. //>>excludeEnd("ctx");
  6297. },
  6298. //>>excludeStart("ide", pragmas.excludeIdeData);
  6299. args: [],
  6300. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  6301. referencedClasses: [],
  6302. //>>excludeEnd("ide");
  6303. messageSends: []
  6304. }),
  6305. $globals.String);
  6306. $core.addMethod(
  6307. $core.method({
  6308. selector: "shallowCopy",
  6309. protocol: "copying",
  6310. fn: function (){
  6311. var self=this,$self=this;
  6312. return self;
  6313. },
  6314. //>>excludeStart("ide", pragmas.excludeIdeData);
  6315. args: [],
  6316. source: "shallowCopy\x0a\x09^ self",
  6317. referencedClasses: [],
  6318. //>>excludeEnd("ide");
  6319. messageSends: []
  6320. }),
  6321. $globals.String);
  6322. $core.addMethod(
  6323. $core.method({
  6324. selector: "size",
  6325. protocol: "accessing",
  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.length;
  6332. return self;
  6333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6334. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  6335. //>>excludeEnd("ctx");
  6336. },
  6337. //>>excludeStart("ide", pragmas.excludeIdeData);
  6338. args: [],
  6339. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  6340. referencedClasses: [],
  6341. //>>excludeEnd("ide");
  6342. messageSends: []
  6343. }),
  6344. $globals.String);
  6345. $core.addMethod(
  6346. $core.method({
  6347. selector: "subStrings:",
  6348. protocol: "split join",
  6349. fn: function (aString){
  6350. var self=this,$self=this;
  6351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6352. return $core.withContext(function($ctx1) {
  6353. //>>excludeEnd("ctx");
  6354. return $self._tokenize_(aString);
  6355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6356. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  6357. //>>excludeEnd("ctx");
  6358. },
  6359. //>>excludeStart("ide", pragmas.excludeIdeData);
  6360. args: ["aString"],
  6361. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6362. referencedClasses: [],
  6363. //>>excludeEnd("ide");
  6364. messageSends: ["tokenize:"]
  6365. }),
  6366. $globals.String);
  6367. $core.addMethod(
  6368. $core.method({
  6369. selector: "symbolPrintString",
  6370. protocol: "printing",
  6371. fn: function (){
  6372. var self=this,$self=this;
  6373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6374. return $core.withContext(function($ctx1) {
  6375. //>>excludeEnd("ctx");
  6376. return $recv($globals.String)._streamContents_((function(str){
  6377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6378. return $core.withContext(function($ctx2) {
  6379. //>>excludeEnd("ctx");
  6380. return $self._asSymbolPrintOn_(str);
  6381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6382. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  6383. //>>excludeEnd("ctx");
  6384. }));
  6385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6386. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.String)});
  6387. //>>excludeEnd("ctx");
  6388. },
  6389. //>>excludeStart("ide", pragmas.excludeIdeData);
  6390. args: [],
  6391. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  6392. referencedClasses: ["String"],
  6393. //>>excludeEnd("ide");
  6394. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  6395. }),
  6396. $globals.String);
  6397. $core.addMethod(
  6398. $core.method({
  6399. selector: "tokenize:",
  6400. protocol: "split join",
  6401. fn: function (aString){
  6402. var self=this,$self=this;
  6403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6404. return $core.withContext(function($ctx1) {
  6405. //>>excludeEnd("ctx");
  6406. return self.split(aString);
  6407. return self;
  6408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6409. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  6410. //>>excludeEnd("ctx");
  6411. },
  6412. //>>excludeStart("ide", pragmas.excludeIdeData);
  6413. args: ["aString"],
  6414. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  6415. referencedClasses: [],
  6416. //>>excludeEnd("ide");
  6417. messageSends: []
  6418. }),
  6419. $globals.String);
  6420. $core.addMethod(
  6421. $core.method({
  6422. selector: "trimBoth",
  6423. protocol: "regular expressions",
  6424. fn: function (){
  6425. var self=this,$self=this;
  6426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6427. return $core.withContext(function($ctx1) {
  6428. //>>excludeEnd("ctx");
  6429. return $self._trimBoth_("\x5cs");
  6430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6431. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  6432. //>>excludeEnd("ctx");
  6433. },
  6434. //>>excludeStart("ide", pragmas.excludeIdeData);
  6435. args: [],
  6436. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  6437. referencedClasses: [],
  6438. //>>excludeEnd("ide");
  6439. messageSends: ["trimBoth:"]
  6440. }),
  6441. $globals.String);
  6442. $core.addMethod(
  6443. $core.method({
  6444. selector: "trimBoth:",
  6445. protocol: "regular expressions",
  6446. fn: function (separators){
  6447. var self=this,$self=this;
  6448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6449. return $core.withContext(function($ctx1) {
  6450. //>>excludeEnd("ctx");
  6451. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  6452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6453. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  6454. //>>excludeEnd("ctx");
  6455. },
  6456. //>>excludeStart("ide", pragmas.excludeIdeData);
  6457. args: ["separators"],
  6458. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  6459. referencedClasses: [],
  6460. //>>excludeEnd("ide");
  6461. messageSends: ["trimRight:", "trimLeft:"]
  6462. }),
  6463. $globals.String);
  6464. $core.addMethod(
  6465. $core.method({
  6466. selector: "trimLeft",
  6467. protocol: "regular expressions",
  6468. fn: function (){
  6469. var self=this,$self=this;
  6470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6471. return $core.withContext(function($ctx1) {
  6472. //>>excludeEnd("ctx");
  6473. return $self._trimLeft_("\x5cs");
  6474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6475. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  6476. //>>excludeEnd("ctx");
  6477. },
  6478. //>>excludeStart("ide", pragmas.excludeIdeData);
  6479. args: [],
  6480. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  6481. referencedClasses: [],
  6482. //>>excludeEnd("ide");
  6483. messageSends: ["trimLeft:"]
  6484. }),
  6485. $globals.String);
  6486. $core.addMethod(
  6487. $core.method({
  6488. selector: "trimLeft:",
  6489. protocol: "regular expressions",
  6490. fn: function (separators){
  6491. var self=this,$self=this;
  6492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6493. return $core.withContext(function($ctx1) {
  6494. //>>excludeEnd("ctx");
  6495. var $2,$1;
  6496. $2=$recv("^[".__comma(separators)).__comma("]+");
  6497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6498. $ctx1.sendIdx[","]=1;
  6499. //>>excludeEnd("ctx");
  6500. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6501. return $self._replaceRegexp_with_($1,"");
  6502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6503. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  6504. //>>excludeEnd("ctx");
  6505. },
  6506. //>>excludeStart("ide", pragmas.excludeIdeData);
  6507. args: ["separators"],
  6508. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  6509. referencedClasses: ["RegularExpression"],
  6510. //>>excludeEnd("ide");
  6511. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6512. }),
  6513. $globals.String);
  6514. $core.addMethod(
  6515. $core.method({
  6516. selector: "trimRight",
  6517. protocol: "regular expressions",
  6518. fn: function (){
  6519. var self=this,$self=this;
  6520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6521. return $core.withContext(function($ctx1) {
  6522. //>>excludeEnd("ctx");
  6523. return $self._trimRight_("\x5cs");
  6524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6525. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  6526. //>>excludeEnd("ctx");
  6527. },
  6528. //>>excludeStart("ide", pragmas.excludeIdeData);
  6529. args: [],
  6530. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  6531. referencedClasses: [],
  6532. //>>excludeEnd("ide");
  6533. messageSends: ["trimRight:"]
  6534. }),
  6535. $globals.String);
  6536. $core.addMethod(
  6537. $core.method({
  6538. selector: "trimRight:",
  6539. protocol: "regular expressions",
  6540. fn: function (separators){
  6541. var self=this,$self=this;
  6542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6543. return $core.withContext(function($ctx1) {
  6544. //>>excludeEnd("ctx");
  6545. var $2,$1;
  6546. $2=$recv("[".__comma(separators)).__comma("]+$");
  6547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6548. $ctx1.sendIdx[","]=1;
  6549. //>>excludeEnd("ctx");
  6550. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6551. return $self._replaceRegexp_with_($1,"");
  6552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6553. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  6554. //>>excludeEnd("ctx");
  6555. },
  6556. //>>excludeStart("ide", pragmas.excludeIdeData);
  6557. args: ["separators"],
  6558. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  6559. referencedClasses: ["RegularExpression"],
  6560. //>>excludeEnd("ide");
  6561. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6562. }),
  6563. $globals.String);
  6564. $core.addMethod(
  6565. $core.method({
  6566. selector: "unescaped",
  6567. protocol: "converting",
  6568. fn: function (){
  6569. var self=this,$self=this;
  6570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6571. return $core.withContext(function($ctx1) {
  6572. //>>excludeEnd("ctx");
  6573. return unescape(self);
  6574. return self;
  6575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6576. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  6577. //>>excludeEnd("ctx");
  6578. },
  6579. //>>excludeStart("ide", pragmas.excludeIdeData);
  6580. args: [],
  6581. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  6582. referencedClasses: [],
  6583. //>>excludeEnd("ide");
  6584. messageSends: []
  6585. }),
  6586. $globals.String);
  6587. $core.addMethod(
  6588. $core.method({
  6589. selector: "uriComponentDecoded",
  6590. protocol: "converting",
  6591. fn: function (){
  6592. var self=this,$self=this;
  6593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6594. return $core.withContext(function($ctx1) {
  6595. //>>excludeEnd("ctx");
  6596. return decodeURIComponent(self);
  6597. return self;
  6598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6599. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  6600. //>>excludeEnd("ctx");
  6601. },
  6602. //>>excludeStart("ide", pragmas.excludeIdeData);
  6603. args: [],
  6604. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  6605. referencedClasses: [],
  6606. //>>excludeEnd("ide");
  6607. messageSends: []
  6608. }),
  6609. $globals.String);
  6610. $core.addMethod(
  6611. $core.method({
  6612. selector: "uriComponentEncoded",
  6613. protocol: "converting",
  6614. fn: function (){
  6615. var self=this,$self=this;
  6616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6617. return $core.withContext(function($ctx1) {
  6618. //>>excludeEnd("ctx");
  6619. return encodeURIComponent(self);
  6620. return self;
  6621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6622. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  6623. //>>excludeEnd("ctx");
  6624. },
  6625. //>>excludeStart("ide", pragmas.excludeIdeData);
  6626. args: [],
  6627. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  6628. referencedClasses: [],
  6629. //>>excludeEnd("ide");
  6630. messageSends: []
  6631. }),
  6632. $globals.String);
  6633. $core.addMethod(
  6634. $core.method({
  6635. selector: "uriDecoded",
  6636. protocol: "converting",
  6637. fn: function (){
  6638. var self=this,$self=this;
  6639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6640. return $core.withContext(function($ctx1) {
  6641. //>>excludeEnd("ctx");
  6642. return decodeURI(self);
  6643. return self;
  6644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6645. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  6646. //>>excludeEnd("ctx");
  6647. },
  6648. //>>excludeStart("ide", pragmas.excludeIdeData);
  6649. args: [],
  6650. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  6651. referencedClasses: [],
  6652. //>>excludeEnd("ide");
  6653. messageSends: []
  6654. }),
  6655. $globals.String);
  6656. $core.addMethod(
  6657. $core.method({
  6658. selector: "uriEncoded",
  6659. protocol: "converting",
  6660. fn: function (){
  6661. var self=this,$self=this;
  6662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6663. return $core.withContext(function($ctx1) {
  6664. //>>excludeEnd("ctx");
  6665. return encodeURI(self);
  6666. return self;
  6667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6668. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  6669. //>>excludeEnd("ctx");
  6670. },
  6671. //>>excludeStart("ide", pragmas.excludeIdeData);
  6672. args: [],
  6673. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  6674. referencedClasses: [],
  6675. //>>excludeEnd("ide");
  6676. messageSends: []
  6677. }),
  6678. $globals.String);
  6679. $core.addMethod(
  6680. $core.method({
  6681. selector: "value:",
  6682. protocol: "evaluating",
  6683. fn: function (anObject){
  6684. var self=this,$self=this;
  6685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6686. return $core.withContext(function($ctx1) {
  6687. //>>excludeEnd("ctx");
  6688. return $recv(anObject)._perform_(self);
  6689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6690. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  6691. //>>excludeEnd("ctx");
  6692. },
  6693. //>>excludeStart("ide", pragmas.excludeIdeData);
  6694. args: ["anObject"],
  6695. source: "value: anObject \x0a\x09^ anObject perform: self",
  6696. referencedClasses: [],
  6697. //>>excludeEnd("ide");
  6698. messageSends: ["perform:"]
  6699. }),
  6700. $globals.String);
  6701. $core.addMethod(
  6702. $core.method({
  6703. selector: "cr",
  6704. protocol: "accessing",
  6705. fn: function (){
  6706. var self=this,$self=this;
  6707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6708. return $core.withContext(function($ctx1) {
  6709. //>>excludeEnd("ctx");
  6710. return "\r";
  6711. return self;
  6712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6713. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.a$cls)});
  6714. //>>excludeEnd("ctx");
  6715. },
  6716. //>>excludeStart("ide", pragmas.excludeIdeData);
  6717. args: [],
  6718. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  6719. referencedClasses: [],
  6720. //>>excludeEnd("ide");
  6721. messageSends: []
  6722. }),
  6723. $globals.String.a$cls);
  6724. $core.addMethod(
  6725. $core.method({
  6726. selector: "crlf",
  6727. protocol: "accessing",
  6728. fn: function (){
  6729. var self=this,$self=this;
  6730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6731. return $core.withContext(function($ctx1) {
  6732. //>>excludeEnd("ctx");
  6733. return "\r\n";
  6734. return self;
  6735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6736. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.a$cls)});
  6737. //>>excludeEnd("ctx");
  6738. },
  6739. //>>excludeStart("ide", pragmas.excludeIdeData);
  6740. args: [],
  6741. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  6742. referencedClasses: [],
  6743. //>>excludeEnd("ide");
  6744. messageSends: []
  6745. }),
  6746. $globals.String.a$cls);
  6747. $core.addMethod(
  6748. $core.method({
  6749. selector: "esc",
  6750. protocol: "accessing",
  6751. fn: function (){
  6752. var self=this,$self=this;
  6753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6754. return $core.withContext(function($ctx1) {
  6755. //>>excludeEnd("ctx");
  6756. return $self._fromCharCode_((27));
  6757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6758. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.a$cls)});
  6759. //>>excludeEnd("ctx");
  6760. },
  6761. //>>excludeStart("ide", pragmas.excludeIdeData);
  6762. args: [],
  6763. source: "esc\x0a\x09^ self fromCharCode: 27",
  6764. referencedClasses: [],
  6765. //>>excludeEnd("ide");
  6766. messageSends: ["fromCharCode:"]
  6767. }),
  6768. $globals.String.a$cls);
  6769. $core.addMethod(
  6770. $core.method({
  6771. selector: "fromCharCode:",
  6772. protocol: "instance creation",
  6773. fn: function (anInteger){
  6774. var self=this,$self=this;
  6775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6776. return $core.withContext(function($ctx1) {
  6777. //>>excludeEnd("ctx");
  6778. return String.fromCharCode(anInteger);
  6779. return self;
  6780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6781. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.a$cls)});
  6782. //>>excludeEnd("ctx");
  6783. },
  6784. //>>excludeStart("ide", pragmas.excludeIdeData);
  6785. args: ["anInteger"],
  6786. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  6787. referencedClasses: [],
  6788. //>>excludeEnd("ide");
  6789. messageSends: []
  6790. }),
  6791. $globals.String.a$cls);
  6792. $core.addMethod(
  6793. $core.method({
  6794. selector: "fromString:",
  6795. protocol: "instance creation",
  6796. fn: function (aString){
  6797. var self=this,$self=this;
  6798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6799. return $core.withContext(function($ctx1) {
  6800. //>>excludeEnd("ctx");
  6801. return String(aString);
  6802. return self;
  6803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6804. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.a$cls)});
  6805. //>>excludeEnd("ctx");
  6806. },
  6807. //>>excludeStart("ide", pragmas.excludeIdeData);
  6808. args: ["aString"],
  6809. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  6810. referencedClasses: [],
  6811. //>>excludeEnd("ide");
  6812. messageSends: []
  6813. }),
  6814. $globals.String.a$cls);
  6815. $core.addMethod(
  6816. $core.method({
  6817. selector: "lf",
  6818. protocol: "accessing",
  6819. fn: function (){
  6820. var self=this,$self=this;
  6821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6822. return $core.withContext(function($ctx1) {
  6823. //>>excludeEnd("ctx");
  6824. return "\n";
  6825. return self;
  6826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6827. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.a$cls)});
  6828. //>>excludeEnd("ctx");
  6829. },
  6830. //>>excludeStart("ide", pragmas.excludeIdeData);
  6831. args: [],
  6832. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  6833. referencedClasses: [],
  6834. //>>excludeEnd("ide");
  6835. messageSends: []
  6836. }),
  6837. $globals.String.a$cls);
  6838. $core.addMethod(
  6839. $core.method({
  6840. selector: "random",
  6841. protocol: "random",
  6842. fn: function (){
  6843. var self=this,$self=this;
  6844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6845. return $core.withContext(function($ctx1) {
  6846. //>>excludeEnd("ctx");
  6847. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  6848. return self;
  6849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6850. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.a$cls)});
  6851. //>>excludeEnd("ctx");
  6852. },
  6853. //>>excludeStart("ide", pragmas.excludeIdeData);
  6854. args: [],
  6855. 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);'>",
  6856. referencedClasses: [],
  6857. //>>excludeEnd("ide");
  6858. messageSends: []
  6859. }),
  6860. $globals.String.a$cls);
  6861. $core.addMethod(
  6862. $core.method({
  6863. selector: "randomNotIn:",
  6864. protocol: "random",
  6865. fn: function (aString){
  6866. var self=this,$self=this;
  6867. var result;
  6868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6869. return $core.withContext(function($ctx1) {
  6870. //>>excludeEnd("ctx");
  6871. $recv((function(){
  6872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6873. return $core.withContext(function($ctx2) {
  6874. //>>excludeEnd("ctx");
  6875. result=$self._random();
  6876. return $recv(aString)._includesSubString_(result);
  6877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6879. //>>excludeEnd("ctx");
  6880. }))._whileTrue();
  6881. return result;
  6882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6883. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.a$cls)});
  6884. //>>excludeEnd("ctx");
  6885. },
  6886. //>>excludeStart("ide", pragmas.excludeIdeData);
  6887. args: ["aString"],
  6888. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  6889. referencedClasses: [],
  6890. //>>excludeEnd("ide");
  6891. messageSends: ["whileTrue", "random", "includesSubString:"]
  6892. }),
  6893. $globals.String.a$cls);
  6894. $core.addMethod(
  6895. $core.method({
  6896. selector: "space",
  6897. protocol: "accessing",
  6898. fn: function (){
  6899. var self=this,$self=this;
  6900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6901. return $core.withContext(function($ctx1) {
  6902. //>>excludeEnd("ctx");
  6903. return " ";
  6904. return self;
  6905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6906. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.a$cls)});
  6907. //>>excludeEnd("ctx");
  6908. },
  6909. //>>excludeStart("ide", pragmas.excludeIdeData);
  6910. args: [],
  6911. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  6912. referencedClasses: [],
  6913. //>>excludeEnd("ide");
  6914. messageSends: []
  6915. }),
  6916. $globals.String.a$cls);
  6917. $core.addMethod(
  6918. $core.method({
  6919. selector: "streamClass",
  6920. protocol: "accessing",
  6921. fn: function (){
  6922. var self=this,$self=this;
  6923. return $globals.StringStream;
  6924. },
  6925. //>>excludeStart("ide", pragmas.excludeIdeData);
  6926. args: [],
  6927. source: "streamClass\x0a\x09\x09^ StringStream",
  6928. referencedClasses: ["StringStream"],
  6929. //>>excludeEnd("ide");
  6930. messageSends: []
  6931. }),
  6932. $globals.String.a$cls);
  6933. $core.addMethod(
  6934. $core.method({
  6935. selector: "tab",
  6936. protocol: "accessing",
  6937. fn: function (){
  6938. var self=this,$self=this;
  6939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6940. return $core.withContext(function($ctx1) {
  6941. //>>excludeEnd("ctx");
  6942. return "\t";
  6943. return self;
  6944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6945. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.a$cls)});
  6946. //>>excludeEnd("ctx");
  6947. },
  6948. //>>excludeStart("ide", pragmas.excludeIdeData);
  6949. args: [],
  6950. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  6951. referencedClasses: [],
  6952. //>>excludeEnd("ide");
  6953. messageSends: []
  6954. }),
  6955. $globals.String.a$cls);
  6956. $core.addMethod(
  6957. $core.method({
  6958. selector: "value:",
  6959. protocol: "instance creation",
  6960. fn: function (aUTFCharCode){
  6961. var self=this,$self=this;
  6962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6963. return $core.withContext(function($ctx1) {
  6964. //>>excludeEnd("ctx");
  6965. return String.fromCharCode(aUTFCharCode);;
  6966. return self;
  6967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6968. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.a$cls)});
  6969. //>>excludeEnd("ctx");
  6970. },
  6971. //>>excludeStart("ide", pragmas.excludeIdeData);
  6972. args: ["aUTFCharCode"],
  6973. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  6974. referencedClasses: [],
  6975. //>>excludeEnd("ide");
  6976. messageSends: []
  6977. }),
  6978. $globals.String.a$cls);
  6979. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  6980. //>>excludeStart("ide", pragmas.excludeIdeData);
  6981. $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`.";
  6982. //>>excludeEnd("ide");
  6983. $core.addMethod(
  6984. $core.method({
  6985. selector: "=",
  6986. protocol: "comparing",
  6987. fn: function (aCollection){
  6988. var self=this,$self=this;
  6989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6990. return $core.withContext(function($ctx1) {
  6991. //>>excludeEnd("ctx");
  6992. var $2,$1,$4,$3,$5;
  6993. var $early={};
  6994. try {
  6995. $2=$self._class();
  6996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6997. $ctx1.sendIdx["class"]=1;
  6998. //>>excludeEnd("ctx");
  6999. $1=$recv($2).__eq($recv(aCollection)._class());
  7000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7001. $ctx1.sendIdx["="]=1;
  7002. //>>excludeEnd("ctx");
  7003. if(!$core.assert($1)){
  7004. return false;
  7005. }
  7006. $4=$self._size();
  7007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7008. $ctx1.sendIdx["size"]=1;
  7009. //>>excludeEnd("ctx");
  7010. $3=$recv($4).__eq($recv(aCollection)._size());
  7011. if(!$core.assert($3)){
  7012. return false;
  7013. }
  7014. $self._do_((function(each){
  7015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7016. return $core.withContext(function($ctx2) {
  7017. //>>excludeEnd("ctx");
  7018. $5=$recv(aCollection)._includes_(each);
  7019. if(!$core.assert($5)){
  7020. throw $early=[false];
  7021. }
  7022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7023. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7024. //>>excludeEnd("ctx");
  7025. }));
  7026. return true;
  7027. }
  7028. catch(e) {if(e===$early)return e[0]; throw e}
  7029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7030. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  7031. //>>excludeEnd("ctx");
  7032. },
  7033. //>>excludeStart("ide", pragmas.excludeIdeData);
  7034. args: ["aCollection"],
  7035. 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",
  7036. referencedClasses: [],
  7037. //>>excludeEnd("ide");
  7038. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  7039. }),
  7040. $globals.Set);
  7041. $core.addMethod(
  7042. $core.method({
  7043. selector: "add:",
  7044. protocol: "adding/removing",
  7045. fn: function (anObject){
  7046. var self=this,$self=this;
  7047. var bucket;
  7048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7049. return $core.withContext(function($ctx1) {
  7050. //>>excludeEnd("ctx");
  7051. var $1,$receiver;
  7052. bucket=$self._bucketsOfElement_(anObject);
  7053. $1=$recv(bucket)._second();
  7054. if(($receiver = $1) == null || $receiver.a$nil){
  7055. var object,slowBucket;
  7056. object=$recv(bucket)._first();
  7057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7058. $ctx1.sendIdx["first"]=1;
  7059. //>>excludeEnd("ctx");
  7060. slowBucket=$recv(bucket)._third();
  7061. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  7062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7063. return $core.withContext(function($ctx2) {
  7064. //>>excludeEnd("ctx");
  7065. $recv(slowBucket)._add_(object);
  7066. $self["@size"]=$recv($self["@size"]).__plus((1));
  7067. return $self["@size"];
  7068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7070. //>>excludeEnd("ctx");
  7071. }));
  7072. return object;
  7073. } else {
  7074. var primitiveBucket;
  7075. primitiveBucket=$receiver;
  7076. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  7077. }
  7078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7079. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7080. //>>excludeEnd("ctx");
  7081. },
  7082. //>>excludeStart("ide", pragmas.excludeIdeData);
  7083. args: ["anObject"],
  7084. 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 ]",
  7085. referencedClasses: [],
  7086. //>>excludeEnd("ide");
  7087. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  7088. }),
  7089. $globals.Set);
  7090. $core.addMethod(
  7091. $core.method({
  7092. selector: "add:in:",
  7093. protocol: "private",
  7094. fn: function (anObject,anotherObject){
  7095. var self=this,$self=this;
  7096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7097. return $core.withContext(function($ctx1) {
  7098. //>>excludeEnd("ctx");
  7099. if (anObject in anotherObject.store) { return anObject; }
  7100. $self['@size']++;
  7101. anotherObject.store[anObject] = true;
  7102. return anObject;
  7103. ;
  7104. return self;
  7105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7106. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7107. //>>excludeEnd("ctx");
  7108. },
  7109. //>>excludeStart("ide", pragmas.excludeIdeData);
  7110. args: ["anObject", "anotherObject"],
  7111. 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'>",
  7112. referencedClasses: [],
  7113. //>>excludeEnd("ide");
  7114. messageSends: []
  7115. }),
  7116. $globals.Set);
  7117. $core.addMethod(
  7118. $core.method({
  7119. selector: "bucketsOfElement:",
  7120. protocol: "private",
  7121. fn: function (anObject){
  7122. var self=this,$self=this;
  7123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7124. return $core.withContext(function($ctx1) {
  7125. //>>excludeEnd("ctx");
  7126. // include nil to well-known objects under "boolean" fastBucket
  7127. if (anObject == null || anObject.a$nil) return [ null, $self['@fastBuckets'].boolean ];
  7128. var prim = anObject.valueOf();
  7129. if (typeof prim === "object" || typeof prim === "function" || !$self['@fastBuckets'][typeof prim]) {
  7130. var bucket = null;
  7131. $self['@slowBucketStores'].some(function (store) {
  7132. return bucket = store._bucketOfElement_(anObject);
  7133. });
  7134. return [ anObject, null, bucket || $self['@defaultBucket'] ];
  7135. }
  7136. return [ prim, $self['@fastBuckets'][typeof prim] ];
  7137. ;
  7138. return self;
  7139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7140. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  7141. //>>excludeEnd("ctx");
  7142. },
  7143. //>>excludeStart("ide", pragmas.excludeIdeData);
  7144. args: ["anObject"],
  7145. 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'>",
  7146. referencedClasses: [],
  7147. //>>excludeEnd("ide");
  7148. messageSends: []
  7149. }),
  7150. $globals.Set);
  7151. $core.addMethod(
  7152. $core.method({
  7153. selector: "classNameOf:",
  7154. protocol: "private",
  7155. fn: function (anObject){
  7156. var self=this,$self=this;
  7157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7158. return $core.withContext(function($ctx1) {
  7159. //>>excludeEnd("ctx");
  7160. return anObject.a$cls != null && anObject.a$cls.name;
  7161. return self;
  7162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7163. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  7164. //>>excludeEnd("ctx");
  7165. },
  7166. //>>excludeStart("ide", pragmas.excludeIdeData);
  7167. args: ["anObject"],
  7168. 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'>",
  7169. referencedClasses: [],
  7170. //>>excludeEnd("ide");
  7171. messageSends: []
  7172. }),
  7173. $globals.Set);
  7174. $core.addMethod(
  7175. $core.method({
  7176. selector: "collect:",
  7177. protocol: "enumerating",
  7178. fn: function (aBlock){
  7179. var self=this,$self=this;
  7180. var collection;
  7181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7182. return $core.withContext(function($ctx1) {
  7183. //>>excludeEnd("ctx");
  7184. collection=$recv($self._class())._new();
  7185. $self._do_((function(each){
  7186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7187. return $core.withContext(function($ctx2) {
  7188. //>>excludeEnd("ctx");
  7189. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7191. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7192. //>>excludeEnd("ctx");
  7193. }));
  7194. return collection;
  7195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7196. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  7197. //>>excludeEnd("ctx");
  7198. },
  7199. //>>excludeStart("ide", pragmas.excludeIdeData);
  7200. args: ["aBlock"],
  7201. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7202. referencedClasses: [],
  7203. //>>excludeEnd("ide");
  7204. messageSends: ["new", "class", "do:", "add:", "value:"]
  7205. }),
  7206. $globals.Set);
  7207. $core.addMethod(
  7208. $core.method({
  7209. selector: "do:",
  7210. protocol: "enumerating",
  7211. fn: function (aBlock){
  7212. var self=this,$self=this;
  7213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7214. return $core.withContext(function($ctx1) {
  7215. //>>excludeEnd("ctx");
  7216. var el, keys, i;
  7217. el = $self['@fastBuckets'];
  7218. keys = Object.keys(el);
  7219. for (i = 0; i < keys.length; ++i) {
  7220. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7221. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7222. else { store._do_(aBlock); }
  7223. }
  7224. el = $self['@slowBucketStores'];
  7225. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7226. $self['@defaultBucket']._do_(aBlock);
  7227. ;
  7228. return self;
  7229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7230. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  7231. //>>excludeEnd("ctx");
  7232. },
  7233. //>>excludeStart("ide", pragmas.excludeIdeData);
  7234. args: ["aBlock"],
  7235. 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'>",
  7236. referencedClasses: [],
  7237. //>>excludeEnd("ide");
  7238. messageSends: []
  7239. }),
  7240. $globals.Set);
  7241. $core.addMethod(
  7242. $core.method({
  7243. selector: "includes:",
  7244. protocol: "testing",
  7245. fn: function (anObject){
  7246. var self=this,$self=this;
  7247. var bucket;
  7248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7249. return $core.withContext(function($ctx1) {
  7250. //>>excludeEnd("ctx");
  7251. var $1,$2,$3,$receiver;
  7252. bucket=$self._bucketsOfElement_(anObject);
  7253. $1=$recv(bucket)._second();
  7254. if(($receiver = $1) == null || $receiver.a$nil){
  7255. $2=$recv(bucket)._third();
  7256. $3=$recv(bucket)._first();
  7257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7258. $ctx1.sendIdx["first"]=1;
  7259. //>>excludeEnd("ctx");
  7260. return $recv($2)._includes_($3);
  7261. } else {
  7262. var primitiveBucket;
  7263. primitiveBucket=$receiver;
  7264. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7265. }
  7266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7267. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7268. //>>excludeEnd("ctx");
  7269. },
  7270. //>>excludeStart("ide", pragmas.excludeIdeData);
  7271. args: ["anObject"],
  7272. 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 ]",
  7273. referencedClasses: [],
  7274. //>>excludeEnd("ide");
  7275. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7276. }),
  7277. $globals.Set);
  7278. $core.addMethod(
  7279. $core.method({
  7280. selector: "includes:in:",
  7281. protocol: "private",
  7282. fn: function (anObject,anotherObject){
  7283. var self=this,$self=this;
  7284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7285. return $core.withContext(function($ctx1) {
  7286. //>>excludeEnd("ctx");
  7287. return anObject in anotherObject.store;
  7288. return self;
  7289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7290. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7291. //>>excludeEnd("ctx");
  7292. },
  7293. //>>excludeStart("ide", pragmas.excludeIdeData);
  7294. args: ["anObject", "anotherObject"],
  7295. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  7296. referencedClasses: [],
  7297. //>>excludeEnd("ide");
  7298. messageSends: []
  7299. }),
  7300. $globals.Set);
  7301. $core.addMethod(
  7302. $core.method({
  7303. selector: "initialize",
  7304. protocol: "initialization",
  7305. fn: function (){
  7306. var self=this,$self=this;
  7307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7308. return $core.withContext(function($ctx1) {
  7309. //>>excludeEnd("ctx");
  7310. (
  7311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7312. $ctx1.supercall = true,
  7313. //>>excludeEnd("ctx");
  7314. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  7315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7316. $ctx1.supercall = false;
  7317. //>>excludeEnd("ctx");;
  7318. $self["@defaultBucket"]=[];
  7319. $self._initializeSlowBucketStores();
  7320. $self._removeAll();
  7321. return self;
  7322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7323. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  7324. //>>excludeEnd("ctx");
  7325. },
  7326. //>>excludeStart("ide", pragmas.excludeIdeData);
  7327. args: [],
  7328. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7329. referencedClasses: [],
  7330. //>>excludeEnd("ide");
  7331. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7332. }),
  7333. $globals.Set);
  7334. $core.addMethod(
  7335. $core.method({
  7336. selector: "initializeSlowBucketStores",
  7337. protocol: "initialization",
  7338. fn: function (){
  7339. var self=this,$self=this;
  7340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7341. return $core.withContext(function($ctx1) {
  7342. //>>excludeEnd("ctx");
  7343. var $1;
  7344. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7346. return $core.withContext(function($ctx2) {
  7347. //>>excludeEnd("ctx");
  7348. return $self._classNameOf_(x);
  7349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7350. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7351. //>>excludeEnd("ctx");
  7352. }));
  7353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7354. $ctx1.sendIdx["hashBlock:"]=1;
  7355. //>>excludeEnd("ctx");
  7356. $self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7358. return $core.withContext(function($ctx2) {
  7359. //>>excludeEnd("ctx");
  7360. return $self._jsConstructorNameOf_(x);
  7361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7362. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7363. //>>excludeEnd("ctx");
  7364. }))];
  7365. return self;
  7366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7367. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  7368. //>>excludeEnd("ctx");
  7369. },
  7370. //>>excludeStart("ide", pragmas.excludeIdeData);
  7371. args: [],
  7372. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7373. referencedClasses: ["ArrayBucketStore"],
  7374. //>>excludeEnd("ide");
  7375. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  7376. }),
  7377. $globals.Set);
  7378. $core.addMethod(
  7379. $core.method({
  7380. selector: "jsConstructorNameOf:",
  7381. protocol: "private",
  7382. fn: function (anObject){
  7383. var self=this,$self=this;
  7384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7385. return $core.withContext(function($ctx1) {
  7386. //>>excludeEnd("ctx");
  7387. return anObject.constructor && anObject.constructor.name;
  7388. return self;
  7389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7390. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  7391. //>>excludeEnd("ctx");
  7392. },
  7393. //>>excludeStart("ide", pragmas.excludeIdeData);
  7394. args: ["anObject"],
  7395. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  7396. referencedClasses: [],
  7397. //>>excludeEnd("ide");
  7398. messageSends: []
  7399. }),
  7400. $globals.Set);
  7401. $core.addMethod(
  7402. $core.method({
  7403. selector: "printOn:",
  7404. protocol: "printing",
  7405. fn: function (aStream){
  7406. var self=this,$self=this;
  7407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7408. return $core.withContext(function($ctx1) {
  7409. //>>excludeEnd("ctx");
  7410. (
  7411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7412. $ctx1.supercall = true,
  7413. //>>excludeEnd("ctx");
  7414. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  7415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7416. $ctx1.supercall = false;
  7417. //>>excludeEnd("ctx");;
  7418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7419. $ctx1.sendIdx["printOn:"]=1;
  7420. //>>excludeEnd("ctx");
  7421. $recv(aStream)._nextPutAll_(" (");
  7422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7423. $ctx1.sendIdx["nextPutAll:"]=1;
  7424. //>>excludeEnd("ctx");
  7425. $self._do_separatedBy_((function(each){
  7426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7427. return $core.withContext(function($ctx2) {
  7428. //>>excludeEnd("ctx");
  7429. return $recv(each)._printOn_(aStream);
  7430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7431. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7432. //>>excludeEnd("ctx");
  7433. }),(function(){
  7434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7435. return $core.withContext(function($ctx2) {
  7436. //>>excludeEnd("ctx");
  7437. return $recv(aStream)._nextPutAll_(" ");
  7438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7439. $ctx2.sendIdx["nextPutAll:"]=2;
  7440. //>>excludeEnd("ctx");
  7441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7443. //>>excludeEnd("ctx");
  7444. }));
  7445. $recv(aStream)._nextPutAll_(")");
  7446. return self;
  7447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7448. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  7449. //>>excludeEnd("ctx");
  7450. },
  7451. //>>excludeStart("ide", pragmas.excludeIdeData);
  7452. args: ["aStream"],
  7453. 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: ')'",
  7454. referencedClasses: [],
  7455. //>>excludeEnd("ide");
  7456. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  7457. }),
  7458. $globals.Set);
  7459. $core.addMethod(
  7460. $core.method({
  7461. selector: "remove:ifAbsent:",
  7462. protocol: "adding/removing",
  7463. fn: function (anObject,aBlock){
  7464. var self=this,$self=this;
  7465. var bucket;
  7466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7467. return $core.withContext(function($ctx1) {
  7468. //>>excludeEnd("ctx");
  7469. var $1,$2,$3,$receiver;
  7470. var $early={};
  7471. try {
  7472. bucket=$self._bucketsOfElement_(anObject);
  7473. $1=$recv(bucket)._second();
  7474. if(($receiver = $1) == null || $receiver.a$nil){
  7475. $2=$recv(bucket)._third();
  7476. $3=$recv(bucket)._first();
  7477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7478. $ctx1.sendIdx["first"]=1;
  7479. //>>excludeEnd("ctx");
  7480. $recv($2)._remove_ifAbsent_($3,(function(){
  7481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7482. return $core.withContext(function($ctx2) {
  7483. //>>excludeEnd("ctx");
  7484. throw $early=[$recv(aBlock)._value()];
  7485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7486. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7487. //>>excludeEnd("ctx");
  7488. }));
  7489. $self["@size"]=$recv($self["@size"]).__minus((1));
  7490. return $self["@size"];
  7491. } else {
  7492. var primitiveBucket;
  7493. primitiveBucket=$receiver;
  7494. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  7495. }
  7496. }
  7497. catch(e) {if(e===$early)return e[0]; throw e}
  7498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7499. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  7500. //>>excludeEnd("ctx");
  7501. },
  7502. //>>excludeStart("ide", pragmas.excludeIdeData);
  7503. args: ["anObject", "aBlock"],
  7504. 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 ]",
  7505. referencedClasses: [],
  7506. //>>excludeEnd("ide");
  7507. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:ifAbsent:"]
  7508. }),
  7509. $globals.Set);
  7510. $core.addMethod(
  7511. $core.method({
  7512. selector: "remove:in:ifAbsent:",
  7513. protocol: "private",
  7514. fn: function (anObject,anotherObject,aBlock){
  7515. var self=this,$self=this;
  7516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7517. return $core.withContext(function($ctx1) {
  7518. //>>excludeEnd("ctx");
  7519. if (anObject in anotherObject.store) {
  7520. delete anotherObject.store[anObject];
  7521. $self['@size']--;
  7522. return anObject;
  7523. } else {
  7524. return aBlock._value();
  7525. };
  7526. return self;
  7527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7528. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock},$globals.Set)});
  7529. //>>excludeEnd("ctx");
  7530. },
  7531. //>>excludeStart("ide", pragmas.excludeIdeData);
  7532. args: ["anObject", "anotherObject", "aBlock"],
  7533. 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}'>",
  7534. referencedClasses: [],
  7535. //>>excludeEnd("ide");
  7536. messageSends: []
  7537. }),
  7538. $globals.Set);
  7539. $core.addMethod(
  7540. $core.method({
  7541. selector: "removeAll",
  7542. protocol: "adding/removing",
  7543. fn: function (){
  7544. var self=this,$self=this;
  7545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7546. return $core.withContext(function($ctx1) {
  7547. //>>excludeEnd("ctx");
  7548. $self['@fastBuckets'] = {
  7549. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  7550. "number": { store: Object.create(null), fn: Number },
  7551. "string": { store: Object.create(null) }
  7552. };
  7553. $self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  7554. $self['@defaultBucket']._removeAll();
  7555. $self['@size'] = 0;
  7556. ;
  7557. return self;
  7558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7559. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  7560. //>>excludeEnd("ctx");
  7561. },
  7562. //>>excludeStart("ide", pragmas.excludeIdeData);
  7563. args: [],
  7564. 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'>",
  7565. referencedClasses: [],
  7566. //>>excludeEnd("ide");
  7567. messageSends: []
  7568. }),
  7569. $globals.Set);
  7570. $core.addMethod(
  7571. $core.method({
  7572. selector: "select:",
  7573. protocol: "enumerating",
  7574. fn: function (aBlock){
  7575. var self=this,$self=this;
  7576. var collection;
  7577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7578. return $core.withContext(function($ctx1) {
  7579. //>>excludeEnd("ctx");
  7580. var $1;
  7581. collection=$recv($self._class())._new();
  7582. $self._do_((function(each){
  7583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7584. return $core.withContext(function($ctx2) {
  7585. //>>excludeEnd("ctx");
  7586. $1=$recv(aBlock)._value_(each);
  7587. if($core.assert($1)){
  7588. return $recv(collection)._add_(each);
  7589. }
  7590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7591. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7592. //>>excludeEnd("ctx");
  7593. }));
  7594. return collection;
  7595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7596. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  7597. //>>excludeEnd("ctx");
  7598. },
  7599. //>>excludeStart("ide", pragmas.excludeIdeData);
  7600. args: ["aBlock"],
  7601. 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",
  7602. referencedClasses: [],
  7603. //>>excludeEnd("ide");
  7604. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7605. }),
  7606. $globals.Set);
  7607. $core.addMethod(
  7608. $core.method({
  7609. selector: "select:thenCollect:",
  7610. protocol: "enumerating",
  7611. fn: function (selectBlock,collectBlock){
  7612. var self=this,$self=this;
  7613. var collection;
  7614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7615. return $core.withContext(function($ctx1) {
  7616. //>>excludeEnd("ctx");
  7617. var $1;
  7618. collection=$recv($self._class())._new();
  7619. $self._do_((function(each){
  7620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7621. return $core.withContext(function($ctx2) {
  7622. //>>excludeEnd("ctx");
  7623. $1=$recv(selectBlock)._value_(each);
  7624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7625. $ctx2.sendIdx["value:"]=1;
  7626. //>>excludeEnd("ctx");
  7627. if($core.assert($1)){
  7628. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  7629. }
  7630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7631. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7632. //>>excludeEnd("ctx");
  7633. }));
  7634. return collection;
  7635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7636. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  7637. //>>excludeEnd("ctx");
  7638. },
  7639. //>>excludeStart("ide", pragmas.excludeIdeData);
  7640. args: ["selectBlock", "collectBlock"],
  7641. 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",
  7642. referencedClasses: [],
  7643. //>>excludeEnd("ide");
  7644. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7645. }),
  7646. $globals.Set);
  7647. $core.addMethod(
  7648. $core.method({
  7649. selector: "size",
  7650. protocol: "accessing",
  7651. fn: function (){
  7652. var self=this,$self=this;
  7653. return $self["@size"];
  7654. },
  7655. //>>excludeStart("ide", pragmas.excludeIdeData);
  7656. args: [],
  7657. source: "size\x0a\x09^ size",
  7658. referencedClasses: [],
  7659. //>>excludeEnd("ide");
  7660. messageSends: []
  7661. }),
  7662. $globals.Set);
  7663. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  7664. //>>excludeStart("ide", pragmas.excludeIdeData);
  7665. $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.";
  7666. //>>excludeEnd("ide");
  7667. $core.addMethod(
  7668. $core.method({
  7669. selector: "<<",
  7670. protocol: "writing",
  7671. fn: function (anObject){
  7672. var self=this,$self=this;
  7673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7674. return $core.withContext(function($ctx1) {
  7675. //>>excludeEnd("ctx");
  7676. $self._write_(anObject);
  7677. return self;
  7678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7679. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  7680. //>>excludeEnd("ctx");
  7681. },
  7682. //>>excludeStart("ide", pragmas.excludeIdeData);
  7683. args: ["anObject"],
  7684. source: "<< anObject\x0a\x09self write: anObject",
  7685. referencedClasses: [],
  7686. //>>excludeEnd("ide");
  7687. messageSends: ["write:"]
  7688. }),
  7689. $globals.ProtoStream);
  7690. $core.addMethod(
  7691. $core.method({
  7692. selector: "atEnd",
  7693. protocol: "testing",
  7694. fn: function (){
  7695. var self=this,$self=this;
  7696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7697. return $core.withContext(function($ctx1) {
  7698. //>>excludeEnd("ctx");
  7699. $self._subclassResponsibility();
  7700. return self;
  7701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7702. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  7703. //>>excludeEnd("ctx");
  7704. },
  7705. //>>excludeStart("ide", pragmas.excludeIdeData);
  7706. args: [],
  7707. source: "atEnd\x0a\x09self subclassResponsibility",
  7708. referencedClasses: [],
  7709. //>>excludeEnd("ide");
  7710. messageSends: ["subclassResponsibility"]
  7711. }),
  7712. $globals.ProtoStream);
  7713. $core.addMethod(
  7714. $core.method({
  7715. selector: "atStart",
  7716. protocol: "testing",
  7717. fn: function (){
  7718. var self=this,$self=this;
  7719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7720. return $core.withContext(function($ctx1) {
  7721. //>>excludeEnd("ctx");
  7722. $self._subclassResponsibility();
  7723. return self;
  7724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7725. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  7726. //>>excludeEnd("ctx");
  7727. },
  7728. //>>excludeStart("ide", pragmas.excludeIdeData);
  7729. args: [],
  7730. source: "atStart\x0a\x09self subclassResponsibility",
  7731. referencedClasses: [],
  7732. //>>excludeEnd("ide");
  7733. messageSends: ["subclassResponsibility"]
  7734. }),
  7735. $globals.ProtoStream);
  7736. $core.addMethod(
  7737. $core.method({
  7738. selector: "contents",
  7739. protocol: "accessing",
  7740. fn: function (){
  7741. var self=this,$self=this;
  7742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7743. return $core.withContext(function($ctx1) {
  7744. //>>excludeEnd("ctx");
  7745. $self._subclassResponsibility();
  7746. return self;
  7747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7748. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  7749. //>>excludeEnd("ctx");
  7750. },
  7751. //>>excludeStart("ide", pragmas.excludeIdeData);
  7752. args: [],
  7753. source: "contents\x0a\x09self subclassResponsibility",
  7754. referencedClasses: [],
  7755. //>>excludeEnd("ide");
  7756. messageSends: ["subclassResponsibility"]
  7757. }),
  7758. $globals.ProtoStream);
  7759. $core.addMethod(
  7760. $core.method({
  7761. selector: "do:",
  7762. protocol: "enumerating",
  7763. fn: function (aBlock){
  7764. var self=this,$self=this;
  7765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7766. return $core.withContext(function($ctx1) {
  7767. //>>excludeEnd("ctx");
  7768. $recv((function(){
  7769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7770. return $core.withContext(function($ctx2) {
  7771. //>>excludeEnd("ctx");
  7772. return $self._atEnd();
  7773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7774. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7775. //>>excludeEnd("ctx");
  7776. }))._whileFalse_((function(){
  7777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7778. return $core.withContext(function($ctx2) {
  7779. //>>excludeEnd("ctx");
  7780. return $recv(aBlock)._value_($self._next());
  7781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7782. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7783. //>>excludeEnd("ctx");
  7784. }));
  7785. return self;
  7786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7787. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  7788. //>>excludeEnd("ctx");
  7789. },
  7790. //>>excludeStart("ide", pragmas.excludeIdeData);
  7791. args: ["aBlock"],
  7792. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  7793. referencedClasses: [],
  7794. //>>excludeEnd("ide");
  7795. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  7796. }),
  7797. $globals.ProtoStream);
  7798. $core.addMethod(
  7799. $core.method({
  7800. selector: "isEmpty",
  7801. protocol: "testing",
  7802. fn: function (){
  7803. var self=this,$self=this;
  7804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7805. return $core.withContext(function($ctx1) {
  7806. //>>excludeEnd("ctx");
  7807. return $recv($self._atStart())._and_((function(){
  7808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7809. return $core.withContext(function($ctx2) {
  7810. //>>excludeEnd("ctx");
  7811. return $self._atEnd();
  7812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7814. //>>excludeEnd("ctx");
  7815. }));
  7816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7817. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  7818. //>>excludeEnd("ctx");
  7819. },
  7820. //>>excludeStart("ide", pragmas.excludeIdeData);
  7821. args: [],
  7822. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  7823. referencedClasses: [],
  7824. //>>excludeEnd("ide");
  7825. messageSends: ["and:", "atStart", "atEnd"]
  7826. }),
  7827. $globals.ProtoStream);
  7828. $core.addMethod(
  7829. $core.method({
  7830. selector: "next",
  7831. protocol: "reading",
  7832. fn: function (){
  7833. var self=this,$self=this;
  7834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7835. return $core.withContext(function($ctx1) {
  7836. //>>excludeEnd("ctx");
  7837. var $1;
  7838. $1=$self._atEnd();
  7839. if($core.assert($1)){
  7840. return nil;
  7841. } else {
  7842. return $self._subclassResponsibility();
  7843. }
  7844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7845. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  7846. //>>excludeEnd("ctx");
  7847. },
  7848. //>>excludeStart("ide", pragmas.excludeIdeData);
  7849. args: [],
  7850. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7851. referencedClasses: [],
  7852. //>>excludeEnd("ide");
  7853. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7854. }),
  7855. $globals.ProtoStream);
  7856. $core.addMethod(
  7857. $core.method({
  7858. selector: "nextPut:",
  7859. protocol: "writing",
  7860. fn: function (anObject){
  7861. var self=this,$self=this;
  7862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7863. return $core.withContext(function($ctx1) {
  7864. //>>excludeEnd("ctx");
  7865. $self._subclassResponsibility();
  7866. return self;
  7867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7868. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  7869. //>>excludeEnd("ctx");
  7870. },
  7871. //>>excludeStart("ide", pragmas.excludeIdeData);
  7872. args: ["anObject"],
  7873. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  7874. referencedClasses: [],
  7875. //>>excludeEnd("ide");
  7876. messageSends: ["subclassResponsibility"]
  7877. }),
  7878. $globals.ProtoStream);
  7879. $core.addMethod(
  7880. $core.method({
  7881. selector: "nextPutAll:",
  7882. protocol: "writing",
  7883. fn: function (aCollection){
  7884. var self=this,$self=this;
  7885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7886. return $core.withContext(function($ctx1) {
  7887. //>>excludeEnd("ctx");
  7888. $recv(aCollection)._do_((function(each){
  7889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7890. return $core.withContext(function($ctx2) {
  7891. //>>excludeEnd("ctx");
  7892. return $self._nextPut_(each);
  7893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7894. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7895. //>>excludeEnd("ctx");
  7896. }));
  7897. return self;
  7898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7899. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  7900. //>>excludeEnd("ctx");
  7901. },
  7902. //>>excludeStart("ide", pragmas.excludeIdeData);
  7903. args: ["aCollection"],
  7904. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  7905. referencedClasses: [],
  7906. //>>excludeEnd("ide");
  7907. messageSends: ["do:", "nextPut:"]
  7908. }),
  7909. $globals.ProtoStream);
  7910. $core.addMethod(
  7911. $core.method({
  7912. selector: "nextPutString:",
  7913. protocol: "writing",
  7914. fn: function (aString){
  7915. var self=this,$self=this;
  7916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7917. return $core.withContext(function($ctx1) {
  7918. //>>excludeEnd("ctx");
  7919. $self._nextPut_(aString);
  7920. return self;
  7921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7922. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  7923. //>>excludeEnd("ctx");
  7924. },
  7925. //>>excludeStart("ide", pragmas.excludeIdeData);
  7926. args: ["aString"],
  7927. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  7928. referencedClasses: [],
  7929. //>>excludeEnd("ide");
  7930. messageSends: ["nextPut:"]
  7931. }),
  7932. $globals.ProtoStream);
  7933. $core.addMethod(
  7934. $core.method({
  7935. selector: "peek",
  7936. protocol: "reading",
  7937. fn: function (){
  7938. var self=this,$self=this;
  7939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7940. return $core.withContext(function($ctx1) {
  7941. //>>excludeEnd("ctx");
  7942. var $1;
  7943. $1=$self._atEnd();
  7944. if($core.assert($1)){
  7945. return nil;
  7946. } else {
  7947. return $self._subclassResponsibility();
  7948. }
  7949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7950. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  7951. //>>excludeEnd("ctx");
  7952. },
  7953. //>>excludeStart("ide", pragmas.excludeIdeData);
  7954. args: [],
  7955. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7956. referencedClasses: [],
  7957. //>>excludeEnd("ide");
  7958. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7959. }),
  7960. $globals.ProtoStream);
  7961. $core.addMethod(
  7962. $core.method({
  7963. selector: "reset",
  7964. protocol: "actions",
  7965. fn: function (){
  7966. var self=this,$self=this;
  7967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7968. return $core.withContext(function($ctx1) {
  7969. //>>excludeEnd("ctx");
  7970. $self._subclassResponsibility();
  7971. return self;
  7972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7973. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  7974. //>>excludeEnd("ctx");
  7975. },
  7976. //>>excludeStart("ide", pragmas.excludeIdeData);
  7977. args: [],
  7978. source: "reset\x0a\x09self subclassResponsibility",
  7979. referencedClasses: [],
  7980. //>>excludeEnd("ide");
  7981. messageSends: ["subclassResponsibility"]
  7982. }),
  7983. $globals.ProtoStream);
  7984. $core.addMethod(
  7985. $core.method({
  7986. selector: "resetContents",
  7987. protocol: "actions",
  7988. fn: function (){
  7989. var self=this,$self=this;
  7990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7991. return $core.withContext(function($ctx1) {
  7992. //>>excludeEnd("ctx");
  7993. $self._subclassResponsibility();
  7994. return self;
  7995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7996. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  7997. //>>excludeEnd("ctx");
  7998. },
  7999. //>>excludeStart("ide", pragmas.excludeIdeData);
  8000. args: [],
  8001. source: "resetContents\x0a\x09self subclassResponsibility",
  8002. referencedClasses: [],
  8003. //>>excludeEnd("ide");
  8004. messageSends: ["subclassResponsibility"]
  8005. }),
  8006. $globals.ProtoStream);
  8007. $core.addMethod(
  8008. $core.method({
  8009. selector: "setToEnd",
  8010. protocol: "positioning",
  8011. fn: function (){
  8012. var self=this,$self=this;
  8013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8014. return $core.withContext(function($ctx1) {
  8015. //>>excludeEnd("ctx");
  8016. $self._subclassResponsibility();
  8017. return self;
  8018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8019. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  8020. //>>excludeEnd("ctx");
  8021. },
  8022. //>>excludeStart("ide", pragmas.excludeIdeData);
  8023. args: [],
  8024. source: "setToEnd\x0a\x09self subclassResponsibility",
  8025. referencedClasses: [],
  8026. //>>excludeEnd("ide");
  8027. messageSends: ["subclassResponsibility"]
  8028. }),
  8029. $globals.ProtoStream);
  8030. $core.addMethod(
  8031. $core.method({
  8032. selector: "setToStart",
  8033. protocol: "positioning",
  8034. fn: function (){
  8035. var self=this,$self=this;
  8036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8037. return $core.withContext(function($ctx1) {
  8038. //>>excludeEnd("ctx");
  8039. $self._reset();
  8040. return self;
  8041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8042. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  8043. //>>excludeEnd("ctx");
  8044. },
  8045. //>>excludeStart("ide", pragmas.excludeIdeData);
  8046. args: [],
  8047. source: "setToStart\x0a\x09self reset",
  8048. referencedClasses: [],
  8049. //>>excludeEnd("ide");
  8050. messageSends: ["reset"]
  8051. }),
  8052. $globals.ProtoStream);
  8053. $core.addMethod(
  8054. $core.method({
  8055. selector: "write:",
  8056. protocol: "writing",
  8057. fn: function (anObject){
  8058. var self=this,$self=this;
  8059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8060. return $core.withContext(function($ctx1) {
  8061. //>>excludeEnd("ctx");
  8062. $recv(anObject)._putOn_(self);
  8063. return self;
  8064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8065. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  8066. //>>excludeEnd("ctx");
  8067. },
  8068. //>>excludeStart("ide", pragmas.excludeIdeData);
  8069. args: ["anObject"],
  8070. source: "write: anObject\x0a\x09anObject putOn: self",
  8071. referencedClasses: [],
  8072. //>>excludeEnd("ide");
  8073. messageSends: ["putOn:"]
  8074. }),
  8075. $globals.ProtoStream);
  8076. $core.addMethod(
  8077. $core.method({
  8078. selector: "on:",
  8079. protocol: "instance creation",
  8080. fn: function (aCollection){
  8081. var self=this,$self=this;
  8082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8083. return $core.withContext(function($ctx1) {
  8084. //>>excludeEnd("ctx");
  8085. var $1;
  8086. $1=$self._new();
  8087. $recv($1)._setCollection_(aCollection);
  8088. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8089. return $recv($1)._yourself();
  8090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8091. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.a$cls)});
  8092. //>>excludeEnd("ctx");
  8093. },
  8094. //>>excludeStart("ide", pragmas.excludeIdeData);
  8095. args: ["aCollection"],
  8096. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8097. referencedClasses: [],
  8098. //>>excludeEnd("ide");
  8099. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8100. }),
  8101. $globals.ProtoStream.a$cls);
  8102. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  8103. //>>excludeStart("ide", pragmas.excludeIdeData);
  8104. $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.";
  8105. //>>excludeEnd("ide");
  8106. $core.addMethod(
  8107. $core.method({
  8108. selector: "atEnd",
  8109. protocol: "testing",
  8110. fn: function (){
  8111. var self=this,$self=this;
  8112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8113. return $core.withContext(function($ctx1) {
  8114. //>>excludeEnd("ctx");
  8115. return $recv($self._position()).__eq($self._size());
  8116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8117. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  8118. //>>excludeEnd("ctx");
  8119. },
  8120. //>>excludeStart("ide", pragmas.excludeIdeData);
  8121. args: [],
  8122. source: "atEnd\x0a\x09^ self position = self size",
  8123. referencedClasses: [],
  8124. //>>excludeEnd("ide");
  8125. messageSends: ["=", "position", "size"]
  8126. }),
  8127. $globals.Stream);
  8128. $core.addMethod(
  8129. $core.method({
  8130. selector: "atStart",
  8131. protocol: "testing",
  8132. fn: function (){
  8133. var self=this,$self=this;
  8134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8135. return $core.withContext(function($ctx1) {
  8136. //>>excludeEnd("ctx");
  8137. return $recv($self._position()).__eq((0));
  8138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8139. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  8140. //>>excludeEnd("ctx");
  8141. },
  8142. //>>excludeStart("ide", pragmas.excludeIdeData);
  8143. args: [],
  8144. source: "atStart\x0a\x09^ self position = 0",
  8145. referencedClasses: [],
  8146. //>>excludeEnd("ide");
  8147. messageSends: ["=", "position"]
  8148. }),
  8149. $globals.Stream);
  8150. $core.addMethod(
  8151. $core.method({
  8152. selector: "close",
  8153. protocol: "actions",
  8154. fn: function (){
  8155. var self=this,$self=this;
  8156. return self;
  8157. },
  8158. //>>excludeStart("ide", pragmas.excludeIdeData);
  8159. args: [],
  8160. source: "close",
  8161. referencedClasses: [],
  8162. //>>excludeEnd("ide");
  8163. messageSends: []
  8164. }),
  8165. $globals.Stream);
  8166. $core.addMethod(
  8167. $core.method({
  8168. selector: "collection",
  8169. protocol: "accessing",
  8170. fn: function (){
  8171. var self=this,$self=this;
  8172. return $self["@collection"];
  8173. },
  8174. //>>excludeStart("ide", pragmas.excludeIdeData);
  8175. args: [],
  8176. source: "collection\x0a\x09^ collection",
  8177. referencedClasses: [],
  8178. //>>excludeEnd("ide");
  8179. messageSends: []
  8180. }),
  8181. $globals.Stream);
  8182. $core.addMethod(
  8183. $core.method({
  8184. selector: "contents",
  8185. protocol: "accessing",
  8186. fn: function (){
  8187. var self=this,$self=this;
  8188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8189. return $core.withContext(function($ctx1) {
  8190. //>>excludeEnd("ctx");
  8191. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  8192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8193. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  8194. //>>excludeEnd("ctx");
  8195. },
  8196. //>>excludeStart("ide", pragmas.excludeIdeData);
  8197. args: [],
  8198. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8199. referencedClasses: [],
  8200. //>>excludeEnd("ide");
  8201. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8202. }),
  8203. $globals.Stream);
  8204. $core.addMethod(
  8205. $core.method({
  8206. selector: "flush",
  8207. protocol: "actions",
  8208. fn: function (){
  8209. var self=this,$self=this;
  8210. return self;
  8211. },
  8212. //>>excludeStart("ide", pragmas.excludeIdeData);
  8213. args: [],
  8214. source: "flush",
  8215. referencedClasses: [],
  8216. //>>excludeEnd("ide");
  8217. messageSends: []
  8218. }),
  8219. $globals.Stream);
  8220. $core.addMethod(
  8221. $core.method({
  8222. selector: "isEmpty",
  8223. protocol: "testing",
  8224. fn: function (){
  8225. var self=this,$self=this;
  8226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8227. return $core.withContext(function($ctx1) {
  8228. //>>excludeEnd("ctx");
  8229. return $recv($self._size()).__eq((0));
  8230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8231. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  8232. //>>excludeEnd("ctx");
  8233. },
  8234. //>>excludeStart("ide", pragmas.excludeIdeData);
  8235. args: [],
  8236. source: "isEmpty\x0a\x09^ self size = 0",
  8237. referencedClasses: [],
  8238. //>>excludeEnd("ide");
  8239. messageSends: ["=", "size"]
  8240. }),
  8241. $globals.Stream);
  8242. $core.addMethod(
  8243. $core.method({
  8244. selector: "next",
  8245. protocol: "reading",
  8246. fn: function (){
  8247. var self=this,$self=this;
  8248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8249. return $core.withContext(function($ctx1) {
  8250. //>>excludeEnd("ctx");
  8251. var $1,$3,$2;
  8252. $1=$self._atEnd();
  8253. if($core.assert($1)){
  8254. return nil;
  8255. } else {
  8256. $3=$self._position();
  8257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8258. $ctx1.sendIdx["position"]=1;
  8259. //>>excludeEnd("ctx");
  8260. $2=$recv($3).__plus((1));
  8261. $self._position_($2);
  8262. return $recv($self["@collection"])._at_($self._position());
  8263. }
  8264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8265. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  8266. //>>excludeEnd("ctx");
  8267. },
  8268. //>>excludeStart("ide", pragmas.excludeIdeData);
  8269. args: [],
  8270. 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 ]",
  8271. referencedClasses: [],
  8272. //>>excludeEnd("ide");
  8273. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8274. }),
  8275. $globals.Stream);
  8276. $core.addMethod(
  8277. $core.method({
  8278. selector: "next:",
  8279. protocol: "reading",
  8280. fn: function (anInteger){
  8281. var self=this,$self=this;
  8282. var tempCollection;
  8283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8284. return $core.withContext(function($ctx1) {
  8285. //>>excludeEnd("ctx");
  8286. var $1;
  8287. tempCollection=$recv($recv($self._collection())._class())._new();
  8288. $recv(anInteger)._timesRepeat_((function(){
  8289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8290. return $core.withContext(function($ctx2) {
  8291. //>>excludeEnd("ctx");
  8292. $1=$self._atEnd();
  8293. if(!$core.assert($1)){
  8294. return $recv(tempCollection)._add_($self._next());
  8295. }
  8296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8298. //>>excludeEnd("ctx");
  8299. }));
  8300. return tempCollection;
  8301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8302. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  8303. //>>excludeEnd("ctx");
  8304. },
  8305. //>>excludeStart("ide", pragmas.excludeIdeData);
  8306. args: ["anInteger"],
  8307. 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",
  8308. referencedClasses: [],
  8309. //>>excludeEnd("ide");
  8310. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8311. }),
  8312. $globals.Stream);
  8313. $core.addMethod(
  8314. $core.method({
  8315. selector: "nextPut:",
  8316. protocol: "writing",
  8317. fn: function (anObject){
  8318. var self=this,$self=this;
  8319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8320. return $core.withContext(function($ctx1) {
  8321. //>>excludeEnd("ctx");
  8322. var $2,$1,$3,$4;
  8323. $2=$self._position();
  8324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8325. $ctx1.sendIdx["position"]=1;
  8326. //>>excludeEnd("ctx");
  8327. $1=$recv($2).__plus((1));
  8328. $self._position_($1);
  8329. $3=$self._collection();
  8330. $4=$self._position();
  8331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8332. $ctx1.sendIdx["position"]=2;
  8333. //>>excludeEnd("ctx");
  8334. $recv($3)._at_put_($4,anObject);
  8335. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8336. return self;
  8337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8338. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  8339. //>>excludeEnd("ctx");
  8340. },
  8341. //>>excludeStart("ide", pragmas.excludeIdeData);
  8342. args: ["anObject"],
  8343. 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)",
  8344. referencedClasses: [],
  8345. //>>excludeEnd("ide");
  8346. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8347. }),
  8348. $globals.Stream);
  8349. $core.addMethod(
  8350. $core.method({
  8351. selector: "peek",
  8352. protocol: "reading",
  8353. fn: function (){
  8354. var self=this,$self=this;
  8355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8356. return $core.withContext(function($ctx1) {
  8357. //>>excludeEnd("ctx");
  8358. var $1;
  8359. $1=$self._atEnd();
  8360. if(!$core.assert($1)){
  8361. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  8362. }
  8363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8364. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  8365. //>>excludeEnd("ctx");
  8366. },
  8367. //>>excludeStart("ide", pragmas.excludeIdeData);
  8368. args: [],
  8369. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8370. referencedClasses: [],
  8371. //>>excludeEnd("ide");
  8372. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8373. }),
  8374. $globals.Stream);
  8375. $core.addMethod(
  8376. $core.method({
  8377. selector: "position",
  8378. protocol: "accessing",
  8379. fn: function (){
  8380. var self=this,$self=this;
  8381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8382. return $core.withContext(function($ctx1) {
  8383. //>>excludeEnd("ctx");
  8384. var $1,$receiver;
  8385. $1=$self["@position"];
  8386. if(($receiver = $1) == null || $receiver.a$nil){
  8387. $self["@position"]=(0);
  8388. return $self["@position"];
  8389. } else {
  8390. return $1;
  8391. }
  8392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8393. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  8394. //>>excludeEnd("ctx");
  8395. },
  8396. //>>excludeStart("ide", pragmas.excludeIdeData);
  8397. args: [],
  8398. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  8399. referencedClasses: [],
  8400. //>>excludeEnd("ide");
  8401. messageSends: ["ifNil:"]
  8402. }),
  8403. $globals.Stream);
  8404. $core.addMethod(
  8405. $core.method({
  8406. selector: "position:",
  8407. protocol: "accessing",
  8408. fn: function (anInteger){
  8409. var self=this,$self=this;
  8410. $self["@position"]=anInteger;
  8411. return self;
  8412. },
  8413. //>>excludeStart("ide", pragmas.excludeIdeData);
  8414. args: ["anInteger"],
  8415. source: "position: anInteger\x0a\x09position := anInteger",
  8416. referencedClasses: [],
  8417. //>>excludeEnd("ide");
  8418. messageSends: []
  8419. }),
  8420. $globals.Stream);
  8421. $core.addMethod(
  8422. $core.method({
  8423. selector: "reset",
  8424. protocol: "actions",
  8425. fn: function (){
  8426. var self=this,$self=this;
  8427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8428. return $core.withContext(function($ctx1) {
  8429. //>>excludeEnd("ctx");
  8430. $self._position_((0));
  8431. return self;
  8432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8433. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  8434. //>>excludeEnd("ctx");
  8435. },
  8436. //>>excludeStart("ide", pragmas.excludeIdeData);
  8437. args: [],
  8438. source: "reset\x0a\x09self position: 0",
  8439. referencedClasses: [],
  8440. //>>excludeEnd("ide");
  8441. messageSends: ["position:"]
  8442. }),
  8443. $globals.Stream);
  8444. $core.addMethod(
  8445. $core.method({
  8446. selector: "resetContents",
  8447. protocol: "actions",
  8448. fn: function (){
  8449. var self=this,$self=this;
  8450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8451. return $core.withContext(function($ctx1) {
  8452. //>>excludeEnd("ctx");
  8453. $self._reset();
  8454. $self._setStreamSize_((0));
  8455. return self;
  8456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8457. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  8458. //>>excludeEnd("ctx");
  8459. },
  8460. //>>excludeStart("ide", pragmas.excludeIdeData);
  8461. args: [],
  8462. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  8463. referencedClasses: [],
  8464. //>>excludeEnd("ide");
  8465. messageSends: ["reset", "setStreamSize:"]
  8466. }),
  8467. $globals.Stream);
  8468. $core.addMethod(
  8469. $core.method({
  8470. selector: "setCollection:",
  8471. protocol: "accessing",
  8472. fn: function (aCollection){
  8473. var self=this,$self=this;
  8474. $self["@collection"]=aCollection;
  8475. return self;
  8476. },
  8477. //>>excludeStart("ide", pragmas.excludeIdeData);
  8478. args: ["aCollection"],
  8479. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  8480. referencedClasses: [],
  8481. //>>excludeEnd("ide");
  8482. messageSends: []
  8483. }),
  8484. $globals.Stream);
  8485. $core.addMethod(
  8486. $core.method({
  8487. selector: "setStreamSize:",
  8488. protocol: "accessing",
  8489. fn: function (anInteger){
  8490. var self=this,$self=this;
  8491. $self["@streamSize"]=anInteger;
  8492. return self;
  8493. },
  8494. //>>excludeStart("ide", pragmas.excludeIdeData);
  8495. args: ["anInteger"],
  8496. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  8497. referencedClasses: [],
  8498. //>>excludeEnd("ide");
  8499. messageSends: []
  8500. }),
  8501. $globals.Stream);
  8502. $core.addMethod(
  8503. $core.method({
  8504. selector: "setToEnd",
  8505. protocol: "positioning",
  8506. fn: function (){
  8507. var self=this,$self=this;
  8508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8509. return $core.withContext(function($ctx1) {
  8510. //>>excludeEnd("ctx");
  8511. $self._position_($self._size());
  8512. return self;
  8513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8514. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  8515. //>>excludeEnd("ctx");
  8516. },
  8517. //>>excludeStart("ide", pragmas.excludeIdeData);
  8518. args: [],
  8519. source: "setToEnd\x0a\x09self position: self size",
  8520. referencedClasses: [],
  8521. //>>excludeEnd("ide");
  8522. messageSends: ["position:", "size"]
  8523. }),
  8524. $globals.Stream);
  8525. $core.addMethod(
  8526. $core.method({
  8527. selector: "size",
  8528. protocol: "accessing",
  8529. fn: function (){
  8530. var self=this,$self=this;
  8531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8532. return $core.withContext(function($ctx1) {
  8533. //>>excludeEnd("ctx");
  8534. return $self._streamSize();
  8535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8536. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  8537. //>>excludeEnd("ctx");
  8538. },
  8539. //>>excludeStart("ide", pragmas.excludeIdeData);
  8540. args: [],
  8541. source: "size\x0a\x09^ self streamSize",
  8542. referencedClasses: [],
  8543. //>>excludeEnd("ide");
  8544. messageSends: ["streamSize"]
  8545. }),
  8546. $globals.Stream);
  8547. $core.addMethod(
  8548. $core.method({
  8549. selector: "skip:",
  8550. protocol: "positioning",
  8551. fn: function (anInteger){
  8552. var self=this,$self=this;
  8553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8554. return $core.withContext(function($ctx1) {
  8555. //>>excludeEnd("ctx");
  8556. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  8557. return self;
  8558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8559. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  8560. //>>excludeEnd("ctx");
  8561. },
  8562. //>>excludeStart("ide", pragmas.excludeIdeData);
  8563. args: ["anInteger"],
  8564. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  8565. referencedClasses: [],
  8566. //>>excludeEnd("ide");
  8567. messageSends: ["position:", "min:max:", "+", "position", "size"]
  8568. }),
  8569. $globals.Stream);
  8570. $core.addMethod(
  8571. $core.method({
  8572. selector: "streamSize",
  8573. protocol: "accessing",
  8574. fn: function (){
  8575. var self=this,$self=this;
  8576. return $self["@streamSize"];
  8577. },
  8578. //>>excludeStart("ide", pragmas.excludeIdeData);
  8579. args: [],
  8580. source: "streamSize\x0a\x09^ streamSize",
  8581. referencedClasses: [],
  8582. //>>excludeEnd("ide");
  8583. messageSends: []
  8584. }),
  8585. $globals.Stream);
  8586. $core.addMethod(
  8587. $core.method({
  8588. selector: "on:",
  8589. protocol: "instance creation",
  8590. fn: function (aCollection){
  8591. var self=this,$self=this;
  8592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8593. return $core.withContext(function($ctx1) {
  8594. //>>excludeEnd("ctx");
  8595. var $1;
  8596. $1=$self._new();
  8597. $recv($1)._setCollection_(aCollection);
  8598. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8599. return $recv($1)._yourself();
  8600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8601. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.a$cls)});
  8602. //>>excludeEnd("ctx");
  8603. },
  8604. //>>excludeStart("ide", pragmas.excludeIdeData);
  8605. args: ["aCollection"],
  8606. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8607. referencedClasses: [],
  8608. //>>excludeEnd("ide");
  8609. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8610. }),
  8611. $globals.Stream.a$cls);
  8612. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  8613. //>>excludeStart("ide", pragmas.excludeIdeData);
  8614. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  8615. //>>excludeEnd("ide");
  8616. $core.addMethod(
  8617. $core.method({
  8618. selector: "cr",
  8619. protocol: "writing",
  8620. fn: function (){
  8621. var self=this,$self=this;
  8622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8623. return $core.withContext(function($ctx1) {
  8624. //>>excludeEnd("ctx");
  8625. return $self._nextPutAll_($recv($globals.String)._cr());
  8626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8627. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  8628. //>>excludeEnd("ctx");
  8629. },
  8630. //>>excludeStart("ide", pragmas.excludeIdeData);
  8631. args: [],
  8632. source: "cr\x0a\x09^ self nextPutAll: String cr",
  8633. referencedClasses: ["String"],
  8634. //>>excludeEnd("ide");
  8635. messageSends: ["nextPutAll:", "cr"]
  8636. }),
  8637. $globals.StringStream);
  8638. $core.addMethod(
  8639. $core.method({
  8640. selector: "crlf",
  8641. protocol: "writing",
  8642. fn: function (){
  8643. var self=this,$self=this;
  8644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8645. return $core.withContext(function($ctx1) {
  8646. //>>excludeEnd("ctx");
  8647. return $self._nextPutAll_($recv($globals.String)._crlf());
  8648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8649. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  8650. //>>excludeEnd("ctx");
  8651. },
  8652. //>>excludeStart("ide", pragmas.excludeIdeData);
  8653. args: [],
  8654. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  8655. referencedClasses: ["String"],
  8656. //>>excludeEnd("ide");
  8657. messageSends: ["nextPutAll:", "crlf"]
  8658. }),
  8659. $globals.StringStream);
  8660. $core.addMethod(
  8661. $core.method({
  8662. selector: "lf",
  8663. protocol: "writing",
  8664. fn: function (){
  8665. var self=this,$self=this;
  8666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8667. return $core.withContext(function($ctx1) {
  8668. //>>excludeEnd("ctx");
  8669. return $self._nextPutAll_($recv($globals.String)._lf());
  8670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8671. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  8672. //>>excludeEnd("ctx");
  8673. },
  8674. //>>excludeStart("ide", pragmas.excludeIdeData);
  8675. args: [],
  8676. source: "lf\x0a\x09^ self nextPutAll: String lf",
  8677. referencedClasses: ["String"],
  8678. //>>excludeEnd("ide");
  8679. messageSends: ["nextPutAll:", "lf"]
  8680. }),
  8681. $globals.StringStream);
  8682. $core.addMethod(
  8683. $core.method({
  8684. selector: "next:",
  8685. protocol: "reading",
  8686. fn: function (anInteger){
  8687. var self=this,$self=this;
  8688. var tempCollection;
  8689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8690. return $core.withContext(function($ctx1) {
  8691. //>>excludeEnd("ctx");
  8692. var $1;
  8693. tempCollection=$recv($recv($self._collection())._class())._new();
  8694. $recv(anInteger)._timesRepeat_((function(){
  8695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8696. return $core.withContext(function($ctx2) {
  8697. //>>excludeEnd("ctx");
  8698. $1=$self._atEnd();
  8699. if(!$core.assert($1)){
  8700. tempCollection=$recv(tempCollection).__comma($self._next());
  8701. return tempCollection;
  8702. }
  8703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8704. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8705. //>>excludeEnd("ctx");
  8706. }));
  8707. return tempCollection;
  8708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8709. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  8710. //>>excludeEnd("ctx");
  8711. },
  8712. //>>excludeStart("ide", pragmas.excludeIdeData);
  8713. args: ["anInteger"],
  8714. 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",
  8715. referencedClasses: [],
  8716. //>>excludeEnd("ide");
  8717. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  8718. }),
  8719. $globals.StringStream);
  8720. $core.addMethod(
  8721. $core.method({
  8722. selector: "nextPut:",
  8723. protocol: "writing",
  8724. fn: function (aString){
  8725. var self=this,$self=this;
  8726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8727. return $core.withContext(function($ctx1) {
  8728. //>>excludeEnd("ctx");
  8729. $self._nextPutAll_(aString);
  8730. return self;
  8731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8732. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  8733. //>>excludeEnd("ctx");
  8734. },
  8735. //>>excludeStart("ide", pragmas.excludeIdeData);
  8736. args: ["aString"],
  8737. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  8738. referencedClasses: [],
  8739. //>>excludeEnd("ide");
  8740. messageSends: ["nextPutAll:"]
  8741. }),
  8742. $globals.StringStream);
  8743. $core.addMethod(
  8744. $core.method({
  8745. selector: "nextPutAll:",
  8746. protocol: "writing",
  8747. fn: function (aString){
  8748. var self=this,$self=this;
  8749. var pre,post;
  8750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8751. return $core.withContext(function($ctx1) {
  8752. //>>excludeEnd("ctx");
  8753. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  8754. $1=$self._atEnd();
  8755. if($core.assert($1)){
  8756. $3=$self._collection();
  8757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8758. $ctx1.sendIdx["collection"]=1;
  8759. //>>excludeEnd("ctx");
  8760. $2=$recv($3).__comma(aString);
  8761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8762. $ctx1.sendIdx[","]=1;
  8763. //>>excludeEnd("ctx");
  8764. $self._setCollection_($2);
  8765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8766. $ctx1.sendIdx["setCollection:"]=1;
  8767. //>>excludeEnd("ctx");
  8768. } else {
  8769. $4=$self._collection();
  8770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8771. $ctx1.sendIdx["collection"]=2;
  8772. //>>excludeEnd("ctx");
  8773. $5=$self._position();
  8774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8775. $ctx1.sendIdx["position"]=1;
  8776. //>>excludeEnd("ctx");
  8777. pre=$recv($4)._copyFrom_to_((1),$5);
  8778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8779. $ctx1.sendIdx["copyFrom:to:"]=1;
  8780. //>>excludeEnd("ctx");
  8781. $6=$self._collection();
  8782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8783. $ctx1.sendIdx["collection"]=3;
  8784. //>>excludeEnd("ctx");
  8785. $9=$self._position();
  8786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8787. $ctx1.sendIdx["position"]=2;
  8788. //>>excludeEnd("ctx");
  8789. $8=$recv($9).__plus((1));
  8790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8791. $ctx1.sendIdx["+"]=2;
  8792. //>>excludeEnd("ctx");
  8793. $10=$recv(aString)._size();
  8794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8795. $ctx1.sendIdx["size"]=1;
  8796. //>>excludeEnd("ctx");
  8797. $7=$recv($8).__plus($10);
  8798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8799. $ctx1.sendIdx["+"]=1;
  8800. //>>excludeEnd("ctx");
  8801. $11=$recv($self._collection())._size();
  8802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8803. $ctx1.sendIdx["size"]=2;
  8804. //>>excludeEnd("ctx");
  8805. post=$recv($6)._copyFrom_to_($7,$11);
  8806. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  8807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8808. $ctx1.sendIdx[","]=2;
  8809. //>>excludeEnd("ctx");
  8810. $self._setCollection_($12);
  8811. }
  8812. $14=$self._position();
  8813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8814. $ctx1.sendIdx["position"]=3;
  8815. //>>excludeEnd("ctx");
  8816. $13=$recv($14).__plus($recv(aString)._size());
  8817. $self._position_($13);
  8818. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8819. return self;
  8820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8821. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  8822. //>>excludeEnd("ctx");
  8823. },
  8824. //>>excludeStart("ide", pragmas.excludeIdeData);
  8825. args: ["aString"],
  8826. 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)",
  8827. referencedClasses: [],
  8828. //>>excludeEnd("ide");
  8829. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  8830. }),
  8831. $globals.StringStream);
  8832. $core.addMethod(
  8833. $core.method({
  8834. selector: "nextPutString:",
  8835. protocol: "writing",
  8836. fn: function (aString){
  8837. var self=this,$self=this;
  8838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8839. return $core.withContext(function($ctx1) {
  8840. //>>excludeEnd("ctx");
  8841. $self._nextPutAll_(aString);
  8842. return self;
  8843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8844. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  8845. //>>excludeEnd("ctx");
  8846. },
  8847. //>>excludeStart("ide", pragmas.excludeIdeData);
  8848. args: ["aString"],
  8849. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  8850. referencedClasses: [],
  8851. //>>excludeEnd("ide");
  8852. messageSends: ["nextPutAll:"]
  8853. }),
  8854. $globals.StringStream);
  8855. $core.addMethod(
  8856. $core.method({
  8857. selector: "print:",
  8858. protocol: "writing",
  8859. fn: function (anObject){
  8860. var self=this,$self=this;
  8861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8862. return $core.withContext(function($ctx1) {
  8863. //>>excludeEnd("ctx");
  8864. $recv(anObject)._printOn_(self);
  8865. return self;
  8866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8867. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  8868. //>>excludeEnd("ctx");
  8869. },
  8870. //>>excludeStart("ide", pragmas.excludeIdeData);
  8871. args: ["anObject"],
  8872. source: "print: anObject\x0a\x09anObject printOn: self",
  8873. referencedClasses: [],
  8874. //>>excludeEnd("ide");
  8875. messageSends: ["printOn:"]
  8876. }),
  8877. $globals.StringStream);
  8878. $core.addMethod(
  8879. $core.method({
  8880. selector: "printSymbol:",
  8881. protocol: "writing",
  8882. fn: function (anObject){
  8883. var self=this,$self=this;
  8884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8885. return $core.withContext(function($ctx1) {
  8886. //>>excludeEnd("ctx");
  8887. $recv(anObject)._asSymbolPrintOn_(self);
  8888. return self;
  8889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8890. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  8891. //>>excludeEnd("ctx");
  8892. },
  8893. //>>excludeStart("ide", pragmas.excludeIdeData);
  8894. args: ["anObject"],
  8895. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  8896. referencedClasses: [],
  8897. //>>excludeEnd("ide");
  8898. messageSends: ["asSymbolPrintOn:"]
  8899. }),
  8900. $globals.StringStream);
  8901. $core.addMethod(
  8902. $core.method({
  8903. selector: "space",
  8904. protocol: "writing",
  8905. fn: function (){
  8906. var self=this,$self=this;
  8907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8908. return $core.withContext(function($ctx1) {
  8909. //>>excludeEnd("ctx");
  8910. $self._nextPut_(" ");
  8911. return self;
  8912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8913. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  8914. //>>excludeEnd("ctx");
  8915. },
  8916. //>>excludeStart("ide", pragmas.excludeIdeData);
  8917. args: [],
  8918. source: "space\x0a\x09self nextPut: ' '",
  8919. referencedClasses: [],
  8920. //>>excludeEnd("ide");
  8921. messageSends: ["nextPut:"]
  8922. }),
  8923. $globals.StringStream);
  8924. $core.addMethod(
  8925. $core.method({
  8926. selector: "tab",
  8927. protocol: "writing",
  8928. fn: function (){
  8929. var self=this,$self=this;
  8930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8931. return $core.withContext(function($ctx1) {
  8932. //>>excludeEnd("ctx");
  8933. return $self._nextPutAll_($recv($globals.String)._tab());
  8934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8935. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  8936. //>>excludeEnd("ctx");
  8937. },
  8938. //>>excludeStart("ide", pragmas.excludeIdeData);
  8939. args: [],
  8940. source: "tab\x0a\x09^ self nextPutAll: String tab",
  8941. referencedClasses: ["String"],
  8942. //>>excludeEnd("ide");
  8943. messageSends: ["nextPutAll:", "tab"]
  8944. }),
  8945. $globals.StringStream);
  8946. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  8947. //>>excludeStart("ide", pragmas.excludeIdeData);
  8948. $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.";
  8949. //>>excludeEnd("ide");
  8950. $core.addMethod(
  8951. $core.method({
  8952. selector: "initialize",
  8953. protocol: "initialization",
  8954. fn: function (){
  8955. var self=this,$self=this;
  8956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8957. return $core.withContext(function($ctx1) {
  8958. //>>excludeEnd("ctx");
  8959. (
  8960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8961. $ctx1.supercall = true,
  8962. //>>excludeEnd("ctx");
  8963. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  8964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8965. $ctx1.supercall = false;
  8966. //>>excludeEnd("ctx");;
  8967. $self["@read"]=$recv($globals.OrderedCollection)._new();
  8968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8969. $ctx1.sendIdx["new"]=1;
  8970. //>>excludeEnd("ctx");
  8971. $self["@write"]=$recv($globals.OrderedCollection)._new();
  8972. $self["@readIndex"]=(1);
  8973. return self;
  8974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8975. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  8976. //>>excludeEnd("ctx");
  8977. },
  8978. //>>excludeStart("ide", pragmas.excludeIdeData);
  8979. args: [],
  8980. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  8981. referencedClasses: ["OrderedCollection"],
  8982. //>>excludeEnd("ide");
  8983. messageSends: ["initialize", "new"]
  8984. }),
  8985. $globals.Queue);
  8986. $core.addMethod(
  8987. $core.method({
  8988. selector: "next",
  8989. protocol: "accessing",
  8990. fn: function (){
  8991. var self=this,$self=this;
  8992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8993. return $core.withContext(function($ctx1) {
  8994. //>>excludeEnd("ctx");
  8995. return $self._nextIfAbsent_((function(){
  8996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8997. return $core.withContext(function($ctx2) {
  8998. //>>excludeEnd("ctx");
  8999. return $self._error_("Cannot read from empty Queue.");
  9000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9001. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9002. //>>excludeEnd("ctx");
  9003. }));
  9004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9005. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  9006. //>>excludeEnd("ctx");
  9007. },
  9008. //>>excludeStart("ide", pragmas.excludeIdeData);
  9009. args: [],
  9010. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  9011. referencedClasses: [],
  9012. //>>excludeEnd("ide");
  9013. messageSends: ["nextIfAbsent:", "error:"]
  9014. }),
  9015. $globals.Queue);
  9016. $core.addMethod(
  9017. $core.method({
  9018. selector: "nextIfAbsent:",
  9019. protocol: "accessing",
  9020. fn: function (aBlock){
  9021. var self=this,$self=this;
  9022. var result;
  9023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9024. return $core.withContext(function($ctx1) {
  9025. //>>excludeEnd("ctx");
  9026. var $1;
  9027. var $early={};
  9028. try {
  9029. result=$recv($self["@read"])._at_ifAbsent_($self["@readIndex"],(function(){
  9030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9031. return $core.withContext(function($ctx2) {
  9032. //>>excludeEnd("ctx");
  9033. $recv($self["@write"])._ifEmpty_((function(){
  9034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9035. return $core.withContext(function($ctx3) {
  9036. //>>excludeEnd("ctx");
  9037. $1=$recv($self["@readIndex"]).__gt((1));
  9038. if($core.assert($1)){
  9039. $self["@read"]=[];
  9040. $self["@readIndex"]=(1);
  9041. $self["@readIndex"];
  9042. }
  9043. throw $early=[$recv(aBlock)._value()];
  9044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9045. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  9046. //>>excludeEnd("ctx");
  9047. }));
  9048. $self["@read"]=$self["@write"];
  9049. $self["@readIndex"]=(1);
  9050. $self["@write"]=$recv($globals.OrderedCollection)._new();
  9051. return $recv($self["@read"])._first();
  9052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9053. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9054. //>>excludeEnd("ctx");
  9055. }));
  9056. $recv($self["@read"])._at_put_($self["@readIndex"],nil);
  9057. $self["@readIndex"]=$recv($self["@readIndex"]).__plus((1));
  9058. return result;
  9059. }
  9060. catch(e) {if(e===$early)return e[0]; throw e}
  9061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9062. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  9063. //>>excludeEnd("ctx");
  9064. },
  9065. //>>excludeStart("ide", pragmas.excludeIdeData);
  9066. args: ["aBlock"],
  9067. 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",
  9068. referencedClasses: ["OrderedCollection"],
  9069. //>>excludeEnd("ide");
  9070. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  9071. }),
  9072. $globals.Queue);
  9073. $core.addMethod(
  9074. $core.method({
  9075. selector: "nextPut:",
  9076. protocol: "accessing",
  9077. fn: function (anObject){
  9078. var self=this,$self=this;
  9079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9080. return $core.withContext(function($ctx1) {
  9081. //>>excludeEnd("ctx");
  9082. $recv($self["@write"])._add_(anObject);
  9083. return self;
  9084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9085. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  9086. //>>excludeEnd("ctx");
  9087. },
  9088. //>>excludeStart("ide", pragmas.excludeIdeData);
  9089. args: ["anObject"],
  9090. source: "nextPut: anObject\x0a\x09write add: anObject",
  9091. referencedClasses: [],
  9092. //>>excludeEnd("ide");
  9093. messageSends: ["add:"]
  9094. }),
  9095. $globals.Queue);
  9096. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  9097. //>>excludeStart("ide", pragmas.excludeIdeData);
  9098. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9099. //>>excludeEnd("ide");
  9100. $core.addMethod(
  9101. $core.method({
  9102. selector: "compile:",
  9103. protocol: "evaluating",
  9104. fn: function (aString){
  9105. var self=this,$self=this;
  9106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9107. return $core.withContext(function($ctx1) {
  9108. //>>excludeEnd("ctx");
  9109. return self.compile(aString);
  9110. return self;
  9111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9112. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  9113. //>>excludeEnd("ctx");
  9114. },
  9115. //>>excludeStart("ide", pragmas.excludeIdeData);
  9116. args: ["aString"],
  9117. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  9118. referencedClasses: [],
  9119. //>>excludeEnd("ide");
  9120. messageSends: []
  9121. }),
  9122. $globals.RegularExpression);
  9123. $core.addMethod(
  9124. $core.method({
  9125. selector: "exec:",
  9126. protocol: "evaluating",
  9127. fn: function (aString){
  9128. var self=this,$self=this;
  9129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9130. return $core.withContext(function($ctx1) {
  9131. //>>excludeEnd("ctx");
  9132. return self.exec(aString) || nil;
  9133. return self;
  9134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9135. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  9136. //>>excludeEnd("ctx");
  9137. },
  9138. //>>excludeStart("ide", pragmas.excludeIdeData);
  9139. args: ["aString"],
  9140. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  9141. referencedClasses: [],
  9142. //>>excludeEnd("ide");
  9143. messageSends: []
  9144. }),
  9145. $globals.RegularExpression);
  9146. $core.addMethod(
  9147. $core.method({
  9148. selector: "test:",
  9149. protocol: "evaluating",
  9150. fn: function (aString){
  9151. var self=this,$self=this;
  9152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9153. return $core.withContext(function($ctx1) {
  9154. //>>excludeEnd("ctx");
  9155. return self.test(aString);
  9156. return self;
  9157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9158. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  9159. //>>excludeEnd("ctx");
  9160. },
  9161. //>>excludeStart("ide", pragmas.excludeIdeData);
  9162. args: ["aString"],
  9163. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  9164. referencedClasses: [],
  9165. //>>excludeEnd("ide");
  9166. messageSends: []
  9167. }),
  9168. $globals.RegularExpression);
  9169. $core.addMethod(
  9170. $core.method({
  9171. selector: "fromString:",
  9172. protocol: "instance creation",
  9173. fn: function (aString){
  9174. var self=this,$self=this;
  9175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9176. return $core.withContext(function($ctx1) {
  9177. //>>excludeEnd("ctx");
  9178. return $self._fromString_flag_(aString,"");
  9179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9180. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.a$cls)});
  9181. //>>excludeEnd("ctx");
  9182. },
  9183. //>>excludeStart("ide", pragmas.excludeIdeData);
  9184. args: ["aString"],
  9185. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9186. referencedClasses: [],
  9187. //>>excludeEnd("ide");
  9188. messageSends: ["fromString:flag:"]
  9189. }),
  9190. $globals.RegularExpression.a$cls);
  9191. $core.addMethod(
  9192. $core.method({
  9193. selector: "fromString:flag:",
  9194. protocol: "instance creation",
  9195. fn: function (aString,anotherString){
  9196. var self=this,$self=this;
  9197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9198. return $core.withContext(function($ctx1) {
  9199. //>>excludeEnd("ctx");
  9200. return new RegExp(aString, anotherString);
  9201. return self;
  9202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9203. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.a$cls)});
  9204. //>>excludeEnd("ctx");
  9205. },
  9206. //>>excludeStart("ide", pragmas.excludeIdeData);
  9207. args: ["aString", "anotherString"],
  9208. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  9209. referencedClasses: [],
  9210. //>>excludeEnd("ide");
  9211. messageSends: []
  9212. }),
  9213. $globals.RegularExpression.a$cls);
  9214. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  9215. $core.addMethod(
  9216. $core.method({
  9217. selector: "at:",
  9218. protocol: "accessing",
  9219. fn: function (anIndex){
  9220. var self=this,$self=this;
  9221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9222. return $core.withContext(function($ctx1) {
  9223. //>>excludeEnd("ctx");
  9224. return $self._at_ifAbsent_(anIndex,(function(){
  9225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9226. return $core.withContext(function($ctx2) {
  9227. //>>excludeEnd("ctx");
  9228. return $self._errorNotFound();
  9229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9230. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9231. //>>excludeEnd("ctx");
  9232. }));
  9233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9234. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.TKeyValueCollection)});
  9235. //>>excludeEnd("ctx");
  9236. },
  9237. //>>excludeStart("ide", pragmas.excludeIdeData);
  9238. args: ["anIndex"],
  9239. 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 ]",
  9240. referencedClasses: [],
  9241. //>>excludeEnd("ide");
  9242. messageSends: ["at:ifAbsent:", "errorNotFound"]
  9243. }),
  9244. $globals.TKeyValueCollection);
  9245. $core.addMethod(
  9246. $core.method({
  9247. selector: "at:ifAbsent:",
  9248. protocol: "accessing",
  9249. fn: function (anIndex,aBlock){
  9250. var self=this,$self=this;
  9251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9252. return $core.withContext(function($ctx1) {
  9253. //>>excludeEnd("ctx");
  9254. $self._subclassResponsibility();
  9255. return self;
  9256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9257. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.TKeyValueCollection)});
  9258. //>>excludeEnd("ctx");
  9259. },
  9260. //>>excludeStart("ide", pragmas.excludeIdeData);
  9261. args: ["anIndex", "aBlock"],
  9262. 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",
  9263. referencedClasses: [],
  9264. //>>excludeEnd("ide");
  9265. messageSends: ["subclassResponsibility"]
  9266. }),
  9267. $globals.TKeyValueCollection);
  9268. $core.addMethod(
  9269. $core.method({
  9270. selector: "at:ifAbsentPut:",
  9271. protocol: "accessing",
  9272. fn: function (aKey,aBlock){
  9273. var self=this,$self=this;
  9274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9275. return $core.withContext(function($ctx1) {
  9276. //>>excludeEnd("ctx");
  9277. return $self._at_ifAbsent_(aKey,(function(){
  9278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9279. return $core.withContext(function($ctx2) {
  9280. //>>excludeEnd("ctx");
  9281. return $self._at_put_(aKey,$recv(aBlock)._value());
  9282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9283. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9284. //>>excludeEnd("ctx");
  9285. }));
  9286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9287. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.TKeyValueCollection)});
  9288. //>>excludeEnd("ctx");
  9289. },
  9290. //>>excludeStart("ide", pragmas.excludeIdeData);
  9291. args: ["aKey", "aBlock"],
  9292. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  9293. referencedClasses: [],
  9294. //>>excludeEnd("ide");
  9295. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  9296. }),
  9297. $globals.TKeyValueCollection);
  9298. $core.addMethod(
  9299. $core.method({
  9300. selector: "at:ifPresent:",
  9301. protocol: "accessing",
  9302. fn: function (anIndex,aBlock){
  9303. var self=this,$self=this;
  9304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9305. return $core.withContext(function($ctx1) {
  9306. //>>excludeEnd("ctx");
  9307. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  9308. return nil;
  9309. }));
  9310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9311. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.TKeyValueCollection)});
  9312. //>>excludeEnd("ctx");
  9313. },
  9314. //>>excludeStart("ide", pragmas.excludeIdeData);
  9315. args: ["anIndex", "aBlock"],
  9316. 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 ]",
  9317. referencedClasses: [],
  9318. //>>excludeEnd("ide");
  9319. messageSends: ["at:ifPresent:ifAbsent:"]
  9320. }),
  9321. $globals.TKeyValueCollection);
  9322. $core.addMethod(
  9323. $core.method({
  9324. selector: "at:ifPresent:ifAbsent:",
  9325. protocol: "accessing",
  9326. fn: function (anIndex,aBlock,anotherBlock){
  9327. var self=this,$self=this;
  9328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9329. return $core.withContext(function($ctx1) {
  9330. //>>excludeEnd("ctx");
  9331. $self._subclassResponsibility();
  9332. return self;
  9333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9334. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TKeyValueCollection)});
  9335. //>>excludeEnd("ctx");
  9336. },
  9337. //>>excludeStart("ide", pragmas.excludeIdeData);
  9338. args: ["anIndex", "aBlock", "anotherBlock"],
  9339. 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",
  9340. referencedClasses: [],
  9341. //>>excludeEnd("ide");
  9342. messageSends: ["subclassResponsibility"]
  9343. }),
  9344. $globals.TKeyValueCollection);
  9345. $core.addMethod(
  9346. $core.method({
  9347. selector: "at:put:",
  9348. protocol: "accessing",
  9349. fn: function (anIndex,anObject){
  9350. var self=this,$self=this;
  9351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9352. return $core.withContext(function($ctx1) {
  9353. //>>excludeEnd("ctx");
  9354. $self._subclassResponsibility();
  9355. return self;
  9356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9357. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.TKeyValueCollection)});
  9358. //>>excludeEnd("ctx");
  9359. },
  9360. //>>excludeStart("ide", pragmas.excludeIdeData);
  9361. args: ["anIndex", "anObject"],
  9362. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  9363. referencedClasses: [],
  9364. //>>excludeEnd("ide");
  9365. messageSends: ["subclassResponsibility"]
  9366. }),
  9367. $globals.TKeyValueCollection);
  9368. $core.addMethod(
  9369. $core.method({
  9370. selector: "indexOf:",
  9371. protocol: "accessing",
  9372. fn: function (anObject){
  9373. var self=this,$self=this;
  9374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9375. return $core.withContext(function($ctx1) {
  9376. //>>excludeEnd("ctx");
  9377. return $self._indexOf_ifAbsent_(anObject,(function(){
  9378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9379. return $core.withContext(function($ctx2) {
  9380. //>>excludeEnd("ctx");
  9381. return $self._errorNotFound();
  9382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9383. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9384. //>>excludeEnd("ctx");
  9385. }));
  9386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9387. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.TKeyValueCollection)});
  9388. //>>excludeEnd("ctx");
  9389. },
  9390. //>>excludeStart("ide", pragmas.excludeIdeData);
  9391. args: ["anObject"],
  9392. 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 ]",
  9393. referencedClasses: [],
  9394. //>>excludeEnd("ide");
  9395. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  9396. }),
  9397. $globals.TKeyValueCollection);
  9398. $core.addMethod(
  9399. $core.method({
  9400. selector: "indexOf:ifAbsent:",
  9401. protocol: "accessing",
  9402. fn: function (anObject,aBlock){
  9403. var self=this,$self=this;
  9404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9405. return $core.withContext(function($ctx1) {
  9406. //>>excludeEnd("ctx");
  9407. $self._subclassResponsibility();
  9408. return self;
  9409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9410. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.TKeyValueCollection)});
  9411. //>>excludeEnd("ctx");
  9412. },
  9413. //>>excludeStart("ide", pragmas.excludeIdeData);
  9414. args: ["anObject", "aBlock"],
  9415. 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",
  9416. referencedClasses: [],
  9417. //>>excludeEnd("ide");
  9418. messageSends: ["subclassResponsibility"]
  9419. }),
  9420. $globals.TKeyValueCollection);
  9421. $core.addMethod(
  9422. $core.method({
  9423. selector: "with:do:",
  9424. protocol: "enumerating",
  9425. fn: function (anotherCollection,aBlock){
  9426. var self=this,$self=this;
  9427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9428. return $core.withContext(function($ctx1) {
  9429. //>>excludeEnd("ctx");
  9430. $self._withIndexDo_((function(each,index){
  9431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9432. return $core.withContext(function($ctx2) {
  9433. //>>excludeEnd("ctx");
  9434. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  9435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9436. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  9437. //>>excludeEnd("ctx");
  9438. }));
  9439. return self;
  9440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9441. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.TKeyValueCollection)});
  9442. //>>excludeEnd("ctx");
  9443. },
  9444. //>>excludeStart("ide", pragmas.excludeIdeData);
  9445. args: ["anotherCollection", "aBlock"],
  9446. 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) ]",
  9447. referencedClasses: [],
  9448. //>>excludeEnd("ide");
  9449. messageSends: ["withIndexDo:", "value:value:", "at:"]
  9450. }),
  9451. $globals.TKeyValueCollection);
  9452. $core.addMethod(
  9453. $core.method({
  9454. selector: "withIndexDo:",
  9455. protocol: "enumerating",
  9456. fn: function (aBlock){
  9457. var self=this,$self=this;
  9458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9459. return $core.withContext(function($ctx1) {
  9460. //>>excludeEnd("ctx");
  9461. $self._subclassResponsibility();
  9462. return self;
  9463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9464. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.TKeyValueCollection)});
  9465. //>>excludeEnd("ctx");
  9466. },
  9467. //>>excludeStart("ide", pragmas.excludeIdeData);
  9468. args: ["aBlock"],
  9469. 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",
  9470. referencedClasses: [],
  9471. //>>excludeEnd("ide");
  9472. messageSends: ["subclassResponsibility"]
  9473. }),
  9474. $globals.TKeyValueCollection);
  9475. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  9476. $core.addMethod(
  9477. $core.method({
  9478. selector: "detect:ifNone:",
  9479. protocol: "enumerating",
  9480. fn: function (aBlock,anotherBlock){
  9481. var self=this,$self=this;
  9482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9483. return $core.withContext(function($ctx1) {
  9484. //>>excludeEnd("ctx");
  9485. for(var i = 0; i < self.length; i++)
  9486. if(aBlock._value_(self[i]))
  9487. return self[i];
  9488. return anotherBlock._value();
  9489. ;
  9490. return self;
  9491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9492. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.TNativeZeroBasedCollection)});
  9493. //>>excludeEnd("ctx");
  9494. },
  9495. //>>excludeStart("ide", pragmas.excludeIdeData);
  9496. args: ["aBlock", "anotherBlock"],
  9497. 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'>",
  9498. referencedClasses: [],
  9499. //>>excludeEnd("ide");
  9500. messageSends: []
  9501. }),
  9502. $globals.TNativeZeroBasedCollection);
  9503. $core.addMethod(
  9504. $core.method({
  9505. selector: "do:",
  9506. protocol: "enumerating",
  9507. fn: function (aBlock){
  9508. var self=this,$self=this;
  9509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9510. return $core.withContext(function($ctx1) {
  9511. //>>excludeEnd("ctx");
  9512. for(var i=0; i < self.length; i++) {
  9513. aBlock._value_(self[i]);
  9514. }
  9515. ;
  9516. return self;
  9517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9518. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9519. //>>excludeEnd("ctx");
  9520. },
  9521. //>>excludeStart("ide", pragmas.excludeIdeData);
  9522. args: ["aBlock"],
  9523. 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'>",
  9524. referencedClasses: [],
  9525. //>>excludeEnd("ide");
  9526. messageSends: []
  9527. }),
  9528. $globals.TNativeZeroBasedCollection);
  9529. $core.addMethod(
  9530. $core.method({
  9531. selector: "indexOf:ifAbsent:",
  9532. protocol: "accessing",
  9533. fn: function (anObject,aBlock){
  9534. var self=this,$self=this;
  9535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9536. return $core.withContext(function($ctx1) {
  9537. //>>excludeEnd("ctx");
  9538. for(var i=0; i < self.length; i++) {
  9539. if($recv(self[i]).__eq(anObject)) {return i+1}
  9540. };
  9541. return aBlock._value();
  9542. ;
  9543. return self;
  9544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9545. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9546. //>>excludeEnd("ctx");
  9547. },
  9548. //>>excludeStart("ide", pragmas.excludeIdeData);
  9549. args: ["anObject", "aBlock"],
  9550. 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'>",
  9551. referencedClasses: [],
  9552. //>>excludeEnd("ide");
  9553. messageSends: []
  9554. }),
  9555. $globals.TNativeZeroBasedCollection);
  9556. $core.addMethod(
  9557. $core.method({
  9558. selector: "indexOf:startingAt:ifAbsent:",
  9559. protocol: "accessing",
  9560. fn: function (anObject,start,aBlock){
  9561. var self=this,$self=this;
  9562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9563. return $core.withContext(function($ctx1) {
  9564. //>>excludeEnd("ctx");
  9565. for(var i=start - 1; i < self.length; i++){
  9566. if($recv(self[i]).__eq(anObject)) {return i+1}
  9567. }
  9568. return aBlock._value();
  9569. ;
  9570. return self;
  9571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9572. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9573. //>>excludeEnd("ctx");
  9574. },
  9575. //>>excludeStart("ide", pragmas.excludeIdeData);
  9576. args: ["anObject", "start", "aBlock"],
  9577. 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'>",
  9578. referencedClasses: [],
  9579. //>>excludeEnd("ide");
  9580. messageSends: []
  9581. }),
  9582. $globals.TNativeZeroBasedCollection);
  9583. $core.addMethod(
  9584. $core.method({
  9585. selector: "single",
  9586. protocol: "accessing",
  9587. fn: function (){
  9588. var self=this,$self=this;
  9589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9590. return $core.withContext(function($ctx1) {
  9591. //>>excludeEnd("ctx");
  9592. if (self.length == 0) throw new Error("Collection is empty");
  9593. if (self.length > 1) throw new Error("Collection holds more than one element.");
  9594. return self[0];;
  9595. return self;
  9596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9597. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.TNativeZeroBasedCollection)});
  9598. //>>excludeEnd("ctx");
  9599. },
  9600. //>>excludeStart("ide", pragmas.excludeIdeData);
  9601. args: [],
  9602. 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'>",
  9603. referencedClasses: [],
  9604. //>>excludeEnd("ide");
  9605. messageSends: []
  9606. }),
  9607. $globals.TNativeZeroBasedCollection);
  9608. $core.addMethod(
  9609. $core.method({
  9610. selector: "with:do:",
  9611. protocol: "enumerating",
  9612. fn: function (anotherCollection,aBlock){
  9613. var self=this,$self=this;
  9614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9615. return $core.withContext(function($ctx1) {
  9616. //>>excludeEnd("ctx");
  9617. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  9618. for(var i=0; i<self.length; i++) {
  9619. aBlock._value_value_(self[i], anotherCollection[i]);
  9620. }
  9621. ;
  9622. return self;
  9623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9624. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9625. //>>excludeEnd("ctx");
  9626. },
  9627. //>>excludeStart("ide", pragmas.excludeIdeData);
  9628. args: ["anotherCollection", "aBlock"],
  9629. 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'>",
  9630. referencedClasses: [],
  9631. //>>excludeEnd("ide");
  9632. messageSends: []
  9633. }),
  9634. $globals.TNativeZeroBasedCollection);
  9635. $core.addMethod(
  9636. $core.method({
  9637. selector: "withIndexDo:",
  9638. protocol: "enumerating",
  9639. fn: function (aBlock){
  9640. var self=this,$self=this;
  9641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9642. return $core.withContext(function($ctx1) {
  9643. //>>excludeEnd("ctx");
  9644. for(var i=0; i < self.length; i++) {
  9645. aBlock._value_value_(self[i], i+1);
  9646. }
  9647. ;
  9648. return self;
  9649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9650. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9651. //>>excludeEnd("ctx");
  9652. },
  9653. //>>excludeStart("ide", pragmas.excludeIdeData);
  9654. args: ["aBlock"],
  9655. 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'>",
  9656. referencedClasses: [],
  9657. //>>excludeEnd("ide");
  9658. messageSends: []
  9659. }),
  9660. $globals.TNativeZeroBasedCollection);
  9661. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  9662. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  9663. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  9664. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  9665. });