Kernel-Collections.js 328 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088
  1. define(["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  2. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. var $pkg = $core.addPackage("Kernel-Collections");
  4. $pkg.innerEval = function (expr) { return eval(expr); };
  5. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  6. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  7. //>>excludeStart("ide", pragmas.excludeIdeData);
  8. $globals.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`";
  9. //>>excludeEnd("ide");
  10. $core.addMethod(
  11. $core.method({
  12. selector: "=",
  13. protocol: "comparing",
  14. fn: function (anAssociation){
  15. var self=this,$self=this;
  16. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17. return $core.withContext(function($ctx1) {
  18. //>>excludeEnd("ctx");
  19. var $3,$2,$5,$4,$6,$1;
  20. $3=$self._class();
  21. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22. $ctx1.sendIdx["class"]=1;
  23. //>>excludeEnd("ctx");
  24. $2=$recv($3).__eq($recv(anAssociation)._class());
  25. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26. $ctx1.sendIdx["="]=1;
  27. //>>excludeEnd("ctx");
  28. $1=$recv($2)._and_((function(){
  29. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30. return $core.withContext(function($ctx2) {
  31. //>>excludeEnd("ctx");
  32. $5=$self._key();
  33. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34. $ctx2.sendIdx["key"]=1;
  35. //>>excludeEnd("ctx");
  36. $4=$recv($5).__eq($recv(anAssociation)._key());
  37. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38. $ctx2.sendIdx["="]=2;
  39. //>>excludeEnd("ctx");
  40. return $recv($4)._and_((function(){
  41. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42. return $core.withContext(function($ctx3) {
  43. //>>excludeEnd("ctx");
  44. $6=$self._value();
  45. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46. $ctx3.sendIdx["value"]=1;
  47. //>>excludeEnd("ctx");
  48. return $recv($6).__eq($recv(anAssociation)._value());
  49. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  50. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51. //>>excludeEnd("ctx");
  52. }));
  53. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55. //>>excludeEnd("ctx");
  56. }));
  57. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58. $ctx1.sendIdx["and:"]=1;
  59. //>>excludeEnd("ctx");
  60. return $1;
  61. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  63. //>>excludeEnd("ctx");
  64. },
  65. //>>excludeStart("ide", pragmas.excludeIdeData);
  66. args: ["anAssociation"],
  67. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  68. referencedClasses: [],
  69. //>>excludeEnd("ide");
  70. messageSends: ["and:", "=", "class", "key", "value"]
  71. }),
  72. $globals.Association);
  73. $core.addMethod(
  74. $core.method({
  75. selector: "key",
  76. protocol: "accessing",
  77. fn: function (){
  78. var self=this,$self=this;
  79. return $self.key;
  80. },
  81. //>>excludeStart("ide", pragmas.excludeIdeData);
  82. args: [],
  83. source: "key\x0a\x09^ key",
  84. referencedClasses: [],
  85. //>>excludeEnd("ide");
  86. messageSends: []
  87. }),
  88. $globals.Association);
  89. $core.addMethod(
  90. $core.method({
  91. selector: "key:",
  92. protocol: "accessing",
  93. fn: function (aKey){
  94. var self=this,$self=this;
  95. $self.key=aKey;
  96. return self;
  97. },
  98. //>>excludeStart("ide", pragmas.excludeIdeData);
  99. args: ["aKey"],
  100. source: "key: aKey\x0a\x09key := aKey",
  101. referencedClasses: [],
  102. //>>excludeEnd("ide");
  103. messageSends: []
  104. }),
  105. $globals.Association);
  106. $core.addMethod(
  107. $core.method({
  108. selector: "printOn:",
  109. protocol: "printing",
  110. fn: function (aStream){
  111. var self=this,$self=this;
  112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  113. return $core.withContext(function($ctx1) {
  114. //>>excludeEnd("ctx");
  115. $recv($self._key())._printOn_(aStream);
  116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  117. $ctx1.sendIdx["printOn:"]=1;
  118. //>>excludeEnd("ctx");
  119. $recv(aStream)._nextPutAll_(" -> ");
  120. $recv($self._value())._printOn_(aStream);
  121. return self;
  122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  123. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  124. //>>excludeEnd("ctx");
  125. },
  126. //>>excludeStart("ide", pragmas.excludeIdeData);
  127. args: ["aStream"],
  128. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  129. referencedClasses: [],
  130. //>>excludeEnd("ide");
  131. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  132. }),
  133. $globals.Association);
  134. $core.addMethod(
  135. $core.method({
  136. selector: "value",
  137. protocol: "accessing",
  138. fn: function (){
  139. var self=this,$self=this;
  140. return $self.value;
  141. },
  142. //>>excludeStart("ide", pragmas.excludeIdeData);
  143. args: [],
  144. source: "value\x0a\x09^ value",
  145. referencedClasses: [],
  146. //>>excludeEnd("ide");
  147. messageSends: []
  148. }),
  149. $globals.Association);
  150. $core.addMethod(
  151. $core.method({
  152. selector: "value:",
  153. protocol: "accessing",
  154. fn: function (aValue){
  155. var self=this,$self=this;
  156. $self.value=aValue;
  157. return self;
  158. },
  159. //>>excludeStart("ide", pragmas.excludeIdeData);
  160. args: ["aValue"],
  161. source: "value: aValue\x0a\x09value := aValue",
  162. referencedClasses: [],
  163. //>>excludeEnd("ide");
  164. messageSends: []
  165. }),
  166. $globals.Association);
  167. $core.addMethod(
  168. $core.method({
  169. selector: "key:value:",
  170. protocol: "instance creation",
  171. fn: function (aKey,aValue){
  172. var self=this,$self=this;
  173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  174. return $core.withContext(function($ctx1) {
  175. //>>excludeEnd("ctx");
  176. var $1;
  177. $1=$self._new();
  178. $recv($1)._key_(aKey);
  179. $recv($1)._value_(aValue);
  180. return $recv($1)._yourself();
  181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  182. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.a$cls)});
  183. //>>excludeEnd("ctx");
  184. },
  185. //>>excludeStart("ide", pragmas.excludeIdeData);
  186. args: ["aKey", "aValue"],
  187. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  188. referencedClasses: [],
  189. //>>excludeEnd("ide");
  190. messageSends: ["key:", "new", "value:", "yourself"]
  191. }),
  192. $globals.Association.a$cls);
  193. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  194. //>>excludeStart("ide", pragmas.excludeIdeData);
  195. $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`.";
  196. //>>excludeEnd("ide");
  197. $core.addMethod(
  198. $core.method({
  199. selector: "bucketOfElement:",
  200. protocol: "accessing",
  201. fn: function (anObject){
  202. var self=this,$self=this;
  203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  204. return $core.withContext(function($ctx1) {
  205. //>>excludeEnd("ctx");
  206. var hash = $self['@hashBlock'](anObject);
  207. if (!hash) return null;
  208. var buckets = $self['@buckets'],
  209. bucket = buckets[hash];
  210. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  211. return bucket;
  212. ;
  213. return self;
  214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  215. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  216. //>>excludeEnd("ctx");
  217. },
  218. //>>excludeStart("ide", pragmas.excludeIdeData);
  219. args: ["anObject"],
  220. 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'>",
  221. referencedClasses: [],
  222. //>>excludeEnd("ide");
  223. messageSends: []
  224. }),
  225. $globals.BucketStore);
  226. $core.addMethod(
  227. $core.method({
  228. selector: "do:",
  229. protocol: "enumerating",
  230. fn: function (aBlock){
  231. var self=this,$self=this;
  232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  233. return $core.withContext(function($ctx1) {
  234. //>>excludeEnd("ctx");
  235. var buckets = $self['@buckets'];
  236. var keys = Object.keys(buckets);
  237. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  238. ;
  239. return self;
  240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  241. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  242. //>>excludeEnd("ctx");
  243. },
  244. //>>excludeStart("ide", pragmas.excludeIdeData);
  245. args: ["aBlock"],
  246. 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'>",
  247. referencedClasses: [],
  248. //>>excludeEnd("ide");
  249. messageSends: []
  250. }),
  251. $globals.BucketStore);
  252. $core.addMethod(
  253. $core.method({
  254. selector: "hashBlock:",
  255. protocol: "accessing",
  256. fn: function (aBlock){
  257. var self=this,$self=this;
  258. $self.hashBlock=aBlock;
  259. return self;
  260. },
  261. //>>excludeStart("ide", pragmas.excludeIdeData);
  262. args: ["aBlock"],
  263. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  264. referencedClasses: [],
  265. //>>excludeEnd("ide");
  266. messageSends: []
  267. }),
  268. $globals.BucketStore);
  269. $core.addMethod(
  270. $core.method({
  271. selector: "initialize",
  272. protocol: "initialization",
  273. fn: function (){
  274. var self=this,$self=this;
  275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  276. return $core.withContext(function($ctx1) {
  277. //>>excludeEnd("ctx");
  278. (
  279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  280. $ctx1.supercall = true,
  281. //>>excludeEnd("ctx");
  282. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  284. $ctx1.supercall = false;
  285. //>>excludeEnd("ctx");;
  286. $self._removeAll();
  287. return self;
  288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  289. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  290. //>>excludeEnd("ctx");
  291. },
  292. //>>excludeStart("ide", pragmas.excludeIdeData);
  293. args: [],
  294. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  295. referencedClasses: [],
  296. //>>excludeEnd("ide");
  297. messageSends: ["initialize", "removeAll"]
  298. }),
  299. $globals.BucketStore);
  300. $core.addMethod(
  301. $core.method({
  302. selector: "newBucket",
  303. protocol: "private",
  304. fn: function (){
  305. var self=this,$self=this;
  306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  307. return $core.withContext(function($ctx1) {
  308. //>>excludeEnd("ctx");
  309. $self._subclassResponsibility();
  310. return self;
  311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  312. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  313. //>>excludeEnd("ctx");
  314. },
  315. //>>excludeStart("ide", pragmas.excludeIdeData);
  316. args: [],
  317. source: "newBucket\x0a\x09self subclassResponsibility",
  318. referencedClasses: [],
  319. //>>excludeEnd("ide");
  320. messageSends: ["subclassResponsibility"]
  321. }),
  322. $globals.BucketStore);
  323. $core.addMethod(
  324. $core.method({
  325. selector: "removeAll",
  326. protocol: "adding/removing",
  327. fn: function (){
  328. var self=this,$self=this;
  329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  330. return $core.withContext(function($ctx1) {
  331. //>>excludeEnd("ctx");
  332. $self['@buckets'] = Object.create(null);;
  333. return self;
  334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  335. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  336. //>>excludeEnd("ctx");
  337. },
  338. //>>excludeStart("ide", pragmas.excludeIdeData);
  339. args: [],
  340. source: "removeAll\x0a\x09<inlineJS: '$self[''@buckets''] = Object.create(null);'>",
  341. referencedClasses: [],
  342. //>>excludeEnd("ide");
  343. messageSends: []
  344. }),
  345. $globals.BucketStore);
  346. $core.addMethod(
  347. $core.method({
  348. selector: "hashBlock:",
  349. protocol: "instance creation",
  350. fn: function (aBlock){
  351. var self=this,$self=this;
  352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  353. return $core.withContext(function($ctx1) {
  354. //>>excludeEnd("ctx");
  355. var $1;
  356. $1=$self._new();
  357. $recv($1)._hashBlock_(aBlock);
  358. return $recv($1)._yourself();
  359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  360. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.a$cls)});
  361. //>>excludeEnd("ctx");
  362. },
  363. //>>excludeStart("ide", pragmas.excludeIdeData);
  364. args: ["aBlock"],
  365. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  366. referencedClasses: [],
  367. //>>excludeEnd("ide");
  368. messageSends: ["hashBlock:", "new", "yourself"]
  369. }),
  370. $globals.BucketStore.a$cls);
  371. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  372. //>>excludeStart("ide", pragmas.excludeIdeData);
  373. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  374. //>>excludeEnd("ide");
  375. $core.addMethod(
  376. $core.method({
  377. selector: "newBucket",
  378. protocol: "private",
  379. fn: function (){
  380. var self=this,$self=this;
  381. return [];
  382. },
  383. //>>excludeStart("ide", pragmas.excludeIdeData);
  384. args: [],
  385. source: "newBucket\x0a\x09^ #()",
  386. referencedClasses: [],
  387. //>>excludeEnd("ide");
  388. messageSends: []
  389. }),
  390. $globals.ArrayBucketStore);
  391. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  392. //>>excludeStart("ide", pragmas.excludeIdeData);
  393. $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.";
  394. //>>excludeEnd("ide");
  395. $core.addMethod(
  396. $core.method({
  397. selector: ",",
  398. protocol: "copying",
  399. fn: function (aCollection){
  400. var self=this,$self=this;
  401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  402. return $core.withContext(function($ctx1) {
  403. //>>excludeEnd("ctx");
  404. var $1;
  405. $1=$self._copy();
  406. $recv($1)._addAll_(aCollection);
  407. return $recv($1)._yourself();
  408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  409. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  410. //>>excludeEnd("ctx");
  411. },
  412. //>>excludeStart("ide", pragmas.excludeIdeData);
  413. args: ["aCollection"],
  414. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  415. referencedClasses: [],
  416. //>>excludeEnd("ide");
  417. messageSends: ["addAll:", "copy", "yourself"]
  418. }),
  419. $globals.Collection);
  420. $core.addMethod(
  421. $core.method({
  422. selector: "add:",
  423. protocol: "adding/removing",
  424. fn: function (anObject){
  425. var self=this,$self=this;
  426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  427. return $core.withContext(function($ctx1) {
  428. //>>excludeEnd("ctx");
  429. $self._subclassResponsibility();
  430. return self;
  431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  432. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  433. //>>excludeEnd("ctx");
  434. },
  435. //>>excludeStart("ide", pragmas.excludeIdeData);
  436. args: ["anObject"],
  437. source: "add: anObject\x0a\x09self subclassResponsibility",
  438. referencedClasses: [],
  439. //>>excludeEnd("ide");
  440. messageSends: ["subclassResponsibility"]
  441. }),
  442. $globals.Collection);
  443. $core.addMethod(
  444. $core.method({
  445. selector: "addAll:",
  446. protocol: "adding/removing",
  447. fn: function (aCollection){
  448. var self=this,$self=this;
  449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  450. return $core.withContext(function($ctx1) {
  451. //>>excludeEnd("ctx");
  452. $recv(aCollection)._do_((function(each){
  453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  454. return $core.withContext(function($ctx2) {
  455. //>>excludeEnd("ctx");
  456. return $self._add_(each);
  457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  458. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  459. //>>excludeEnd("ctx");
  460. }));
  461. return aCollection;
  462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  463. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  464. //>>excludeEnd("ctx");
  465. },
  466. //>>excludeStart("ide", pragmas.excludeIdeData);
  467. args: ["aCollection"],
  468. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  469. referencedClasses: [],
  470. //>>excludeEnd("ide");
  471. messageSends: ["do:", "add:"]
  472. }),
  473. $globals.Collection);
  474. $core.addMethod(
  475. $core.method({
  476. selector: "allSatisfy:",
  477. protocol: "enumerating",
  478. fn: function (aBlock){
  479. var self=this,$self=this;
  480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  481. return $core.withContext(function($ctx1) {
  482. //>>excludeEnd("ctx");
  483. var $1;
  484. var $early={};
  485. try {
  486. $self._do_((function(each){
  487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  488. return $core.withContext(function($ctx2) {
  489. //>>excludeEnd("ctx");
  490. $1=$recv(aBlock)._value_(each);
  491. if(!$core.assert($1)){
  492. throw $early=[false];
  493. }
  494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  495. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  496. //>>excludeEnd("ctx");
  497. }));
  498. return true;
  499. }
  500. catch(e) {if(e===$early)return e[0]; throw e}
  501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  502. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  503. //>>excludeEnd("ctx");
  504. },
  505. //>>excludeStart("ide", pragmas.excludeIdeData);
  506. args: ["aBlock"],
  507. 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",
  508. referencedClasses: [],
  509. //>>excludeEnd("ide");
  510. messageSends: ["do:", "ifFalse:", "value:"]
  511. }),
  512. $globals.Collection);
  513. $core.addMethod(
  514. $core.method({
  515. selector: "anyOne",
  516. protocol: "accessing",
  517. fn: function (){
  518. var self=this,$self=this;
  519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  520. return $core.withContext(function($ctx1) {
  521. //>>excludeEnd("ctx");
  522. var $early={};
  523. try {
  524. $self._ifEmpty_((function(){
  525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  526. return $core.withContext(function($ctx2) {
  527. //>>excludeEnd("ctx");
  528. return $self._error_("Collection is empty");
  529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  531. //>>excludeEnd("ctx");
  532. }));
  533. $self._do_((function(each){
  534. throw $early=[each];
  535. }));
  536. return self;
  537. }
  538. catch(e) {if(e===$early)return e[0]; throw e}
  539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  540. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  541. //>>excludeEnd("ctx");
  542. },
  543. //>>excludeStart("ide", pragmas.excludeIdeData);
  544. args: [],
  545. 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 ]",
  546. referencedClasses: [],
  547. //>>excludeEnd("ide");
  548. messageSends: ["ifEmpty:", "error:", "do:"]
  549. }),
  550. $globals.Collection);
  551. $core.addMethod(
  552. $core.method({
  553. selector: "anySatisfy:",
  554. protocol: "enumerating",
  555. fn: function (aBlock){
  556. var self=this,$self=this;
  557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  558. return $core.withContext(function($ctx1) {
  559. //>>excludeEnd("ctx");
  560. var $1;
  561. var $early={};
  562. try {
  563. $self._do_((function(each){
  564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  565. return $core.withContext(function($ctx2) {
  566. //>>excludeEnd("ctx");
  567. $1=$recv(aBlock)._value_(each);
  568. if($core.assert($1)){
  569. throw $early=[true];
  570. }
  571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  572. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  573. //>>excludeEnd("ctx");
  574. }));
  575. return false;
  576. }
  577. catch(e) {if(e===$early)return e[0]; throw e}
  578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  579. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  580. //>>excludeEnd("ctx");
  581. },
  582. //>>excludeStart("ide", pragmas.excludeIdeData);
  583. args: ["aBlock"],
  584. 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",
  585. referencedClasses: [],
  586. //>>excludeEnd("ide");
  587. messageSends: ["do:", "ifTrue:", "value:"]
  588. }),
  589. $globals.Collection);
  590. $core.addMethod(
  591. $core.method({
  592. selector: "asArray",
  593. protocol: "converting",
  594. fn: function (){
  595. var self=this,$self=this;
  596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  597. return $core.withContext(function($ctx1) {
  598. //>>excludeEnd("ctx");
  599. return $recv($globals.Array)._withAll_(self);
  600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  601. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  602. //>>excludeEnd("ctx");
  603. },
  604. //>>excludeStart("ide", pragmas.excludeIdeData);
  605. args: [],
  606. source: "asArray\x0a\x09^ Array withAll: self",
  607. referencedClasses: ["Array"],
  608. //>>excludeEnd("ide");
  609. messageSends: ["withAll:"]
  610. }),
  611. $globals.Collection);
  612. $core.addMethod(
  613. $core.method({
  614. selector: "asJavaScriptObject",
  615. protocol: "converting",
  616. fn: function (){
  617. var self=this,$self=this;
  618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  619. return $core.withContext(function($ctx1) {
  620. //>>excludeEnd("ctx");
  621. return $recv($self._asArray())._collect_((function(each){
  622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  623. return $core.withContext(function($ctx2) {
  624. //>>excludeEnd("ctx");
  625. return $recv(each)._asJavaScriptObject();
  626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  627. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  628. //>>excludeEnd("ctx");
  629. }));
  630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  631. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.Collection)});
  632. //>>excludeEnd("ctx");
  633. },
  634. //>>excludeStart("ide", pragmas.excludeIdeData);
  635. args: [],
  636. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  637. referencedClasses: [],
  638. //>>excludeEnd("ide");
  639. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  640. }),
  641. $globals.Collection);
  642. $core.addMethod(
  643. $core.method({
  644. selector: "asOrderedCollection",
  645. protocol: "converting",
  646. fn: function (){
  647. var self=this,$self=this;
  648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  649. return $core.withContext(function($ctx1) {
  650. //>>excludeEnd("ctx");
  651. return $self._asArray();
  652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  653. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  654. //>>excludeEnd("ctx");
  655. },
  656. //>>excludeStart("ide", pragmas.excludeIdeData);
  657. args: [],
  658. source: "asOrderedCollection\x0a\x09^ self asArray",
  659. referencedClasses: [],
  660. //>>excludeEnd("ide");
  661. messageSends: ["asArray"]
  662. }),
  663. $globals.Collection);
  664. $core.addMethod(
  665. $core.method({
  666. selector: "asSet",
  667. protocol: "converting",
  668. fn: function (){
  669. var self=this,$self=this;
  670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  671. return $core.withContext(function($ctx1) {
  672. //>>excludeEnd("ctx");
  673. return $recv($globals.Set)._withAll_(self);
  674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  675. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  676. //>>excludeEnd("ctx");
  677. },
  678. //>>excludeStart("ide", pragmas.excludeIdeData);
  679. args: [],
  680. source: "asSet\x0a\x09^ Set withAll: self",
  681. referencedClasses: ["Set"],
  682. //>>excludeEnd("ide");
  683. messageSends: ["withAll:"]
  684. }),
  685. $globals.Collection);
  686. $core.addMethod(
  687. $core.method({
  688. selector: "collect:",
  689. protocol: "enumerating",
  690. fn: function (aBlock){
  691. var self=this,$self=this;
  692. var stream;
  693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  694. return $core.withContext(function($ctx1) {
  695. //>>excludeEnd("ctx");
  696. stream=$recv($recv($self._class())._new())._writeStream();
  697. $self._do_((function(each){
  698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  699. return $core.withContext(function($ctx2) {
  700. //>>excludeEnd("ctx");
  701. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  703. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  704. //>>excludeEnd("ctx");
  705. }));
  706. return $recv(stream)._contents();
  707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  708. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  709. //>>excludeEnd("ctx");
  710. },
  711. //>>excludeStart("ide", pragmas.excludeIdeData);
  712. args: ["aBlock"],
  713. 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",
  714. referencedClasses: [],
  715. //>>excludeEnd("ide");
  716. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  717. }),
  718. $globals.Collection);
  719. $core.addMethod(
  720. $core.method({
  721. selector: "copyWith:",
  722. protocol: "copying",
  723. fn: function (anObject){
  724. var self=this,$self=this;
  725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  726. return $core.withContext(function($ctx1) {
  727. //>>excludeEnd("ctx");
  728. var $1;
  729. $1=$self._copy();
  730. $recv($1)._add_(anObject);
  731. return $recv($1)._yourself();
  732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  733. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  734. //>>excludeEnd("ctx");
  735. },
  736. //>>excludeStart("ide", pragmas.excludeIdeData);
  737. args: ["anObject"],
  738. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  739. referencedClasses: [],
  740. //>>excludeEnd("ide");
  741. messageSends: ["add:", "copy", "yourself"]
  742. }),
  743. $globals.Collection);
  744. $core.addMethod(
  745. $core.method({
  746. selector: "copyWithAll:",
  747. protocol: "copying",
  748. fn: function (aCollection){
  749. var self=this,$self=this;
  750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  751. return $core.withContext(function($ctx1) {
  752. //>>excludeEnd("ctx");
  753. $self._deprecatedAPI_("Use #, instead.");
  754. return $self.__comma(aCollection);
  755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  756. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  757. //>>excludeEnd("ctx");
  758. },
  759. //>>excludeStart("ide", pragmas.excludeIdeData);
  760. args: ["aCollection"],
  761. source: "copyWithAll: aCollection\x0a\x09self deprecatedAPI: 'Use #, instead.'.\x0a\x09^ self, aCollection",
  762. referencedClasses: [],
  763. //>>excludeEnd("ide");
  764. messageSends: ["deprecatedAPI:", ","]
  765. }),
  766. $globals.Collection);
  767. $core.addMethod(
  768. $core.method({
  769. selector: "copyWithout:",
  770. protocol: "copying",
  771. fn: function (anObject){
  772. var self=this,$self=this;
  773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  774. return $core.withContext(function($ctx1) {
  775. //>>excludeEnd("ctx");
  776. return $self._reject_((function(each){
  777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  778. return $core.withContext(function($ctx2) {
  779. //>>excludeEnd("ctx");
  780. return $recv(each).__eq(anObject);
  781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  782. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  783. //>>excludeEnd("ctx");
  784. }));
  785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  786. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject},$globals.Collection)});
  787. //>>excludeEnd("ctx");
  788. },
  789. //>>excludeStart("ide", pragmas.excludeIdeData);
  790. args: ["anObject"],
  791. 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 ]",
  792. referencedClasses: [],
  793. //>>excludeEnd("ide");
  794. messageSends: ["reject:", "="]
  795. }),
  796. $globals.Collection);
  797. $core.addMethod(
  798. $core.method({
  799. selector: "copyWithoutAll:",
  800. protocol: "copying",
  801. fn: function (aCollection){
  802. var self=this,$self=this;
  803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  804. return $core.withContext(function($ctx1) {
  805. //>>excludeEnd("ctx");
  806. return $self._reject_((function(each){
  807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  808. return $core.withContext(function($ctx2) {
  809. //>>excludeEnd("ctx");
  810. return $recv(aCollection)._includes_(each);
  811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  812. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  813. //>>excludeEnd("ctx");
  814. }));
  815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  816. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  817. //>>excludeEnd("ctx");
  818. },
  819. //>>excludeStart("ide", pragmas.excludeIdeData);
  820. args: ["aCollection"],
  821. 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 ]",
  822. referencedClasses: [],
  823. //>>excludeEnd("ide");
  824. messageSends: ["reject:", "includes:"]
  825. }),
  826. $globals.Collection);
  827. $core.addMethod(
  828. $core.method({
  829. selector: "deepCopy",
  830. protocol: "copying",
  831. fn: function (){
  832. var self=this,$self=this;
  833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  834. return $core.withContext(function($ctx1) {
  835. //>>excludeEnd("ctx");
  836. return $self._collect_((function(each){
  837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  838. return $core.withContext(function($ctx2) {
  839. //>>excludeEnd("ctx");
  840. return $recv(each)._deepCopy();
  841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  842. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  843. //>>excludeEnd("ctx");
  844. }));
  845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  846. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  847. //>>excludeEnd("ctx");
  848. },
  849. //>>excludeStart("ide", pragmas.excludeIdeData);
  850. args: [],
  851. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  852. referencedClasses: [],
  853. //>>excludeEnd("ide");
  854. messageSends: ["collect:", "deepCopy"]
  855. }),
  856. $globals.Collection);
  857. $core.addMethod(
  858. $core.method({
  859. selector: "detect:",
  860. protocol: "enumerating",
  861. fn: function (aBlock){
  862. var self=this,$self=this;
  863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  864. return $core.withContext(function($ctx1) {
  865. //>>excludeEnd("ctx");
  866. return $self._detect_ifNone_(aBlock,(function(){
  867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  868. return $core.withContext(function($ctx2) {
  869. //>>excludeEnd("ctx");
  870. return $self._errorNotFound();
  871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  872. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  873. //>>excludeEnd("ctx");
  874. }));
  875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  876. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  877. //>>excludeEnd("ctx");
  878. },
  879. //>>excludeStart("ide", pragmas.excludeIdeData);
  880. args: ["aBlock"],
  881. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  882. referencedClasses: [],
  883. //>>excludeEnd("ide");
  884. messageSends: ["detect:ifNone:", "errorNotFound"]
  885. }),
  886. $globals.Collection);
  887. $core.addMethod(
  888. $core.method({
  889. selector: "detect:ifNone:",
  890. protocol: "enumerating",
  891. fn: function (aBlock,anotherBlock){
  892. var self=this,$self=this;
  893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  894. return $core.withContext(function($ctx1) {
  895. //>>excludeEnd("ctx");
  896. var $1;
  897. var $early={};
  898. try {
  899. $self._do_((function(each){
  900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  901. return $core.withContext(function($ctx2) {
  902. //>>excludeEnd("ctx");
  903. $1=$recv(aBlock)._value_(each);
  904. if($core.assert($1)){
  905. throw $early=[each];
  906. }
  907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  908. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  909. //>>excludeEnd("ctx");
  910. }));
  911. return $recv(anotherBlock)._value();
  912. }
  913. catch(e) {if(e===$early)return e[0]; throw e}
  914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  915. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  916. //>>excludeEnd("ctx");
  917. },
  918. //>>excludeStart("ide", pragmas.excludeIdeData);
  919. args: ["aBlock", "anotherBlock"],
  920. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  921. referencedClasses: [],
  922. //>>excludeEnd("ide");
  923. messageSends: ["do:", "ifTrue:", "value:", "value"]
  924. }),
  925. $globals.Collection);
  926. $core.addMethod(
  927. $core.method({
  928. selector: "do:",
  929. protocol: "enumerating",
  930. fn: function (aBlock){
  931. var self=this,$self=this;
  932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  933. return $core.withContext(function($ctx1) {
  934. //>>excludeEnd("ctx");
  935. $self._subclassResponsibility();
  936. return self;
  937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  938. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  939. //>>excludeEnd("ctx");
  940. },
  941. //>>excludeStart("ide", pragmas.excludeIdeData);
  942. args: ["aBlock"],
  943. source: "do: aBlock\x0a\x09self subclassResponsibility",
  944. referencedClasses: [],
  945. //>>excludeEnd("ide");
  946. messageSends: ["subclassResponsibility"]
  947. }),
  948. $globals.Collection);
  949. $core.addMethod(
  950. $core.method({
  951. selector: "do:separatedBy:",
  952. protocol: "enumerating",
  953. fn: function (aBlock,anotherBlock){
  954. var self=this,$self=this;
  955. var actionBeforeElement;
  956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  957. return $core.withContext(function($ctx1) {
  958. //>>excludeEnd("ctx");
  959. actionBeforeElement=(function(){
  960. actionBeforeElement=anotherBlock;
  961. return actionBeforeElement;
  962. });
  963. $self._do_((function(each){
  964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  965. return $core.withContext(function($ctx2) {
  966. //>>excludeEnd("ctx");
  967. $recv(actionBeforeElement)._value();
  968. return $recv(aBlock)._value_(each);
  969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  970. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  971. //>>excludeEnd("ctx");
  972. }));
  973. return self;
  974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  975. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  976. //>>excludeEnd("ctx");
  977. },
  978. //>>excludeStart("ide", pragmas.excludeIdeData);
  979. args: ["aBlock", "anotherBlock"],
  980. 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 ]",
  981. referencedClasses: [],
  982. //>>excludeEnd("ide");
  983. messageSends: ["do:", "value", "value:"]
  984. }),
  985. $globals.Collection);
  986. $core.addMethod(
  987. $core.method({
  988. selector: "errorNotFound",
  989. protocol: "error handling",
  990. fn: function (){
  991. var self=this,$self=this;
  992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  993. return $core.withContext(function($ctx1) {
  994. //>>excludeEnd("ctx");
  995. $self._error_("Object is not in the collection");
  996. return self;
  997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  998. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  999. //>>excludeEnd("ctx");
  1000. },
  1001. //>>excludeStart("ide", pragmas.excludeIdeData);
  1002. args: [],
  1003. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  1004. referencedClasses: [],
  1005. //>>excludeEnd("ide");
  1006. messageSends: ["error:"]
  1007. }),
  1008. $globals.Collection);
  1009. $core.addMethod(
  1010. $core.method({
  1011. selector: "ifEmpty:",
  1012. protocol: "testing",
  1013. fn: function (aBlock){
  1014. var self=this,$self=this;
  1015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1016. return $core.withContext(function($ctx1) {
  1017. //>>excludeEnd("ctx");
  1018. var $1;
  1019. $1=$self._isEmpty();
  1020. if($core.assert($1)){
  1021. return $recv(aBlock)._value();
  1022. } else {
  1023. return self;
  1024. }
  1025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1026. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  1027. //>>excludeEnd("ctx");
  1028. },
  1029. //>>excludeStart("ide", pragmas.excludeIdeData);
  1030. args: ["aBlock"],
  1031. 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 ]",
  1032. referencedClasses: [],
  1033. //>>excludeEnd("ide");
  1034. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  1035. }),
  1036. $globals.Collection);
  1037. $core.addMethod(
  1038. $core.method({
  1039. selector: "ifEmpty:ifNotEmpty:",
  1040. protocol: "testing",
  1041. fn: function (aBlock,anotherBlock){
  1042. var self=this,$self=this;
  1043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1044. return $core.withContext(function($ctx1) {
  1045. //>>excludeEnd("ctx");
  1046. var $1;
  1047. $1=$self._isEmpty();
  1048. if($core.assert($1)){
  1049. return $recv(aBlock)._value();
  1050. } else {
  1051. return $recv(anotherBlock)._value_(self);
  1052. }
  1053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1054. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  1055. //>>excludeEnd("ctx");
  1056. },
  1057. //>>excludeStart("ide", pragmas.excludeIdeData);
  1058. args: ["aBlock", "anotherBlock"],
  1059. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  1060. referencedClasses: [],
  1061. //>>excludeEnd("ide");
  1062. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  1063. }),
  1064. $globals.Collection);
  1065. $core.addMethod(
  1066. $core.method({
  1067. selector: "ifNotEmpty:",
  1068. protocol: "testing",
  1069. fn: function (aBlock){
  1070. var self=this,$self=this;
  1071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1072. return $core.withContext(function($ctx1) {
  1073. //>>excludeEnd("ctx");
  1074. var $1;
  1075. $1=$self._notEmpty();
  1076. if($core.assert($1)){
  1077. return $recv(aBlock)._value_(self);
  1078. } else {
  1079. return self;
  1080. }
  1081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1082. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  1083. //>>excludeEnd("ctx");
  1084. },
  1085. //>>excludeStart("ide", pragmas.excludeIdeData);
  1086. args: ["aBlock"],
  1087. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  1088. referencedClasses: [],
  1089. //>>excludeEnd("ide");
  1090. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1091. }),
  1092. $globals.Collection);
  1093. $core.addMethod(
  1094. $core.method({
  1095. selector: "ifNotEmpty:ifEmpty:",
  1096. protocol: "testing",
  1097. fn: function (aBlock,anotherBlock){
  1098. var self=this,$self=this;
  1099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1100. return $core.withContext(function($ctx1) {
  1101. //>>excludeEnd("ctx");
  1102. var $1;
  1103. $1=$self._notEmpty();
  1104. if($core.assert($1)){
  1105. return $recv(aBlock)._value_(self);
  1106. } else {
  1107. return $recv(anotherBlock)._value();
  1108. }
  1109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1110. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  1111. //>>excludeEnd("ctx");
  1112. },
  1113. //>>excludeStart("ide", pragmas.excludeIdeData);
  1114. args: ["aBlock", "anotherBlock"],
  1115. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  1116. referencedClasses: [],
  1117. //>>excludeEnd("ide");
  1118. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  1119. }),
  1120. $globals.Collection);
  1121. $core.addMethod(
  1122. $core.method({
  1123. selector: "includes:",
  1124. protocol: "testing",
  1125. fn: function (anObject){
  1126. var self=this,$self=this;
  1127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1128. return $core.withContext(function($ctx1) {
  1129. //>>excludeEnd("ctx");
  1130. return $self._anySatisfy_((function(each){
  1131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1132. return $core.withContext(function($ctx2) {
  1133. //>>excludeEnd("ctx");
  1134. return $recv(each).__eq(anObject);
  1135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1136. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1137. //>>excludeEnd("ctx");
  1138. }));
  1139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1140. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  1141. //>>excludeEnd("ctx");
  1142. },
  1143. //>>excludeStart("ide", pragmas.excludeIdeData);
  1144. args: ["anObject"],
  1145. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  1146. referencedClasses: [],
  1147. //>>excludeEnd("ide");
  1148. messageSends: ["anySatisfy:", "="]
  1149. }),
  1150. $globals.Collection);
  1151. $core.addMethod(
  1152. $core.method({
  1153. selector: "inject:into:",
  1154. protocol: "enumerating",
  1155. fn: function (anObject,aBlock){
  1156. var self=this,$self=this;
  1157. var result;
  1158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1159. return $core.withContext(function($ctx1) {
  1160. //>>excludeEnd("ctx");
  1161. result=anObject;
  1162. $self._do_((function(each){
  1163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1164. return $core.withContext(function($ctx2) {
  1165. //>>excludeEnd("ctx");
  1166. result=$recv(aBlock)._value_value_(result,each);
  1167. return result;
  1168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1169. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1170. //>>excludeEnd("ctx");
  1171. }));
  1172. return result;
  1173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1174. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  1175. //>>excludeEnd("ctx");
  1176. },
  1177. //>>excludeStart("ide", pragmas.excludeIdeData);
  1178. args: ["anObject", "aBlock"],
  1179. 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",
  1180. referencedClasses: [],
  1181. //>>excludeEnd("ide");
  1182. messageSends: ["do:", "value:value:"]
  1183. }),
  1184. $globals.Collection);
  1185. $core.addMethod(
  1186. $core.method({
  1187. selector: "intersection:",
  1188. protocol: "enumerating",
  1189. fn: function (aCollection){
  1190. var self=this,$self=this;
  1191. var set,outputSet;
  1192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1193. return $core.withContext(function($ctx1) {
  1194. //>>excludeEnd("ctx");
  1195. var $2,$1;
  1196. set=$self._asSet();
  1197. outputSet=$recv($globals.Set)._new();
  1198. $recv(aCollection)._do_((function(each){
  1199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1200. return $core.withContext(function($ctx2) {
  1201. //>>excludeEnd("ctx");
  1202. $2=$recv(set)._includes_(each);
  1203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1204. $ctx2.sendIdx["includes:"]=1;
  1205. //>>excludeEnd("ctx");
  1206. $1=$recv($2)._and_((function(){
  1207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1208. return $core.withContext(function($ctx3) {
  1209. //>>excludeEnd("ctx");
  1210. return $recv($recv(outputSet)._includes_(each))._not();
  1211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1212. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1213. //>>excludeEnd("ctx");
  1214. }));
  1215. if($core.assert($1)){
  1216. return $recv(outputSet)._add_(each);
  1217. }
  1218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1219. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1220. //>>excludeEnd("ctx");
  1221. }));
  1222. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  1223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1224. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  1225. //>>excludeEnd("ctx");
  1226. },
  1227. //>>excludeStart("ide", pragmas.excludeIdeData);
  1228. args: ["aCollection"],
  1229. 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",
  1230. referencedClasses: ["Set"],
  1231. //>>excludeEnd("ide");
  1232. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  1233. }),
  1234. $globals.Collection);
  1235. $core.addMethod(
  1236. $core.method({
  1237. selector: "isEmpty",
  1238. protocol: "testing",
  1239. fn: function (){
  1240. var self=this,$self=this;
  1241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1242. return $core.withContext(function($ctx1) {
  1243. //>>excludeEnd("ctx");
  1244. return $recv($self._size()).__eq((0));
  1245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1246. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  1247. //>>excludeEnd("ctx");
  1248. },
  1249. //>>excludeStart("ide", pragmas.excludeIdeData);
  1250. args: [],
  1251. source: "isEmpty\x0a\x09^ self size = 0",
  1252. referencedClasses: [],
  1253. //>>excludeEnd("ide");
  1254. messageSends: ["=", "size"]
  1255. }),
  1256. $globals.Collection);
  1257. $core.addMethod(
  1258. $core.method({
  1259. selector: "noneSatisfy:",
  1260. protocol: "enumerating",
  1261. fn: function (aBlock){
  1262. var self=this,$self=this;
  1263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1264. return $core.withContext(function($ctx1) {
  1265. //>>excludeEnd("ctx");
  1266. var $1;
  1267. var $early={};
  1268. try {
  1269. $self._do_((function(item){
  1270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1271. return $core.withContext(function($ctx2) {
  1272. //>>excludeEnd("ctx");
  1273. $1=$recv(aBlock)._value_(item);
  1274. if($core.assert($1)){
  1275. throw $early=[false];
  1276. }
  1277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1278. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  1279. //>>excludeEnd("ctx");
  1280. }));
  1281. return true;
  1282. }
  1283. catch(e) {if(e===$early)return e[0]; throw e}
  1284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1285. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  1286. //>>excludeEnd("ctx");
  1287. },
  1288. //>>excludeStart("ide", pragmas.excludeIdeData);
  1289. args: ["aBlock"],
  1290. 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",
  1291. referencedClasses: [],
  1292. //>>excludeEnd("ide");
  1293. messageSends: ["do:", "ifTrue:", "value:"]
  1294. }),
  1295. $globals.Collection);
  1296. $core.addMethod(
  1297. $core.method({
  1298. selector: "notEmpty",
  1299. protocol: "testing",
  1300. fn: function (){
  1301. var self=this,$self=this;
  1302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1303. return $core.withContext(function($ctx1) {
  1304. //>>excludeEnd("ctx");
  1305. return $recv($self._isEmpty())._not();
  1306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1307. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  1308. //>>excludeEnd("ctx");
  1309. },
  1310. //>>excludeStart("ide", pragmas.excludeIdeData);
  1311. args: [],
  1312. source: "notEmpty\x0a\x09^ self isEmpty not",
  1313. referencedClasses: [],
  1314. //>>excludeEnd("ide");
  1315. messageSends: ["not", "isEmpty"]
  1316. }),
  1317. $globals.Collection);
  1318. $core.addMethod(
  1319. $core.method({
  1320. selector: "occurrencesOf:",
  1321. protocol: "accessing",
  1322. fn: function (anObject){
  1323. var self=this,$self=this;
  1324. var tally;
  1325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1326. return $core.withContext(function($ctx1) {
  1327. //>>excludeEnd("ctx");
  1328. var $1;
  1329. tally=(0);
  1330. $self._do_((function(each){
  1331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1332. return $core.withContext(function($ctx2) {
  1333. //>>excludeEnd("ctx");
  1334. $1=$recv(anObject).__eq(each);
  1335. if($core.assert($1)){
  1336. tally=$recv(tally).__plus((1));
  1337. return tally;
  1338. }
  1339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1340. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1341. //>>excludeEnd("ctx");
  1342. }));
  1343. return tally;
  1344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1345. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  1346. //>>excludeEnd("ctx");
  1347. },
  1348. //>>excludeStart("ide", pragmas.excludeIdeData);
  1349. args: ["anObject"],
  1350. 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",
  1351. referencedClasses: [],
  1352. //>>excludeEnd("ide");
  1353. messageSends: ["do:", "ifTrue:", "=", "+"]
  1354. }),
  1355. $globals.Collection);
  1356. $core.addMethod(
  1357. $core.method({
  1358. selector: "putOn:",
  1359. protocol: "streaming",
  1360. fn: function (aStream){
  1361. var self=this,$self=this;
  1362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1363. return $core.withContext(function($ctx1) {
  1364. //>>excludeEnd("ctx");
  1365. $self._do_((function(each){
  1366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1367. return $core.withContext(function($ctx2) {
  1368. //>>excludeEnd("ctx");
  1369. return $recv(each)._putOn_(aStream);
  1370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1371. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1372. //>>excludeEnd("ctx");
  1373. }));
  1374. return self;
  1375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1376. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  1377. //>>excludeEnd("ctx");
  1378. },
  1379. //>>excludeStart("ide", pragmas.excludeIdeData);
  1380. args: ["aStream"],
  1381. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  1382. referencedClasses: [],
  1383. //>>excludeEnd("ide");
  1384. messageSends: ["do:", "putOn:"]
  1385. }),
  1386. $globals.Collection);
  1387. $core.addMethod(
  1388. $core.method({
  1389. selector: "reject:",
  1390. protocol: "enumerating",
  1391. fn: function (aBlock){
  1392. var self=this,$self=this;
  1393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1394. return $core.withContext(function($ctx1) {
  1395. //>>excludeEnd("ctx");
  1396. return $self._select_((function(each){
  1397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1398. return $core.withContext(function($ctx2) {
  1399. //>>excludeEnd("ctx");
  1400. return $recv($recv(aBlock)._value_(each)).__eq(false);
  1401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1402. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1403. //>>excludeEnd("ctx");
  1404. }));
  1405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1406. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  1407. //>>excludeEnd("ctx");
  1408. },
  1409. //>>excludeStart("ide", pragmas.excludeIdeData);
  1410. args: ["aBlock"],
  1411. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  1412. referencedClasses: [],
  1413. //>>excludeEnd("ide");
  1414. messageSends: ["select:", "=", "value:"]
  1415. }),
  1416. $globals.Collection);
  1417. $core.addMethod(
  1418. $core.method({
  1419. selector: "remove:",
  1420. protocol: "adding/removing",
  1421. fn: function (anObject){
  1422. var self=this,$self=this;
  1423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1424. return $core.withContext(function($ctx1) {
  1425. //>>excludeEnd("ctx");
  1426. return $self._remove_ifAbsent_(anObject,(function(){
  1427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1428. return $core.withContext(function($ctx2) {
  1429. //>>excludeEnd("ctx");
  1430. return $self._errorNotFound();
  1431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1433. //>>excludeEnd("ctx");
  1434. }));
  1435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1436. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  1437. //>>excludeEnd("ctx");
  1438. },
  1439. //>>excludeStart("ide", pragmas.excludeIdeData);
  1440. args: ["anObject"],
  1441. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  1442. referencedClasses: [],
  1443. //>>excludeEnd("ide");
  1444. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  1445. }),
  1446. $globals.Collection);
  1447. $core.addMethod(
  1448. $core.method({
  1449. selector: "remove:ifAbsent:",
  1450. protocol: "adding/removing",
  1451. fn: function (anObject,aBlock){
  1452. var self=this,$self=this;
  1453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1454. return $core.withContext(function($ctx1) {
  1455. //>>excludeEnd("ctx");
  1456. $self._subclassResponsibility();
  1457. return self;
  1458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1459. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  1460. //>>excludeEnd("ctx");
  1461. },
  1462. //>>excludeStart("ide", pragmas.excludeIdeData);
  1463. args: ["anObject", "aBlock"],
  1464. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1465. referencedClasses: [],
  1466. //>>excludeEnd("ide");
  1467. messageSends: ["subclassResponsibility"]
  1468. }),
  1469. $globals.Collection);
  1470. $core.addMethod(
  1471. $core.method({
  1472. selector: "removeAll",
  1473. protocol: "adding/removing",
  1474. fn: function (){
  1475. var self=this,$self=this;
  1476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1477. return $core.withContext(function($ctx1) {
  1478. //>>excludeEnd("ctx");
  1479. $self._subclassResponsibility();
  1480. return self;
  1481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1482. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  1483. //>>excludeEnd("ctx");
  1484. },
  1485. //>>excludeStart("ide", pragmas.excludeIdeData);
  1486. args: [],
  1487. source: "removeAll\x0a\x09self subclassResponsibility",
  1488. referencedClasses: [],
  1489. //>>excludeEnd("ide");
  1490. messageSends: ["subclassResponsibility"]
  1491. }),
  1492. $globals.Collection);
  1493. $core.addMethod(
  1494. $core.method({
  1495. selector: "select:",
  1496. protocol: "enumerating",
  1497. fn: function (aBlock){
  1498. var self=this,$self=this;
  1499. var stream;
  1500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1501. return $core.withContext(function($ctx1) {
  1502. //>>excludeEnd("ctx");
  1503. var $1;
  1504. stream=$recv($recv($self._class())._new())._writeStream();
  1505. $self._do_((function(each){
  1506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1507. return $core.withContext(function($ctx2) {
  1508. //>>excludeEnd("ctx");
  1509. $1=$recv(aBlock)._value_(each);
  1510. if($core.assert($1)){
  1511. return $recv(stream)._nextPut_(each);
  1512. }
  1513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1514. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1515. //>>excludeEnd("ctx");
  1516. }));
  1517. return $recv(stream)._contents();
  1518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1519. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  1520. //>>excludeEnd("ctx");
  1521. },
  1522. //>>excludeStart("ide", pragmas.excludeIdeData);
  1523. args: ["aBlock"],
  1524. 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",
  1525. referencedClasses: [],
  1526. //>>excludeEnd("ide");
  1527. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1528. }),
  1529. $globals.Collection);
  1530. $core.addMethod(
  1531. $core.method({
  1532. selector: "select:thenCollect:",
  1533. protocol: "enumerating",
  1534. fn: function (selectBlock,collectBlock){
  1535. var self=this,$self=this;
  1536. var stream;
  1537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1538. return $core.withContext(function($ctx1) {
  1539. //>>excludeEnd("ctx");
  1540. var $1;
  1541. stream=$recv($recv($self._class())._new())._writeStream();
  1542. $self._do_((function(each){
  1543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1544. return $core.withContext(function($ctx2) {
  1545. //>>excludeEnd("ctx");
  1546. $1=$recv(selectBlock)._value_(each);
  1547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1548. $ctx2.sendIdx["value:"]=1;
  1549. //>>excludeEnd("ctx");
  1550. if($core.assert($1)){
  1551. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  1552. }
  1553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1554. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1555. //>>excludeEnd("ctx");
  1556. }));
  1557. return $recv(stream)._contents();
  1558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1559. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  1560. //>>excludeEnd("ctx");
  1561. },
  1562. //>>excludeStart("ide", pragmas.excludeIdeData);
  1563. args: ["selectBlock", "collectBlock"],
  1564. 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",
  1565. referencedClasses: [],
  1566. //>>excludeEnd("ide");
  1567. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1568. }),
  1569. $globals.Collection);
  1570. $core.addMethod(
  1571. $core.method({
  1572. selector: "shallowCopy",
  1573. protocol: "copying",
  1574. fn: function (){
  1575. var self=this,$self=this;
  1576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1577. return $core.withContext(function($ctx1) {
  1578. //>>excludeEnd("ctx");
  1579. return $self._collect_((function(each){
  1580. return each;
  1581. }));
  1582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1583. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  1584. //>>excludeEnd("ctx");
  1585. },
  1586. //>>excludeStart("ide", pragmas.excludeIdeData);
  1587. args: [],
  1588. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  1589. referencedClasses: [],
  1590. //>>excludeEnd("ide");
  1591. messageSends: ["collect:"]
  1592. }),
  1593. $globals.Collection);
  1594. $core.addMethod(
  1595. $core.method({
  1596. selector: "single",
  1597. protocol: "accessing",
  1598. fn: function (){
  1599. var self=this,$self=this;
  1600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1601. return $core.withContext(function($ctx1) {
  1602. //>>excludeEnd("ctx");
  1603. var $1;
  1604. $self._ifEmpty_((function(){
  1605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1606. return $core.withContext(function($ctx2) {
  1607. //>>excludeEnd("ctx");
  1608. return $self._error_("Collection is empty");
  1609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1610. $ctx2.sendIdx["error:"]=1;
  1611. //>>excludeEnd("ctx");
  1612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1613. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1614. //>>excludeEnd("ctx");
  1615. }));
  1616. $1=$recv($self._size()).__gt((1));
  1617. if($core.assert($1)){
  1618. $self._error_("Collection holds more than one element");
  1619. }
  1620. return $self._anyOne();
  1621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1622. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  1623. //>>excludeEnd("ctx");
  1624. },
  1625. //>>excludeStart("ide", pragmas.excludeIdeData);
  1626. args: [],
  1627. 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",
  1628. referencedClasses: [],
  1629. //>>excludeEnd("ide");
  1630. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  1631. }),
  1632. $globals.Collection);
  1633. $core.addMethod(
  1634. $core.method({
  1635. selector: "size",
  1636. protocol: "accessing",
  1637. fn: function (){
  1638. var self=this,$self=this;
  1639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1640. return $core.withContext(function($ctx1) {
  1641. //>>excludeEnd("ctx");
  1642. $self._subclassResponsibility();
  1643. return self;
  1644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1645. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  1646. //>>excludeEnd("ctx");
  1647. },
  1648. //>>excludeStart("ide", pragmas.excludeIdeData);
  1649. args: [],
  1650. source: "size\x0a\x09self subclassResponsibility",
  1651. referencedClasses: [],
  1652. //>>excludeEnd("ide");
  1653. messageSends: ["subclassResponsibility"]
  1654. }),
  1655. $globals.Collection);
  1656. $core.addMethod(
  1657. $core.method({
  1658. selector: "classTag",
  1659. protocol: "accessing",
  1660. fn: function (){
  1661. var self=this,$self=this;
  1662. return "collection";
  1663. },
  1664. //>>excludeStart("ide", pragmas.excludeIdeData);
  1665. args: [],
  1666. 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'",
  1667. referencedClasses: [],
  1668. //>>excludeEnd("ide");
  1669. messageSends: []
  1670. }),
  1671. $globals.Collection.a$cls);
  1672. $core.addMethod(
  1673. $core.method({
  1674. selector: "new:",
  1675. protocol: "instance creation",
  1676. fn: function (anInteger){
  1677. var self=this,$self=this;
  1678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1679. return $core.withContext(function($ctx1) {
  1680. //>>excludeEnd("ctx");
  1681. return $self._new();
  1682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1683. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.a$cls)});
  1684. //>>excludeEnd("ctx");
  1685. },
  1686. //>>excludeStart("ide", pragmas.excludeIdeData);
  1687. args: ["anInteger"],
  1688. source: "new: anInteger\x0a\x09^ self new",
  1689. referencedClasses: [],
  1690. //>>excludeEnd("ide");
  1691. messageSends: ["new"]
  1692. }),
  1693. $globals.Collection.a$cls);
  1694. $core.addMethod(
  1695. $core.method({
  1696. selector: "with:",
  1697. protocol: "instance creation",
  1698. fn: function (anObject){
  1699. var self=this,$self=this;
  1700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1701. return $core.withContext(function($ctx1) {
  1702. //>>excludeEnd("ctx");
  1703. var $1;
  1704. $1=$self._new();
  1705. $recv($1)._add_(anObject);
  1706. return $recv($1)._yourself();
  1707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1708. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.a$cls)});
  1709. //>>excludeEnd("ctx");
  1710. },
  1711. //>>excludeStart("ide", pragmas.excludeIdeData);
  1712. args: ["anObject"],
  1713. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1714. referencedClasses: [],
  1715. //>>excludeEnd("ide");
  1716. messageSends: ["add:", "new", "yourself"]
  1717. }),
  1718. $globals.Collection.a$cls);
  1719. $core.addMethod(
  1720. $core.method({
  1721. selector: "with:with:",
  1722. protocol: "instance creation",
  1723. fn: function (anObject,anotherObject){
  1724. var self=this,$self=this;
  1725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1726. return $core.withContext(function($ctx1) {
  1727. //>>excludeEnd("ctx");
  1728. var $1;
  1729. $1=$self._new();
  1730. $recv($1)._add_(anObject);
  1731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1732. $ctx1.sendIdx["add:"]=1;
  1733. //>>excludeEnd("ctx");
  1734. $recv($1)._add_(anotherObject);
  1735. return $recv($1)._yourself();
  1736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1737. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.a$cls)});
  1738. //>>excludeEnd("ctx");
  1739. },
  1740. //>>excludeStart("ide", pragmas.excludeIdeData);
  1741. args: ["anObject", "anotherObject"],
  1742. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1743. referencedClasses: [],
  1744. //>>excludeEnd("ide");
  1745. messageSends: ["add:", "new", "yourself"]
  1746. }),
  1747. $globals.Collection.a$cls);
  1748. $core.addMethod(
  1749. $core.method({
  1750. selector: "with:with:with:",
  1751. protocol: "instance creation",
  1752. fn: function (firstObject,secondObject,thirdObject){
  1753. var self=this,$self=this;
  1754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1755. return $core.withContext(function($ctx1) {
  1756. //>>excludeEnd("ctx");
  1757. var $1;
  1758. $1=$self._new();
  1759. $recv($1)._add_(firstObject);
  1760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1761. $ctx1.sendIdx["add:"]=1;
  1762. //>>excludeEnd("ctx");
  1763. $recv($1)._add_(secondObject);
  1764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1765. $ctx1.sendIdx["add:"]=2;
  1766. //>>excludeEnd("ctx");
  1767. $recv($1)._add_(thirdObject);
  1768. return $recv($1)._yourself();
  1769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1770. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.a$cls)});
  1771. //>>excludeEnd("ctx");
  1772. },
  1773. //>>excludeStart("ide", pragmas.excludeIdeData);
  1774. args: ["firstObject", "secondObject", "thirdObject"],
  1775. 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",
  1776. referencedClasses: [],
  1777. //>>excludeEnd("ide");
  1778. messageSends: ["add:", "new", "yourself"]
  1779. }),
  1780. $globals.Collection.a$cls);
  1781. $core.addMethod(
  1782. $core.method({
  1783. selector: "withAll:",
  1784. protocol: "instance creation",
  1785. fn: function (aCollection){
  1786. var self=this,$self=this;
  1787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1788. return $core.withContext(function($ctx1) {
  1789. //>>excludeEnd("ctx");
  1790. var $1;
  1791. $1=$self._new();
  1792. $recv($1)._addAll_(aCollection);
  1793. return $recv($1)._yourself();
  1794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1795. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.a$cls)});
  1796. //>>excludeEnd("ctx");
  1797. },
  1798. //>>excludeStart("ide", pragmas.excludeIdeData);
  1799. args: ["aCollection"],
  1800. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1801. referencedClasses: [],
  1802. //>>excludeEnd("ide");
  1803. messageSends: ["addAll:", "new", "yourself"]
  1804. }),
  1805. $globals.Collection.a$cls);
  1806. $core.addClass("AssociativeCollection", $globals.Collection, [], "Kernel-Collections");
  1807. //>>excludeStart("ide", pragmas.excludeIdeData);
  1808. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  1809. //>>excludeEnd("ide");
  1810. $core.addMethod(
  1811. $core.method({
  1812. selector: "=",
  1813. protocol: "comparing",
  1814. fn: function (anAssocitativeCollection){
  1815. var self=this,$self=this;
  1816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1817. return $core.withContext(function($ctx1) {
  1818. //>>excludeEnd("ctx");
  1819. var $2,$1,$4,$3,$5;
  1820. $2=$self._class();
  1821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1822. $ctx1.sendIdx["class"]=1;
  1823. //>>excludeEnd("ctx");
  1824. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  1825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1826. $ctx1.sendIdx["="]=1;
  1827. //>>excludeEnd("ctx");
  1828. if(!$core.assert($1)){
  1829. return false;
  1830. }
  1831. $4=$self._size();
  1832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1833. $ctx1.sendIdx["size"]=1;
  1834. //>>excludeEnd("ctx");
  1835. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  1836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1837. $ctx1.sendIdx["="]=2;
  1838. //>>excludeEnd("ctx");
  1839. if(!$core.assert($3)){
  1840. return false;
  1841. }
  1842. $5=$self._associations();
  1843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1844. $ctx1.sendIdx["associations"]=1;
  1845. //>>excludeEnd("ctx");
  1846. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  1847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1848. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  1849. //>>excludeEnd("ctx");
  1850. },
  1851. //>>excludeStart("ide", pragmas.excludeIdeData);
  1852. args: ["anAssocitativeCollection"],
  1853. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  1854. referencedClasses: [],
  1855. //>>excludeEnd("ide");
  1856. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  1857. }),
  1858. $globals.AssociativeCollection);
  1859. $core.addMethod(
  1860. $core.method({
  1861. selector: "add:",
  1862. protocol: "adding/removing",
  1863. fn: function (anAssociation){
  1864. var self=this,$self=this;
  1865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1866. return $core.withContext(function($ctx1) {
  1867. //>>excludeEnd("ctx");
  1868. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  1869. return self;
  1870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1871. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  1872. //>>excludeEnd("ctx");
  1873. },
  1874. //>>excludeStart("ide", pragmas.excludeIdeData);
  1875. args: ["anAssociation"],
  1876. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  1877. referencedClasses: [],
  1878. //>>excludeEnd("ide");
  1879. messageSends: ["at:put:", "key", "value"]
  1880. }),
  1881. $globals.AssociativeCollection);
  1882. $core.addMethod(
  1883. $core.method({
  1884. selector: "addAll:",
  1885. protocol: "adding/removing",
  1886. fn: function (anAssociativeCollection){
  1887. var self=this,$self=this;
  1888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1889. return $core.withContext(function($ctx1) {
  1890. //>>excludeEnd("ctx");
  1891. (
  1892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1893. $ctx1.supercall = true,
  1894. //>>excludeEnd("ctx");
  1895. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  1896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1897. $ctx1.supercall = false;
  1898. //>>excludeEnd("ctx");;
  1899. return anAssociativeCollection;
  1900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1901. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  1902. //>>excludeEnd("ctx");
  1903. },
  1904. //>>excludeStart("ide", pragmas.excludeIdeData);
  1905. args: ["anAssociativeCollection"],
  1906. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  1907. referencedClasses: [],
  1908. //>>excludeEnd("ide");
  1909. messageSends: ["addAll:", "associations"]
  1910. }),
  1911. $globals.AssociativeCollection);
  1912. $core.addMethod(
  1913. $core.method({
  1914. selector: "asDictionary",
  1915. protocol: "converting",
  1916. fn: function (){
  1917. var self=this,$self=this;
  1918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1919. return $core.withContext(function($ctx1) {
  1920. //>>excludeEnd("ctx");
  1921. return $recv($globals.Dictionary)._from_($self._associations());
  1922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1923. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  1924. //>>excludeEnd("ctx");
  1925. },
  1926. //>>excludeStart("ide", pragmas.excludeIdeData);
  1927. args: [],
  1928. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  1929. referencedClasses: ["Dictionary"],
  1930. //>>excludeEnd("ide");
  1931. messageSends: ["from:", "associations"]
  1932. }),
  1933. $globals.AssociativeCollection);
  1934. $core.addMethod(
  1935. $core.method({
  1936. selector: "asHashedCollection",
  1937. protocol: "converting",
  1938. fn: function (){
  1939. var self=this,$self=this;
  1940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1941. return $core.withContext(function($ctx1) {
  1942. //>>excludeEnd("ctx");
  1943. return $recv($globals.HashedCollection)._from_($self._associations());
  1944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1945. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  1946. //>>excludeEnd("ctx");
  1947. },
  1948. //>>excludeStart("ide", pragmas.excludeIdeData);
  1949. args: [],
  1950. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  1951. referencedClasses: ["HashedCollection"],
  1952. //>>excludeEnd("ide");
  1953. messageSends: ["from:", "associations"]
  1954. }),
  1955. $globals.AssociativeCollection);
  1956. $core.addMethod(
  1957. $core.method({
  1958. selector: "asJavaScriptObject",
  1959. protocol: "converting",
  1960. fn: function (){
  1961. var self=this,$self=this;
  1962. var hash;
  1963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1964. return $core.withContext(function($ctx1) {
  1965. //>>excludeEnd("ctx");
  1966. hash=$recv($globals.HashedCollection)._new();
  1967. $self._keysAndValuesDo_((function(key,value){
  1968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1969. return $core.withContext(function($ctx2) {
  1970. //>>excludeEnd("ctx");
  1971. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  1972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1973. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  1974. //>>excludeEnd("ctx");
  1975. }));
  1976. return hash;
  1977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1978. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash},$globals.AssociativeCollection)});
  1979. //>>excludeEnd("ctx");
  1980. },
  1981. //>>excludeStart("ide", pragmas.excludeIdeData);
  1982. args: [],
  1983. 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",
  1984. referencedClasses: ["HashedCollection"],
  1985. //>>excludeEnd("ide");
  1986. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  1987. }),
  1988. $globals.AssociativeCollection);
  1989. $core.addMethod(
  1990. $core.method({
  1991. selector: "associations",
  1992. protocol: "accessing",
  1993. fn: function (){
  1994. var self=this,$self=this;
  1995. var associations;
  1996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1997. return $core.withContext(function($ctx1) {
  1998. //>>excludeEnd("ctx");
  1999. associations=[];
  2000. $self._associationsDo_((function(each){
  2001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2002. return $core.withContext(function($ctx2) {
  2003. //>>excludeEnd("ctx");
  2004. return $recv(associations)._add_(each);
  2005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2006. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2007. //>>excludeEnd("ctx");
  2008. }));
  2009. return associations;
  2010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2011. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  2012. //>>excludeEnd("ctx");
  2013. },
  2014. //>>excludeStart("ide", pragmas.excludeIdeData);
  2015. args: [],
  2016. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  2017. referencedClasses: [],
  2018. //>>excludeEnd("ide");
  2019. messageSends: ["associationsDo:", "add:"]
  2020. }),
  2021. $globals.AssociativeCollection);
  2022. $core.addMethod(
  2023. $core.method({
  2024. selector: "associationsDo:",
  2025. protocol: "enumerating",
  2026. fn: function (aBlock){
  2027. var self=this,$self=this;
  2028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2029. return $core.withContext(function($ctx1) {
  2030. //>>excludeEnd("ctx");
  2031. $self._keysAndValuesDo_((function(key,value){
  2032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2033. return $core.withContext(function($ctx2) {
  2034. //>>excludeEnd("ctx");
  2035. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  2036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2037. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2038. //>>excludeEnd("ctx");
  2039. }));
  2040. return self;
  2041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2042. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2043. //>>excludeEnd("ctx");
  2044. },
  2045. //>>excludeStart("ide", pragmas.excludeIdeData);
  2046. args: ["aBlock"],
  2047. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2048. referencedClasses: ["Association"],
  2049. //>>excludeEnd("ide");
  2050. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2051. }),
  2052. $globals.AssociativeCollection);
  2053. $core.addMethod(
  2054. $core.method({
  2055. selector: "at:ifPresent:ifAbsent:",
  2056. protocol: "accessing",
  2057. fn: function (aKey,aBlock,anotherBlock){
  2058. var self=this,$self=this;
  2059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2060. return $core.withContext(function($ctx1) {
  2061. //>>excludeEnd("ctx");
  2062. var $1;
  2063. $1=$self._includesKey_(aKey);
  2064. if($core.assert($1)){
  2065. return $recv(aBlock)._value_($self._at_(aKey));
  2066. } else {
  2067. return $recv(anotherBlock)._value();
  2068. }
  2069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2070. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  2071. //>>excludeEnd("ctx");
  2072. },
  2073. //>>excludeStart("ide", pragmas.excludeIdeData);
  2074. args: ["aKey", "aBlock", "anotherBlock"],
  2075. 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 ]",
  2076. referencedClasses: [],
  2077. //>>excludeEnd("ide");
  2078. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2079. }),
  2080. $globals.AssociativeCollection);
  2081. $core.addMethod(
  2082. $core.method({
  2083. selector: "collect:",
  2084. protocol: "enumerating",
  2085. fn: function (aBlock){
  2086. var self=this,$self=this;
  2087. var newDict;
  2088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2089. return $core.withContext(function($ctx1) {
  2090. //>>excludeEnd("ctx");
  2091. newDict=$recv($self._class())._new();
  2092. $self._keysAndValuesDo_((function(key,value){
  2093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2094. return $core.withContext(function($ctx2) {
  2095. //>>excludeEnd("ctx");
  2096. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  2097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2098. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2099. //>>excludeEnd("ctx");
  2100. }));
  2101. return newDict;
  2102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2103. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  2104. //>>excludeEnd("ctx");
  2105. },
  2106. //>>excludeStart("ide", pragmas.excludeIdeData);
  2107. args: ["aBlock"],
  2108. 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",
  2109. referencedClasses: [],
  2110. //>>excludeEnd("ide");
  2111. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  2112. }),
  2113. $globals.AssociativeCollection);
  2114. $core.addMethod(
  2115. $core.method({
  2116. selector: "deepCopy",
  2117. protocol: "copying",
  2118. fn: function (){
  2119. var self=this,$self=this;
  2120. var copy;
  2121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2122. return $core.withContext(function($ctx1) {
  2123. //>>excludeEnd("ctx");
  2124. copy=$recv($self._class())._new();
  2125. $self._keysAndValuesDo_((function(key,value){
  2126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2127. return $core.withContext(function($ctx2) {
  2128. //>>excludeEnd("ctx");
  2129. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  2130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2131. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2132. //>>excludeEnd("ctx");
  2133. }));
  2134. return copy;
  2135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2136. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  2137. //>>excludeEnd("ctx");
  2138. },
  2139. //>>excludeStart("ide", pragmas.excludeIdeData);
  2140. args: [],
  2141. 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",
  2142. referencedClasses: [],
  2143. //>>excludeEnd("ide");
  2144. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  2145. }),
  2146. $globals.AssociativeCollection);
  2147. $core.addMethod(
  2148. $core.method({
  2149. selector: "detect:ifNone:",
  2150. protocol: "enumerating",
  2151. fn: function (aBlock,anotherBlock){
  2152. var self=this,$self=this;
  2153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2154. return $core.withContext(function($ctx1) {
  2155. //>>excludeEnd("ctx");
  2156. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  2157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2158. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  2159. //>>excludeEnd("ctx");
  2160. },
  2161. //>>excludeStart("ide", pragmas.excludeIdeData);
  2162. args: ["aBlock", "anotherBlock"],
  2163. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  2164. referencedClasses: [],
  2165. //>>excludeEnd("ide");
  2166. messageSends: ["detect:ifNone:", "values"]
  2167. }),
  2168. $globals.AssociativeCollection);
  2169. $core.addMethod(
  2170. $core.method({
  2171. selector: "do:",
  2172. protocol: "enumerating",
  2173. fn: function (aBlock){
  2174. var self=this,$self=this;
  2175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2176. return $core.withContext(function($ctx1) {
  2177. //>>excludeEnd("ctx");
  2178. $self._valuesDo_(aBlock);
  2179. return self;
  2180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2181. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2182. //>>excludeEnd("ctx");
  2183. },
  2184. //>>excludeStart("ide", pragmas.excludeIdeData);
  2185. args: ["aBlock"],
  2186. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  2187. referencedClasses: [],
  2188. //>>excludeEnd("ide");
  2189. messageSends: ["valuesDo:"]
  2190. }),
  2191. $globals.AssociativeCollection);
  2192. $core.addMethod(
  2193. $core.method({
  2194. selector: "includes:",
  2195. protocol: "enumerating",
  2196. fn: function (anObject){
  2197. var self=this,$self=this;
  2198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2199. return $core.withContext(function($ctx1) {
  2200. //>>excludeEnd("ctx");
  2201. return $recv($self._values())._includes_(anObject);
  2202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2203. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  2204. //>>excludeEnd("ctx");
  2205. },
  2206. //>>excludeStart("ide", pragmas.excludeIdeData);
  2207. args: ["anObject"],
  2208. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  2209. referencedClasses: [],
  2210. //>>excludeEnd("ide");
  2211. messageSends: ["includes:", "values"]
  2212. }),
  2213. $globals.AssociativeCollection);
  2214. $core.addMethod(
  2215. $core.method({
  2216. selector: "includesKey:",
  2217. protocol: "testing",
  2218. fn: function (aKey){
  2219. var self=this,$self=this;
  2220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2221. return $core.withContext(function($ctx1) {
  2222. //>>excludeEnd("ctx");
  2223. $self._subclassResponsibility();
  2224. return self;
  2225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2226. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  2227. //>>excludeEnd("ctx");
  2228. },
  2229. //>>excludeStart("ide", pragmas.excludeIdeData);
  2230. args: ["aKey"],
  2231. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  2232. referencedClasses: [],
  2233. //>>excludeEnd("ide");
  2234. messageSends: ["subclassResponsibility"]
  2235. }),
  2236. $globals.AssociativeCollection);
  2237. $core.addMethod(
  2238. $core.method({
  2239. selector: "indexOf:ifAbsent:",
  2240. protocol: "accessing",
  2241. fn: function (anObject,aBlock){
  2242. var self=this,$self=this;
  2243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2244. return $core.withContext(function($ctx1) {
  2245. //>>excludeEnd("ctx");
  2246. return $recv($self._keys())._detect_ifNone_((function(each){
  2247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2248. return $core.withContext(function($ctx2) {
  2249. //>>excludeEnd("ctx");
  2250. return $recv($self._at_(each)).__eq(anObject);
  2251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2252. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2253. //>>excludeEnd("ctx");
  2254. }),aBlock);
  2255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2256. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  2257. //>>excludeEnd("ctx");
  2258. },
  2259. //>>excludeStart("ide", pragmas.excludeIdeData);
  2260. args: ["anObject", "aBlock"],
  2261. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  2262. referencedClasses: [],
  2263. //>>excludeEnd("ide");
  2264. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  2265. }),
  2266. $globals.AssociativeCollection);
  2267. $core.addMethod(
  2268. $core.method({
  2269. selector: "keyAtValue:",
  2270. protocol: "accessing",
  2271. fn: function (anObject){
  2272. var self=this,$self=this;
  2273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2274. return $core.withContext(function($ctx1) {
  2275. //>>excludeEnd("ctx");
  2276. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  2277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2278. return $core.withContext(function($ctx2) {
  2279. //>>excludeEnd("ctx");
  2280. return $self._errorNotFound();
  2281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2283. //>>excludeEnd("ctx");
  2284. }));
  2285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2286. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  2287. //>>excludeEnd("ctx");
  2288. },
  2289. //>>excludeStart("ide", pragmas.excludeIdeData);
  2290. args: ["anObject"],
  2291. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  2292. referencedClasses: [],
  2293. //>>excludeEnd("ide");
  2294. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  2295. }),
  2296. $globals.AssociativeCollection);
  2297. $core.addMethod(
  2298. $core.method({
  2299. selector: "keyAtValue:ifAbsent:",
  2300. protocol: "accessing",
  2301. fn: function (anObject,aBlock){
  2302. var self=this,$self=this;
  2303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2304. return $core.withContext(function($ctx1) {
  2305. //>>excludeEnd("ctx");
  2306. return $self._indexOf_ifAbsent_(anObject,aBlock);
  2307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2308. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  2309. //>>excludeEnd("ctx");
  2310. },
  2311. //>>excludeStart("ide", pragmas.excludeIdeData);
  2312. args: ["anObject", "aBlock"],
  2313. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  2314. referencedClasses: [],
  2315. //>>excludeEnd("ide");
  2316. messageSends: ["indexOf:ifAbsent:"]
  2317. }),
  2318. $globals.AssociativeCollection);
  2319. $core.addMethod(
  2320. $core.method({
  2321. selector: "keys",
  2322. protocol: "accessing",
  2323. fn: function (){
  2324. var self=this,$self=this;
  2325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2326. return $core.withContext(function($ctx1) {
  2327. //>>excludeEnd("ctx");
  2328. $self._subclassResponsibility();
  2329. return self;
  2330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2331. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  2332. //>>excludeEnd("ctx");
  2333. },
  2334. //>>excludeStart("ide", pragmas.excludeIdeData);
  2335. args: [],
  2336. source: "keys\x0a\x09self subclassResponsibility",
  2337. referencedClasses: [],
  2338. //>>excludeEnd("ide");
  2339. messageSends: ["subclassResponsibility"]
  2340. }),
  2341. $globals.AssociativeCollection);
  2342. $core.addMethod(
  2343. $core.method({
  2344. selector: "keysAndValuesDo:",
  2345. protocol: "enumerating",
  2346. fn: function (aBlock){
  2347. var self=this,$self=this;
  2348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2349. return $core.withContext(function($ctx1) {
  2350. //>>excludeEnd("ctx");
  2351. $self._keysDo_((function(each){
  2352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2353. return $core.withContext(function($ctx2) {
  2354. //>>excludeEnd("ctx");
  2355. return $recv(aBlock)._value_value_(each,$self._at_(each));
  2356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2357. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2358. //>>excludeEnd("ctx");
  2359. }));
  2360. return self;
  2361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2362. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2363. //>>excludeEnd("ctx");
  2364. },
  2365. //>>excludeStart("ide", pragmas.excludeIdeData);
  2366. args: ["aBlock"],
  2367. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  2368. referencedClasses: [],
  2369. //>>excludeEnd("ide");
  2370. messageSends: ["keysDo:", "value:value:", "at:"]
  2371. }),
  2372. $globals.AssociativeCollection);
  2373. $core.addMethod(
  2374. $core.method({
  2375. selector: "keysDo:",
  2376. protocol: "enumerating",
  2377. fn: function (aBlock){
  2378. var self=this,$self=this;
  2379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2380. return $core.withContext(function($ctx1) {
  2381. //>>excludeEnd("ctx");
  2382. $self._subclassResponsibility();
  2383. return self;
  2384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2385. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2386. //>>excludeEnd("ctx");
  2387. },
  2388. //>>excludeStart("ide", pragmas.excludeIdeData);
  2389. args: ["aBlock"],
  2390. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  2391. referencedClasses: [],
  2392. //>>excludeEnd("ide");
  2393. messageSends: ["subclassResponsibility"]
  2394. }),
  2395. $globals.AssociativeCollection);
  2396. $core.addMethod(
  2397. $core.method({
  2398. selector: "printOn:",
  2399. protocol: "printing",
  2400. fn: function (aStream){
  2401. var self=this,$self=this;
  2402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2403. return $core.withContext(function($ctx1) {
  2404. //>>excludeEnd("ctx");
  2405. (
  2406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2407. $ctx1.supercall = true,
  2408. //>>excludeEnd("ctx");
  2409. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  2410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2411. $ctx1.supercall = false;
  2412. //>>excludeEnd("ctx");;
  2413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2414. $ctx1.sendIdx["printOn:"]=1;
  2415. //>>excludeEnd("ctx");
  2416. $recv(aStream)._nextPutAll_(" (");
  2417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2418. $ctx1.sendIdx["nextPutAll:"]=1;
  2419. //>>excludeEnd("ctx");
  2420. $recv($self._associations())._do_separatedBy_((function(each){
  2421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2422. return $core.withContext(function($ctx2) {
  2423. //>>excludeEnd("ctx");
  2424. return $recv(each)._printOn_(aStream);
  2425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2426. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2427. //>>excludeEnd("ctx");
  2428. }),(function(){
  2429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2430. return $core.withContext(function($ctx2) {
  2431. //>>excludeEnd("ctx");
  2432. return $recv(aStream)._nextPutAll_(" , ");
  2433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2434. $ctx2.sendIdx["nextPutAll:"]=2;
  2435. //>>excludeEnd("ctx");
  2436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2438. //>>excludeEnd("ctx");
  2439. }));
  2440. $recv(aStream)._nextPutAll_(")");
  2441. return self;
  2442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2443. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  2444. //>>excludeEnd("ctx");
  2445. },
  2446. //>>excludeStart("ide", pragmas.excludeIdeData);
  2447. args: ["aStream"],
  2448. 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: ')'",
  2449. referencedClasses: [],
  2450. //>>excludeEnd("ide");
  2451. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  2452. }),
  2453. $globals.AssociativeCollection);
  2454. $core.addMethod(
  2455. $core.method({
  2456. selector: "remove:ifAbsent:",
  2457. protocol: "adding/removing",
  2458. fn: function (aKey,aBlock){
  2459. var self=this,$self=this;
  2460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2461. return $core.withContext(function($ctx1) {
  2462. //>>excludeEnd("ctx");
  2463. return $self._removeKey_ifAbsent_(aKey,aBlock);
  2464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2465. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  2466. //>>excludeEnd("ctx");
  2467. },
  2468. //>>excludeStart("ide", pragmas.excludeIdeData);
  2469. args: ["aKey", "aBlock"],
  2470. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  2471. referencedClasses: [],
  2472. //>>excludeEnd("ide");
  2473. messageSends: ["removeKey:ifAbsent:"]
  2474. }),
  2475. $globals.AssociativeCollection);
  2476. $core.addMethod(
  2477. $core.method({
  2478. selector: "removeAll",
  2479. protocol: "adding/removing",
  2480. fn: function (){
  2481. var self=this,$self=this;
  2482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2483. return $core.withContext(function($ctx1) {
  2484. //>>excludeEnd("ctx");
  2485. return $recv($self._keys())._do_((function(each){
  2486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2487. return $core.withContext(function($ctx2) {
  2488. //>>excludeEnd("ctx");
  2489. return $self._removeKey_(each);
  2490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2491. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2492. //>>excludeEnd("ctx");
  2493. }));
  2494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2495. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  2496. //>>excludeEnd("ctx");
  2497. },
  2498. //>>excludeStart("ide", pragmas.excludeIdeData);
  2499. args: [],
  2500. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  2501. referencedClasses: [],
  2502. //>>excludeEnd("ide");
  2503. messageSends: ["do:", "keys", "removeKey:"]
  2504. }),
  2505. $globals.AssociativeCollection);
  2506. $core.addMethod(
  2507. $core.method({
  2508. selector: "removeKey:",
  2509. protocol: "adding/removing",
  2510. fn: function (aKey){
  2511. var self=this,$self=this;
  2512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2513. return $core.withContext(function($ctx1) {
  2514. //>>excludeEnd("ctx");
  2515. return $self._remove_(aKey);
  2516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2517. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  2518. //>>excludeEnd("ctx");
  2519. },
  2520. //>>excludeStart("ide", pragmas.excludeIdeData);
  2521. args: ["aKey"],
  2522. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  2523. referencedClasses: [],
  2524. //>>excludeEnd("ide");
  2525. messageSends: ["remove:"]
  2526. }),
  2527. $globals.AssociativeCollection);
  2528. $core.addMethod(
  2529. $core.method({
  2530. selector: "removeKey:ifAbsent:",
  2531. protocol: "adding/removing",
  2532. fn: function (aKey,aBlock){
  2533. var self=this,$self=this;
  2534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2535. return $core.withContext(function($ctx1) {
  2536. //>>excludeEnd("ctx");
  2537. $self._subclassResponsibility();
  2538. return self;
  2539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2540. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  2541. //>>excludeEnd("ctx");
  2542. },
  2543. //>>excludeStart("ide", pragmas.excludeIdeData);
  2544. args: ["aKey", "aBlock"],
  2545. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2546. referencedClasses: [],
  2547. //>>excludeEnd("ide");
  2548. messageSends: ["subclassResponsibility"]
  2549. }),
  2550. $globals.AssociativeCollection);
  2551. $core.addMethod(
  2552. $core.method({
  2553. selector: "select:",
  2554. protocol: "enumerating",
  2555. fn: function (aBlock){
  2556. var self=this,$self=this;
  2557. var newDict;
  2558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2559. return $core.withContext(function($ctx1) {
  2560. //>>excludeEnd("ctx");
  2561. var $1;
  2562. newDict=$recv($self._class())._new();
  2563. $self._keysAndValuesDo_((function(key,value){
  2564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2565. return $core.withContext(function($ctx2) {
  2566. //>>excludeEnd("ctx");
  2567. $1=$recv(aBlock)._value_(value);
  2568. if($core.assert($1)){
  2569. return $recv(newDict)._at_put_(key,value);
  2570. }
  2571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2572. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2573. //>>excludeEnd("ctx");
  2574. }));
  2575. return newDict;
  2576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2577. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  2578. //>>excludeEnd("ctx");
  2579. },
  2580. //>>excludeStart("ide", pragmas.excludeIdeData);
  2581. args: ["aBlock"],
  2582. 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",
  2583. referencedClasses: [],
  2584. //>>excludeEnd("ide");
  2585. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2586. }),
  2587. $globals.AssociativeCollection);
  2588. $core.addMethod(
  2589. $core.method({
  2590. selector: "select:thenCollect:",
  2591. protocol: "enumerating",
  2592. fn: function (selectBlock,collectBlock){
  2593. var self=this,$self=this;
  2594. var newDict;
  2595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2596. return $core.withContext(function($ctx1) {
  2597. //>>excludeEnd("ctx");
  2598. var $1;
  2599. newDict=$recv($self._class())._new();
  2600. $self._keysAndValuesDo_((function(key,value){
  2601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2602. return $core.withContext(function($ctx2) {
  2603. //>>excludeEnd("ctx");
  2604. $1=$recv(selectBlock)._value_(value);
  2605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2606. $ctx2.sendIdx["value:"]=1;
  2607. //>>excludeEnd("ctx");
  2608. if($core.assert($1)){
  2609. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  2610. }
  2611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2612. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2613. //>>excludeEnd("ctx");
  2614. }));
  2615. return newDict;
  2616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2617. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict},$globals.AssociativeCollection)});
  2618. //>>excludeEnd("ctx");
  2619. },
  2620. //>>excludeStart("ide", pragmas.excludeIdeData);
  2621. args: ["selectBlock", "collectBlock"],
  2622. 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",
  2623. referencedClasses: [],
  2624. //>>excludeEnd("ide");
  2625. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2626. }),
  2627. $globals.AssociativeCollection);
  2628. $core.addMethod(
  2629. $core.method({
  2630. selector: "shallowCopy",
  2631. protocol: "copying",
  2632. fn: function (){
  2633. var self=this,$self=this;
  2634. var copy;
  2635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2636. return $core.withContext(function($ctx1) {
  2637. //>>excludeEnd("ctx");
  2638. copy=$recv($self._class())._new();
  2639. $self._keysAndValuesDo_((function(key,value){
  2640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2641. return $core.withContext(function($ctx2) {
  2642. //>>excludeEnd("ctx");
  2643. return $recv(copy)._at_put_(key,value);
  2644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2645. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2646. //>>excludeEnd("ctx");
  2647. }));
  2648. return copy;
  2649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2650. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  2651. //>>excludeEnd("ctx");
  2652. },
  2653. //>>excludeStart("ide", pragmas.excludeIdeData);
  2654. args: [],
  2655. 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",
  2656. referencedClasses: [],
  2657. //>>excludeEnd("ide");
  2658. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2659. }),
  2660. $globals.AssociativeCollection);
  2661. $core.addMethod(
  2662. $core.method({
  2663. selector: "size",
  2664. protocol: "accessing",
  2665. fn: function (){
  2666. var self=this,$self=this;
  2667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2668. return $core.withContext(function($ctx1) {
  2669. //>>excludeEnd("ctx");
  2670. return $recv($self._keys())._size();
  2671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2672. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  2673. //>>excludeEnd("ctx");
  2674. },
  2675. //>>excludeStart("ide", pragmas.excludeIdeData);
  2676. args: [],
  2677. source: "size\x0a\x09^ self keys size",
  2678. referencedClasses: [],
  2679. //>>excludeEnd("ide");
  2680. messageSends: ["size", "keys"]
  2681. }),
  2682. $globals.AssociativeCollection);
  2683. $core.addMethod(
  2684. $core.method({
  2685. selector: "values",
  2686. protocol: "accessing",
  2687. fn: function (){
  2688. var self=this,$self=this;
  2689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2690. return $core.withContext(function($ctx1) {
  2691. //>>excludeEnd("ctx");
  2692. $self._subclassResponsibility();
  2693. return self;
  2694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2695. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  2696. //>>excludeEnd("ctx");
  2697. },
  2698. //>>excludeStart("ide", pragmas.excludeIdeData);
  2699. args: [],
  2700. source: "values\x0a\x09self subclassResponsibility",
  2701. referencedClasses: [],
  2702. //>>excludeEnd("ide");
  2703. messageSends: ["subclassResponsibility"]
  2704. }),
  2705. $globals.AssociativeCollection);
  2706. $core.addMethod(
  2707. $core.method({
  2708. selector: "valuesDo:",
  2709. protocol: "enumerating",
  2710. fn: function (aBlock){
  2711. var self=this,$self=this;
  2712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2713. return $core.withContext(function($ctx1) {
  2714. //>>excludeEnd("ctx");
  2715. $self._subclassResponsibility();
  2716. return self;
  2717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2718. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2719. //>>excludeEnd("ctx");
  2720. },
  2721. //>>excludeStart("ide", pragmas.excludeIdeData);
  2722. args: ["aBlock"],
  2723. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2724. referencedClasses: [],
  2725. //>>excludeEnd("ide");
  2726. messageSends: ["subclassResponsibility"]
  2727. }),
  2728. $globals.AssociativeCollection);
  2729. $core.addMethod(
  2730. $core.method({
  2731. selector: "withIndexDo:",
  2732. protocol: "enumerating",
  2733. fn: function (aBlock){
  2734. var self=this,$self=this;
  2735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2736. return $core.withContext(function($ctx1) {
  2737. //>>excludeEnd("ctx");
  2738. $self._keysAndValuesDo_((function(key,value){
  2739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2740. return $core.withContext(function($ctx2) {
  2741. //>>excludeEnd("ctx");
  2742. return $recv(aBlock)._value_value_(value,key);
  2743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2744. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2745. //>>excludeEnd("ctx");
  2746. }));
  2747. return self;
  2748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2749. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2750. //>>excludeEnd("ctx");
  2751. },
  2752. //>>excludeStart("ide", pragmas.excludeIdeData);
  2753. args: ["aBlock"],
  2754. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  2755. referencedClasses: [],
  2756. //>>excludeEnd("ide");
  2757. messageSends: ["keysAndValuesDo:", "value:value:"]
  2758. }),
  2759. $globals.AssociativeCollection);
  2760. $core.addMethod(
  2761. $core.method({
  2762. selector: "from:",
  2763. protocol: "instance creation",
  2764. fn: function (aCollection){
  2765. var self=this,$self=this;
  2766. var newCollection;
  2767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2768. return $core.withContext(function($ctx1) {
  2769. //>>excludeEnd("ctx");
  2770. newCollection=$self._new();
  2771. $recv(aCollection)._do_((function(each){
  2772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2773. return $core.withContext(function($ctx2) {
  2774. //>>excludeEnd("ctx");
  2775. return $recv(newCollection)._add_(each);
  2776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2777. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2778. //>>excludeEnd("ctx");
  2779. }));
  2780. return newCollection;
  2781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2782. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  2783. //>>excludeEnd("ctx");
  2784. },
  2785. //>>excludeStart("ide", pragmas.excludeIdeData);
  2786. args: ["aCollection"],
  2787. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  2788. referencedClasses: [],
  2789. //>>excludeEnd("ide");
  2790. messageSends: ["new", "do:", "add:"]
  2791. }),
  2792. $globals.AssociativeCollection.a$cls);
  2793. $core.addMethod(
  2794. $core.method({
  2795. selector: "fromPairs:",
  2796. protocol: "instance creation",
  2797. fn: function (aCollection){
  2798. var self=this,$self=this;
  2799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2800. return $core.withContext(function($ctx1) {
  2801. //>>excludeEnd("ctx");
  2802. return $self._from_(aCollection);
  2803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2804. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.a$cls)});
  2805. //>>excludeEnd("ctx");
  2806. },
  2807. //>>excludeStart("ide", pragmas.excludeIdeData);
  2808. args: ["aCollection"],
  2809. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  2810. referencedClasses: [],
  2811. //>>excludeEnd("ide");
  2812. messageSends: ["from:"]
  2813. }),
  2814. $globals.AssociativeCollection.a$cls);
  2815. $core.addMethod(
  2816. $core.method({
  2817. selector: "newFromPairs:",
  2818. protocol: "instance creation",
  2819. fn: function (aCollection){
  2820. var self=this,$self=this;
  2821. var newCollection;
  2822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2823. return $core.withContext(function($ctx1) {
  2824. //>>excludeEnd("ctx");
  2825. var $2,$1,$3,$4;
  2826. $2=$recv(aCollection)._size();
  2827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2828. $ctx1.sendIdx["size"]=1;
  2829. //>>excludeEnd("ctx");
  2830. $1=$recv($2)._even();
  2831. if(!$core.assert($1)){
  2832. $self._error_("#newFromPairs only accepts arrays of an even length");
  2833. }
  2834. newCollection=$self._new();
  2835. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  2836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2837. return $core.withContext(function($ctx2) {
  2838. //>>excludeEnd("ctx");
  2839. $3=newCollection;
  2840. $4=$recv(aCollection)._at_(each);
  2841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2842. $ctx2.sendIdx["at:"]=1;
  2843. //>>excludeEnd("ctx");
  2844. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  2845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2846. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2847. //>>excludeEnd("ctx");
  2848. }));
  2849. return newCollection;
  2850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2851. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  2852. //>>excludeEnd("ctx");
  2853. },
  2854. //>>excludeStart("ide", pragmas.excludeIdeData);
  2855. args: ["aCollection"],
  2856. 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",
  2857. referencedClasses: [],
  2858. //>>excludeEnd("ide");
  2859. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  2860. }),
  2861. $globals.AssociativeCollection.a$cls);
  2862. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  2863. //>>excludeStart("ide", pragmas.excludeIdeData);
  2864. $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.";
  2865. //>>excludeEnd("ide");
  2866. $core.addMethod(
  2867. $core.method({
  2868. selector: "at:ifAbsent:",
  2869. protocol: "accessing",
  2870. fn: function (aKey,aBlock){
  2871. var self=this,$self=this;
  2872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2873. return $core.withContext(function($ctx1) {
  2874. //>>excludeEnd("ctx");
  2875. var index = $self._positionOfKey_(aKey);
  2876. return index >=0 ? $self['@values'][index] : aBlock._value();
  2877. ;
  2878. return self;
  2879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2880. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  2881. //>>excludeEnd("ctx");
  2882. },
  2883. //>>excludeStart("ide", pragmas.excludeIdeData);
  2884. args: ["aKey", "aBlock"],
  2885. 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'>",
  2886. referencedClasses: [],
  2887. //>>excludeEnd("ide");
  2888. messageSends: []
  2889. }),
  2890. $globals.Dictionary);
  2891. $core.addMethod(
  2892. $core.method({
  2893. selector: "at:put:",
  2894. protocol: "accessing",
  2895. fn: function (aKey,aValue){
  2896. var self=this,$self=this;
  2897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2898. return $core.withContext(function($ctx1) {
  2899. //>>excludeEnd("ctx");
  2900. var index = $self._positionOfKey_(aKey);
  2901. if(index === -1) {
  2902. var keys = $self['@keys'];
  2903. index = keys.length;
  2904. keys.push(aKey);
  2905. }
  2906. return $self['@values'][index] = aValue;
  2907. ;
  2908. return self;
  2909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2910. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  2911. //>>excludeEnd("ctx");
  2912. },
  2913. //>>excludeStart("ide", pragmas.excludeIdeData);
  2914. args: ["aKey", "aValue"],
  2915. 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'>",
  2916. referencedClasses: [],
  2917. //>>excludeEnd("ide");
  2918. messageSends: []
  2919. }),
  2920. $globals.Dictionary);
  2921. $core.addMethod(
  2922. $core.method({
  2923. selector: "includesKey:",
  2924. protocol: "testing",
  2925. fn: function (aKey){
  2926. var self=this,$self=this;
  2927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2928. return $core.withContext(function($ctx1) {
  2929. //>>excludeEnd("ctx");
  2930. return $self._positionOfKey_(aKey) >= 0;;
  2931. return self;
  2932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2933. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  2934. //>>excludeEnd("ctx");
  2935. },
  2936. //>>excludeStart("ide", pragmas.excludeIdeData);
  2937. args: ["aKey"],
  2938. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  2939. referencedClasses: [],
  2940. //>>excludeEnd("ide");
  2941. messageSends: []
  2942. }),
  2943. $globals.Dictionary);
  2944. $core.addMethod(
  2945. $core.method({
  2946. selector: "indexOf:ifAbsent:",
  2947. protocol: "accessing",
  2948. fn: function (anObject,aBlock){
  2949. var self=this,$self=this;
  2950. var index;
  2951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2952. return $core.withContext(function($ctx1) {
  2953. //>>excludeEnd("ctx");
  2954. var $1;
  2955. index=$recv($self.values)._indexOf_ifAbsent_(anObject,(function(){
  2956. return (0);
  2957. }));
  2958. $1=$recv(index).__eq((0));
  2959. if($core.assert($1)){
  2960. return $recv(aBlock)._value();
  2961. } else {
  2962. return $recv($self.keys)._at_(index);
  2963. }
  2964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2965. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  2966. //>>excludeEnd("ctx");
  2967. },
  2968. //>>excludeStart("ide", pragmas.excludeIdeData);
  2969. args: ["anObject", "aBlock"],
  2970. 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 ]",
  2971. referencedClasses: [],
  2972. //>>excludeEnd("ide");
  2973. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  2974. }),
  2975. $globals.Dictionary);
  2976. $core.addMethod(
  2977. $core.method({
  2978. selector: "initialize",
  2979. protocol: "initialization",
  2980. fn: function (){
  2981. var self=this,$self=this;
  2982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2983. return $core.withContext(function($ctx1) {
  2984. //>>excludeEnd("ctx");
  2985. (
  2986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2987. $ctx1.supercall = true,
  2988. //>>excludeEnd("ctx");
  2989. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  2990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2991. $ctx1.supercall = false;
  2992. //>>excludeEnd("ctx");;
  2993. $self.keys=[];
  2994. $self.values=[];
  2995. return self;
  2996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2997. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  2998. //>>excludeEnd("ctx");
  2999. },
  3000. //>>excludeStart("ide", pragmas.excludeIdeData);
  3001. args: [],
  3002. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  3003. referencedClasses: [],
  3004. //>>excludeEnd("ide");
  3005. messageSends: ["initialize"]
  3006. }),
  3007. $globals.Dictionary);
  3008. $core.addMethod(
  3009. $core.method({
  3010. selector: "keys",
  3011. protocol: "accessing",
  3012. fn: function (){
  3013. var self=this,$self=this;
  3014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3015. return $core.withContext(function($ctx1) {
  3016. //>>excludeEnd("ctx");
  3017. return $recv($self.keys)._copy();
  3018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3019. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  3020. //>>excludeEnd("ctx");
  3021. },
  3022. //>>excludeStart("ide", pragmas.excludeIdeData);
  3023. args: [],
  3024. source: "keys\x0a\x09^ keys copy",
  3025. referencedClasses: [],
  3026. //>>excludeEnd("ide");
  3027. messageSends: ["copy"]
  3028. }),
  3029. $globals.Dictionary);
  3030. $core.addMethod(
  3031. $core.method({
  3032. selector: "keysAndValuesDo:",
  3033. protocol: "enumerating",
  3034. fn: function (aBlock){
  3035. var self=this,$self=this;
  3036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3037. return $core.withContext(function($ctx1) {
  3038. //>>excludeEnd("ctx");
  3039. return $recv($self.keys)._with_do_($self.values,aBlock);
  3040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3041. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  3042. //>>excludeEnd("ctx");
  3043. },
  3044. //>>excludeStart("ide", pragmas.excludeIdeData);
  3045. args: ["aBlock"],
  3046. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3047. referencedClasses: [],
  3048. //>>excludeEnd("ide");
  3049. messageSends: ["with:do:"]
  3050. }),
  3051. $globals.Dictionary);
  3052. $core.addMethod(
  3053. $core.method({
  3054. selector: "keysDo:",
  3055. protocol: "enumerating",
  3056. fn: function (aBlock){
  3057. var self=this,$self=this;
  3058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3059. return $core.withContext(function($ctx1) {
  3060. //>>excludeEnd("ctx");
  3061. return $recv($self.keys)._do_(aBlock);
  3062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3063. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  3064. //>>excludeEnd("ctx");
  3065. },
  3066. //>>excludeStart("ide", pragmas.excludeIdeData);
  3067. args: ["aBlock"],
  3068. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3069. referencedClasses: [],
  3070. //>>excludeEnd("ide");
  3071. messageSends: ["do:"]
  3072. }),
  3073. $globals.Dictionary);
  3074. $core.addMethod(
  3075. $core.method({
  3076. selector: "positionOfKey:",
  3077. protocol: "private",
  3078. fn: function (anObject){
  3079. var self=this,$self=this;
  3080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3081. return $core.withContext(function($ctx1) {
  3082. //>>excludeEnd("ctx");
  3083. var keys = $self['@keys'];
  3084. for(var i=0;i<keys.length;i++){
  3085. if(keys[i].__eq(anObject)) { return i;}
  3086. }
  3087. return -1;
  3088. ;
  3089. return self;
  3090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3091. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  3092. //>>excludeEnd("ctx");
  3093. },
  3094. //>>excludeStart("ide", pragmas.excludeIdeData);
  3095. args: ["anObject"],
  3096. 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'>",
  3097. referencedClasses: [],
  3098. //>>excludeEnd("ide");
  3099. messageSends: []
  3100. }),
  3101. $globals.Dictionary);
  3102. $core.addMethod(
  3103. $core.method({
  3104. selector: "removeAll",
  3105. protocol: "adding/removing",
  3106. fn: function (){
  3107. var self=this,$self=this;
  3108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3109. return $core.withContext(function($ctx1) {
  3110. //>>excludeEnd("ctx");
  3111. $recv($self.keys)._removeAll();
  3112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3113. $ctx1.sendIdx["removeAll"]=1;
  3114. //>>excludeEnd("ctx");
  3115. $recv($self.values)._removeAll();
  3116. return self;
  3117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3118. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  3119. //>>excludeEnd("ctx");
  3120. },
  3121. //>>excludeStart("ide", pragmas.excludeIdeData);
  3122. args: [],
  3123. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3124. referencedClasses: [],
  3125. //>>excludeEnd("ide");
  3126. messageSends: ["removeAll"]
  3127. }),
  3128. $globals.Dictionary);
  3129. $core.addMethod(
  3130. $core.method({
  3131. selector: "removeKey:ifAbsent:",
  3132. protocol: "adding/removing",
  3133. fn: function (aKey,aBlock){
  3134. var self=this,$self=this;
  3135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3136. return $core.withContext(function($ctx1) {
  3137. //>>excludeEnd("ctx");
  3138. var index = $self._positionOfKey_(aKey);
  3139. if(index === -1) {
  3140. return aBlock._value()
  3141. } else {
  3142. var keys = $self['@keys'], values = $self['@values'];
  3143. var value = values[index], l = keys.length;
  3144. keys[index] = keys[l-1];
  3145. keys.pop();
  3146. values[index] = values[l-1];
  3147. values.pop();
  3148. return value;
  3149. }
  3150. ;
  3151. return self;
  3152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3153. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  3154. //>>excludeEnd("ctx");
  3155. },
  3156. //>>excludeStart("ide", pragmas.excludeIdeData);
  3157. args: ["aKey", "aBlock"],
  3158. 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'>",
  3159. referencedClasses: [],
  3160. //>>excludeEnd("ide");
  3161. messageSends: []
  3162. }),
  3163. $globals.Dictionary);
  3164. $core.addMethod(
  3165. $core.method({
  3166. selector: "values",
  3167. protocol: "accessing",
  3168. fn: function (){
  3169. var self=this,$self=this;
  3170. return $self.values;
  3171. },
  3172. //>>excludeStart("ide", pragmas.excludeIdeData);
  3173. args: [],
  3174. source: "values\x0a\x09^ values",
  3175. referencedClasses: [],
  3176. //>>excludeEnd("ide");
  3177. messageSends: []
  3178. }),
  3179. $globals.Dictionary);
  3180. $core.addMethod(
  3181. $core.method({
  3182. selector: "valuesDo:",
  3183. protocol: "enumerating",
  3184. fn: function (aBlock){
  3185. var self=this,$self=this;
  3186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3187. return $core.withContext(function($ctx1) {
  3188. //>>excludeEnd("ctx");
  3189. return $recv($self.values)._do_(aBlock);
  3190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3191. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  3192. //>>excludeEnd("ctx");
  3193. },
  3194. //>>excludeStart("ide", pragmas.excludeIdeData);
  3195. args: ["aBlock"],
  3196. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3197. referencedClasses: [],
  3198. //>>excludeEnd("ide");
  3199. messageSends: ["do:"]
  3200. }),
  3201. $globals.Dictionary);
  3202. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  3203. //>>excludeStart("ide", pragmas.excludeIdeData);
  3204. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3205. //>>excludeEnd("ide");
  3206. $core.addMethod(
  3207. $core.method({
  3208. selector: "at:ifAbsent:",
  3209. protocol: "accessing",
  3210. fn: function (aKey,aBlock){
  3211. var self=this,$self=this;
  3212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3213. return $core.withContext(function($ctx1) {
  3214. //>>excludeEnd("ctx");
  3215. var $1;
  3216. $1=$self._includesKey_(aKey);
  3217. if($core.assert($1)){
  3218. return $self._basicAt_(aKey);
  3219. } else {
  3220. return $recv(aBlock)._value();
  3221. }
  3222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3223. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  3224. //>>excludeEnd("ctx");
  3225. },
  3226. //>>excludeStart("ide", pragmas.excludeIdeData);
  3227. args: ["aKey", "aBlock"],
  3228. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3229. referencedClasses: [],
  3230. //>>excludeEnd("ide");
  3231. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3232. }),
  3233. $globals.HashedCollection);
  3234. $core.addMethod(
  3235. $core.method({
  3236. selector: "at:put:",
  3237. protocol: "accessing",
  3238. fn: function (aKey,aValue){
  3239. var self=this,$self=this;
  3240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3241. return $core.withContext(function($ctx1) {
  3242. //>>excludeEnd("ctx");
  3243. return $self._basicAt_put_(aKey,aValue);
  3244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3245. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  3246. //>>excludeEnd("ctx");
  3247. },
  3248. //>>excludeStart("ide", pragmas.excludeIdeData);
  3249. args: ["aKey", "aValue"],
  3250. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3251. referencedClasses: [],
  3252. //>>excludeEnd("ide");
  3253. messageSends: ["basicAt:put:"]
  3254. }),
  3255. $globals.HashedCollection);
  3256. $core.addMethod(
  3257. $core.method({
  3258. selector: "includesKey:",
  3259. protocol: "testing",
  3260. fn: function (aKey){
  3261. var self=this,$self=this;
  3262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3263. return $core.withContext(function($ctx1) {
  3264. //>>excludeEnd("ctx");
  3265. return self.hasOwnProperty(aKey);
  3266. return self;
  3267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3268. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  3269. //>>excludeEnd("ctx");
  3270. },
  3271. //>>excludeStart("ide", pragmas.excludeIdeData);
  3272. args: ["aKey"],
  3273. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  3274. referencedClasses: [],
  3275. //>>excludeEnd("ide");
  3276. messageSends: []
  3277. }),
  3278. $globals.HashedCollection);
  3279. $core.addMethod(
  3280. $core.method({
  3281. selector: "keys",
  3282. protocol: "accessing",
  3283. fn: function (){
  3284. var self=this,$self=this;
  3285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3286. return $core.withContext(function($ctx1) {
  3287. //>>excludeEnd("ctx");
  3288. return Object.keys(self);
  3289. return self;
  3290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3291. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  3292. //>>excludeEnd("ctx");
  3293. },
  3294. //>>excludeStart("ide", pragmas.excludeIdeData);
  3295. args: [],
  3296. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  3297. referencedClasses: [],
  3298. //>>excludeEnd("ide");
  3299. messageSends: []
  3300. }),
  3301. $globals.HashedCollection);
  3302. $core.addMethod(
  3303. $core.method({
  3304. selector: "keysDo:",
  3305. protocol: "enumerating",
  3306. fn: function (aBlock){
  3307. var self=this,$self=this;
  3308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3309. return $core.withContext(function($ctx1) {
  3310. //>>excludeEnd("ctx");
  3311. $recv($self._keys())._do_(aBlock);
  3312. return self;
  3313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3314. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  3315. //>>excludeEnd("ctx");
  3316. },
  3317. //>>excludeStart("ide", pragmas.excludeIdeData);
  3318. args: ["aBlock"],
  3319. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3320. referencedClasses: [],
  3321. //>>excludeEnd("ide");
  3322. messageSends: ["do:", "keys"]
  3323. }),
  3324. $globals.HashedCollection);
  3325. $core.addMethod(
  3326. $core.method({
  3327. selector: "removeKey:ifAbsent:",
  3328. protocol: "adding/removing",
  3329. fn: function (aKey,aBlock){
  3330. var self=this,$self=this;
  3331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3332. return $core.withContext(function($ctx1) {
  3333. //>>excludeEnd("ctx");
  3334. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3336. return $core.withContext(function($ctx2) {
  3337. //>>excludeEnd("ctx");
  3338. $self._basicDelete_(aKey);
  3339. return removed;
  3340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3341. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3342. //>>excludeEnd("ctx");
  3343. }),(function(){
  3344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3345. return $core.withContext(function($ctx2) {
  3346. //>>excludeEnd("ctx");
  3347. return $recv(aBlock)._value();
  3348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3349. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3350. //>>excludeEnd("ctx");
  3351. }));
  3352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3353. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  3354. //>>excludeEnd("ctx");
  3355. },
  3356. //>>excludeStart("ide", pragmas.excludeIdeData);
  3357. args: ["aKey", "aBlock"],
  3358. 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 ]",
  3359. referencedClasses: [],
  3360. //>>excludeEnd("ide");
  3361. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3362. }),
  3363. $globals.HashedCollection);
  3364. $core.addMethod(
  3365. $core.method({
  3366. selector: "values",
  3367. protocol: "accessing",
  3368. fn: function (){
  3369. var self=this,$self=this;
  3370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3371. return $core.withContext(function($ctx1) {
  3372. //>>excludeEnd("ctx");
  3373. return $self._keys().map(function(key){
  3374. return $self._at_(key);
  3375. });
  3376. ;
  3377. return self;
  3378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3379. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  3380. //>>excludeEnd("ctx");
  3381. },
  3382. //>>excludeStart("ide", pragmas.excludeIdeData);
  3383. args: [],
  3384. 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'>",
  3385. referencedClasses: [],
  3386. //>>excludeEnd("ide");
  3387. messageSends: []
  3388. }),
  3389. $globals.HashedCollection);
  3390. $core.addMethod(
  3391. $core.method({
  3392. selector: "valuesDo:",
  3393. protocol: "enumerating",
  3394. fn: function (aBlock){
  3395. var self=this,$self=this;
  3396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3397. return $core.withContext(function($ctx1) {
  3398. //>>excludeEnd("ctx");
  3399. $recv($self._values())._do_(aBlock);
  3400. return self;
  3401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3402. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  3403. //>>excludeEnd("ctx");
  3404. },
  3405. //>>excludeStart("ide", pragmas.excludeIdeData);
  3406. args: ["aBlock"],
  3407. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3408. referencedClasses: [],
  3409. //>>excludeEnd("ide");
  3410. messageSends: ["do:", "values"]
  3411. }),
  3412. $globals.HashedCollection);
  3413. $core.addClass("SequenceableCollection", $globals.Collection, [], "Kernel-Collections");
  3414. //>>excludeStart("ide", pragmas.excludeIdeData);
  3415. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3416. //>>excludeEnd("ide");
  3417. $core.addMethod(
  3418. $core.method({
  3419. selector: "=",
  3420. protocol: "comparing",
  3421. fn: function (aCollection){
  3422. var self=this,$self=this;
  3423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3424. return $core.withContext(function($ctx1) {
  3425. //>>excludeEnd("ctx");
  3426. var $3,$2,$4,$1,$5;
  3427. var $early={};
  3428. try {
  3429. $3=$self._class();
  3430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3431. $ctx1.sendIdx["class"]=1;
  3432. //>>excludeEnd("ctx");
  3433. $2=$recv($3).__eq($recv(aCollection)._class());
  3434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3435. $ctx1.sendIdx["="]=1;
  3436. //>>excludeEnd("ctx");
  3437. $1=$recv($2)._and_((function(){
  3438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3439. return $core.withContext(function($ctx2) {
  3440. //>>excludeEnd("ctx");
  3441. $4=$self._size();
  3442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3443. $ctx2.sendIdx["size"]=1;
  3444. //>>excludeEnd("ctx");
  3445. return $recv($4).__eq($recv(aCollection)._size());
  3446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3447. $ctx2.sendIdx["="]=2;
  3448. //>>excludeEnd("ctx");
  3449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3450. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3451. //>>excludeEnd("ctx");
  3452. }));
  3453. if(!$core.assert($1)){
  3454. return false;
  3455. }
  3456. $self._withIndexDo_((function(each,i){
  3457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3458. return $core.withContext(function($ctx2) {
  3459. //>>excludeEnd("ctx");
  3460. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  3461. if(!$core.assert($5)){
  3462. throw $early=[false];
  3463. }
  3464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3465. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3466. //>>excludeEnd("ctx");
  3467. }));
  3468. return true;
  3469. }
  3470. catch(e) {if(e===$early)return e[0]; throw e}
  3471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3472. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  3473. //>>excludeEnd("ctx");
  3474. },
  3475. //>>excludeStart("ide", pragmas.excludeIdeData);
  3476. args: ["aCollection"],
  3477. 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",
  3478. referencedClasses: [],
  3479. //>>excludeEnd("ide");
  3480. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3481. }),
  3482. $globals.SequenceableCollection);
  3483. $core.addMethod(
  3484. $core.method({
  3485. selector: "addLast:",
  3486. protocol: "adding/removing",
  3487. fn: function (anObject){
  3488. var self=this,$self=this;
  3489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3490. return $core.withContext(function($ctx1) {
  3491. //>>excludeEnd("ctx");
  3492. $self._add_(anObject);
  3493. return self;
  3494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3495. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  3496. //>>excludeEnd("ctx");
  3497. },
  3498. //>>excludeStart("ide", pragmas.excludeIdeData);
  3499. args: ["anObject"],
  3500. source: "addLast: anObject\x0a\x09self add: anObject",
  3501. referencedClasses: [],
  3502. //>>excludeEnd("ide");
  3503. messageSends: ["add:"]
  3504. }),
  3505. $globals.SequenceableCollection);
  3506. $core.addMethod(
  3507. $core.method({
  3508. selector: "allButFirst",
  3509. protocol: "accessing",
  3510. fn: function (){
  3511. var self=this,$self=this;
  3512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3513. return $core.withContext(function($ctx1) {
  3514. //>>excludeEnd("ctx");
  3515. return $self._copyFrom_to_((2),$self._size());
  3516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3517. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  3518. //>>excludeEnd("ctx");
  3519. },
  3520. //>>excludeStart("ide", pragmas.excludeIdeData);
  3521. args: [],
  3522. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3523. referencedClasses: [],
  3524. //>>excludeEnd("ide");
  3525. messageSends: ["copyFrom:to:", "size"]
  3526. }),
  3527. $globals.SequenceableCollection);
  3528. $core.addMethod(
  3529. $core.method({
  3530. selector: "allButLast",
  3531. protocol: "accessing",
  3532. fn: function (){
  3533. var self=this,$self=this;
  3534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3535. return $core.withContext(function($ctx1) {
  3536. //>>excludeEnd("ctx");
  3537. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  3538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3539. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  3540. //>>excludeEnd("ctx");
  3541. },
  3542. //>>excludeStart("ide", pragmas.excludeIdeData);
  3543. args: [],
  3544. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  3545. referencedClasses: [],
  3546. //>>excludeEnd("ide");
  3547. messageSends: ["copyFrom:to:", "-", "size"]
  3548. }),
  3549. $globals.SequenceableCollection);
  3550. $core.addMethod(
  3551. $core.method({
  3552. selector: "anyOne",
  3553. protocol: "accessing",
  3554. fn: function (){
  3555. var self=this,$self=this;
  3556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3557. return $core.withContext(function($ctx1) {
  3558. //>>excludeEnd("ctx");
  3559. return $self._at_((1));
  3560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3561. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  3562. //>>excludeEnd("ctx");
  3563. },
  3564. //>>excludeStart("ide", pragmas.excludeIdeData);
  3565. args: [],
  3566. source: "anyOne\x0a\x09^ self at: 1",
  3567. referencedClasses: [],
  3568. //>>excludeEnd("ide");
  3569. messageSends: ["at:"]
  3570. }),
  3571. $globals.SequenceableCollection);
  3572. $core.addMethod(
  3573. $core.method({
  3574. selector: "atRandom",
  3575. protocol: "accessing",
  3576. fn: function (){
  3577. var self=this,$self=this;
  3578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3579. return $core.withContext(function($ctx1) {
  3580. //>>excludeEnd("ctx");
  3581. return $self._at_($recv($self._size())._atRandom());
  3582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3583. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  3584. //>>excludeEnd("ctx");
  3585. },
  3586. //>>excludeStart("ide", pragmas.excludeIdeData);
  3587. args: [],
  3588. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3589. referencedClasses: [],
  3590. //>>excludeEnd("ide");
  3591. messageSends: ["at:", "atRandom", "size"]
  3592. }),
  3593. $globals.SequenceableCollection);
  3594. $core.addMethod(
  3595. $core.method({
  3596. selector: "beginsWith:",
  3597. protocol: "testing",
  3598. fn: function (prefix){
  3599. var self=this,$self=this;
  3600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3601. return $core.withContext(function($ctx1) {
  3602. //>>excludeEnd("ctx");
  3603. var $2,$3,$1;
  3604. $2=$self._size();
  3605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3606. $ctx1.sendIdx["size"]=1;
  3607. //>>excludeEnd("ctx");
  3608. $3=$recv(prefix)._size();
  3609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3610. $ctx1.sendIdx["size"]=2;
  3611. //>>excludeEnd("ctx");
  3612. $1=$recv($2).__lt($3);
  3613. if($core.assert($1)){
  3614. return false;
  3615. }
  3616. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  3617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3618. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  3619. //>>excludeEnd("ctx");
  3620. },
  3621. //>>excludeStart("ide", pragmas.excludeIdeData);
  3622. args: ["prefix"],
  3623. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3624. referencedClasses: [],
  3625. //>>excludeEnd("ide");
  3626. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3627. }),
  3628. $globals.SequenceableCollection);
  3629. $core.addMethod(
  3630. $core.method({
  3631. selector: "copyFrom:to:",
  3632. protocol: "copying",
  3633. fn: function (anIndex,anotherIndex){
  3634. var self=this,$self=this;
  3635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3636. return $core.withContext(function($ctx1) {
  3637. //>>excludeEnd("ctx");
  3638. $self._subclassResponsibility();
  3639. return self;
  3640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3641. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  3642. //>>excludeEnd("ctx");
  3643. },
  3644. //>>excludeStart("ide", pragmas.excludeIdeData);
  3645. args: ["anIndex", "anotherIndex"],
  3646. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  3647. referencedClasses: [],
  3648. //>>excludeEnd("ide");
  3649. messageSends: ["subclassResponsibility"]
  3650. }),
  3651. $globals.SequenceableCollection);
  3652. $core.addMethod(
  3653. $core.method({
  3654. selector: "endsWith:",
  3655. protocol: "testing",
  3656. fn: function (suffix){
  3657. var self=this,$self=this;
  3658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3659. return $core.withContext(function($ctx1) {
  3660. //>>excludeEnd("ctx");
  3661. var $2,$3,$1;
  3662. $2=$self._size();
  3663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3664. $ctx1.sendIdx["size"]=1;
  3665. //>>excludeEnd("ctx");
  3666. $3=$recv(suffix)._size();
  3667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3668. $ctx1.sendIdx["size"]=2;
  3669. //>>excludeEnd("ctx");
  3670. $1=$recv($2).__lt($3);
  3671. if($core.assert($1)){
  3672. return false;
  3673. }
  3674. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  3675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3676. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  3677. //>>excludeEnd("ctx");
  3678. },
  3679. //>>excludeStart("ide", pragmas.excludeIdeData);
  3680. args: ["suffix"],
  3681. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  3682. referencedClasses: [],
  3683. //>>excludeEnd("ide");
  3684. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  3685. }),
  3686. $globals.SequenceableCollection);
  3687. $core.addMethod(
  3688. $core.method({
  3689. selector: "first",
  3690. protocol: "accessing",
  3691. fn: function (){
  3692. var self=this,$self=this;
  3693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3694. return $core.withContext(function($ctx1) {
  3695. //>>excludeEnd("ctx");
  3696. return $self._at_((1));
  3697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3698. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  3699. //>>excludeEnd("ctx");
  3700. },
  3701. //>>excludeStart("ide", pragmas.excludeIdeData);
  3702. args: [],
  3703. source: "first\x0a\x09^ self at: 1",
  3704. referencedClasses: [],
  3705. //>>excludeEnd("ide");
  3706. messageSends: ["at:"]
  3707. }),
  3708. $globals.SequenceableCollection);
  3709. $core.addMethod(
  3710. $core.method({
  3711. selector: "first:",
  3712. protocol: "accessing",
  3713. fn: function (aNumber){
  3714. var self=this,$self=this;
  3715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3716. return $core.withContext(function($ctx1) {
  3717. //>>excludeEnd("ctx");
  3718. var $1;
  3719. $1=$recv($self._size()).__lt(aNumber);
  3720. if($core.assert($1)){
  3721. $self._error_("Invalid number of elements");
  3722. }
  3723. return $self._copyFrom_to_((1),aNumber);
  3724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3725. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  3726. //>>excludeEnd("ctx");
  3727. },
  3728. //>>excludeStart("ide", pragmas.excludeIdeData);
  3729. args: ["aNumber"],
  3730. 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",
  3731. referencedClasses: [],
  3732. //>>excludeEnd("ide");
  3733. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  3734. }),
  3735. $globals.SequenceableCollection);
  3736. $core.addMethod(
  3737. $core.method({
  3738. selector: "fourth",
  3739. protocol: "accessing",
  3740. fn: function (){
  3741. var self=this,$self=this;
  3742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3743. return $core.withContext(function($ctx1) {
  3744. //>>excludeEnd("ctx");
  3745. return $self._at_((4));
  3746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3747. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  3748. //>>excludeEnd("ctx");
  3749. },
  3750. //>>excludeStart("ide", pragmas.excludeIdeData);
  3751. args: [],
  3752. source: "fourth\x0a\x09^ self at: 4",
  3753. referencedClasses: [],
  3754. //>>excludeEnd("ide");
  3755. messageSends: ["at:"]
  3756. }),
  3757. $globals.SequenceableCollection);
  3758. $core.addMethod(
  3759. $core.method({
  3760. selector: "includes:",
  3761. protocol: "testing",
  3762. fn: function (anObject){
  3763. var self=this,$self=this;
  3764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3765. return $core.withContext(function($ctx1) {
  3766. //>>excludeEnd("ctx");
  3767. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  3768. return nil;
  3769. })))._notNil();
  3770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3771. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  3772. //>>excludeEnd("ctx");
  3773. },
  3774. //>>excludeStart("ide", pragmas.excludeIdeData);
  3775. args: ["anObject"],
  3776. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  3777. referencedClasses: [],
  3778. //>>excludeEnd("ide");
  3779. messageSends: ["notNil", "indexOf:ifAbsent:"]
  3780. }),
  3781. $globals.SequenceableCollection);
  3782. $core.addMethod(
  3783. $core.method({
  3784. selector: "indexOf:startingAt:",
  3785. protocol: "accessing",
  3786. fn: function (anObject,start){
  3787. var self=this,$self=this;
  3788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3789. return $core.withContext(function($ctx1) {
  3790. //>>excludeEnd("ctx");
  3791. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  3792. return (0);
  3793. }));
  3794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3795. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  3796. //>>excludeEnd("ctx");
  3797. },
  3798. //>>excludeStart("ide", pragmas.excludeIdeData);
  3799. args: ["anObject", "start"],
  3800. 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 ]",
  3801. referencedClasses: [],
  3802. //>>excludeEnd("ide");
  3803. messageSends: ["indexOf:startingAt:ifAbsent:"]
  3804. }),
  3805. $globals.SequenceableCollection);
  3806. $core.addMethod(
  3807. $core.method({
  3808. selector: "indexOf:startingAt:ifAbsent:",
  3809. protocol: "accessing",
  3810. fn: function (anObject,start,aBlock){
  3811. var self=this,$self=this;
  3812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3813. return $core.withContext(function($ctx1) {
  3814. //>>excludeEnd("ctx");
  3815. $self._subclassResponsibility();
  3816. return self;
  3817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3818. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  3819. //>>excludeEnd("ctx");
  3820. },
  3821. //>>excludeStart("ide", pragmas.excludeIdeData);
  3822. args: ["anObject", "start", "aBlock"],
  3823. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  3824. referencedClasses: [],
  3825. //>>excludeEnd("ide");
  3826. messageSends: ["subclassResponsibility"]
  3827. }),
  3828. $globals.SequenceableCollection);
  3829. $core.addMethod(
  3830. $core.method({
  3831. selector: "last",
  3832. protocol: "accessing",
  3833. fn: function (){
  3834. var self=this,$self=this;
  3835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3836. return $core.withContext(function($ctx1) {
  3837. //>>excludeEnd("ctx");
  3838. return $self._at_($self._size());
  3839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3840. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  3841. //>>excludeEnd("ctx");
  3842. },
  3843. //>>excludeStart("ide", pragmas.excludeIdeData);
  3844. args: [],
  3845. source: "last\x0a\x09^ self at: self size",
  3846. referencedClasses: [],
  3847. //>>excludeEnd("ide");
  3848. messageSends: ["at:", "size"]
  3849. }),
  3850. $globals.SequenceableCollection);
  3851. $core.addMethod(
  3852. $core.method({
  3853. selector: "last:",
  3854. protocol: "accessing",
  3855. fn: function (aNumber){
  3856. var self=this,$self=this;
  3857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3858. return $core.withContext(function($ctx1) {
  3859. //>>excludeEnd("ctx");
  3860. var $2,$1,$5,$4,$3;
  3861. $2=$self._size();
  3862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3863. $ctx1.sendIdx["size"]=1;
  3864. //>>excludeEnd("ctx");
  3865. $1=$recv($2).__lt(aNumber);
  3866. if($core.assert($1)){
  3867. $self._error_("Invalid number of elements");
  3868. }
  3869. $5=$self._size();
  3870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3871. $ctx1.sendIdx["size"]=2;
  3872. //>>excludeEnd("ctx");
  3873. $4=$recv($5).__minus(aNumber);
  3874. $3=$recv($4).__plus((1));
  3875. return $self._copyFrom_to_($3,$self._size());
  3876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3877. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  3878. //>>excludeEnd("ctx");
  3879. },
  3880. //>>excludeStart("ide", pragmas.excludeIdeData);
  3881. args: ["aNumber"],
  3882. 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",
  3883. referencedClasses: [],
  3884. //>>excludeEnd("ide");
  3885. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  3886. }),
  3887. $globals.SequenceableCollection);
  3888. $core.addMethod(
  3889. $core.method({
  3890. selector: "newStream",
  3891. protocol: "streaming",
  3892. fn: function (){
  3893. var self=this,$self=this;
  3894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3895. return $core.withContext(function($ctx1) {
  3896. //>>excludeEnd("ctx");
  3897. return $recv($self._streamClass())._on_(self);
  3898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3899. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  3900. //>>excludeEnd("ctx");
  3901. },
  3902. //>>excludeStart("ide", pragmas.excludeIdeData);
  3903. args: [],
  3904. source: "newStream\x0a\x09^ self streamClass on: self",
  3905. referencedClasses: [],
  3906. //>>excludeEnd("ide");
  3907. messageSends: ["on:", "streamClass"]
  3908. }),
  3909. $globals.SequenceableCollection);
  3910. $core.addMethod(
  3911. $core.method({
  3912. selector: "readStream",
  3913. protocol: "streaming",
  3914. fn: function (){
  3915. var self=this,$self=this;
  3916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3917. return $core.withContext(function($ctx1) {
  3918. //>>excludeEnd("ctx");
  3919. return $self._stream();
  3920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3921. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  3922. //>>excludeEnd("ctx");
  3923. },
  3924. //>>excludeStart("ide", pragmas.excludeIdeData);
  3925. args: [],
  3926. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  3927. referencedClasses: [],
  3928. //>>excludeEnd("ide");
  3929. messageSends: ["stream"]
  3930. }),
  3931. $globals.SequenceableCollection);
  3932. $core.addMethod(
  3933. $core.method({
  3934. selector: "removeLast",
  3935. protocol: "adding/removing",
  3936. fn: function (){
  3937. var self=this,$self=this;
  3938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3939. return $core.withContext(function($ctx1) {
  3940. //>>excludeEnd("ctx");
  3941. return $self._remove_($self._last());
  3942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3943. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  3944. //>>excludeEnd("ctx");
  3945. },
  3946. //>>excludeStart("ide", pragmas.excludeIdeData);
  3947. args: [],
  3948. source: "removeLast\x0a\x09^ self remove: self last",
  3949. referencedClasses: [],
  3950. //>>excludeEnd("ide");
  3951. messageSends: ["remove:", "last"]
  3952. }),
  3953. $globals.SequenceableCollection);
  3954. $core.addMethod(
  3955. $core.method({
  3956. selector: "reverseDo:",
  3957. protocol: "enumerating",
  3958. fn: function (aBlock){
  3959. var self=this,$self=this;
  3960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3961. return $core.withContext(function($ctx1) {
  3962. //>>excludeEnd("ctx");
  3963. $recv($self._reversed())._do_(aBlock);
  3964. return self;
  3965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3966. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  3967. //>>excludeEnd("ctx");
  3968. },
  3969. //>>excludeStart("ide", pragmas.excludeIdeData);
  3970. args: ["aBlock"],
  3971. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  3972. referencedClasses: [],
  3973. //>>excludeEnd("ide");
  3974. messageSends: ["do:", "reversed"]
  3975. }),
  3976. $globals.SequenceableCollection);
  3977. $core.addMethod(
  3978. $core.method({
  3979. selector: "reversed",
  3980. protocol: "converting",
  3981. fn: function (){
  3982. var self=this,$self=this;
  3983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3984. return $core.withContext(function($ctx1) {
  3985. //>>excludeEnd("ctx");
  3986. $self._subclassResponsibility();
  3987. return self;
  3988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3989. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  3990. //>>excludeEnd("ctx");
  3991. },
  3992. //>>excludeStart("ide", pragmas.excludeIdeData);
  3993. args: [],
  3994. source: "reversed\x0a\x09self subclassResponsibility",
  3995. referencedClasses: [],
  3996. //>>excludeEnd("ide");
  3997. messageSends: ["subclassResponsibility"]
  3998. }),
  3999. $globals.SequenceableCollection);
  4000. $core.addMethod(
  4001. $core.method({
  4002. selector: "second",
  4003. protocol: "accessing",
  4004. fn: function (){
  4005. var self=this,$self=this;
  4006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4007. return $core.withContext(function($ctx1) {
  4008. //>>excludeEnd("ctx");
  4009. return $self._at_((2));
  4010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4011. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  4012. //>>excludeEnd("ctx");
  4013. },
  4014. //>>excludeStart("ide", pragmas.excludeIdeData);
  4015. args: [],
  4016. source: "second\x0a\x09^ self at: 2",
  4017. referencedClasses: [],
  4018. //>>excludeEnd("ide");
  4019. messageSends: ["at:"]
  4020. }),
  4021. $globals.SequenceableCollection);
  4022. $core.addMethod(
  4023. $core.method({
  4024. selector: "stream",
  4025. protocol: "streaming",
  4026. fn: function (){
  4027. var self=this,$self=this;
  4028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4029. return $core.withContext(function($ctx1) {
  4030. //>>excludeEnd("ctx");
  4031. return $self._newStream();
  4032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4033. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  4034. //>>excludeEnd("ctx");
  4035. },
  4036. //>>excludeStart("ide", pragmas.excludeIdeData);
  4037. args: [],
  4038. source: "stream\x0a\x09^ self newStream",
  4039. referencedClasses: [],
  4040. //>>excludeEnd("ide");
  4041. messageSends: ["newStream"]
  4042. }),
  4043. $globals.SequenceableCollection);
  4044. $core.addMethod(
  4045. $core.method({
  4046. selector: "streamClass",
  4047. protocol: "streaming",
  4048. fn: function (){
  4049. var self=this,$self=this;
  4050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4051. return $core.withContext(function($ctx1) {
  4052. //>>excludeEnd("ctx");
  4053. return $recv($self._class())._streamClass();
  4054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4055. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  4056. //>>excludeEnd("ctx");
  4057. },
  4058. //>>excludeStart("ide", pragmas.excludeIdeData);
  4059. args: [],
  4060. source: "streamClass\x0a\x09^ self class streamClass",
  4061. referencedClasses: [],
  4062. //>>excludeEnd("ide");
  4063. messageSends: ["streamClass", "class"]
  4064. }),
  4065. $globals.SequenceableCollection);
  4066. $core.addMethod(
  4067. $core.method({
  4068. selector: "third",
  4069. protocol: "accessing",
  4070. fn: function (){
  4071. var self=this,$self=this;
  4072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4073. return $core.withContext(function($ctx1) {
  4074. //>>excludeEnd("ctx");
  4075. return $self._at_((3));
  4076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4077. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  4078. //>>excludeEnd("ctx");
  4079. },
  4080. //>>excludeStart("ide", pragmas.excludeIdeData);
  4081. args: [],
  4082. source: "third\x0a\x09^ self at: 3",
  4083. referencedClasses: [],
  4084. //>>excludeEnd("ide");
  4085. messageSends: ["at:"]
  4086. }),
  4087. $globals.SequenceableCollection);
  4088. $core.addMethod(
  4089. $core.method({
  4090. selector: "writeStream",
  4091. protocol: "streaming",
  4092. fn: function (){
  4093. var self=this,$self=this;
  4094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4095. return $core.withContext(function($ctx1) {
  4096. //>>excludeEnd("ctx");
  4097. return $self._stream();
  4098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4099. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  4100. //>>excludeEnd("ctx");
  4101. },
  4102. //>>excludeStart("ide", pragmas.excludeIdeData);
  4103. args: [],
  4104. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4105. referencedClasses: [],
  4106. //>>excludeEnd("ide");
  4107. messageSends: ["stream"]
  4108. }),
  4109. $globals.SequenceableCollection);
  4110. $core.addMethod(
  4111. $core.method({
  4112. selector: "streamClass",
  4113. protocol: "accessing",
  4114. fn: function (){
  4115. var self=this,$self=this;
  4116. return $globals.Stream;
  4117. },
  4118. //>>excludeStart("ide", pragmas.excludeIdeData);
  4119. args: [],
  4120. source: "streamClass\x0a\x09\x09^ Stream",
  4121. referencedClasses: ["Stream"],
  4122. //>>excludeEnd("ide");
  4123. messageSends: []
  4124. }),
  4125. $globals.SequenceableCollection.a$cls);
  4126. $core.addMethod(
  4127. $core.method({
  4128. selector: "streamContents:",
  4129. protocol: "streaming",
  4130. fn: function (aBlock){
  4131. var self=this,$self=this;
  4132. var stream;
  4133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4134. return $core.withContext(function($ctx1) {
  4135. //>>excludeEnd("ctx");
  4136. stream=$recv($self._streamClass())._on_($self._new());
  4137. $recv(aBlock)._value_(stream);
  4138. return $recv(stream)._contents();
  4139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4140. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.a$cls)});
  4141. //>>excludeEnd("ctx");
  4142. },
  4143. //>>excludeStart("ide", pragmas.excludeIdeData);
  4144. args: ["aBlock"],
  4145. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4146. referencedClasses: [],
  4147. //>>excludeEnd("ide");
  4148. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4149. }),
  4150. $globals.SequenceableCollection.a$cls);
  4151. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  4152. //>>excludeStart("ide", pragmas.excludeIdeData);
  4153. $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`.";
  4154. //>>excludeEnd("ide");
  4155. $core.addMethod(
  4156. $core.method({
  4157. selector: "add:",
  4158. protocol: "adding/removing",
  4159. fn: function (anObject){
  4160. var self=this,$self=this;
  4161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4162. return $core.withContext(function($ctx1) {
  4163. //>>excludeEnd("ctx");
  4164. self.push(anObject); return anObject;;
  4165. return self;
  4166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4167. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  4168. //>>excludeEnd("ctx");
  4169. },
  4170. //>>excludeStart("ide", pragmas.excludeIdeData);
  4171. args: ["anObject"],
  4172. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  4173. referencedClasses: [],
  4174. //>>excludeEnd("ide");
  4175. messageSends: []
  4176. }),
  4177. $globals.Array);
  4178. $core.addMethod(
  4179. $core.method({
  4180. selector: "addAll:",
  4181. protocol: "adding/removing",
  4182. fn: function (aCollection){
  4183. var self=this,$self=this;
  4184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4185. return $core.withContext(function($ctx1) {
  4186. //>>excludeEnd("ctx");
  4187. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  4188. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  4189. return aCollection;;
  4190. return self;
  4191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4192. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  4193. //>>excludeEnd("ctx");
  4194. },
  4195. //>>excludeStart("ide", pragmas.excludeIdeData);
  4196. args: ["aCollection"],
  4197. 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'>",
  4198. referencedClasses: [],
  4199. //>>excludeEnd("ide");
  4200. messageSends: []
  4201. }),
  4202. $globals.Array);
  4203. $core.addMethod(
  4204. $core.method({
  4205. selector: "addFirst:",
  4206. protocol: "adding/removing",
  4207. fn: function (anObject){
  4208. var self=this,$self=this;
  4209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4210. return $core.withContext(function($ctx1) {
  4211. //>>excludeEnd("ctx");
  4212. self.unshift(anObject); return anObject;;
  4213. return self;
  4214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4215. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  4216. //>>excludeEnd("ctx");
  4217. },
  4218. //>>excludeStart("ide", pragmas.excludeIdeData);
  4219. args: ["anObject"],
  4220. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  4221. referencedClasses: [],
  4222. //>>excludeEnd("ide");
  4223. messageSends: []
  4224. }),
  4225. $globals.Array);
  4226. $core.addMethod(
  4227. $core.method({
  4228. selector: "asJavaScriptSource",
  4229. protocol: "converting",
  4230. fn: function (){
  4231. var self=this,$self=this;
  4232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4233. return $core.withContext(function($ctx1) {
  4234. //>>excludeEnd("ctx");
  4235. var $1;
  4236. $1=$recv("[".__comma($recv($self._collect_((function(each){
  4237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4238. return $core.withContext(function($ctx2) {
  4239. //>>excludeEnd("ctx");
  4240. return $recv(each)._asJavaScriptSource();
  4241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4242. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4243. //>>excludeEnd("ctx");
  4244. })))._join_(", "))).__comma("]");
  4245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4246. $ctx1.sendIdx[","]=1;
  4247. //>>excludeEnd("ctx");
  4248. return $1;
  4249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4250. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Array)});
  4251. //>>excludeEnd("ctx");
  4252. },
  4253. //>>excludeStart("ide", pragmas.excludeIdeData);
  4254. args: [],
  4255. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  4256. referencedClasses: [],
  4257. //>>excludeEnd("ide");
  4258. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  4259. }),
  4260. $globals.Array);
  4261. $core.addMethod(
  4262. $core.method({
  4263. selector: "at:put:",
  4264. protocol: "accessing",
  4265. fn: function (anIndex,anObject){
  4266. var self=this,$self=this;
  4267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4268. return $core.withContext(function($ctx1) {
  4269. //>>excludeEnd("ctx");
  4270. return self[anIndex - 1] = anObject;
  4271. return self;
  4272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4273. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  4274. //>>excludeEnd("ctx");
  4275. },
  4276. //>>excludeStart("ide", pragmas.excludeIdeData);
  4277. args: ["anIndex", "anObject"],
  4278. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  4279. referencedClasses: [],
  4280. //>>excludeEnd("ide");
  4281. messageSends: []
  4282. }),
  4283. $globals.Array);
  4284. $core.addMethod(
  4285. $core.method({
  4286. selector: "collect:",
  4287. protocol: "enumerating",
  4288. fn: function (aBlock){
  4289. var self=this,$self=this;
  4290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4291. return $core.withContext(function($ctx1) {
  4292. //>>excludeEnd("ctx");
  4293. return self.map(function(each) {return aBlock._value_(each)});
  4294. return self;
  4295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4296. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  4297. //>>excludeEnd("ctx");
  4298. },
  4299. //>>excludeStart("ide", pragmas.excludeIdeData);
  4300. args: ["aBlock"],
  4301. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  4302. referencedClasses: [],
  4303. //>>excludeEnd("ide");
  4304. messageSends: []
  4305. }),
  4306. $globals.Array);
  4307. $core.addMethod(
  4308. $core.method({
  4309. selector: "copyFrom:to:",
  4310. protocol: "copying",
  4311. fn: function (anIndex,anotherIndex){
  4312. var self=this,$self=this;
  4313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4314. return $core.withContext(function($ctx1) {
  4315. //>>excludeEnd("ctx");
  4316. if (anIndex >= 1 && anotherIndex <= self.length) {
  4317. return self.slice(anIndex - 1, anotherIndex);
  4318. } else {
  4319. self._at_(anIndex);
  4320. self._at_(self.length + 1);
  4321. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4322. };
  4323. return self;
  4324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4325. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  4326. //>>excludeEnd("ctx");
  4327. },
  4328. //>>excludeStart("ide", pragmas.excludeIdeData);
  4329. args: ["anIndex", "anotherIndex"],
  4330. 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'>",
  4331. referencedClasses: [],
  4332. //>>excludeEnd("ide");
  4333. messageSends: []
  4334. }),
  4335. $globals.Array);
  4336. $core.addMethod(
  4337. $core.method({
  4338. selector: "join:",
  4339. protocol: "enumerating",
  4340. fn: function (aString){
  4341. var self=this,$self=this;
  4342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4343. return $core.withContext(function($ctx1) {
  4344. //>>excludeEnd("ctx");
  4345. return self.join(aString);
  4346. return self;
  4347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4348. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  4349. //>>excludeEnd("ctx");
  4350. },
  4351. //>>excludeStart("ide", pragmas.excludeIdeData);
  4352. args: ["aString"],
  4353. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  4354. referencedClasses: [],
  4355. //>>excludeEnd("ide");
  4356. messageSends: []
  4357. }),
  4358. $globals.Array);
  4359. $core.addMethod(
  4360. $core.method({
  4361. selector: "printOn:",
  4362. protocol: "printing",
  4363. fn: function (aStream){
  4364. var self=this,$self=this;
  4365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4366. return $core.withContext(function($ctx1) {
  4367. //>>excludeEnd("ctx");
  4368. (
  4369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4370. $ctx1.supercall = true,
  4371. //>>excludeEnd("ctx");
  4372. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  4373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4374. $ctx1.supercall = false;
  4375. //>>excludeEnd("ctx");;
  4376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4377. $ctx1.sendIdx["printOn:"]=1;
  4378. //>>excludeEnd("ctx");
  4379. $recv(aStream)._nextPutAll_(" (");
  4380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4381. $ctx1.sendIdx["nextPutAll:"]=1;
  4382. //>>excludeEnd("ctx");
  4383. $self._do_separatedBy_((function(each){
  4384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4385. return $core.withContext(function($ctx2) {
  4386. //>>excludeEnd("ctx");
  4387. return $recv(each)._printOn_(aStream);
  4388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4389. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4390. //>>excludeEnd("ctx");
  4391. }),(function(){
  4392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4393. return $core.withContext(function($ctx2) {
  4394. //>>excludeEnd("ctx");
  4395. return $recv(aStream)._nextPutAll_(" ");
  4396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4397. $ctx2.sendIdx["nextPutAll:"]=2;
  4398. //>>excludeEnd("ctx");
  4399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4400. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4401. //>>excludeEnd("ctx");
  4402. }));
  4403. $recv(aStream)._nextPutAll_(")");
  4404. return self;
  4405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4406. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  4407. //>>excludeEnd("ctx");
  4408. },
  4409. //>>excludeStart("ide", pragmas.excludeIdeData);
  4410. args: ["aStream"],
  4411. 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: ')'",
  4412. referencedClasses: [],
  4413. //>>excludeEnd("ide");
  4414. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4415. }),
  4416. $globals.Array);
  4417. $core.addMethod(
  4418. $core.method({
  4419. selector: "remove:ifAbsent:",
  4420. protocol: "adding/removing",
  4421. fn: function (anObject,aBlock){
  4422. var self=this,$self=this;
  4423. var index;
  4424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4425. return $core.withContext(function($ctx1) {
  4426. //>>excludeEnd("ctx");
  4427. var $1;
  4428. index=$self._indexOf_ifAbsent_(anObject,(function(){
  4429. return (0);
  4430. }));
  4431. $1=$recv(index).__eq((0));
  4432. if($core.assert($1)){
  4433. return $recv(aBlock)._value();
  4434. } else {
  4435. $self._removeIndex_(index);
  4436. return anObject;
  4437. }
  4438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4439. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  4440. //>>excludeEnd("ctx");
  4441. },
  4442. //>>excludeStart("ide", pragmas.excludeIdeData);
  4443. args: ["anObject", "aBlock"],
  4444. 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 ]",
  4445. referencedClasses: [],
  4446. //>>excludeEnd("ide");
  4447. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4448. }),
  4449. $globals.Array);
  4450. $core.addMethod(
  4451. $core.method({
  4452. selector: "removeAll",
  4453. protocol: "adding/removing",
  4454. fn: function (){
  4455. var self=this,$self=this;
  4456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4457. return $core.withContext(function($ctx1) {
  4458. //>>excludeEnd("ctx");
  4459. self.length = 0;
  4460. return self;
  4461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4462. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  4463. //>>excludeEnd("ctx");
  4464. },
  4465. //>>excludeStart("ide", pragmas.excludeIdeData);
  4466. args: [],
  4467. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  4468. referencedClasses: [],
  4469. //>>excludeEnd("ide");
  4470. messageSends: []
  4471. }),
  4472. $globals.Array);
  4473. $core.addMethod(
  4474. $core.method({
  4475. selector: "removeFrom:to:",
  4476. protocol: "adding/removing",
  4477. fn: function (aNumber,anotherNumber){
  4478. var self=this,$self=this;
  4479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4480. return $core.withContext(function($ctx1) {
  4481. //>>excludeEnd("ctx");
  4482. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4483. return self;
  4484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4485. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  4486. //>>excludeEnd("ctx");
  4487. },
  4488. //>>excludeStart("ide", pragmas.excludeIdeData);
  4489. args: ["aNumber", "anotherNumber"],
  4490. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  4491. referencedClasses: [],
  4492. //>>excludeEnd("ide");
  4493. messageSends: []
  4494. }),
  4495. $globals.Array);
  4496. $core.addMethod(
  4497. $core.method({
  4498. selector: "removeIndex:",
  4499. protocol: "adding/removing",
  4500. fn: function (anInteger){
  4501. var self=this,$self=this;
  4502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4503. return $core.withContext(function($ctx1) {
  4504. //>>excludeEnd("ctx");
  4505. self.splice(anInteger - 1, 1);
  4506. return self;
  4507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4508. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  4509. //>>excludeEnd("ctx");
  4510. },
  4511. //>>excludeStart("ide", pragmas.excludeIdeData);
  4512. args: ["anInteger"],
  4513. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  4514. referencedClasses: [],
  4515. //>>excludeEnd("ide");
  4516. messageSends: []
  4517. }),
  4518. $globals.Array);
  4519. $core.addMethod(
  4520. $core.method({
  4521. selector: "removeLast",
  4522. protocol: "adding/removing",
  4523. fn: function (){
  4524. var self=this,$self=this;
  4525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4526. return $core.withContext(function($ctx1) {
  4527. //>>excludeEnd("ctx");
  4528. return self.pop();;
  4529. return self;
  4530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4531. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  4532. //>>excludeEnd("ctx");
  4533. },
  4534. //>>excludeStart("ide", pragmas.excludeIdeData);
  4535. args: [],
  4536. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  4537. referencedClasses: [],
  4538. //>>excludeEnd("ide");
  4539. messageSends: []
  4540. }),
  4541. $globals.Array);
  4542. $core.addMethod(
  4543. $core.method({
  4544. selector: "reversed",
  4545. protocol: "converting",
  4546. fn: function (){
  4547. var self=this,$self=this;
  4548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4549. return $core.withContext(function($ctx1) {
  4550. //>>excludeEnd("ctx");
  4551. return self.slice().reverse();
  4552. return self;
  4553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4554. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  4555. //>>excludeEnd("ctx");
  4556. },
  4557. //>>excludeStart("ide", pragmas.excludeIdeData);
  4558. args: [],
  4559. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  4560. referencedClasses: [],
  4561. //>>excludeEnd("ide");
  4562. messageSends: []
  4563. }),
  4564. $globals.Array);
  4565. $core.addMethod(
  4566. $core.method({
  4567. selector: "select:",
  4568. protocol: "enumerating",
  4569. fn: function (aBlock){
  4570. var self=this,$self=this;
  4571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4572. return $core.withContext(function($ctx1) {
  4573. //>>excludeEnd("ctx");
  4574. return self.filter(function(each) {return aBlock._value_(each)});
  4575. return self;
  4576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4577. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  4578. //>>excludeEnd("ctx");
  4579. },
  4580. //>>excludeStart("ide", pragmas.excludeIdeData);
  4581. args: ["aBlock"],
  4582. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  4583. referencedClasses: [],
  4584. //>>excludeEnd("ide");
  4585. messageSends: []
  4586. }),
  4587. $globals.Array);
  4588. $core.addMethod(
  4589. $core.method({
  4590. selector: "shallowCopy",
  4591. protocol: "copying",
  4592. fn: function (){
  4593. var self=this,$self=this;
  4594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4595. return $core.withContext(function($ctx1) {
  4596. //>>excludeEnd("ctx");
  4597. return self.slice();
  4598. return self;
  4599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4600. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  4601. //>>excludeEnd("ctx");
  4602. },
  4603. //>>excludeStart("ide", pragmas.excludeIdeData);
  4604. args: [],
  4605. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  4606. referencedClasses: [],
  4607. //>>excludeEnd("ide");
  4608. messageSends: []
  4609. }),
  4610. $globals.Array);
  4611. $core.addMethod(
  4612. $core.method({
  4613. selector: "sort",
  4614. protocol: "enumerating",
  4615. fn: function (){
  4616. var self=this,$self=this;
  4617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4618. return $core.withContext(function($ctx1) {
  4619. //>>excludeEnd("ctx");
  4620. return $self._sort_((function(a,b){
  4621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4622. return $core.withContext(function($ctx2) {
  4623. //>>excludeEnd("ctx");
  4624. return $recv(a).__lt(b);
  4625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4626. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  4627. //>>excludeEnd("ctx");
  4628. }));
  4629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4630. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  4631. //>>excludeEnd("ctx");
  4632. },
  4633. //>>excludeStart("ide", pragmas.excludeIdeData);
  4634. args: [],
  4635. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  4636. referencedClasses: [],
  4637. //>>excludeEnd("ide");
  4638. messageSends: ["sort:", "<"]
  4639. }),
  4640. $globals.Array);
  4641. $core.addMethod(
  4642. $core.method({
  4643. selector: "sort:",
  4644. protocol: "enumerating",
  4645. fn: function (aBlock){
  4646. var self=this,$self=this;
  4647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4648. return $core.withContext(function($ctx1) {
  4649. //>>excludeEnd("ctx");
  4650. return self.sort(function(a, b) {
  4651. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  4652. })
  4653. ;
  4654. return self;
  4655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4656. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  4657. //>>excludeEnd("ctx");
  4658. },
  4659. //>>excludeStart("ide", pragmas.excludeIdeData);
  4660. args: ["aBlock"],
  4661. 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'>",
  4662. referencedClasses: [],
  4663. //>>excludeEnd("ide");
  4664. messageSends: []
  4665. }),
  4666. $globals.Array);
  4667. $core.addMethod(
  4668. $core.method({
  4669. selector: "sorted",
  4670. protocol: "enumerating",
  4671. fn: function (){
  4672. var self=this,$self=this;
  4673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4674. return $core.withContext(function($ctx1) {
  4675. //>>excludeEnd("ctx");
  4676. return $recv($self._copy())._sort();
  4677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4678. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  4679. //>>excludeEnd("ctx");
  4680. },
  4681. //>>excludeStart("ide", pragmas.excludeIdeData);
  4682. args: [],
  4683. source: "sorted\x0a\x09^ self copy sort",
  4684. referencedClasses: [],
  4685. //>>excludeEnd("ide");
  4686. messageSends: ["sort", "copy"]
  4687. }),
  4688. $globals.Array);
  4689. $core.addMethod(
  4690. $core.method({
  4691. selector: "sorted:",
  4692. protocol: "enumerating",
  4693. fn: function (aBlock){
  4694. var self=this,$self=this;
  4695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4696. return $core.withContext(function($ctx1) {
  4697. //>>excludeEnd("ctx");
  4698. return $recv($self._copy())._sort_(aBlock);
  4699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4700. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  4701. //>>excludeEnd("ctx");
  4702. },
  4703. //>>excludeStart("ide", pragmas.excludeIdeData);
  4704. args: ["aBlock"],
  4705. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  4706. referencedClasses: [],
  4707. //>>excludeEnd("ide");
  4708. messageSends: ["sort:", "copy"]
  4709. }),
  4710. $globals.Array);
  4711. $core.addMethod(
  4712. $core.method({
  4713. selector: "new:",
  4714. protocol: "instance creation",
  4715. fn: function (anInteger){
  4716. var self=this,$self=this;
  4717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4718. return $core.withContext(function($ctx1) {
  4719. //>>excludeEnd("ctx");
  4720. return new Array(anInteger);
  4721. return self;
  4722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4723. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.a$cls)});
  4724. //>>excludeEnd("ctx");
  4725. },
  4726. //>>excludeStart("ide", pragmas.excludeIdeData);
  4727. args: ["anInteger"],
  4728. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  4729. referencedClasses: [],
  4730. //>>excludeEnd("ide");
  4731. messageSends: []
  4732. }),
  4733. $globals.Array.a$cls);
  4734. $core.addMethod(
  4735. $core.method({
  4736. selector: "with:",
  4737. protocol: "instance creation",
  4738. fn: function (anObject){
  4739. var self=this,$self=this;
  4740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4741. return $core.withContext(function($ctx1) {
  4742. //>>excludeEnd("ctx");
  4743. var $1;
  4744. $1=$self._new_((1));
  4745. $recv($1)._at_put_((1),anObject);
  4746. return $recv($1)._yourself();
  4747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4748. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.a$cls)});
  4749. //>>excludeEnd("ctx");
  4750. },
  4751. //>>excludeStart("ide", pragmas.excludeIdeData);
  4752. args: ["anObject"],
  4753. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  4754. referencedClasses: [],
  4755. //>>excludeEnd("ide");
  4756. messageSends: ["at:put:", "new:", "yourself"]
  4757. }),
  4758. $globals.Array.a$cls);
  4759. $core.addMethod(
  4760. $core.method({
  4761. selector: "with:with:",
  4762. protocol: "instance creation",
  4763. fn: function (anObject,anObject2){
  4764. var self=this,$self=this;
  4765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4766. return $core.withContext(function($ctx1) {
  4767. //>>excludeEnd("ctx");
  4768. var $1;
  4769. $1=$self._new_((2));
  4770. $recv($1)._at_put_((1),anObject);
  4771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4772. $ctx1.sendIdx["at:put:"]=1;
  4773. //>>excludeEnd("ctx");
  4774. $recv($1)._at_put_((2),anObject2);
  4775. return $recv($1)._yourself();
  4776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4777. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.a$cls)});
  4778. //>>excludeEnd("ctx");
  4779. },
  4780. //>>excludeStart("ide", pragmas.excludeIdeData);
  4781. args: ["anObject", "anObject2"],
  4782. 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",
  4783. referencedClasses: [],
  4784. //>>excludeEnd("ide");
  4785. messageSends: ["at:put:", "new:", "yourself"]
  4786. }),
  4787. $globals.Array.a$cls);
  4788. $core.addMethod(
  4789. $core.method({
  4790. selector: "with:with:with:",
  4791. protocol: "instance creation",
  4792. fn: function (anObject,anObject2,anObject3){
  4793. var self=this,$self=this;
  4794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4795. return $core.withContext(function($ctx1) {
  4796. //>>excludeEnd("ctx");
  4797. var $1;
  4798. $1=$self._new_((3));
  4799. $recv($1)._at_put_((1),anObject);
  4800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4801. $ctx1.sendIdx["at:put:"]=1;
  4802. //>>excludeEnd("ctx");
  4803. $recv($1)._at_put_((2),anObject2);
  4804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4805. $ctx1.sendIdx["at:put:"]=2;
  4806. //>>excludeEnd("ctx");
  4807. $recv($1)._at_put_((3),anObject3);
  4808. return $recv($1)._yourself();
  4809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4810. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.a$cls)});
  4811. //>>excludeEnd("ctx");
  4812. },
  4813. //>>excludeStart("ide", pragmas.excludeIdeData);
  4814. args: ["anObject", "anObject2", "anObject3"],
  4815. 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",
  4816. referencedClasses: [],
  4817. //>>excludeEnd("ide");
  4818. messageSends: ["at:put:", "new:", "yourself"]
  4819. }),
  4820. $globals.Array.a$cls);
  4821. $core.addMethod(
  4822. $core.method({
  4823. selector: "withAll:",
  4824. protocol: "instance creation",
  4825. fn: function (aCollection){
  4826. var self=this,$self=this;
  4827. var instance,index;
  4828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4829. return $core.withContext(function($ctx1) {
  4830. //>>excludeEnd("ctx");
  4831. index=(1);
  4832. instance=$self._new_($recv(aCollection)._size());
  4833. $recv(aCollection)._do_((function(each){
  4834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4835. return $core.withContext(function($ctx2) {
  4836. //>>excludeEnd("ctx");
  4837. $recv(instance)._at_put_(index,each);
  4838. index=$recv(index).__plus((1));
  4839. return index;
  4840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4841. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4842. //>>excludeEnd("ctx");
  4843. }));
  4844. return instance;
  4845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4846. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.a$cls)});
  4847. //>>excludeEnd("ctx");
  4848. },
  4849. //>>excludeStart("ide", pragmas.excludeIdeData);
  4850. args: ["aCollection"],
  4851. 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",
  4852. referencedClasses: [],
  4853. //>>excludeEnd("ide");
  4854. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  4855. }),
  4856. $globals.Array.a$cls);
  4857. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  4858. //>>excludeStart("ide", pragmas.excludeIdeData);
  4859. $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 >> #,`";
  4860. //>>excludeEnd("ide");
  4861. $core.addMethod(
  4862. $core.method({
  4863. selector: ",",
  4864. protocol: "copying",
  4865. fn: function (aString){
  4866. var self=this,$self=this;
  4867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4868. return $core.withContext(function($ctx1) {
  4869. //>>excludeEnd("ctx");
  4870. return String(self) + aString;
  4871. return self;
  4872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4873. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  4874. //>>excludeEnd("ctx");
  4875. },
  4876. //>>excludeStart("ide", pragmas.excludeIdeData);
  4877. args: ["aString"],
  4878. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  4879. referencedClasses: [],
  4880. //>>excludeEnd("ide");
  4881. messageSends: []
  4882. }),
  4883. $globals.String);
  4884. $core.addMethod(
  4885. $core.method({
  4886. selector: "<",
  4887. protocol: "comparing",
  4888. fn: function (aString){
  4889. var self=this,$self=this;
  4890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4891. return $core.withContext(function($ctx1) {
  4892. //>>excludeEnd("ctx");
  4893. return String(self) < aString._asString();
  4894. return self;
  4895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4896. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  4897. //>>excludeEnd("ctx");
  4898. },
  4899. //>>excludeStart("ide", pragmas.excludeIdeData);
  4900. args: ["aString"],
  4901. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  4902. referencedClasses: [],
  4903. //>>excludeEnd("ide");
  4904. messageSends: []
  4905. }),
  4906. $globals.String);
  4907. $core.addMethod(
  4908. $core.method({
  4909. selector: "<=",
  4910. protocol: "comparing",
  4911. fn: function (aString){
  4912. var self=this,$self=this;
  4913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4914. return $core.withContext(function($ctx1) {
  4915. //>>excludeEnd("ctx");
  4916. return String(self) <= aString._asString();
  4917. return self;
  4918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4919. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  4920. //>>excludeEnd("ctx");
  4921. },
  4922. //>>excludeStart("ide", pragmas.excludeIdeData);
  4923. args: ["aString"],
  4924. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  4925. referencedClasses: [],
  4926. //>>excludeEnd("ide");
  4927. messageSends: []
  4928. }),
  4929. $globals.String);
  4930. $core.addMethod(
  4931. $core.method({
  4932. selector: "=",
  4933. protocol: "comparing",
  4934. fn: function (aString){
  4935. var self=this,$self=this;
  4936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4937. return $core.withContext(function($ctx1) {
  4938. //>>excludeEnd("ctx");
  4939. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  4940. return self;
  4941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4942. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  4943. //>>excludeEnd("ctx");
  4944. },
  4945. //>>excludeStart("ide", pragmas.excludeIdeData);
  4946. args: ["aString"],
  4947. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  4948. referencedClasses: [],
  4949. //>>excludeEnd("ide");
  4950. messageSends: []
  4951. }),
  4952. $globals.String);
  4953. $core.addMethod(
  4954. $core.method({
  4955. selector: "==",
  4956. protocol: "comparing",
  4957. fn: function (aString){
  4958. var self=this,$self=this;
  4959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4960. return $core.withContext(function($ctx1) {
  4961. //>>excludeEnd("ctx");
  4962. if (typeof aString === "string") return String(self) === aString;
  4963. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  4964. else return false;;
  4965. return self;
  4966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4967. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  4968. //>>excludeEnd("ctx");
  4969. },
  4970. //>>excludeStart("ide", pragmas.excludeIdeData);
  4971. args: ["aString"],
  4972. 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'>",
  4973. referencedClasses: [],
  4974. //>>excludeEnd("ide");
  4975. messageSends: []
  4976. }),
  4977. $globals.String);
  4978. $core.addMethod(
  4979. $core.method({
  4980. selector: ">",
  4981. protocol: "comparing",
  4982. fn: function (aString){
  4983. var self=this,$self=this;
  4984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4985. return $core.withContext(function($ctx1) {
  4986. //>>excludeEnd("ctx");
  4987. return String(self) > aString._asString();
  4988. return self;
  4989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4990. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  4991. //>>excludeEnd("ctx");
  4992. },
  4993. //>>excludeStart("ide", pragmas.excludeIdeData);
  4994. args: ["aString"],
  4995. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  4996. referencedClasses: [],
  4997. //>>excludeEnd("ide");
  4998. messageSends: []
  4999. }),
  5000. $globals.String);
  5001. $core.addMethod(
  5002. $core.method({
  5003. selector: ">=",
  5004. protocol: "comparing",
  5005. fn: function (aString){
  5006. var self=this,$self=this;
  5007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5008. return $core.withContext(function($ctx1) {
  5009. //>>excludeEnd("ctx");
  5010. return String(self) >= aString._asString();
  5011. return self;
  5012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5013. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  5014. //>>excludeEnd("ctx");
  5015. },
  5016. //>>excludeStart("ide", pragmas.excludeIdeData);
  5017. args: ["aString"],
  5018. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  5019. referencedClasses: [],
  5020. //>>excludeEnd("ide");
  5021. messageSends: []
  5022. }),
  5023. $globals.String);
  5024. $core.addMethod(
  5025. $core.method({
  5026. selector: "add:",
  5027. protocol: "adding/removing",
  5028. fn: function (anObject){
  5029. var self=this,$self=this;
  5030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5031. return $core.withContext(function($ctx1) {
  5032. //>>excludeEnd("ctx");
  5033. $self._errorReadOnly();
  5034. return self;
  5035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5036. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.String)});
  5037. //>>excludeEnd("ctx");
  5038. },
  5039. //>>excludeStart("ide", pragmas.excludeIdeData);
  5040. args: ["anObject"],
  5041. source: "add: anObject\x0a\x09self errorReadOnly",
  5042. referencedClasses: [],
  5043. //>>excludeEnd("ide");
  5044. messageSends: ["errorReadOnly"]
  5045. }),
  5046. $globals.String);
  5047. $core.addMethod(
  5048. $core.method({
  5049. selector: "asJavaScriptMethodName",
  5050. protocol: "converting",
  5051. fn: function (){
  5052. var self=this,$self=this;
  5053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5054. return $core.withContext(function($ctx1) {
  5055. //>>excludeEnd("ctx");
  5056. return $core.st2js(self);
  5057. return self;
  5058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5059. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  5060. //>>excludeEnd("ctx");
  5061. },
  5062. //>>excludeStart("ide", pragmas.excludeIdeData);
  5063. args: [],
  5064. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  5065. referencedClasses: [],
  5066. //>>excludeEnd("ide");
  5067. messageSends: []
  5068. }),
  5069. $globals.String);
  5070. $core.addMethod(
  5071. $core.method({
  5072. selector: "asJavaScriptObject",
  5073. protocol: "converting",
  5074. fn: function (){
  5075. var self=this,$self=this;
  5076. return self;
  5077. },
  5078. //>>excludeStart("ide", pragmas.excludeIdeData);
  5079. args: [],
  5080. source: "asJavaScriptObject\x0a\x09^ self",
  5081. referencedClasses: [],
  5082. //>>excludeEnd("ide");
  5083. messageSends: []
  5084. }),
  5085. $globals.String);
  5086. $core.addMethod(
  5087. $core.method({
  5088. selector: "asJavaScriptSource",
  5089. protocol: "converting",
  5090. fn: function (){
  5091. var self=this,$self=this;
  5092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5093. return $core.withContext(function($ctx1) {
  5094. //>>excludeEnd("ctx");
  5095. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5096. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5097. else
  5098. return "\"" + self + "\"";
  5099. ;
  5100. return self;
  5101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5102. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  5103. //>>excludeEnd("ctx");
  5104. },
  5105. //>>excludeStart("ide", pragmas.excludeIdeData);
  5106. args: [],
  5107. 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'>",
  5108. referencedClasses: [],
  5109. //>>excludeEnd("ide");
  5110. messageSends: []
  5111. }),
  5112. $globals.String);
  5113. $core.addMethod(
  5114. $core.method({
  5115. selector: "asLowercase",
  5116. protocol: "converting",
  5117. fn: function (){
  5118. var self=this,$self=this;
  5119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5120. return $core.withContext(function($ctx1) {
  5121. //>>excludeEnd("ctx");
  5122. return self.toLowerCase();
  5123. return self;
  5124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5125. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  5126. //>>excludeEnd("ctx");
  5127. },
  5128. //>>excludeStart("ide", pragmas.excludeIdeData);
  5129. args: [],
  5130. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  5131. referencedClasses: [],
  5132. //>>excludeEnd("ide");
  5133. messageSends: []
  5134. }),
  5135. $globals.String);
  5136. $core.addMethod(
  5137. $core.method({
  5138. selector: "asMutator",
  5139. protocol: "converting",
  5140. fn: function (){
  5141. var self=this,$self=this;
  5142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5143. return $core.withContext(function($ctx1) {
  5144. //>>excludeEnd("ctx");
  5145. var $1;
  5146. $1=$recv($self._last()).__eq(":");
  5147. if(!$core.assert($1)){
  5148. return $self.__comma(":");
  5149. }
  5150. return self;
  5151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5152. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  5153. //>>excludeEnd("ctx");
  5154. },
  5155. //>>excludeStart("ide", pragmas.excludeIdeData);
  5156. args: [],
  5157. 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",
  5158. referencedClasses: [],
  5159. //>>excludeEnd("ide");
  5160. messageSends: ["ifFalse:", "=", "last", ","]
  5161. }),
  5162. $globals.String);
  5163. $core.addMethod(
  5164. $core.method({
  5165. selector: "asNumber",
  5166. protocol: "converting",
  5167. fn: function (){
  5168. var self=this,$self=this;
  5169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5170. return $core.withContext(function($ctx1) {
  5171. //>>excludeEnd("ctx");
  5172. return Number(self);
  5173. return self;
  5174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5175. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  5176. //>>excludeEnd("ctx");
  5177. },
  5178. //>>excludeStart("ide", pragmas.excludeIdeData);
  5179. args: [],
  5180. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  5181. referencedClasses: [],
  5182. //>>excludeEnd("ide");
  5183. messageSends: []
  5184. }),
  5185. $globals.String);
  5186. $core.addMethod(
  5187. $core.method({
  5188. selector: "asRegexp",
  5189. protocol: "converting",
  5190. fn: function (){
  5191. var self=this,$self=this;
  5192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5193. return $core.withContext(function($ctx1) {
  5194. //>>excludeEnd("ctx");
  5195. return $recv($globals.RegularExpression)._fromString_(self);
  5196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5197. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  5198. //>>excludeEnd("ctx");
  5199. },
  5200. //>>excludeStart("ide", pragmas.excludeIdeData);
  5201. args: [],
  5202. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  5203. referencedClasses: ["RegularExpression"],
  5204. //>>excludeEnd("ide");
  5205. messageSends: ["fromString:"]
  5206. }),
  5207. $globals.String);
  5208. $core.addMethod(
  5209. $core.method({
  5210. selector: "asString",
  5211. protocol: "converting",
  5212. fn: function (){
  5213. var self=this,$self=this;
  5214. return self;
  5215. },
  5216. //>>excludeStart("ide", pragmas.excludeIdeData);
  5217. args: [],
  5218. source: "asString\x0a\x09^ self",
  5219. referencedClasses: [],
  5220. //>>excludeEnd("ide");
  5221. messageSends: []
  5222. }),
  5223. $globals.String);
  5224. $core.addMethod(
  5225. $core.method({
  5226. selector: "asSymbol",
  5227. protocol: "converting",
  5228. fn: function (){
  5229. var self=this,$self=this;
  5230. return self;
  5231. },
  5232. //>>excludeStart("ide", pragmas.excludeIdeData);
  5233. args: [],
  5234. source: "asSymbol\x0a\x09^ self",
  5235. referencedClasses: [],
  5236. //>>excludeEnd("ide");
  5237. messageSends: []
  5238. }),
  5239. $globals.String);
  5240. $core.addMethod(
  5241. $core.method({
  5242. selector: "asSymbolPrintOn:",
  5243. protocol: "printing",
  5244. fn: function (aStream){
  5245. var self=this,$self=this;
  5246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5247. return $core.withContext(function($ctx1) {
  5248. //>>excludeEnd("ctx");
  5249. var $1;
  5250. $recv(aStream)._nextPutAll_("#");
  5251. $1=$recv($self._asString())._isSelector();
  5252. if($core.assert($1)){
  5253. $recv(aStream)._nextPut_(self);
  5254. } else {
  5255. $self._printOn_(aStream);
  5256. }
  5257. return self;
  5258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5259. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.String)});
  5260. //>>excludeEnd("ctx");
  5261. },
  5262. //>>excludeStart("ide", pragmas.excludeIdeData);
  5263. args: ["aStream"],
  5264. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  5265. referencedClasses: [],
  5266. //>>excludeEnd("ide");
  5267. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  5268. }),
  5269. $globals.String);
  5270. $core.addMethod(
  5271. $core.method({
  5272. selector: "asUppercase",
  5273. protocol: "converting",
  5274. fn: function (){
  5275. var self=this,$self=this;
  5276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5277. return $core.withContext(function($ctx1) {
  5278. //>>excludeEnd("ctx");
  5279. return self.toUpperCase();
  5280. return self;
  5281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5282. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  5283. //>>excludeEnd("ctx");
  5284. },
  5285. //>>excludeStart("ide", pragmas.excludeIdeData);
  5286. args: [],
  5287. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  5288. referencedClasses: [],
  5289. //>>excludeEnd("ide");
  5290. messageSends: []
  5291. }),
  5292. $globals.String);
  5293. $core.addMethod(
  5294. $core.method({
  5295. selector: "asciiValue",
  5296. protocol: "accessing",
  5297. fn: function (){
  5298. var self=this,$self=this;
  5299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5300. return $core.withContext(function($ctx1) {
  5301. //>>excludeEnd("ctx");
  5302. return self.charCodeAt(0);;
  5303. return self;
  5304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5305. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  5306. //>>excludeEnd("ctx");
  5307. },
  5308. //>>excludeStart("ide", pragmas.excludeIdeData);
  5309. args: [],
  5310. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  5311. referencedClasses: [],
  5312. //>>excludeEnd("ide");
  5313. messageSends: []
  5314. }),
  5315. $globals.String);
  5316. $core.addMethod(
  5317. $core.method({
  5318. selector: "at:ifAbsent:",
  5319. protocol: "accessing",
  5320. fn: function (anIndex,aBlock){
  5321. var self=this,$self=this;
  5322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5323. return $core.withContext(function($ctx1) {
  5324. //>>excludeEnd("ctx");
  5325. return String(self)[anIndex - 1] || aBlock._value();
  5326. return self;
  5327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5328. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  5329. //>>excludeEnd("ctx");
  5330. },
  5331. //>>excludeStart("ide", pragmas.excludeIdeData);
  5332. args: ["anIndex", "aBlock"],
  5333. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  5334. referencedClasses: [],
  5335. //>>excludeEnd("ide");
  5336. messageSends: []
  5337. }),
  5338. $globals.String);
  5339. $core.addMethod(
  5340. $core.method({
  5341. selector: "at:ifPresent:ifAbsent:",
  5342. protocol: "accessing",
  5343. fn: function (anIndex,aBlock,anotherBlock){
  5344. var self=this,$self=this;
  5345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5346. return $core.withContext(function($ctx1) {
  5347. //>>excludeEnd("ctx");
  5348. var result = String(self)[anIndex - 1];
  5349. return result ? aBlock._value_(result) : anotherBlock._value();
  5350. ;
  5351. return self;
  5352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5353. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  5354. //>>excludeEnd("ctx");
  5355. },
  5356. //>>excludeStart("ide", pragmas.excludeIdeData);
  5357. args: ["anIndex", "aBlock", "anotherBlock"],
  5358. 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'>",
  5359. referencedClasses: [],
  5360. //>>excludeEnd("ide");
  5361. messageSends: []
  5362. }),
  5363. $globals.String);
  5364. $core.addMethod(
  5365. $core.method({
  5366. selector: "at:put:",
  5367. protocol: "accessing",
  5368. fn: function (anIndex,anObject){
  5369. var self=this,$self=this;
  5370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5371. return $core.withContext(function($ctx1) {
  5372. //>>excludeEnd("ctx");
  5373. $self._errorReadOnly();
  5374. return self;
  5375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5376. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.String)});
  5377. //>>excludeEnd("ctx");
  5378. },
  5379. //>>excludeStart("ide", pragmas.excludeIdeData);
  5380. args: ["anIndex", "anObject"],
  5381. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5382. referencedClasses: [],
  5383. //>>excludeEnd("ide");
  5384. messageSends: ["errorReadOnly"]
  5385. }),
  5386. $globals.String);
  5387. $core.addMethod(
  5388. $core.method({
  5389. selector: "capitalized",
  5390. protocol: "converting",
  5391. fn: function (){
  5392. var self=this,$self=this;
  5393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5394. return $core.withContext(function($ctx1) {
  5395. //>>excludeEnd("ctx");
  5396. return $self._ifNotEmpty_((function(){
  5397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5398. return $core.withContext(function($ctx2) {
  5399. //>>excludeEnd("ctx");
  5400. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  5401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5403. //>>excludeEnd("ctx");
  5404. }));
  5405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5406. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  5407. //>>excludeEnd("ctx");
  5408. },
  5409. //>>excludeStart("ide", pragmas.excludeIdeData);
  5410. args: [],
  5411. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  5412. referencedClasses: [],
  5413. //>>excludeEnd("ide");
  5414. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  5415. }),
  5416. $globals.String);
  5417. $core.addMethod(
  5418. $core.method({
  5419. selector: "charCodeAt:",
  5420. protocol: "accessing",
  5421. fn: function (anInteger){
  5422. var self=this,$self=this;
  5423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5424. return $core.withContext(function($ctx1) {
  5425. //>>excludeEnd("ctx");
  5426. return self.charCodeAt(anInteger - 1);
  5427. return self;
  5428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5429. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  5430. //>>excludeEnd("ctx");
  5431. },
  5432. //>>excludeStart("ide", pragmas.excludeIdeData);
  5433. args: ["anInteger"],
  5434. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  5435. referencedClasses: [],
  5436. //>>excludeEnd("ide");
  5437. messageSends: []
  5438. }),
  5439. $globals.String);
  5440. $core.addMethod(
  5441. $core.method({
  5442. selector: "copyFrom:to:",
  5443. protocol: "copying",
  5444. fn: function (anIndex,anotherIndex){
  5445. var self=this,$self=this;
  5446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5447. return $core.withContext(function($ctx1) {
  5448. //>>excludeEnd("ctx");
  5449. return self.substring(anIndex - 1, anotherIndex);
  5450. return self;
  5451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5452. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  5453. //>>excludeEnd("ctx");
  5454. },
  5455. //>>excludeStart("ide", pragmas.excludeIdeData);
  5456. args: ["anIndex", "anotherIndex"],
  5457. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  5458. referencedClasses: [],
  5459. //>>excludeEnd("ide");
  5460. messageSends: []
  5461. }),
  5462. $globals.String);
  5463. $core.addMethod(
  5464. $core.method({
  5465. selector: "crlfSanitized",
  5466. protocol: "converting",
  5467. fn: function (){
  5468. var self=this,$self=this;
  5469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5470. return $core.withContext(function($ctx1) {
  5471. //>>excludeEnd("ctx");
  5472. return $recv($self._lines())._join_($recv($globals.String)._lf());
  5473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5474. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  5475. //>>excludeEnd("ctx");
  5476. },
  5477. //>>excludeStart("ide", pragmas.excludeIdeData);
  5478. args: [],
  5479. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  5480. referencedClasses: ["String"],
  5481. //>>excludeEnd("ide");
  5482. messageSends: ["join:", "lines", "lf"]
  5483. }),
  5484. $globals.String);
  5485. $core.addMethod(
  5486. $core.method({
  5487. selector: "deepCopy",
  5488. protocol: "copying",
  5489. fn: function (){
  5490. var self=this,$self=this;
  5491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5492. return $core.withContext(function($ctx1) {
  5493. //>>excludeEnd("ctx");
  5494. return $self._shallowCopy();
  5495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5496. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  5497. //>>excludeEnd("ctx");
  5498. },
  5499. //>>excludeStart("ide", pragmas.excludeIdeData);
  5500. args: [],
  5501. source: "deepCopy\x0a\x09^ self shallowCopy",
  5502. referencedClasses: [],
  5503. //>>excludeEnd("ide");
  5504. messageSends: ["shallowCopy"]
  5505. }),
  5506. $globals.String);
  5507. $core.addMethod(
  5508. $core.method({
  5509. selector: "errorReadOnly",
  5510. protocol: "error handling",
  5511. fn: function (){
  5512. var self=this,$self=this;
  5513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5514. return $core.withContext(function($ctx1) {
  5515. //>>excludeEnd("ctx");
  5516. $self._error_("Object is read-only");
  5517. return self;
  5518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5519. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.String)});
  5520. //>>excludeEnd("ctx");
  5521. },
  5522. //>>excludeStart("ide", pragmas.excludeIdeData);
  5523. args: [],
  5524. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5525. referencedClasses: [],
  5526. //>>excludeEnd("ide");
  5527. messageSends: ["error:"]
  5528. }),
  5529. $globals.String);
  5530. $core.addMethod(
  5531. $core.method({
  5532. selector: "escaped",
  5533. protocol: "converting",
  5534. fn: function (){
  5535. var self=this,$self=this;
  5536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5537. return $core.withContext(function($ctx1) {
  5538. //>>excludeEnd("ctx");
  5539. return escape(self);
  5540. return self;
  5541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5542. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  5543. //>>excludeEnd("ctx");
  5544. },
  5545. //>>excludeStart("ide", pragmas.excludeIdeData);
  5546. args: [],
  5547. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  5548. referencedClasses: [],
  5549. //>>excludeEnd("ide");
  5550. messageSends: []
  5551. }),
  5552. $globals.String);
  5553. $core.addMethod(
  5554. $core.method({
  5555. selector: "includesSubString:",
  5556. protocol: "testing",
  5557. fn: function (subString){
  5558. var self=this,$self=this;
  5559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5560. return $core.withContext(function($ctx1) {
  5561. //>>excludeEnd("ctx");
  5562. return self.indexOf(subString) != -1;
  5563. return self;
  5564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5565. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  5566. //>>excludeEnd("ctx");
  5567. },
  5568. //>>excludeStart("ide", pragmas.excludeIdeData);
  5569. args: ["subString"],
  5570. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  5571. referencedClasses: [],
  5572. //>>excludeEnd("ide");
  5573. messageSends: []
  5574. }),
  5575. $globals.String);
  5576. $core.addMethod(
  5577. $core.method({
  5578. selector: "isCapitalized",
  5579. protocol: "testing",
  5580. fn: function (){
  5581. var self=this,$self=this;
  5582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5583. return $core.withContext(function($ctx1) {
  5584. //>>excludeEnd("ctx");
  5585. var $2,$1;
  5586. $2=$self._first();
  5587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5588. $ctx1.sendIdx["first"]=1;
  5589. //>>excludeEnd("ctx");
  5590. $1=$recv($2)._asUppercase();
  5591. return $recv($1).__eq_eq($self._first());
  5592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5593. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  5594. //>>excludeEnd("ctx");
  5595. },
  5596. //>>excludeStart("ide", pragmas.excludeIdeData);
  5597. args: [],
  5598. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  5599. referencedClasses: [],
  5600. //>>excludeEnd("ide");
  5601. messageSends: ["==", "asUppercase", "first"]
  5602. }),
  5603. $globals.String);
  5604. $core.addMethod(
  5605. $core.method({
  5606. selector: "isImmutable",
  5607. protocol: "testing",
  5608. fn: function (){
  5609. var self=this,$self=this;
  5610. return true;
  5611. },
  5612. //>>excludeStart("ide", pragmas.excludeIdeData);
  5613. args: [],
  5614. source: "isImmutable\x0a\x09^ true",
  5615. referencedClasses: [],
  5616. //>>excludeEnd("ide");
  5617. messageSends: []
  5618. }),
  5619. $globals.String);
  5620. $core.addMethod(
  5621. $core.method({
  5622. selector: "isSelector",
  5623. protocol: "testing",
  5624. fn: function (){
  5625. var self=this,$self=this;
  5626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5627. return $core.withContext(function($ctx1) {
  5628. //>>excludeEnd("ctx");
  5629. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  5630. return self;
  5631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5632. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  5633. //>>excludeEnd("ctx");
  5634. },
  5635. //>>excludeStart("ide", pragmas.excludeIdeData);
  5636. args: [],
  5637. 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>",
  5638. referencedClasses: [],
  5639. //>>excludeEnd("ide");
  5640. messageSends: []
  5641. }),
  5642. $globals.String);
  5643. $core.addMethod(
  5644. $core.method({
  5645. selector: "isString",
  5646. protocol: "testing",
  5647. fn: function (){
  5648. var self=this,$self=this;
  5649. return true;
  5650. },
  5651. //>>excludeStart("ide", pragmas.excludeIdeData);
  5652. args: [],
  5653. source: "isString\x0a\x09^ true",
  5654. referencedClasses: [],
  5655. //>>excludeEnd("ide");
  5656. messageSends: []
  5657. }),
  5658. $globals.String);
  5659. $core.addMethod(
  5660. $core.method({
  5661. selector: "isVowel",
  5662. protocol: "testing",
  5663. fn: function (){
  5664. var self=this,$self=this;
  5665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5666. return $core.withContext(function($ctx1) {
  5667. //>>excludeEnd("ctx");
  5668. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  5669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5670. return $core.withContext(function($ctx2) {
  5671. //>>excludeEnd("ctx");
  5672. return "aeiou"._includes_($self._asLowercase());
  5673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5675. //>>excludeEnd("ctx");
  5676. }));
  5677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5678. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  5679. //>>excludeEnd("ctx");
  5680. },
  5681. //>>excludeStart("ide", pragmas.excludeIdeData);
  5682. args: [],
  5683. 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 ]",
  5684. referencedClasses: [],
  5685. //>>excludeEnd("ide");
  5686. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  5687. }),
  5688. $globals.String);
  5689. $core.addMethod(
  5690. $core.method({
  5691. selector: "join:",
  5692. protocol: "split join",
  5693. fn: function (aCollection){
  5694. var self=this,$self=this;
  5695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5696. return $core.withContext(function($ctx1) {
  5697. //>>excludeEnd("ctx");
  5698. return $recv($globals.String)._streamContents_((function(stream){
  5699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5700. return $core.withContext(function($ctx2) {
  5701. //>>excludeEnd("ctx");
  5702. return $recv(aCollection)._do_separatedBy_((function(each){
  5703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5704. return $core.withContext(function($ctx3) {
  5705. //>>excludeEnd("ctx");
  5706. return $recv(stream)._nextPutAll_($recv(each)._asString());
  5707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5708. $ctx3.sendIdx["nextPutAll:"]=1;
  5709. //>>excludeEnd("ctx");
  5710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5711. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  5712. //>>excludeEnd("ctx");
  5713. }),(function(){
  5714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5715. return $core.withContext(function($ctx3) {
  5716. //>>excludeEnd("ctx");
  5717. return $recv(stream)._nextPutAll_(self);
  5718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5719. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5720. //>>excludeEnd("ctx");
  5721. }));
  5722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5723. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  5724. //>>excludeEnd("ctx");
  5725. }));
  5726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5727. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  5728. //>>excludeEnd("ctx");
  5729. },
  5730. //>>excludeStart("ide", pragmas.excludeIdeData);
  5731. args: ["aCollection"],
  5732. 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 ]]",
  5733. referencedClasses: ["String"],
  5734. //>>excludeEnd("ide");
  5735. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  5736. }),
  5737. $globals.String);
  5738. $core.addMethod(
  5739. $core.method({
  5740. selector: "lineIndicesDo:",
  5741. protocol: "split join",
  5742. fn: function (aBlock){
  5743. var self=this,$self=this;
  5744. var cr,lf,start,sz,nextLF,nextCR;
  5745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5746. return $core.withContext(function($ctx1) {
  5747. //>>excludeEnd("ctx");
  5748. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  5749. var $early={};
  5750. try {
  5751. start=(1);
  5752. sz=$self._size();
  5753. cr=$recv($globals.String)._cr();
  5754. nextCR=$self._indexOf_startingAt_(cr,(1));
  5755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5756. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  5757. //>>excludeEnd("ctx");
  5758. lf=$recv($globals.String)._lf();
  5759. nextLF=$self._indexOf_startingAt_(lf,(1));
  5760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5761. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  5762. //>>excludeEnd("ctx");
  5763. $recv((function(){
  5764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5765. return $core.withContext(function($ctx2) {
  5766. //>>excludeEnd("ctx");
  5767. return $recv(start).__lt_eq(sz);
  5768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5769. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5770. //>>excludeEnd("ctx");
  5771. }))._whileTrue_((function(){
  5772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5773. return $core.withContext(function($ctx2) {
  5774. //>>excludeEnd("ctx");
  5775. $2=$recv(nextLF).__eq((0));
  5776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5777. $ctx2.sendIdx["="]=1;
  5778. //>>excludeEnd("ctx");
  5779. $1=$recv($2)._and_((function(){
  5780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5781. return $core.withContext(function($ctx3) {
  5782. //>>excludeEnd("ctx");
  5783. return $recv(nextCR).__eq((0));
  5784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5785. $ctx3.sendIdx["="]=2;
  5786. //>>excludeEnd("ctx");
  5787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5788. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5789. //>>excludeEnd("ctx");
  5790. }));
  5791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5792. $ctx2.sendIdx["and:"]=1;
  5793. //>>excludeEnd("ctx");
  5794. if($core.assert($1)){
  5795. $recv(aBlock)._value_value_value_(start,sz,sz);
  5796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5797. $ctx2.sendIdx["value:value:value:"]=1;
  5798. //>>excludeEnd("ctx");
  5799. throw $early=[self];
  5800. }
  5801. $4=$recv(nextCR).__eq((0));
  5802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5803. $ctx2.sendIdx["="]=3;
  5804. //>>excludeEnd("ctx");
  5805. $3=$recv($4)._or_((function(){
  5806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5807. return $core.withContext(function($ctx3) {
  5808. //>>excludeEnd("ctx");
  5809. $5=(0).__lt(nextLF);
  5810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5811. $ctx3.sendIdx["<"]=1;
  5812. //>>excludeEnd("ctx");
  5813. return $recv($5)._and_((function(){
  5814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5815. return $core.withContext(function($ctx4) {
  5816. //>>excludeEnd("ctx");
  5817. return $recv(nextLF).__lt(nextCR);
  5818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5819. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  5820. //>>excludeEnd("ctx");
  5821. }));
  5822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5823. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  5824. //>>excludeEnd("ctx");
  5825. }));
  5826. if($core.assert($3)){
  5827. $6=start;
  5828. $7=$recv(nextLF).__minus((1));
  5829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5830. $ctx2.sendIdx["-"]=1;
  5831. //>>excludeEnd("ctx");
  5832. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  5833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5834. $ctx2.sendIdx["value:value:value:"]=2;
  5835. //>>excludeEnd("ctx");
  5836. start=(1).__plus(nextLF);
  5837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5838. $ctx2.sendIdx["+"]=1;
  5839. //>>excludeEnd("ctx");
  5840. nextLF=$self._indexOf_startingAt_(lf,start);
  5841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5842. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  5843. //>>excludeEnd("ctx");
  5844. return nextLF;
  5845. } else {
  5846. $9=(1).__plus(nextCR);
  5847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5848. $ctx2.sendIdx["+"]=2;
  5849. //>>excludeEnd("ctx");
  5850. $8=$recv($9).__eq(nextLF);
  5851. if($core.assert($8)){
  5852. $10=start;
  5853. $11=$recv(nextCR).__minus((1));
  5854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5855. $ctx2.sendIdx["-"]=2;
  5856. //>>excludeEnd("ctx");
  5857. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  5858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5859. $ctx2.sendIdx["value:value:value:"]=3;
  5860. //>>excludeEnd("ctx");
  5861. start=(1).__plus(nextLF);
  5862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5863. $ctx2.sendIdx["+"]=3;
  5864. //>>excludeEnd("ctx");
  5865. nextCR=$self._indexOf_startingAt_(cr,start);
  5866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5867. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  5868. //>>excludeEnd("ctx");
  5869. nextLF=$self._indexOf_startingAt_(lf,start);
  5870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5871. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  5872. //>>excludeEnd("ctx");
  5873. return nextLF;
  5874. } else {
  5875. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  5876. start=(1).__plus(nextCR);
  5877. nextCR=$self._indexOf_startingAt_(cr,start);
  5878. return nextCR;
  5879. }
  5880. }
  5881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5883. //>>excludeEnd("ctx");
  5884. }));
  5885. return self;
  5886. }
  5887. catch(e) {if(e===$early)return e[0]; throw e}
  5888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5889. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  5890. //>>excludeEnd("ctx");
  5891. },
  5892. //>>excludeStart("ide", pragmas.excludeIdeData);
  5893. args: ["aBlock"],
  5894. 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 ] ]]",
  5895. referencedClasses: ["String"],
  5896. //>>excludeEnd("ide");
  5897. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  5898. }),
  5899. $globals.String);
  5900. $core.addMethod(
  5901. $core.method({
  5902. selector: "lineNumber:",
  5903. protocol: "split join",
  5904. fn: function (anIndex){
  5905. var self=this,$self=this;
  5906. var lineCount;
  5907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5908. return $core.withContext(function($ctx1) {
  5909. //>>excludeEnd("ctx");
  5910. var $2,$1;
  5911. var $early={};
  5912. try {
  5913. lineCount=(0);
  5914. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  5915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5916. return $core.withContext(function($ctx2) {
  5917. //>>excludeEnd("ctx");
  5918. lineCount=$recv(lineCount).__plus((1));
  5919. $2=lineCount;
  5920. $1=$recv($2).__eq(anIndex);
  5921. if($core.assert($1)){
  5922. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  5923. }
  5924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5925. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  5926. //>>excludeEnd("ctx");
  5927. }));
  5928. return nil;
  5929. }
  5930. catch(e) {if(e===$early)return e[0]; throw e}
  5931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5932. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  5933. //>>excludeEnd("ctx");
  5934. },
  5935. //>>excludeStart("ide", pragmas.excludeIdeData);
  5936. args: ["anIndex"],
  5937. 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",
  5938. referencedClasses: [],
  5939. //>>excludeEnd("ide");
  5940. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  5941. }),
  5942. $globals.String);
  5943. $core.addMethod(
  5944. $core.method({
  5945. selector: "lines",
  5946. protocol: "split join",
  5947. fn: function (){
  5948. var self=this,$self=this;
  5949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5950. return $core.withContext(function($ctx1) {
  5951. //>>excludeEnd("ctx");
  5952. var result = self.split(/\r\n|\r|\n/);
  5953. if (!result[result.length-1]) result.pop();
  5954. return result;;
  5955. return self;
  5956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5957. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  5958. //>>excludeEnd("ctx");
  5959. },
  5960. //>>excludeStart("ide", pragmas.excludeIdeData);
  5961. args: [],
  5962. 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'>",
  5963. referencedClasses: [],
  5964. //>>excludeEnd("ide");
  5965. messageSends: []
  5966. }),
  5967. $globals.String);
  5968. $core.addMethod(
  5969. $core.method({
  5970. selector: "linesDo:",
  5971. protocol: "split join",
  5972. fn: function (aBlock){
  5973. var self=this,$self=this;
  5974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5975. return $core.withContext(function($ctx1) {
  5976. //>>excludeEnd("ctx");
  5977. $recv($self._lines())._do_(aBlock);
  5978. return self;
  5979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5980. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  5981. //>>excludeEnd("ctx");
  5982. },
  5983. //>>excludeStart("ide", pragmas.excludeIdeData);
  5984. args: ["aBlock"],
  5985. 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",
  5986. referencedClasses: [],
  5987. //>>excludeEnd("ide");
  5988. messageSends: ["do:", "lines"]
  5989. }),
  5990. $globals.String);
  5991. $core.addMethod(
  5992. $core.method({
  5993. selector: "match:",
  5994. protocol: "regular expressions",
  5995. fn: function (aRegexp){
  5996. var self=this,$self=this;
  5997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5998. return $core.withContext(function($ctx1) {
  5999. //>>excludeEnd("ctx");
  6000. return self.search(aRegexp) != -1;
  6001. return self;
  6002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6003. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  6004. //>>excludeEnd("ctx");
  6005. },
  6006. //>>excludeStart("ide", pragmas.excludeIdeData);
  6007. args: ["aRegexp"],
  6008. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  6009. referencedClasses: [],
  6010. //>>excludeEnd("ide");
  6011. messageSends: []
  6012. }),
  6013. $globals.String);
  6014. $core.addMethod(
  6015. $core.method({
  6016. selector: "matchesOf:",
  6017. protocol: "regular expressions",
  6018. fn: function (aRegularExpression){
  6019. var self=this,$self=this;
  6020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6021. return $core.withContext(function($ctx1) {
  6022. //>>excludeEnd("ctx");
  6023. return self.match(aRegularExpression);
  6024. return self;
  6025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6026. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  6027. //>>excludeEnd("ctx");
  6028. },
  6029. //>>excludeStart("ide", pragmas.excludeIdeData);
  6030. args: ["aRegularExpression"],
  6031. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  6032. referencedClasses: [],
  6033. //>>excludeEnd("ide");
  6034. messageSends: []
  6035. }),
  6036. $globals.String);
  6037. $core.addMethod(
  6038. $core.method({
  6039. selector: "printNl",
  6040. protocol: "printing",
  6041. fn: function (){
  6042. var self=this,$self=this;
  6043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6044. return $core.withContext(function($ctx1) {
  6045. //>>excludeEnd("ctx");
  6046. console.log(self);
  6047. return self;
  6048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6049. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  6050. //>>excludeEnd("ctx");
  6051. },
  6052. //>>excludeStart("ide", pragmas.excludeIdeData);
  6053. args: [],
  6054. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  6055. referencedClasses: [],
  6056. //>>excludeEnd("ide");
  6057. messageSends: []
  6058. }),
  6059. $globals.String);
  6060. $core.addMethod(
  6061. $core.method({
  6062. selector: "printOn:",
  6063. protocol: "printing",
  6064. fn: function (aStream){
  6065. var self=this,$self=this;
  6066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6067. return $core.withContext(function($ctx1) {
  6068. //>>excludeEnd("ctx");
  6069. $recv(aStream)._nextPutAll_("'");
  6070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6071. $ctx1.sendIdx["nextPutAll:"]=1;
  6072. //>>excludeEnd("ctx");
  6073. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  6074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6075. $ctx1.sendIdx["nextPutAll:"]=2;
  6076. //>>excludeEnd("ctx");
  6077. $recv(aStream)._nextPutAll_("'");
  6078. return self;
  6079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6080. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  6081. //>>excludeEnd("ctx");
  6082. },
  6083. //>>excludeStart("ide", pragmas.excludeIdeData);
  6084. args: ["aStream"],
  6085. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  6086. referencedClasses: [],
  6087. //>>excludeEnd("ide");
  6088. messageSends: ["nextPutAll:", "replace:with:"]
  6089. }),
  6090. $globals.String);
  6091. $core.addMethod(
  6092. $core.method({
  6093. selector: "putOn:",
  6094. protocol: "streaming",
  6095. fn: function (aStream){
  6096. var self=this,$self=this;
  6097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6098. return $core.withContext(function($ctx1) {
  6099. //>>excludeEnd("ctx");
  6100. $recv(aStream)._nextPutString_(self);
  6101. return self;
  6102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6103. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.String)});
  6104. //>>excludeEnd("ctx");
  6105. },
  6106. //>>excludeStart("ide", pragmas.excludeIdeData);
  6107. args: ["aStream"],
  6108. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  6109. referencedClasses: [],
  6110. //>>excludeEnd("ide");
  6111. messageSends: ["nextPutString:"]
  6112. }),
  6113. $globals.String);
  6114. $core.addMethod(
  6115. $core.method({
  6116. selector: "remove:",
  6117. protocol: "adding/removing",
  6118. fn: function (anObject){
  6119. var self=this,$self=this;
  6120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6121. return $core.withContext(function($ctx1) {
  6122. //>>excludeEnd("ctx");
  6123. $self._errorReadOnly();
  6124. return self;
  6125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6126. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.String)});
  6127. //>>excludeEnd("ctx");
  6128. },
  6129. //>>excludeStart("ide", pragmas.excludeIdeData);
  6130. args: ["anObject"],
  6131. source: "remove: anObject\x0a\x09self errorReadOnly",
  6132. referencedClasses: [],
  6133. //>>excludeEnd("ide");
  6134. messageSends: ["errorReadOnly"]
  6135. }),
  6136. $globals.String);
  6137. $core.addMethod(
  6138. $core.method({
  6139. selector: "remove:ifAbsent:",
  6140. protocol: "adding/removing",
  6141. fn: function (anObject,aBlock){
  6142. var self=this,$self=this;
  6143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6144. return $core.withContext(function($ctx1) {
  6145. //>>excludeEnd("ctx");
  6146. $self._errorReadOnly();
  6147. return self;
  6148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6149. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.String)});
  6150. //>>excludeEnd("ctx");
  6151. },
  6152. //>>excludeStart("ide", pragmas.excludeIdeData);
  6153. args: ["anObject", "aBlock"],
  6154. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  6155. referencedClasses: [],
  6156. //>>excludeEnd("ide");
  6157. messageSends: ["errorReadOnly"]
  6158. }),
  6159. $globals.String);
  6160. $core.addMethod(
  6161. $core.method({
  6162. selector: "replace:with:",
  6163. protocol: "regular expressions",
  6164. fn: function (aString,anotherString){
  6165. var self=this,$self=this;
  6166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6167. return $core.withContext(function($ctx1) {
  6168. //>>excludeEnd("ctx");
  6169. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6171. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  6172. //>>excludeEnd("ctx");
  6173. },
  6174. //>>excludeStart("ide", pragmas.excludeIdeData);
  6175. args: ["aString", "anotherString"],
  6176. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6177. referencedClasses: ["RegularExpression"],
  6178. //>>excludeEnd("ide");
  6179. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6180. }),
  6181. $globals.String);
  6182. $core.addMethod(
  6183. $core.method({
  6184. selector: "replaceRegexp:with:",
  6185. protocol: "regular expressions",
  6186. fn: function (aRegexp,aString){
  6187. var self=this,$self=this;
  6188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6189. return $core.withContext(function($ctx1) {
  6190. //>>excludeEnd("ctx");
  6191. return self.replace(aRegexp, aString);
  6192. return self;
  6193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6194. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  6195. //>>excludeEnd("ctx");
  6196. },
  6197. //>>excludeStart("ide", pragmas.excludeIdeData);
  6198. args: ["aRegexp", "aString"],
  6199. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  6200. referencedClasses: [],
  6201. //>>excludeEnd("ide");
  6202. messageSends: []
  6203. }),
  6204. $globals.String);
  6205. $core.addMethod(
  6206. $core.method({
  6207. selector: "reversed",
  6208. protocol: "converting",
  6209. fn: function (){
  6210. var self=this,$self=this;
  6211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6212. return $core.withContext(function($ctx1) {
  6213. //>>excludeEnd("ctx");
  6214. return self.split("").reverse().join("");
  6215. return self;
  6216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6217. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  6218. //>>excludeEnd("ctx");
  6219. },
  6220. //>>excludeStart("ide", pragmas.excludeIdeData);
  6221. args: [],
  6222. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  6223. referencedClasses: [],
  6224. //>>excludeEnd("ide");
  6225. messageSends: []
  6226. }),
  6227. $globals.String);
  6228. $core.addMethod(
  6229. $core.method({
  6230. selector: "shallowCopy",
  6231. protocol: "copying",
  6232. fn: function (){
  6233. var self=this,$self=this;
  6234. return self;
  6235. },
  6236. //>>excludeStart("ide", pragmas.excludeIdeData);
  6237. args: [],
  6238. source: "shallowCopy\x0a\x09^ self",
  6239. referencedClasses: [],
  6240. //>>excludeEnd("ide");
  6241. messageSends: []
  6242. }),
  6243. $globals.String);
  6244. $core.addMethod(
  6245. $core.method({
  6246. selector: "subStrings:",
  6247. protocol: "split join",
  6248. fn: function (aString){
  6249. var self=this,$self=this;
  6250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6251. return $core.withContext(function($ctx1) {
  6252. //>>excludeEnd("ctx");
  6253. return $self._tokenize_(aString);
  6254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6255. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  6256. //>>excludeEnd("ctx");
  6257. },
  6258. //>>excludeStart("ide", pragmas.excludeIdeData);
  6259. args: ["aString"],
  6260. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6261. referencedClasses: [],
  6262. //>>excludeEnd("ide");
  6263. messageSends: ["tokenize:"]
  6264. }),
  6265. $globals.String);
  6266. $core.addMethod(
  6267. $core.method({
  6268. selector: "symbolPrintString",
  6269. protocol: "printing",
  6270. fn: function (){
  6271. var self=this,$self=this;
  6272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6273. return $core.withContext(function($ctx1) {
  6274. //>>excludeEnd("ctx");
  6275. return $recv($globals.String)._streamContents_((function(str){
  6276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6277. return $core.withContext(function($ctx2) {
  6278. //>>excludeEnd("ctx");
  6279. return $self._asSymbolPrintOn_(str);
  6280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6281. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  6282. //>>excludeEnd("ctx");
  6283. }));
  6284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6285. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.String)});
  6286. //>>excludeEnd("ctx");
  6287. },
  6288. //>>excludeStart("ide", pragmas.excludeIdeData);
  6289. args: [],
  6290. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  6291. referencedClasses: ["String"],
  6292. //>>excludeEnd("ide");
  6293. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  6294. }),
  6295. $globals.String);
  6296. $core.addMethod(
  6297. $core.method({
  6298. selector: "tokenize:",
  6299. protocol: "split join",
  6300. fn: function (aString){
  6301. var self=this,$self=this;
  6302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6303. return $core.withContext(function($ctx1) {
  6304. //>>excludeEnd("ctx");
  6305. return self.split(aString);
  6306. return self;
  6307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6308. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  6309. //>>excludeEnd("ctx");
  6310. },
  6311. //>>excludeStart("ide", pragmas.excludeIdeData);
  6312. args: ["aString"],
  6313. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  6314. referencedClasses: [],
  6315. //>>excludeEnd("ide");
  6316. messageSends: []
  6317. }),
  6318. $globals.String);
  6319. $core.addMethod(
  6320. $core.method({
  6321. selector: "trimBoth",
  6322. protocol: "regular expressions",
  6323. fn: function (){
  6324. var self=this,$self=this;
  6325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6326. return $core.withContext(function($ctx1) {
  6327. //>>excludeEnd("ctx");
  6328. return $self._trimBoth_("\x5cs");
  6329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6330. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  6331. //>>excludeEnd("ctx");
  6332. },
  6333. //>>excludeStart("ide", pragmas.excludeIdeData);
  6334. args: [],
  6335. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  6336. referencedClasses: [],
  6337. //>>excludeEnd("ide");
  6338. messageSends: ["trimBoth:"]
  6339. }),
  6340. $globals.String);
  6341. $core.addMethod(
  6342. $core.method({
  6343. selector: "trimBoth:",
  6344. protocol: "regular expressions",
  6345. fn: function (separators){
  6346. var self=this,$self=this;
  6347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6348. return $core.withContext(function($ctx1) {
  6349. //>>excludeEnd("ctx");
  6350. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  6351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6352. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  6353. //>>excludeEnd("ctx");
  6354. },
  6355. //>>excludeStart("ide", pragmas.excludeIdeData);
  6356. args: ["separators"],
  6357. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  6358. referencedClasses: [],
  6359. //>>excludeEnd("ide");
  6360. messageSends: ["trimRight:", "trimLeft:"]
  6361. }),
  6362. $globals.String);
  6363. $core.addMethod(
  6364. $core.method({
  6365. selector: "trimLeft",
  6366. protocol: "regular expressions",
  6367. fn: function (){
  6368. var self=this,$self=this;
  6369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6370. return $core.withContext(function($ctx1) {
  6371. //>>excludeEnd("ctx");
  6372. return $self._trimLeft_("\x5cs");
  6373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6374. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  6375. //>>excludeEnd("ctx");
  6376. },
  6377. //>>excludeStart("ide", pragmas.excludeIdeData);
  6378. args: [],
  6379. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  6380. referencedClasses: [],
  6381. //>>excludeEnd("ide");
  6382. messageSends: ["trimLeft:"]
  6383. }),
  6384. $globals.String);
  6385. $core.addMethod(
  6386. $core.method({
  6387. selector: "trimLeft:",
  6388. protocol: "regular expressions",
  6389. fn: function (separators){
  6390. var self=this,$self=this;
  6391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6392. return $core.withContext(function($ctx1) {
  6393. //>>excludeEnd("ctx");
  6394. var $2,$1;
  6395. $2=$recv("^[".__comma(separators)).__comma("]+");
  6396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6397. $ctx1.sendIdx[","]=1;
  6398. //>>excludeEnd("ctx");
  6399. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6400. return $self._replaceRegexp_with_($1,"");
  6401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6402. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  6403. //>>excludeEnd("ctx");
  6404. },
  6405. //>>excludeStart("ide", pragmas.excludeIdeData);
  6406. args: ["separators"],
  6407. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  6408. referencedClasses: ["RegularExpression"],
  6409. //>>excludeEnd("ide");
  6410. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6411. }),
  6412. $globals.String);
  6413. $core.addMethod(
  6414. $core.method({
  6415. selector: "trimRight",
  6416. protocol: "regular expressions",
  6417. fn: function (){
  6418. var self=this,$self=this;
  6419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6420. return $core.withContext(function($ctx1) {
  6421. //>>excludeEnd("ctx");
  6422. return $self._trimRight_("\x5cs");
  6423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6424. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  6425. //>>excludeEnd("ctx");
  6426. },
  6427. //>>excludeStart("ide", pragmas.excludeIdeData);
  6428. args: [],
  6429. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  6430. referencedClasses: [],
  6431. //>>excludeEnd("ide");
  6432. messageSends: ["trimRight:"]
  6433. }),
  6434. $globals.String);
  6435. $core.addMethod(
  6436. $core.method({
  6437. selector: "trimRight:",
  6438. protocol: "regular expressions",
  6439. fn: function (separators){
  6440. var self=this,$self=this;
  6441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6442. return $core.withContext(function($ctx1) {
  6443. //>>excludeEnd("ctx");
  6444. var $2,$1;
  6445. $2=$recv("[".__comma(separators)).__comma("]+$");
  6446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6447. $ctx1.sendIdx[","]=1;
  6448. //>>excludeEnd("ctx");
  6449. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6450. return $self._replaceRegexp_with_($1,"");
  6451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6452. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  6453. //>>excludeEnd("ctx");
  6454. },
  6455. //>>excludeStart("ide", pragmas.excludeIdeData);
  6456. args: ["separators"],
  6457. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  6458. referencedClasses: ["RegularExpression"],
  6459. //>>excludeEnd("ide");
  6460. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6461. }),
  6462. $globals.String);
  6463. $core.addMethod(
  6464. $core.method({
  6465. selector: "unescaped",
  6466. protocol: "converting",
  6467. fn: function (){
  6468. var self=this,$self=this;
  6469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6470. return $core.withContext(function($ctx1) {
  6471. //>>excludeEnd("ctx");
  6472. return unescape(self);
  6473. return self;
  6474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6475. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  6476. //>>excludeEnd("ctx");
  6477. },
  6478. //>>excludeStart("ide", pragmas.excludeIdeData);
  6479. args: [],
  6480. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  6481. referencedClasses: [],
  6482. //>>excludeEnd("ide");
  6483. messageSends: []
  6484. }),
  6485. $globals.String);
  6486. $core.addMethod(
  6487. $core.method({
  6488. selector: "uriComponentDecoded",
  6489. protocol: "converting",
  6490. fn: function (){
  6491. var self=this,$self=this;
  6492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6493. return $core.withContext(function($ctx1) {
  6494. //>>excludeEnd("ctx");
  6495. return decodeURIComponent(self);
  6496. return self;
  6497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6498. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  6499. //>>excludeEnd("ctx");
  6500. },
  6501. //>>excludeStart("ide", pragmas.excludeIdeData);
  6502. args: [],
  6503. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  6504. referencedClasses: [],
  6505. //>>excludeEnd("ide");
  6506. messageSends: []
  6507. }),
  6508. $globals.String);
  6509. $core.addMethod(
  6510. $core.method({
  6511. selector: "uriComponentEncoded",
  6512. protocol: "converting",
  6513. fn: function (){
  6514. var self=this,$self=this;
  6515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6516. return $core.withContext(function($ctx1) {
  6517. //>>excludeEnd("ctx");
  6518. return encodeURIComponent(self);
  6519. return self;
  6520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6521. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  6522. //>>excludeEnd("ctx");
  6523. },
  6524. //>>excludeStart("ide", pragmas.excludeIdeData);
  6525. args: [],
  6526. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  6527. referencedClasses: [],
  6528. //>>excludeEnd("ide");
  6529. messageSends: []
  6530. }),
  6531. $globals.String);
  6532. $core.addMethod(
  6533. $core.method({
  6534. selector: "uriDecoded",
  6535. protocol: "converting",
  6536. fn: function (){
  6537. var self=this,$self=this;
  6538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6539. return $core.withContext(function($ctx1) {
  6540. //>>excludeEnd("ctx");
  6541. return decodeURI(self);
  6542. return self;
  6543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6544. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  6545. //>>excludeEnd("ctx");
  6546. },
  6547. //>>excludeStart("ide", pragmas.excludeIdeData);
  6548. args: [],
  6549. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  6550. referencedClasses: [],
  6551. //>>excludeEnd("ide");
  6552. messageSends: []
  6553. }),
  6554. $globals.String);
  6555. $core.addMethod(
  6556. $core.method({
  6557. selector: "uriEncoded",
  6558. protocol: "converting",
  6559. fn: function (){
  6560. var self=this,$self=this;
  6561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6562. return $core.withContext(function($ctx1) {
  6563. //>>excludeEnd("ctx");
  6564. return encodeURI(self);
  6565. return self;
  6566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6567. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  6568. //>>excludeEnd("ctx");
  6569. },
  6570. //>>excludeStart("ide", pragmas.excludeIdeData);
  6571. args: [],
  6572. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  6573. referencedClasses: [],
  6574. //>>excludeEnd("ide");
  6575. messageSends: []
  6576. }),
  6577. $globals.String);
  6578. $core.addMethod(
  6579. $core.method({
  6580. selector: "value:",
  6581. protocol: "evaluating",
  6582. fn: function (anObject){
  6583. var self=this,$self=this;
  6584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6585. return $core.withContext(function($ctx1) {
  6586. //>>excludeEnd("ctx");
  6587. return $recv(anObject)._perform_(self);
  6588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6589. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  6590. //>>excludeEnd("ctx");
  6591. },
  6592. //>>excludeStart("ide", pragmas.excludeIdeData);
  6593. args: ["anObject"],
  6594. source: "value: anObject \x0a\x09^ anObject perform: self",
  6595. referencedClasses: [],
  6596. //>>excludeEnd("ide");
  6597. messageSends: ["perform:"]
  6598. }),
  6599. $globals.String);
  6600. $core.addMethod(
  6601. $core.method({
  6602. selector: "cr",
  6603. protocol: "accessing",
  6604. fn: function (){
  6605. var self=this,$self=this;
  6606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6607. return $core.withContext(function($ctx1) {
  6608. //>>excludeEnd("ctx");
  6609. return "\r";
  6610. return self;
  6611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6612. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.a$cls)});
  6613. //>>excludeEnd("ctx");
  6614. },
  6615. //>>excludeStart("ide", pragmas.excludeIdeData);
  6616. args: [],
  6617. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  6618. referencedClasses: [],
  6619. //>>excludeEnd("ide");
  6620. messageSends: []
  6621. }),
  6622. $globals.String.a$cls);
  6623. $core.addMethod(
  6624. $core.method({
  6625. selector: "crlf",
  6626. protocol: "accessing",
  6627. fn: function (){
  6628. var self=this,$self=this;
  6629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6630. return $core.withContext(function($ctx1) {
  6631. //>>excludeEnd("ctx");
  6632. return "\r\n";
  6633. return self;
  6634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6635. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.a$cls)});
  6636. //>>excludeEnd("ctx");
  6637. },
  6638. //>>excludeStart("ide", pragmas.excludeIdeData);
  6639. args: [],
  6640. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  6641. referencedClasses: [],
  6642. //>>excludeEnd("ide");
  6643. messageSends: []
  6644. }),
  6645. $globals.String.a$cls);
  6646. $core.addMethod(
  6647. $core.method({
  6648. selector: "esc",
  6649. protocol: "accessing",
  6650. fn: function (){
  6651. var self=this,$self=this;
  6652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6653. return $core.withContext(function($ctx1) {
  6654. //>>excludeEnd("ctx");
  6655. return $self._fromCharCode_((27));
  6656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6657. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.a$cls)});
  6658. //>>excludeEnd("ctx");
  6659. },
  6660. //>>excludeStart("ide", pragmas.excludeIdeData);
  6661. args: [],
  6662. source: "esc\x0a\x09^ self fromCharCode: 27",
  6663. referencedClasses: [],
  6664. //>>excludeEnd("ide");
  6665. messageSends: ["fromCharCode:"]
  6666. }),
  6667. $globals.String.a$cls);
  6668. $core.addMethod(
  6669. $core.method({
  6670. selector: "fromCharCode:",
  6671. protocol: "instance creation",
  6672. fn: function (anInteger){
  6673. var self=this,$self=this;
  6674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6675. return $core.withContext(function($ctx1) {
  6676. //>>excludeEnd("ctx");
  6677. return String.fromCharCode(anInteger);
  6678. return self;
  6679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6680. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.a$cls)});
  6681. //>>excludeEnd("ctx");
  6682. },
  6683. //>>excludeStart("ide", pragmas.excludeIdeData);
  6684. args: ["anInteger"],
  6685. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  6686. referencedClasses: [],
  6687. //>>excludeEnd("ide");
  6688. messageSends: []
  6689. }),
  6690. $globals.String.a$cls);
  6691. $core.addMethod(
  6692. $core.method({
  6693. selector: "fromString:",
  6694. protocol: "instance creation",
  6695. fn: function (aString){
  6696. var self=this,$self=this;
  6697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6698. return $core.withContext(function($ctx1) {
  6699. //>>excludeEnd("ctx");
  6700. return String(aString);
  6701. return self;
  6702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6703. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.a$cls)});
  6704. //>>excludeEnd("ctx");
  6705. },
  6706. //>>excludeStart("ide", pragmas.excludeIdeData);
  6707. args: ["aString"],
  6708. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  6709. referencedClasses: [],
  6710. //>>excludeEnd("ide");
  6711. messageSends: []
  6712. }),
  6713. $globals.String.a$cls);
  6714. $core.addMethod(
  6715. $core.method({
  6716. selector: "lf",
  6717. protocol: "accessing",
  6718. fn: function (){
  6719. var self=this,$self=this;
  6720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6721. return $core.withContext(function($ctx1) {
  6722. //>>excludeEnd("ctx");
  6723. return "\n";
  6724. return self;
  6725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6726. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.a$cls)});
  6727. //>>excludeEnd("ctx");
  6728. },
  6729. //>>excludeStart("ide", pragmas.excludeIdeData);
  6730. args: [],
  6731. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  6732. referencedClasses: [],
  6733. //>>excludeEnd("ide");
  6734. messageSends: []
  6735. }),
  6736. $globals.String.a$cls);
  6737. $core.addMethod(
  6738. $core.method({
  6739. selector: "random",
  6740. protocol: "random",
  6741. fn: function (){
  6742. var self=this,$self=this;
  6743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6744. return $core.withContext(function($ctx1) {
  6745. //>>excludeEnd("ctx");
  6746. return ((10+22*Math.random())/32).toString(32).slice(2);;
  6747. return self;
  6748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6749. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.a$cls)});
  6750. //>>excludeEnd("ctx");
  6751. },
  6752. //>>excludeStart("ide", pragmas.excludeIdeData);
  6753. args: [],
  6754. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return ((10+22*Math.random())/32).toString(32).slice(2);'>",
  6755. referencedClasses: [],
  6756. //>>excludeEnd("ide");
  6757. messageSends: []
  6758. }),
  6759. $globals.String.a$cls);
  6760. $core.addMethod(
  6761. $core.method({
  6762. selector: "randomNotIn:",
  6763. protocol: "random",
  6764. fn: function (aString){
  6765. var self=this,$self=this;
  6766. var result;
  6767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6768. return $core.withContext(function($ctx1) {
  6769. //>>excludeEnd("ctx");
  6770. $recv((function(){
  6771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6772. return $core.withContext(function($ctx2) {
  6773. //>>excludeEnd("ctx");
  6774. result=$self._random();
  6775. return $recv(aString)._includesSubString_(result);
  6776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6777. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6778. //>>excludeEnd("ctx");
  6779. }))._whileTrue();
  6780. return result;
  6781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6782. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.a$cls)});
  6783. //>>excludeEnd("ctx");
  6784. },
  6785. //>>excludeStart("ide", pragmas.excludeIdeData);
  6786. args: ["aString"],
  6787. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  6788. referencedClasses: [],
  6789. //>>excludeEnd("ide");
  6790. messageSends: ["whileTrue", "random", "includesSubString:"]
  6791. }),
  6792. $globals.String.a$cls);
  6793. $core.addMethod(
  6794. $core.method({
  6795. selector: "space",
  6796. protocol: "accessing",
  6797. fn: function (){
  6798. var self=this,$self=this;
  6799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6800. return $core.withContext(function($ctx1) {
  6801. //>>excludeEnd("ctx");
  6802. return " ";
  6803. return self;
  6804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6805. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.a$cls)});
  6806. //>>excludeEnd("ctx");
  6807. },
  6808. //>>excludeStart("ide", pragmas.excludeIdeData);
  6809. args: [],
  6810. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  6811. referencedClasses: [],
  6812. //>>excludeEnd("ide");
  6813. messageSends: []
  6814. }),
  6815. $globals.String.a$cls);
  6816. $core.addMethod(
  6817. $core.method({
  6818. selector: "streamClass",
  6819. protocol: "accessing",
  6820. fn: function (){
  6821. var self=this,$self=this;
  6822. return $globals.StringStream;
  6823. },
  6824. //>>excludeStart("ide", pragmas.excludeIdeData);
  6825. args: [],
  6826. source: "streamClass\x0a\x09\x09^ StringStream",
  6827. referencedClasses: ["StringStream"],
  6828. //>>excludeEnd("ide");
  6829. messageSends: []
  6830. }),
  6831. $globals.String.a$cls);
  6832. $core.addMethod(
  6833. $core.method({
  6834. selector: "tab",
  6835. protocol: "accessing",
  6836. fn: function (){
  6837. var self=this,$self=this;
  6838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6839. return $core.withContext(function($ctx1) {
  6840. //>>excludeEnd("ctx");
  6841. return "\t";
  6842. return self;
  6843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6844. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.a$cls)});
  6845. //>>excludeEnd("ctx");
  6846. },
  6847. //>>excludeStart("ide", pragmas.excludeIdeData);
  6848. args: [],
  6849. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  6850. referencedClasses: [],
  6851. //>>excludeEnd("ide");
  6852. messageSends: []
  6853. }),
  6854. $globals.String.a$cls);
  6855. $core.addMethod(
  6856. $core.method({
  6857. selector: "value:",
  6858. protocol: "instance creation",
  6859. fn: function (aUTFCharCode){
  6860. var self=this,$self=this;
  6861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6862. return $core.withContext(function($ctx1) {
  6863. //>>excludeEnd("ctx");
  6864. return String.fromCharCode(aUTFCharCode);;
  6865. return self;
  6866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6867. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.a$cls)});
  6868. //>>excludeEnd("ctx");
  6869. },
  6870. //>>excludeStart("ide", pragmas.excludeIdeData);
  6871. args: ["aUTFCharCode"],
  6872. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  6873. referencedClasses: [],
  6874. //>>excludeEnd("ide");
  6875. messageSends: []
  6876. }),
  6877. $globals.String.a$cls);
  6878. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  6879. //>>excludeStart("ide", pragmas.excludeIdeData);
  6880. $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`.";
  6881. //>>excludeEnd("ide");
  6882. $core.addMethod(
  6883. $core.method({
  6884. selector: "=",
  6885. protocol: "comparing",
  6886. fn: function (aCollection){
  6887. var self=this,$self=this;
  6888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6889. return $core.withContext(function($ctx1) {
  6890. //>>excludeEnd("ctx");
  6891. var $2,$1,$4,$3,$5;
  6892. var $early={};
  6893. try {
  6894. $2=$self._class();
  6895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6896. $ctx1.sendIdx["class"]=1;
  6897. //>>excludeEnd("ctx");
  6898. $1=$recv($2).__eq($recv(aCollection)._class());
  6899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6900. $ctx1.sendIdx["="]=1;
  6901. //>>excludeEnd("ctx");
  6902. if(!$core.assert($1)){
  6903. return false;
  6904. }
  6905. $4=$self._size();
  6906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6907. $ctx1.sendIdx["size"]=1;
  6908. //>>excludeEnd("ctx");
  6909. $3=$recv($4).__eq($recv(aCollection)._size());
  6910. if(!$core.assert($3)){
  6911. return false;
  6912. }
  6913. $self._do_((function(each){
  6914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6915. return $core.withContext(function($ctx2) {
  6916. //>>excludeEnd("ctx");
  6917. $5=$recv(aCollection)._includes_(each);
  6918. if(!$core.assert($5)){
  6919. throw $early=[false];
  6920. }
  6921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6922. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  6923. //>>excludeEnd("ctx");
  6924. }));
  6925. return true;
  6926. }
  6927. catch(e) {if(e===$early)return e[0]; throw e}
  6928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6929. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  6930. //>>excludeEnd("ctx");
  6931. },
  6932. //>>excludeStart("ide", pragmas.excludeIdeData);
  6933. args: ["aCollection"],
  6934. 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",
  6935. referencedClasses: [],
  6936. //>>excludeEnd("ide");
  6937. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  6938. }),
  6939. $globals.Set);
  6940. $core.addMethod(
  6941. $core.method({
  6942. selector: "add:",
  6943. protocol: "adding/removing",
  6944. fn: function (anObject){
  6945. var self=this,$self=this;
  6946. var bucket;
  6947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6948. return $core.withContext(function($ctx1) {
  6949. //>>excludeEnd("ctx");
  6950. var $1,$receiver;
  6951. bucket=$self._bucketsOfElement_(anObject);
  6952. $1=$recv(bucket)._second();
  6953. if(($receiver = $1) == null || $receiver.a$nil){
  6954. var object,slowBucket;
  6955. object=$recv(bucket)._first();
  6956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6957. $ctx1.sendIdx["first"]=1;
  6958. //>>excludeEnd("ctx");
  6959. slowBucket=$recv(bucket)._third();
  6960. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  6961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6962. return $core.withContext(function($ctx2) {
  6963. //>>excludeEnd("ctx");
  6964. $recv(slowBucket)._add_(object);
  6965. $self.size=$recv($self.size).__plus((1));
  6966. return $self.size;
  6967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6969. //>>excludeEnd("ctx");
  6970. }));
  6971. return object;
  6972. } else {
  6973. var primitiveBucket;
  6974. primitiveBucket=$receiver;
  6975. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  6976. }
  6977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6978. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  6979. //>>excludeEnd("ctx");
  6980. },
  6981. //>>excludeStart("ide", pragmas.excludeIdeData);
  6982. args: ["anObject"],
  6983. 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 ]",
  6984. referencedClasses: [],
  6985. //>>excludeEnd("ide");
  6986. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  6987. }),
  6988. $globals.Set);
  6989. $core.addMethod(
  6990. $core.method({
  6991. selector: "add:in:",
  6992. protocol: "private",
  6993. fn: function (anObject,anotherObject){
  6994. var self=this,$self=this;
  6995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6996. return $core.withContext(function($ctx1) {
  6997. //>>excludeEnd("ctx");
  6998. if (anObject in anotherObject.store) { return anObject; }
  6999. $self['@size']++;
  7000. anotherObject.store[anObject] = true;
  7001. return anObject;
  7002. ;
  7003. return self;
  7004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7005. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7006. //>>excludeEnd("ctx");
  7007. },
  7008. //>>excludeStart("ide", pragmas.excludeIdeData);
  7009. args: ["anObject", "anotherObject"],
  7010. 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'>",
  7011. referencedClasses: [],
  7012. //>>excludeEnd("ide");
  7013. messageSends: []
  7014. }),
  7015. $globals.Set);
  7016. $core.addMethod(
  7017. $core.method({
  7018. selector: "bucketsOfElement:",
  7019. protocol: "private",
  7020. fn: function (anObject){
  7021. var self=this,$self=this;
  7022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7023. return $core.withContext(function($ctx1) {
  7024. //>>excludeEnd("ctx");
  7025. // include nil to well-known objects under "boolean" fastBucket
  7026. if (anObject == null || anObject.a$nil) return [ null, $self['@fastBuckets'].boolean ];
  7027. var prim = anObject.valueOf();
  7028. if (typeof prim === "object" || typeof prim === "function" || !$self['@fastBuckets'][typeof prim]) {
  7029. var bucket = null;
  7030. $self['@slowBucketStores'].some(function (store) {
  7031. return bucket = store._bucketOfElement_(anObject);
  7032. });
  7033. return [ anObject, null, bucket || $self['@defaultBucket'] ];
  7034. }
  7035. return [ prim, $self['@fastBuckets'][typeof prim] ];
  7036. ;
  7037. return self;
  7038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7039. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  7040. //>>excludeEnd("ctx");
  7041. },
  7042. //>>excludeStart("ide", pragmas.excludeIdeData);
  7043. args: ["anObject"],
  7044. 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'>",
  7045. referencedClasses: [],
  7046. //>>excludeEnd("ide");
  7047. messageSends: []
  7048. }),
  7049. $globals.Set);
  7050. $core.addMethod(
  7051. $core.method({
  7052. selector: "classNameOf:",
  7053. protocol: "private",
  7054. fn: function (anObject){
  7055. var self=this,$self=this;
  7056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7057. return $core.withContext(function($ctx1) {
  7058. //>>excludeEnd("ctx");
  7059. return anObject.a$cls != null && anObject.a$cls.name;
  7060. return self;
  7061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7062. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  7063. //>>excludeEnd("ctx");
  7064. },
  7065. //>>excludeStart("ide", pragmas.excludeIdeData);
  7066. args: ["anObject"],
  7067. 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'>",
  7068. referencedClasses: [],
  7069. //>>excludeEnd("ide");
  7070. messageSends: []
  7071. }),
  7072. $globals.Set);
  7073. $core.addMethod(
  7074. $core.method({
  7075. selector: "collect:",
  7076. protocol: "enumerating",
  7077. fn: function (aBlock){
  7078. var self=this,$self=this;
  7079. var collection;
  7080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7081. return $core.withContext(function($ctx1) {
  7082. //>>excludeEnd("ctx");
  7083. collection=$recv($self._class())._new();
  7084. $self._do_((function(each){
  7085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7086. return $core.withContext(function($ctx2) {
  7087. //>>excludeEnd("ctx");
  7088. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7090. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7091. //>>excludeEnd("ctx");
  7092. }));
  7093. return collection;
  7094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7095. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  7096. //>>excludeEnd("ctx");
  7097. },
  7098. //>>excludeStart("ide", pragmas.excludeIdeData);
  7099. args: ["aBlock"],
  7100. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7101. referencedClasses: [],
  7102. //>>excludeEnd("ide");
  7103. messageSends: ["new", "class", "do:", "add:", "value:"]
  7104. }),
  7105. $globals.Set);
  7106. $core.addMethod(
  7107. $core.method({
  7108. selector: "do:",
  7109. protocol: "enumerating",
  7110. fn: function (aBlock){
  7111. var self=this,$self=this;
  7112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7113. return $core.withContext(function($ctx1) {
  7114. //>>excludeEnd("ctx");
  7115. var el, keys, i;
  7116. el = $self['@fastBuckets'];
  7117. keys = Object.keys(el);
  7118. for (i = 0; i < keys.length; ++i) {
  7119. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7120. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7121. else { store._do_(aBlock); }
  7122. }
  7123. el = $self['@slowBucketStores'];
  7124. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7125. $self['@defaultBucket']._do_(aBlock);
  7126. ;
  7127. return self;
  7128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7129. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  7130. //>>excludeEnd("ctx");
  7131. },
  7132. //>>excludeStart("ide", pragmas.excludeIdeData);
  7133. args: ["aBlock"],
  7134. 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'>",
  7135. referencedClasses: [],
  7136. //>>excludeEnd("ide");
  7137. messageSends: []
  7138. }),
  7139. $globals.Set);
  7140. $core.addMethod(
  7141. $core.method({
  7142. selector: "includes:",
  7143. protocol: "testing",
  7144. fn: function (anObject){
  7145. var self=this,$self=this;
  7146. var bucket;
  7147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7148. return $core.withContext(function($ctx1) {
  7149. //>>excludeEnd("ctx");
  7150. var $1,$2,$3,$receiver;
  7151. bucket=$self._bucketsOfElement_(anObject);
  7152. $1=$recv(bucket)._second();
  7153. if(($receiver = $1) == null || $receiver.a$nil){
  7154. $2=$recv(bucket)._third();
  7155. $3=$recv(bucket)._first();
  7156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7157. $ctx1.sendIdx["first"]=1;
  7158. //>>excludeEnd("ctx");
  7159. return $recv($2)._includes_($3);
  7160. } else {
  7161. var primitiveBucket;
  7162. primitiveBucket=$receiver;
  7163. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7164. }
  7165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7166. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7167. //>>excludeEnd("ctx");
  7168. },
  7169. //>>excludeStart("ide", pragmas.excludeIdeData);
  7170. args: ["anObject"],
  7171. 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 ]",
  7172. referencedClasses: [],
  7173. //>>excludeEnd("ide");
  7174. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7175. }),
  7176. $globals.Set);
  7177. $core.addMethod(
  7178. $core.method({
  7179. selector: "includes:in:",
  7180. protocol: "private",
  7181. fn: function (anObject,anotherObject){
  7182. var self=this,$self=this;
  7183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7184. return $core.withContext(function($ctx1) {
  7185. //>>excludeEnd("ctx");
  7186. return anObject in anotherObject.store;
  7187. return self;
  7188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7189. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7190. //>>excludeEnd("ctx");
  7191. },
  7192. //>>excludeStart("ide", pragmas.excludeIdeData);
  7193. args: ["anObject", "anotherObject"],
  7194. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  7195. referencedClasses: [],
  7196. //>>excludeEnd("ide");
  7197. messageSends: []
  7198. }),
  7199. $globals.Set);
  7200. $core.addMethod(
  7201. $core.method({
  7202. selector: "initialize",
  7203. protocol: "initialization",
  7204. fn: function (){
  7205. var self=this,$self=this;
  7206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7207. return $core.withContext(function($ctx1) {
  7208. //>>excludeEnd("ctx");
  7209. (
  7210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7211. $ctx1.supercall = true,
  7212. //>>excludeEnd("ctx");
  7213. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  7214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7215. $ctx1.supercall = false;
  7216. //>>excludeEnd("ctx");;
  7217. $self.defaultBucket=[];
  7218. $self._initializeSlowBucketStores();
  7219. $self._removeAll();
  7220. return self;
  7221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7222. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  7223. //>>excludeEnd("ctx");
  7224. },
  7225. //>>excludeStart("ide", pragmas.excludeIdeData);
  7226. args: [],
  7227. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7228. referencedClasses: [],
  7229. //>>excludeEnd("ide");
  7230. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7231. }),
  7232. $globals.Set);
  7233. $core.addMethod(
  7234. $core.method({
  7235. selector: "initializeSlowBucketStores",
  7236. protocol: "initialization",
  7237. fn: function (){
  7238. var self=this,$self=this;
  7239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7240. return $core.withContext(function($ctx1) {
  7241. //>>excludeEnd("ctx");
  7242. var $1;
  7243. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7245. return $core.withContext(function($ctx2) {
  7246. //>>excludeEnd("ctx");
  7247. return $self._classNameOf_(x);
  7248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7249. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7250. //>>excludeEnd("ctx");
  7251. }));
  7252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7253. $ctx1.sendIdx["hashBlock:"]=1;
  7254. //>>excludeEnd("ctx");
  7255. $self.slowBucketStores=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7257. return $core.withContext(function($ctx2) {
  7258. //>>excludeEnd("ctx");
  7259. return $self._jsConstructorNameOf_(x);
  7260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7261. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7262. //>>excludeEnd("ctx");
  7263. }))];
  7264. return self;
  7265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7266. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  7267. //>>excludeEnd("ctx");
  7268. },
  7269. //>>excludeStart("ide", pragmas.excludeIdeData);
  7270. args: [],
  7271. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7272. referencedClasses: ["ArrayBucketStore"],
  7273. //>>excludeEnd("ide");
  7274. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  7275. }),
  7276. $globals.Set);
  7277. $core.addMethod(
  7278. $core.method({
  7279. selector: "jsConstructorNameOf:",
  7280. protocol: "private",
  7281. fn: function (anObject){
  7282. var self=this,$self=this;
  7283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7284. return $core.withContext(function($ctx1) {
  7285. //>>excludeEnd("ctx");
  7286. return anObject.constructor && anObject.constructor.name;
  7287. return self;
  7288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7289. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  7290. //>>excludeEnd("ctx");
  7291. },
  7292. //>>excludeStart("ide", pragmas.excludeIdeData);
  7293. args: ["anObject"],
  7294. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  7295. referencedClasses: [],
  7296. //>>excludeEnd("ide");
  7297. messageSends: []
  7298. }),
  7299. $globals.Set);
  7300. $core.addMethod(
  7301. $core.method({
  7302. selector: "printOn:",
  7303. protocol: "printing",
  7304. fn: function (aStream){
  7305. var self=this,$self=this;
  7306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7307. return $core.withContext(function($ctx1) {
  7308. //>>excludeEnd("ctx");
  7309. (
  7310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7311. $ctx1.supercall = true,
  7312. //>>excludeEnd("ctx");
  7313. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  7314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7315. $ctx1.supercall = false;
  7316. //>>excludeEnd("ctx");;
  7317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7318. $ctx1.sendIdx["printOn:"]=1;
  7319. //>>excludeEnd("ctx");
  7320. $recv(aStream)._nextPutAll_(" (");
  7321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7322. $ctx1.sendIdx["nextPutAll:"]=1;
  7323. //>>excludeEnd("ctx");
  7324. $self._do_separatedBy_((function(each){
  7325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7326. return $core.withContext(function($ctx2) {
  7327. //>>excludeEnd("ctx");
  7328. return $recv(each)._printOn_(aStream);
  7329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7330. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7331. //>>excludeEnd("ctx");
  7332. }),(function(){
  7333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7334. return $core.withContext(function($ctx2) {
  7335. //>>excludeEnd("ctx");
  7336. return $recv(aStream)._nextPutAll_(" ");
  7337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7338. $ctx2.sendIdx["nextPutAll:"]=2;
  7339. //>>excludeEnd("ctx");
  7340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7342. //>>excludeEnd("ctx");
  7343. }));
  7344. $recv(aStream)._nextPutAll_(")");
  7345. return self;
  7346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7347. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  7348. //>>excludeEnd("ctx");
  7349. },
  7350. //>>excludeStart("ide", pragmas.excludeIdeData);
  7351. args: ["aStream"],
  7352. 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: ')'",
  7353. referencedClasses: [],
  7354. //>>excludeEnd("ide");
  7355. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  7356. }),
  7357. $globals.Set);
  7358. $core.addMethod(
  7359. $core.method({
  7360. selector: "remove:ifAbsent:",
  7361. protocol: "adding/removing",
  7362. fn: function (anObject,aBlock){
  7363. var self=this,$self=this;
  7364. var bucket;
  7365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7366. return $core.withContext(function($ctx1) {
  7367. //>>excludeEnd("ctx");
  7368. var $1,$2,$3,$receiver;
  7369. var $early={};
  7370. try {
  7371. bucket=$self._bucketsOfElement_(anObject);
  7372. $1=$recv(bucket)._second();
  7373. if(($receiver = $1) == null || $receiver.a$nil){
  7374. $2=$recv(bucket)._third();
  7375. $3=$recv(bucket)._first();
  7376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7377. $ctx1.sendIdx["first"]=1;
  7378. //>>excludeEnd("ctx");
  7379. $recv($2)._remove_ifAbsent_($3,(function(){
  7380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7381. return $core.withContext(function($ctx2) {
  7382. //>>excludeEnd("ctx");
  7383. throw $early=[$recv(aBlock)._value()];
  7384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7385. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7386. //>>excludeEnd("ctx");
  7387. }));
  7388. $self.size=$recv($self.size).__minus((1));
  7389. return $self.size;
  7390. } else {
  7391. var primitiveBucket;
  7392. primitiveBucket=$receiver;
  7393. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  7394. }
  7395. }
  7396. catch(e) {if(e===$early)return e[0]; throw e}
  7397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7398. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  7399. //>>excludeEnd("ctx");
  7400. },
  7401. //>>excludeStart("ide", pragmas.excludeIdeData);
  7402. args: ["anObject", "aBlock"],
  7403. 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 ]",
  7404. referencedClasses: [],
  7405. //>>excludeEnd("ide");
  7406. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:ifAbsent:"]
  7407. }),
  7408. $globals.Set);
  7409. $core.addMethod(
  7410. $core.method({
  7411. selector: "remove:in:ifAbsent:",
  7412. protocol: "private",
  7413. fn: function (anObject,anotherObject,aBlock){
  7414. var self=this,$self=this;
  7415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7416. return $core.withContext(function($ctx1) {
  7417. //>>excludeEnd("ctx");
  7418. if (anObject in anotherObject.store) {
  7419. delete anotherObject.store[anObject];
  7420. $self['@size']--;
  7421. return anObject;
  7422. } else {
  7423. return aBlock._value();
  7424. };
  7425. return self;
  7426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7427. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock},$globals.Set)});
  7428. //>>excludeEnd("ctx");
  7429. },
  7430. //>>excludeStart("ide", pragmas.excludeIdeData);
  7431. args: ["anObject", "anotherObject", "aBlock"],
  7432. 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}'>",
  7433. referencedClasses: [],
  7434. //>>excludeEnd("ide");
  7435. messageSends: []
  7436. }),
  7437. $globals.Set);
  7438. $core.addMethod(
  7439. $core.method({
  7440. selector: "removeAll",
  7441. protocol: "adding/removing",
  7442. fn: function (){
  7443. var self=this,$self=this;
  7444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7445. return $core.withContext(function($ctx1) {
  7446. //>>excludeEnd("ctx");
  7447. $self['@fastBuckets'] = {
  7448. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  7449. "number": { store: Object.create(null), fn: Number },
  7450. "string": { store: Object.create(null) }
  7451. };
  7452. $self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  7453. $self['@defaultBucket']._removeAll();
  7454. $self['@size'] = 0;
  7455. ;
  7456. return self;
  7457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7458. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  7459. //>>excludeEnd("ctx");
  7460. },
  7461. //>>excludeStart("ide", pragmas.excludeIdeData);
  7462. args: [],
  7463. 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'>",
  7464. referencedClasses: [],
  7465. //>>excludeEnd("ide");
  7466. messageSends: []
  7467. }),
  7468. $globals.Set);
  7469. $core.addMethod(
  7470. $core.method({
  7471. selector: "select:",
  7472. protocol: "enumerating",
  7473. fn: function (aBlock){
  7474. var self=this,$self=this;
  7475. var collection;
  7476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7477. return $core.withContext(function($ctx1) {
  7478. //>>excludeEnd("ctx");
  7479. var $1;
  7480. collection=$recv($self._class())._new();
  7481. $self._do_((function(each){
  7482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7483. return $core.withContext(function($ctx2) {
  7484. //>>excludeEnd("ctx");
  7485. $1=$recv(aBlock)._value_(each);
  7486. if($core.assert($1)){
  7487. return $recv(collection)._add_(each);
  7488. }
  7489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7490. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7491. //>>excludeEnd("ctx");
  7492. }));
  7493. return collection;
  7494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7495. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  7496. //>>excludeEnd("ctx");
  7497. },
  7498. //>>excludeStart("ide", pragmas.excludeIdeData);
  7499. args: ["aBlock"],
  7500. 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",
  7501. referencedClasses: [],
  7502. //>>excludeEnd("ide");
  7503. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7504. }),
  7505. $globals.Set);
  7506. $core.addMethod(
  7507. $core.method({
  7508. selector: "select:thenCollect:",
  7509. protocol: "enumerating",
  7510. fn: function (selectBlock,collectBlock){
  7511. var self=this,$self=this;
  7512. var collection;
  7513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7514. return $core.withContext(function($ctx1) {
  7515. //>>excludeEnd("ctx");
  7516. var $1;
  7517. collection=$recv($self._class())._new();
  7518. $self._do_((function(each){
  7519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7520. return $core.withContext(function($ctx2) {
  7521. //>>excludeEnd("ctx");
  7522. $1=$recv(selectBlock)._value_(each);
  7523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7524. $ctx2.sendIdx["value:"]=1;
  7525. //>>excludeEnd("ctx");
  7526. if($core.assert($1)){
  7527. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  7528. }
  7529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7530. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7531. //>>excludeEnd("ctx");
  7532. }));
  7533. return collection;
  7534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7535. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  7536. //>>excludeEnd("ctx");
  7537. },
  7538. //>>excludeStart("ide", pragmas.excludeIdeData);
  7539. args: ["selectBlock", "collectBlock"],
  7540. 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",
  7541. referencedClasses: [],
  7542. //>>excludeEnd("ide");
  7543. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7544. }),
  7545. $globals.Set);
  7546. $core.addMethod(
  7547. $core.method({
  7548. selector: "size",
  7549. protocol: "accessing",
  7550. fn: function (){
  7551. var self=this,$self=this;
  7552. return $self.size;
  7553. },
  7554. //>>excludeStart("ide", pragmas.excludeIdeData);
  7555. args: [],
  7556. source: "size\x0a\x09^ size",
  7557. referencedClasses: [],
  7558. //>>excludeEnd("ide");
  7559. messageSends: []
  7560. }),
  7561. $globals.Set);
  7562. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  7563. //>>excludeStart("ide", pragmas.excludeIdeData);
  7564. $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.";
  7565. //>>excludeEnd("ide");
  7566. $core.addMethod(
  7567. $core.method({
  7568. selector: "<<",
  7569. protocol: "writing",
  7570. fn: function (anObject){
  7571. var self=this,$self=this;
  7572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7573. return $core.withContext(function($ctx1) {
  7574. //>>excludeEnd("ctx");
  7575. $self._write_(anObject);
  7576. return self;
  7577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7578. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  7579. //>>excludeEnd("ctx");
  7580. },
  7581. //>>excludeStart("ide", pragmas.excludeIdeData);
  7582. args: ["anObject"],
  7583. source: "<< anObject\x0a\x09self write: anObject",
  7584. referencedClasses: [],
  7585. //>>excludeEnd("ide");
  7586. messageSends: ["write:"]
  7587. }),
  7588. $globals.ProtoStream);
  7589. $core.addMethod(
  7590. $core.method({
  7591. selector: "atEnd",
  7592. protocol: "testing",
  7593. fn: function (){
  7594. var self=this,$self=this;
  7595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7596. return $core.withContext(function($ctx1) {
  7597. //>>excludeEnd("ctx");
  7598. $self._subclassResponsibility();
  7599. return self;
  7600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7601. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  7602. //>>excludeEnd("ctx");
  7603. },
  7604. //>>excludeStart("ide", pragmas.excludeIdeData);
  7605. args: [],
  7606. source: "atEnd\x0a\x09self subclassResponsibility",
  7607. referencedClasses: [],
  7608. //>>excludeEnd("ide");
  7609. messageSends: ["subclassResponsibility"]
  7610. }),
  7611. $globals.ProtoStream);
  7612. $core.addMethod(
  7613. $core.method({
  7614. selector: "atStart",
  7615. protocol: "testing",
  7616. fn: function (){
  7617. var self=this,$self=this;
  7618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7619. return $core.withContext(function($ctx1) {
  7620. //>>excludeEnd("ctx");
  7621. $self._subclassResponsibility();
  7622. return self;
  7623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7624. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  7625. //>>excludeEnd("ctx");
  7626. },
  7627. //>>excludeStart("ide", pragmas.excludeIdeData);
  7628. args: [],
  7629. source: "atStart\x0a\x09self subclassResponsibility",
  7630. referencedClasses: [],
  7631. //>>excludeEnd("ide");
  7632. messageSends: ["subclassResponsibility"]
  7633. }),
  7634. $globals.ProtoStream);
  7635. $core.addMethod(
  7636. $core.method({
  7637. selector: "contents",
  7638. protocol: "accessing",
  7639. fn: function (){
  7640. var self=this,$self=this;
  7641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7642. return $core.withContext(function($ctx1) {
  7643. //>>excludeEnd("ctx");
  7644. $self._subclassResponsibility();
  7645. return self;
  7646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7647. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  7648. //>>excludeEnd("ctx");
  7649. },
  7650. //>>excludeStart("ide", pragmas.excludeIdeData);
  7651. args: [],
  7652. source: "contents\x0a\x09self subclassResponsibility",
  7653. referencedClasses: [],
  7654. //>>excludeEnd("ide");
  7655. messageSends: ["subclassResponsibility"]
  7656. }),
  7657. $globals.ProtoStream);
  7658. $core.addMethod(
  7659. $core.method({
  7660. selector: "do:",
  7661. protocol: "enumerating",
  7662. fn: function (aBlock){
  7663. var self=this,$self=this;
  7664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7665. return $core.withContext(function($ctx1) {
  7666. //>>excludeEnd("ctx");
  7667. $recv((function(){
  7668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7669. return $core.withContext(function($ctx2) {
  7670. //>>excludeEnd("ctx");
  7671. return $self._atEnd();
  7672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7673. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7674. //>>excludeEnd("ctx");
  7675. }))._whileFalse_((function(){
  7676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7677. return $core.withContext(function($ctx2) {
  7678. //>>excludeEnd("ctx");
  7679. return $recv(aBlock)._value_($self._next());
  7680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7681. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7682. //>>excludeEnd("ctx");
  7683. }));
  7684. return self;
  7685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7686. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  7687. //>>excludeEnd("ctx");
  7688. },
  7689. //>>excludeStart("ide", pragmas.excludeIdeData);
  7690. args: ["aBlock"],
  7691. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  7692. referencedClasses: [],
  7693. //>>excludeEnd("ide");
  7694. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  7695. }),
  7696. $globals.ProtoStream);
  7697. $core.addMethod(
  7698. $core.method({
  7699. selector: "isEmpty",
  7700. protocol: "testing",
  7701. fn: function (){
  7702. var self=this,$self=this;
  7703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7704. return $core.withContext(function($ctx1) {
  7705. //>>excludeEnd("ctx");
  7706. return $recv($self._atStart())._and_((function(){
  7707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7708. return $core.withContext(function($ctx2) {
  7709. //>>excludeEnd("ctx");
  7710. return $self._atEnd();
  7711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7712. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7713. //>>excludeEnd("ctx");
  7714. }));
  7715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7716. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  7717. //>>excludeEnd("ctx");
  7718. },
  7719. //>>excludeStart("ide", pragmas.excludeIdeData);
  7720. args: [],
  7721. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  7722. referencedClasses: [],
  7723. //>>excludeEnd("ide");
  7724. messageSends: ["and:", "atStart", "atEnd"]
  7725. }),
  7726. $globals.ProtoStream);
  7727. $core.addMethod(
  7728. $core.method({
  7729. selector: "next",
  7730. protocol: "reading",
  7731. fn: function (){
  7732. var self=this,$self=this;
  7733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7734. return $core.withContext(function($ctx1) {
  7735. //>>excludeEnd("ctx");
  7736. var $1;
  7737. $1=$self._atEnd();
  7738. if($core.assert($1)){
  7739. return nil;
  7740. } else {
  7741. return $self._subclassResponsibility();
  7742. }
  7743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7744. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  7745. //>>excludeEnd("ctx");
  7746. },
  7747. //>>excludeStart("ide", pragmas.excludeIdeData);
  7748. args: [],
  7749. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7750. referencedClasses: [],
  7751. //>>excludeEnd("ide");
  7752. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7753. }),
  7754. $globals.ProtoStream);
  7755. $core.addMethod(
  7756. $core.method({
  7757. selector: "nextPut:",
  7758. protocol: "writing",
  7759. fn: function (anObject){
  7760. var self=this,$self=this;
  7761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7762. return $core.withContext(function($ctx1) {
  7763. //>>excludeEnd("ctx");
  7764. $self._subclassResponsibility();
  7765. return self;
  7766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7767. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  7768. //>>excludeEnd("ctx");
  7769. },
  7770. //>>excludeStart("ide", pragmas.excludeIdeData);
  7771. args: ["anObject"],
  7772. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  7773. referencedClasses: [],
  7774. //>>excludeEnd("ide");
  7775. messageSends: ["subclassResponsibility"]
  7776. }),
  7777. $globals.ProtoStream);
  7778. $core.addMethod(
  7779. $core.method({
  7780. selector: "nextPutAll:",
  7781. protocol: "writing",
  7782. fn: function (aCollection){
  7783. var self=this,$self=this;
  7784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7785. return $core.withContext(function($ctx1) {
  7786. //>>excludeEnd("ctx");
  7787. $recv(aCollection)._do_((function(each){
  7788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7789. return $core.withContext(function($ctx2) {
  7790. //>>excludeEnd("ctx");
  7791. return $self._nextPut_(each);
  7792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7793. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7794. //>>excludeEnd("ctx");
  7795. }));
  7796. return self;
  7797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7798. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  7799. //>>excludeEnd("ctx");
  7800. },
  7801. //>>excludeStart("ide", pragmas.excludeIdeData);
  7802. args: ["aCollection"],
  7803. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  7804. referencedClasses: [],
  7805. //>>excludeEnd("ide");
  7806. messageSends: ["do:", "nextPut:"]
  7807. }),
  7808. $globals.ProtoStream);
  7809. $core.addMethod(
  7810. $core.method({
  7811. selector: "nextPutString:",
  7812. protocol: "writing",
  7813. fn: function (aString){
  7814. var self=this,$self=this;
  7815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7816. return $core.withContext(function($ctx1) {
  7817. //>>excludeEnd("ctx");
  7818. $self._nextPut_(aString);
  7819. return self;
  7820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7821. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  7822. //>>excludeEnd("ctx");
  7823. },
  7824. //>>excludeStart("ide", pragmas.excludeIdeData);
  7825. args: ["aString"],
  7826. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  7827. referencedClasses: [],
  7828. //>>excludeEnd("ide");
  7829. messageSends: ["nextPut:"]
  7830. }),
  7831. $globals.ProtoStream);
  7832. $core.addMethod(
  7833. $core.method({
  7834. selector: "peek",
  7835. protocol: "reading",
  7836. fn: function (){
  7837. var self=this,$self=this;
  7838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7839. return $core.withContext(function($ctx1) {
  7840. //>>excludeEnd("ctx");
  7841. var $1;
  7842. $1=$self._atEnd();
  7843. if($core.assert($1)){
  7844. return nil;
  7845. } else {
  7846. return $self._subclassResponsibility();
  7847. }
  7848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7849. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  7850. //>>excludeEnd("ctx");
  7851. },
  7852. //>>excludeStart("ide", pragmas.excludeIdeData);
  7853. args: [],
  7854. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7855. referencedClasses: [],
  7856. //>>excludeEnd("ide");
  7857. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7858. }),
  7859. $globals.ProtoStream);
  7860. $core.addMethod(
  7861. $core.method({
  7862. selector: "reset",
  7863. protocol: "actions",
  7864. fn: function (){
  7865. var self=this,$self=this;
  7866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7867. return $core.withContext(function($ctx1) {
  7868. //>>excludeEnd("ctx");
  7869. $self._subclassResponsibility();
  7870. return self;
  7871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7872. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  7873. //>>excludeEnd("ctx");
  7874. },
  7875. //>>excludeStart("ide", pragmas.excludeIdeData);
  7876. args: [],
  7877. source: "reset\x0a\x09self subclassResponsibility",
  7878. referencedClasses: [],
  7879. //>>excludeEnd("ide");
  7880. messageSends: ["subclassResponsibility"]
  7881. }),
  7882. $globals.ProtoStream);
  7883. $core.addMethod(
  7884. $core.method({
  7885. selector: "resetContents",
  7886. protocol: "actions",
  7887. fn: function (){
  7888. var self=this,$self=this;
  7889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7890. return $core.withContext(function($ctx1) {
  7891. //>>excludeEnd("ctx");
  7892. $self._subclassResponsibility();
  7893. return self;
  7894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7895. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  7896. //>>excludeEnd("ctx");
  7897. },
  7898. //>>excludeStart("ide", pragmas.excludeIdeData);
  7899. args: [],
  7900. source: "resetContents\x0a\x09self subclassResponsibility",
  7901. referencedClasses: [],
  7902. //>>excludeEnd("ide");
  7903. messageSends: ["subclassResponsibility"]
  7904. }),
  7905. $globals.ProtoStream);
  7906. $core.addMethod(
  7907. $core.method({
  7908. selector: "setToEnd",
  7909. protocol: "positioning",
  7910. fn: function (){
  7911. var self=this,$self=this;
  7912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7913. return $core.withContext(function($ctx1) {
  7914. //>>excludeEnd("ctx");
  7915. $self._subclassResponsibility();
  7916. return self;
  7917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7918. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  7919. //>>excludeEnd("ctx");
  7920. },
  7921. //>>excludeStart("ide", pragmas.excludeIdeData);
  7922. args: [],
  7923. source: "setToEnd\x0a\x09self subclassResponsibility",
  7924. referencedClasses: [],
  7925. //>>excludeEnd("ide");
  7926. messageSends: ["subclassResponsibility"]
  7927. }),
  7928. $globals.ProtoStream);
  7929. $core.addMethod(
  7930. $core.method({
  7931. selector: "setToStart",
  7932. protocol: "positioning",
  7933. fn: function (){
  7934. var self=this,$self=this;
  7935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7936. return $core.withContext(function($ctx1) {
  7937. //>>excludeEnd("ctx");
  7938. $self._reset();
  7939. return self;
  7940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7941. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  7942. //>>excludeEnd("ctx");
  7943. },
  7944. //>>excludeStart("ide", pragmas.excludeIdeData);
  7945. args: [],
  7946. source: "setToStart\x0a\x09self reset",
  7947. referencedClasses: [],
  7948. //>>excludeEnd("ide");
  7949. messageSends: ["reset"]
  7950. }),
  7951. $globals.ProtoStream);
  7952. $core.addMethod(
  7953. $core.method({
  7954. selector: "write:",
  7955. protocol: "writing",
  7956. fn: function (anObject){
  7957. var self=this,$self=this;
  7958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7959. return $core.withContext(function($ctx1) {
  7960. //>>excludeEnd("ctx");
  7961. $recv(anObject)._putOn_(self);
  7962. return self;
  7963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7964. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  7965. //>>excludeEnd("ctx");
  7966. },
  7967. //>>excludeStart("ide", pragmas.excludeIdeData);
  7968. args: ["anObject"],
  7969. source: "write: anObject\x0a\x09anObject putOn: self",
  7970. referencedClasses: [],
  7971. //>>excludeEnd("ide");
  7972. messageSends: ["putOn:"]
  7973. }),
  7974. $globals.ProtoStream);
  7975. $core.addMethod(
  7976. $core.method({
  7977. selector: "on:",
  7978. protocol: "instance creation",
  7979. fn: function (aCollection){
  7980. var self=this,$self=this;
  7981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7982. return $core.withContext(function($ctx1) {
  7983. //>>excludeEnd("ctx");
  7984. var $1;
  7985. $1=$self._new();
  7986. $recv($1)._setCollection_(aCollection);
  7987. $recv($1)._setStreamSize_($recv(aCollection)._size());
  7988. return $recv($1)._yourself();
  7989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7990. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.a$cls)});
  7991. //>>excludeEnd("ctx");
  7992. },
  7993. //>>excludeStart("ide", pragmas.excludeIdeData);
  7994. args: ["aCollection"],
  7995. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  7996. referencedClasses: [],
  7997. //>>excludeEnd("ide");
  7998. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  7999. }),
  8000. $globals.ProtoStream.a$cls);
  8001. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  8002. //>>excludeStart("ide", pragmas.excludeIdeData);
  8003. $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.";
  8004. //>>excludeEnd("ide");
  8005. $core.addMethod(
  8006. $core.method({
  8007. selector: "atEnd",
  8008. protocol: "testing",
  8009. fn: function (){
  8010. var self=this,$self=this;
  8011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8012. return $core.withContext(function($ctx1) {
  8013. //>>excludeEnd("ctx");
  8014. return $recv($self._position()).__eq($self._size());
  8015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8016. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  8017. //>>excludeEnd("ctx");
  8018. },
  8019. //>>excludeStart("ide", pragmas.excludeIdeData);
  8020. args: [],
  8021. source: "atEnd\x0a\x09^ self position = self size",
  8022. referencedClasses: [],
  8023. //>>excludeEnd("ide");
  8024. messageSends: ["=", "position", "size"]
  8025. }),
  8026. $globals.Stream);
  8027. $core.addMethod(
  8028. $core.method({
  8029. selector: "atStart",
  8030. protocol: "testing",
  8031. fn: function (){
  8032. var self=this,$self=this;
  8033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8034. return $core.withContext(function($ctx1) {
  8035. //>>excludeEnd("ctx");
  8036. return $recv($self._position()).__eq((0));
  8037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8038. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  8039. //>>excludeEnd("ctx");
  8040. },
  8041. //>>excludeStart("ide", pragmas.excludeIdeData);
  8042. args: [],
  8043. source: "atStart\x0a\x09^ self position = 0",
  8044. referencedClasses: [],
  8045. //>>excludeEnd("ide");
  8046. messageSends: ["=", "position"]
  8047. }),
  8048. $globals.Stream);
  8049. $core.addMethod(
  8050. $core.method({
  8051. selector: "close",
  8052. protocol: "actions",
  8053. fn: function (){
  8054. var self=this,$self=this;
  8055. return self;
  8056. },
  8057. //>>excludeStart("ide", pragmas.excludeIdeData);
  8058. args: [],
  8059. source: "close",
  8060. referencedClasses: [],
  8061. //>>excludeEnd("ide");
  8062. messageSends: []
  8063. }),
  8064. $globals.Stream);
  8065. $core.addMethod(
  8066. $core.method({
  8067. selector: "collection",
  8068. protocol: "accessing",
  8069. fn: function (){
  8070. var self=this,$self=this;
  8071. return $self.collection;
  8072. },
  8073. //>>excludeStart("ide", pragmas.excludeIdeData);
  8074. args: [],
  8075. source: "collection\x0a\x09^ collection",
  8076. referencedClasses: [],
  8077. //>>excludeEnd("ide");
  8078. messageSends: []
  8079. }),
  8080. $globals.Stream);
  8081. $core.addMethod(
  8082. $core.method({
  8083. selector: "contents",
  8084. protocol: "accessing",
  8085. fn: function (){
  8086. var self=this,$self=this;
  8087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8088. return $core.withContext(function($ctx1) {
  8089. //>>excludeEnd("ctx");
  8090. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  8091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8092. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  8093. //>>excludeEnd("ctx");
  8094. },
  8095. //>>excludeStart("ide", pragmas.excludeIdeData);
  8096. args: [],
  8097. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8098. referencedClasses: [],
  8099. //>>excludeEnd("ide");
  8100. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8101. }),
  8102. $globals.Stream);
  8103. $core.addMethod(
  8104. $core.method({
  8105. selector: "flush",
  8106. protocol: "actions",
  8107. fn: function (){
  8108. var self=this,$self=this;
  8109. return self;
  8110. },
  8111. //>>excludeStart("ide", pragmas.excludeIdeData);
  8112. args: [],
  8113. source: "flush",
  8114. referencedClasses: [],
  8115. //>>excludeEnd("ide");
  8116. messageSends: []
  8117. }),
  8118. $globals.Stream);
  8119. $core.addMethod(
  8120. $core.method({
  8121. selector: "isEmpty",
  8122. protocol: "testing",
  8123. fn: function (){
  8124. var self=this,$self=this;
  8125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8126. return $core.withContext(function($ctx1) {
  8127. //>>excludeEnd("ctx");
  8128. return $recv($self._size()).__eq((0));
  8129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8130. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  8131. //>>excludeEnd("ctx");
  8132. },
  8133. //>>excludeStart("ide", pragmas.excludeIdeData);
  8134. args: [],
  8135. source: "isEmpty\x0a\x09^ self size = 0",
  8136. referencedClasses: [],
  8137. //>>excludeEnd("ide");
  8138. messageSends: ["=", "size"]
  8139. }),
  8140. $globals.Stream);
  8141. $core.addMethod(
  8142. $core.method({
  8143. selector: "next",
  8144. protocol: "reading",
  8145. fn: function (){
  8146. var self=this,$self=this;
  8147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8148. return $core.withContext(function($ctx1) {
  8149. //>>excludeEnd("ctx");
  8150. var $1,$3,$2;
  8151. $1=$self._atEnd();
  8152. if($core.assert($1)){
  8153. return nil;
  8154. } else {
  8155. $3=$self._position();
  8156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8157. $ctx1.sendIdx["position"]=1;
  8158. //>>excludeEnd("ctx");
  8159. $2=$recv($3).__plus((1));
  8160. $self._position_($2);
  8161. return $recv($self.collection)._at_($self._position());
  8162. }
  8163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8164. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  8165. //>>excludeEnd("ctx");
  8166. },
  8167. //>>excludeStart("ide", pragmas.excludeIdeData);
  8168. args: [],
  8169. 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 ]",
  8170. referencedClasses: [],
  8171. //>>excludeEnd("ide");
  8172. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8173. }),
  8174. $globals.Stream);
  8175. $core.addMethod(
  8176. $core.method({
  8177. selector: "next:",
  8178. protocol: "reading",
  8179. fn: function (anInteger){
  8180. var self=this,$self=this;
  8181. var tempCollection;
  8182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8183. return $core.withContext(function($ctx1) {
  8184. //>>excludeEnd("ctx");
  8185. var $1;
  8186. tempCollection=$recv($recv($self._collection())._class())._new();
  8187. $recv(anInteger)._timesRepeat_((function(){
  8188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8189. return $core.withContext(function($ctx2) {
  8190. //>>excludeEnd("ctx");
  8191. $1=$self._atEnd();
  8192. if(!$core.assert($1)){
  8193. return $recv(tempCollection)._add_($self._next());
  8194. }
  8195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8196. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8197. //>>excludeEnd("ctx");
  8198. }));
  8199. return tempCollection;
  8200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8201. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  8202. //>>excludeEnd("ctx");
  8203. },
  8204. //>>excludeStart("ide", pragmas.excludeIdeData);
  8205. args: ["anInteger"],
  8206. 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",
  8207. referencedClasses: [],
  8208. //>>excludeEnd("ide");
  8209. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8210. }),
  8211. $globals.Stream);
  8212. $core.addMethod(
  8213. $core.method({
  8214. selector: "nextPut:",
  8215. protocol: "writing",
  8216. fn: function (anObject){
  8217. var self=this,$self=this;
  8218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8219. return $core.withContext(function($ctx1) {
  8220. //>>excludeEnd("ctx");
  8221. var $2,$1,$3,$4;
  8222. $2=$self._position();
  8223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8224. $ctx1.sendIdx["position"]=1;
  8225. //>>excludeEnd("ctx");
  8226. $1=$recv($2).__plus((1));
  8227. $self._position_($1);
  8228. $3=$self._collection();
  8229. $4=$self._position();
  8230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8231. $ctx1.sendIdx["position"]=2;
  8232. //>>excludeEnd("ctx");
  8233. $recv($3)._at_put_($4,anObject);
  8234. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8235. return self;
  8236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8237. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  8238. //>>excludeEnd("ctx");
  8239. },
  8240. //>>excludeStart("ide", pragmas.excludeIdeData);
  8241. args: ["anObject"],
  8242. 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)",
  8243. referencedClasses: [],
  8244. //>>excludeEnd("ide");
  8245. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8246. }),
  8247. $globals.Stream);
  8248. $core.addMethod(
  8249. $core.method({
  8250. selector: "peek",
  8251. protocol: "reading",
  8252. fn: function (){
  8253. var self=this,$self=this;
  8254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8255. return $core.withContext(function($ctx1) {
  8256. //>>excludeEnd("ctx");
  8257. var $1;
  8258. $1=$self._atEnd();
  8259. if(!$core.assert($1)){
  8260. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  8261. }
  8262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8263. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  8264. //>>excludeEnd("ctx");
  8265. },
  8266. //>>excludeStart("ide", pragmas.excludeIdeData);
  8267. args: [],
  8268. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8269. referencedClasses: [],
  8270. //>>excludeEnd("ide");
  8271. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8272. }),
  8273. $globals.Stream);
  8274. $core.addMethod(
  8275. $core.method({
  8276. selector: "position",
  8277. protocol: "accessing",
  8278. fn: function (){
  8279. var self=this,$self=this;
  8280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8281. return $core.withContext(function($ctx1) {
  8282. //>>excludeEnd("ctx");
  8283. var $1,$receiver;
  8284. $1=$self.position;
  8285. if(($receiver = $1) == null || $receiver.a$nil){
  8286. $self.position=(0);
  8287. return $self.position;
  8288. } else {
  8289. return $1;
  8290. }
  8291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8292. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  8293. //>>excludeEnd("ctx");
  8294. },
  8295. //>>excludeStart("ide", pragmas.excludeIdeData);
  8296. args: [],
  8297. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  8298. referencedClasses: [],
  8299. //>>excludeEnd("ide");
  8300. messageSends: ["ifNil:"]
  8301. }),
  8302. $globals.Stream);
  8303. $core.addMethod(
  8304. $core.method({
  8305. selector: "position:",
  8306. protocol: "accessing",
  8307. fn: function (anInteger){
  8308. var self=this,$self=this;
  8309. $self.position=anInteger;
  8310. return self;
  8311. },
  8312. //>>excludeStart("ide", pragmas.excludeIdeData);
  8313. args: ["anInteger"],
  8314. source: "position: anInteger\x0a\x09position := anInteger",
  8315. referencedClasses: [],
  8316. //>>excludeEnd("ide");
  8317. messageSends: []
  8318. }),
  8319. $globals.Stream);
  8320. $core.addMethod(
  8321. $core.method({
  8322. selector: "reset",
  8323. protocol: "actions",
  8324. fn: function (){
  8325. var self=this,$self=this;
  8326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8327. return $core.withContext(function($ctx1) {
  8328. //>>excludeEnd("ctx");
  8329. $self._position_((0));
  8330. return self;
  8331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8332. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  8333. //>>excludeEnd("ctx");
  8334. },
  8335. //>>excludeStart("ide", pragmas.excludeIdeData);
  8336. args: [],
  8337. source: "reset\x0a\x09self position: 0",
  8338. referencedClasses: [],
  8339. //>>excludeEnd("ide");
  8340. messageSends: ["position:"]
  8341. }),
  8342. $globals.Stream);
  8343. $core.addMethod(
  8344. $core.method({
  8345. selector: "resetContents",
  8346. protocol: "actions",
  8347. fn: function (){
  8348. var self=this,$self=this;
  8349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8350. return $core.withContext(function($ctx1) {
  8351. //>>excludeEnd("ctx");
  8352. $self._reset();
  8353. $self._setStreamSize_((0));
  8354. return self;
  8355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8356. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  8357. //>>excludeEnd("ctx");
  8358. },
  8359. //>>excludeStart("ide", pragmas.excludeIdeData);
  8360. args: [],
  8361. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  8362. referencedClasses: [],
  8363. //>>excludeEnd("ide");
  8364. messageSends: ["reset", "setStreamSize:"]
  8365. }),
  8366. $globals.Stream);
  8367. $core.addMethod(
  8368. $core.method({
  8369. selector: "setCollection:",
  8370. protocol: "accessing",
  8371. fn: function (aCollection){
  8372. var self=this,$self=this;
  8373. $self.collection=aCollection;
  8374. return self;
  8375. },
  8376. //>>excludeStart("ide", pragmas.excludeIdeData);
  8377. args: ["aCollection"],
  8378. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  8379. referencedClasses: [],
  8380. //>>excludeEnd("ide");
  8381. messageSends: []
  8382. }),
  8383. $globals.Stream);
  8384. $core.addMethod(
  8385. $core.method({
  8386. selector: "setStreamSize:",
  8387. protocol: "accessing",
  8388. fn: function (anInteger){
  8389. var self=this,$self=this;
  8390. $self.streamSize=anInteger;
  8391. return self;
  8392. },
  8393. //>>excludeStart("ide", pragmas.excludeIdeData);
  8394. args: ["anInteger"],
  8395. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  8396. referencedClasses: [],
  8397. //>>excludeEnd("ide");
  8398. messageSends: []
  8399. }),
  8400. $globals.Stream);
  8401. $core.addMethod(
  8402. $core.method({
  8403. selector: "setToEnd",
  8404. protocol: "positioning",
  8405. fn: function (){
  8406. var self=this,$self=this;
  8407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8408. return $core.withContext(function($ctx1) {
  8409. //>>excludeEnd("ctx");
  8410. $self._position_($self._size());
  8411. return self;
  8412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8413. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  8414. //>>excludeEnd("ctx");
  8415. },
  8416. //>>excludeStart("ide", pragmas.excludeIdeData);
  8417. args: [],
  8418. source: "setToEnd\x0a\x09self position: self size",
  8419. referencedClasses: [],
  8420. //>>excludeEnd("ide");
  8421. messageSends: ["position:", "size"]
  8422. }),
  8423. $globals.Stream);
  8424. $core.addMethod(
  8425. $core.method({
  8426. selector: "size",
  8427. protocol: "accessing",
  8428. fn: function (){
  8429. var self=this,$self=this;
  8430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8431. return $core.withContext(function($ctx1) {
  8432. //>>excludeEnd("ctx");
  8433. return $self._streamSize();
  8434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8435. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  8436. //>>excludeEnd("ctx");
  8437. },
  8438. //>>excludeStart("ide", pragmas.excludeIdeData);
  8439. args: [],
  8440. source: "size\x0a\x09^ self streamSize",
  8441. referencedClasses: [],
  8442. //>>excludeEnd("ide");
  8443. messageSends: ["streamSize"]
  8444. }),
  8445. $globals.Stream);
  8446. $core.addMethod(
  8447. $core.method({
  8448. selector: "skip:",
  8449. protocol: "positioning",
  8450. fn: function (anInteger){
  8451. var self=this,$self=this;
  8452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8453. return $core.withContext(function($ctx1) {
  8454. //>>excludeEnd("ctx");
  8455. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  8456. return self;
  8457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8458. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  8459. //>>excludeEnd("ctx");
  8460. },
  8461. //>>excludeStart("ide", pragmas.excludeIdeData);
  8462. args: ["anInteger"],
  8463. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  8464. referencedClasses: [],
  8465. //>>excludeEnd("ide");
  8466. messageSends: ["position:", "min:max:", "+", "position", "size"]
  8467. }),
  8468. $globals.Stream);
  8469. $core.addMethod(
  8470. $core.method({
  8471. selector: "streamSize",
  8472. protocol: "accessing",
  8473. fn: function (){
  8474. var self=this,$self=this;
  8475. return $self.streamSize;
  8476. },
  8477. //>>excludeStart("ide", pragmas.excludeIdeData);
  8478. args: [],
  8479. source: "streamSize\x0a\x09^ streamSize",
  8480. referencedClasses: [],
  8481. //>>excludeEnd("ide");
  8482. messageSends: []
  8483. }),
  8484. $globals.Stream);
  8485. $core.addMethod(
  8486. $core.method({
  8487. selector: "on:",
  8488. protocol: "instance creation",
  8489. fn: function (aCollection){
  8490. var self=this,$self=this;
  8491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8492. return $core.withContext(function($ctx1) {
  8493. //>>excludeEnd("ctx");
  8494. var $1;
  8495. $1=$self._new();
  8496. $recv($1)._setCollection_(aCollection);
  8497. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8498. return $recv($1)._yourself();
  8499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8500. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.a$cls)});
  8501. //>>excludeEnd("ctx");
  8502. },
  8503. //>>excludeStart("ide", pragmas.excludeIdeData);
  8504. args: ["aCollection"],
  8505. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8506. referencedClasses: [],
  8507. //>>excludeEnd("ide");
  8508. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8509. }),
  8510. $globals.Stream.a$cls);
  8511. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  8512. //>>excludeStart("ide", pragmas.excludeIdeData);
  8513. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  8514. //>>excludeEnd("ide");
  8515. $core.addMethod(
  8516. $core.method({
  8517. selector: "cr",
  8518. protocol: "writing",
  8519. fn: function (){
  8520. var self=this,$self=this;
  8521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8522. return $core.withContext(function($ctx1) {
  8523. //>>excludeEnd("ctx");
  8524. return $self._nextPutAll_($recv($globals.String)._cr());
  8525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8526. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  8527. //>>excludeEnd("ctx");
  8528. },
  8529. //>>excludeStart("ide", pragmas.excludeIdeData);
  8530. args: [],
  8531. source: "cr\x0a\x09^ self nextPutAll: String cr",
  8532. referencedClasses: ["String"],
  8533. //>>excludeEnd("ide");
  8534. messageSends: ["nextPutAll:", "cr"]
  8535. }),
  8536. $globals.StringStream);
  8537. $core.addMethod(
  8538. $core.method({
  8539. selector: "crlf",
  8540. protocol: "writing",
  8541. fn: function (){
  8542. var self=this,$self=this;
  8543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8544. return $core.withContext(function($ctx1) {
  8545. //>>excludeEnd("ctx");
  8546. return $self._nextPutAll_($recv($globals.String)._crlf());
  8547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8548. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  8549. //>>excludeEnd("ctx");
  8550. },
  8551. //>>excludeStart("ide", pragmas.excludeIdeData);
  8552. args: [],
  8553. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  8554. referencedClasses: ["String"],
  8555. //>>excludeEnd("ide");
  8556. messageSends: ["nextPutAll:", "crlf"]
  8557. }),
  8558. $globals.StringStream);
  8559. $core.addMethod(
  8560. $core.method({
  8561. selector: "lf",
  8562. protocol: "writing",
  8563. fn: function (){
  8564. var self=this,$self=this;
  8565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8566. return $core.withContext(function($ctx1) {
  8567. //>>excludeEnd("ctx");
  8568. return $self._nextPutAll_($recv($globals.String)._lf());
  8569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8570. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  8571. //>>excludeEnd("ctx");
  8572. },
  8573. //>>excludeStart("ide", pragmas.excludeIdeData);
  8574. args: [],
  8575. source: "lf\x0a\x09^ self nextPutAll: String lf",
  8576. referencedClasses: ["String"],
  8577. //>>excludeEnd("ide");
  8578. messageSends: ["nextPutAll:", "lf"]
  8579. }),
  8580. $globals.StringStream);
  8581. $core.addMethod(
  8582. $core.method({
  8583. selector: "next:",
  8584. protocol: "reading",
  8585. fn: function (anInteger){
  8586. var self=this,$self=this;
  8587. var tempCollection;
  8588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8589. return $core.withContext(function($ctx1) {
  8590. //>>excludeEnd("ctx");
  8591. var $1;
  8592. tempCollection=$recv($recv($self._collection())._class())._new();
  8593. $recv(anInteger)._timesRepeat_((function(){
  8594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8595. return $core.withContext(function($ctx2) {
  8596. //>>excludeEnd("ctx");
  8597. $1=$self._atEnd();
  8598. if(!$core.assert($1)){
  8599. tempCollection=$recv(tempCollection).__comma($self._next());
  8600. return tempCollection;
  8601. }
  8602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8603. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8604. //>>excludeEnd("ctx");
  8605. }));
  8606. return tempCollection;
  8607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8608. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  8609. //>>excludeEnd("ctx");
  8610. },
  8611. //>>excludeStart("ide", pragmas.excludeIdeData);
  8612. args: ["anInteger"],
  8613. 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",
  8614. referencedClasses: [],
  8615. //>>excludeEnd("ide");
  8616. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  8617. }),
  8618. $globals.StringStream);
  8619. $core.addMethod(
  8620. $core.method({
  8621. selector: "nextPut:",
  8622. protocol: "writing",
  8623. fn: function (aString){
  8624. var self=this,$self=this;
  8625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8626. return $core.withContext(function($ctx1) {
  8627. //>>excludeEnd("ctx");
  8628. $self._nextPutAll_(aString);
  8629. return self;
  8630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8631. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  8632. //>>excludeEnd("ctx");
  8633. },
  8634. //>>excludeStart("ide", pragmas.excludeIdeData);
  8635. args: ["aString"],
  8636. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  8637. referencedClasses: [],
  8638. //>>excludeEnd("ide");
  8639. messageSends: ["nextPutAll:"]
  8640. }),
  8641. $globals.StringStream);
  8642. $core.addMethod(
  8643. $core.method({
  8644. selector: "nextPutAll:",
  8645. protocol: "writing",
  8646. fn: function (aString){
  8647. var self=this,$self=this;
  8648. var pre,post;
  8649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8650. return $core.withContext(function($ctx1) {
  8651. //>>excludeEnd("ctx");
  8652. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  8653. $1=$self._atEnd();
  8654. if($core.assert($1)){
  8655. $3=$self._collection();
  8656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8657. $ctx1.sendIdx["collection"]=1;
  8658. //>>excludeEnd("ctx");
  8659. $2=$recv($3).__comma(aString);
  8660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8661. $ctx1.sendIdx[","]=1;
  8662. //>>excludeEnd("ctx");
  8663. $self._setCollection_($2);
  8664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8665. $ctx1.sendIdx["setCollection:"]=1;
  8666. //>>excludeEnd("ctx");
  8667. } else {
  8668. $4=$self._collection();
  8669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8670. $ctx1.sendIdx["collection"]=2;
  8671. //>>excludeEnd("ctx");
  8672. $5=$self._position();
  8673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8674. $ctx1.sendIdx["position"]=1;
  8675. //>>excludeEnd("ctx");
  8676. pre=$recv($4)._copyFrom_to_((1),$5);
  8677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8678. $ctx1.sendIdx["copyFrom:to:"]=1;
  8679. //>>excludeEnd("ctx");
  8680. $6=$self._collection();
  8681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8682. $ctx1.sendIdx["collection"]=3;
  8683. //>>excludeEnd("ctx");
  8684. $9=$self._position();
  8685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8686. $ctx1.sendIdx["position"]=2;
  8687. //>>excludeEnd("ctx");
  8688. $8=$recv($9).__plus((1));
  8689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8690. $ctx1.sendIdx["+"]=2;
  8691. //>>excludeEnd("ctx");
  8692. $10=$recv(aString)._size();
  8693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8694. $ctx1.sendIdx["size"]=1;
  8695. //>>excludeEnd("ctx");
  8696. $7=$recv($8).__plus($10);
  8697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8698. $ctx1.sendIdx["+"]=1;
  8699. //>>excludeEnd("ctx");
  8700. $11=$recv($self._collection())._size();
  8701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8702. $ctx1.sendIdx["size"]=2;
  8703. //>>excludeEnd("ctx");
  8704. post=$recv($6)._copyFrom_to_($7,$11);
  8705. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  8706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8707. $ctx1.sendIdx[","]=2;
  8708. //>>excludeEnd("ctx");
  8709. $self._setCollection_($12);
  8710. }
  8711. $14=$self._position();
  8712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8713. $ctx1.sendIdx["position"]=3;
  8714. //>>excludeEnd("ctx");
  8715. $13=$recv($14).__plus($recv(aString)._size());
  8716. $self._position_($13);
  8717. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8718. return self;
  8719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8720. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  8721. //>>excludeEnd("ctx");
  8722. },
  8723. //>>excludeStart("ide", pragmas.excludeIdeData);
  8724. args: ["aString"],
  8725. 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)",
  8726. referencedClasses: [],
  8727. //>>excludeEnd("ide");
  8728. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  8729. }),
  8730. $globals.StringStream);
  8731. $core.addMethod(
  8732. $core.method({
  8733. selector: "nextPutString:",
  8734. protocol: "writing",
  8735. fn: function (aString){
  8736. var self=this,$self=this;
  8737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8738. return $core.withContext(function($ctx1) {
  8739. //>>excludeEnd("ctx");
  8740. $self._nextPutAll_(aString);
  8741. return self;
  8742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8743. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  8744. //>>excludeEnd("ctx");
  8745. },
  8746. //>>excludeStart("ide", pragmas.excludeIdeData);
  8747. args: ["aString"],
  8748. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  8749. referencedClasses: [],
  8750. //>>excludeEnd("ide");
  8751. messageSends: ["nextPutAll:"]
  8752. }),
  8753. $globals.StringStream);
  8754. $core.addMethod(
  8755. $core.method({
  8756. selector: "print:",
  8757. protocol: "writing",
  8758. fn: function (anObject){
  8759. var self=this,$self=this;
  8760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8761. return $core.withContext(function($ctx1) {
  8762. //>>excludeEnd("ctx");
  8763. $recv(anObject)._printOn_(self);
  8764. return self;
  8765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8766. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  8767. //>>excludeEnd("ctx");
  8768. },
  8769. //>>excludeStart("ide", pragmas.excludeIdeData);
  8770. args: ["anObject"],
  8771. source: "print: anObject\x0a\x09anObject printOn: self",
  8772. referencedClasses: [],
  8773. //>>excludeEnd("ide");
  8774. messageSends: ["printOn:"]
  8775. }),
  8776. $globals.StringStream);
  8777. $core.addMethod(
  8778. $core.method({
  8779. selector: "printSymbol:",
  8780. protocol: "writing",
  8781. fn: function (anObject){
  8782. var self=this,$self=this;
  8783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8784. return $core.withContext(function($ctx1) {
  8785. //>>excludeEnd("ctx");
  8786. $recv(anObject)._asSymbolPrintOn_(self);
  8787. return self;
  8788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8789. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  8790. //>>excludeEnd("ctx");
  8791. },
  8792. //>>excludeStart("ide", pragmas.excludeIdeData);
  8793. args: ["anObject"],
  8794. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  8795. referencedClasses: [],
  8796. //>>excludeEnd("ide");
  8797. messageSends: ["asSymbolPrintOn:"]
  8798. }),
  8799. $globals.StringStream);
  8800. $core.addMethod(
  8801. $core.method({
  8802. selector: "space",
  8803. protocol: "writing",
  8804. fn: function (){
  8805. var self=this,$self=this;
  8806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8807. return $core.withContext(function($ctx1) {
  8808. //>>excludeEnd("ctx");
  8809. $self._nextPut_(" ");
  8810. return self;
  8811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8812. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  8813. //>>excludeEnd("ctx");
  8814. },
  8815. //>>excludeStart("ide", pragmas.excludeIdeData);
  8816. args: [],
  8817. source: "space\x0a\x09self nextPut: ' '",
  8818. referencedClasses: [],
  8819. //>>excludeEnd("ide");
  8820. messageSends: ["nextPut:"]
  8821. }),
  8822. $globals.StringStream);
  8823. $core.addMethod(
  8824. $core.method({
  8825. selector: "tab",
  8826. protocol: "writing",
  8827. fn: function (){
  8828. var self=this,$self=this;
  8829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8830. return $core.withContext(function($ctx1) {
  8831. //>>excludeEnd("ctx");
  8832. return $self._nextPutAll_($recv($globals.String)._tab());
  8833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8834. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  8835. //>>excludeEnd("ctx");
  8836. },
  8837. //>>excludeStart("ide", pragmas.excludeIdeData);
  8838. args: [],
  8839. source: "tab\x0a\x09^ self nextPutAll: String tab",
  8840. referencedClasses: ["String"],
  8841. //>>excludeEnd("ide");
  8842. messageSends: ["nextPutAll:", "tab"]
  8843. }),
  8844. $globals.StringStream);
  8845. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  8846. //>>excludeStart("ide", pragmas.excludeIdeData);
  8847. $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.";
  8848. //>>excludeEnd("ide");
  8849. $core.addMethod(
  8850. $core.method({
  8851. selector: "initialize",
  8852. protocol: "initialization",
  8853. fn: function (){
  8854. var self=this,$self=this;
  8855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8856. return $core.withContext(function($ctx1) {
  8857. //>>excludeEnd("ctx");
  8858. (
  8859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8860. $ctx1.supercall = true,
  8861. //>>excludeEnd("ctx");
  8862. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  8863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8864. $ctx1.supercall = false;
  8865. //>>excludeEnd("ctx");;
  8866. $self.read=$recv($globals.OrderedCollection)._new();
  8867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8868. $ctx1.sendIdx["new"]=1;
  8869. //>>excludeEnd("ctx");
  8870. $self.write=$recv($globals.OrderedCollection)._new();
  8871. $self.readIndex=(1);
  8872. return self;
  8873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8874. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  8875. //>>excludeEnd("ctx");
  8876. },
  8877. //>>excludeStart("ide", pragmas.excludeIdeData);
  8878. args: [],
  8879. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  8880. referencedClasses: ["OrderedCollection"],
  8881. //>>excludeEnd("ide");
  8882. messageSends: ["initialize", "new"]
  8883. }),
  8884. $globals.Queue);
  8885. $core.addMethod(
  8886. $core.method({
  8887. selector: "next",
  8888. protocol: "accessing",
  8889. fn: function (){
  8890. var self=this,$self=this;
  8891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8892. return $core.withContext(function($ctx1) {
  8893. //>>excludeEnd("ctx");
  8894. return $self._nextIfAbsent_((function(){
  8895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8896. return $core.withContext(function($ctx2) {
  8897. //>>excludeEnd("ctx");
  8898. return $self._error_("Cannot read from empty Queue.");
  8899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8900. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8901. //>>excludeEnd("ctx");
  8902. }));
  8903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8904. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  8905. //>>excludeEnd("ctx");
  8906. },
  8907. //>>excludeStart("ide", pragmas.excludeIdeData);
  8908. args: [],
  8909. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  8910. referencedClasses: [],
  8911. //>>excludeEnd("ide");
  8912. messageSends: ["nextIfAbsent:", "error:"]
  8913. }),
  8914. $globals.Queue);
  8915. $core.addMethod(
  8916. $core.method({
  8917. selector: "nextIfAbsent:",
  8918. protocol: "accessing",
  8919. fn: function (aBlock){
  8920. var self=this,$self=this;
  8921. var result;
  8922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8923. return $core.withContext(function($ctx1) {
  8924. //>>excludeEnd("ctx");
  8925. var $1;
  8926. var $early={};
  8927. try {
  8928. result=$recv($self.read)._at_ifAbsent_($self.readIndex,(function(){
  8929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8930. return $core.withContext(function($ctx2) {
  8931. //>>excludeEnd("ctx");
  8932. $recv($self.write)._ifEmpty_((function(){
  8933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8934. return $core.withContext(function($ctx3) {
  8935. //>>excludeEnd("ctx");
  8936. $1=$recv($self.readIndex).__gt((1));
  8937. if($core.assert($1)){
  8938. $self.read=[];
  8939. $self.readIndex=(1);
  8940. $self.readIndex;
  8941. }
  8942. throw $early=[$recv(aBlock)._value()];
  8943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8944. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  8945. //>>excludeEnd("ctx");
  8946. }));
  8947. $self.read=$self.write;
  8948. $self.readIndex=(1);
  8949. $self.write=$recv($globals.OrderedCollection)._new();
  8950. return $recv($self.read)._first();
  8951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8952. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8953. //>>excludeEnd("ctx");
  8954. }));
  8955. $recv($self.read)._at_put_($self.readIndex,nil);
  8956. $self.readIndex=$recv($self.readIndex).__plus((1));
  8957. return result;
  8958. }
  8959. catch(e) {if(e===$early)return e[0]; throw e}
  8960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8961. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  8962. //>>excludeEnd("ctx");
  8963. },
  8964. //>>excludeStart("ide", pragmas.excludeIdeData);
  8965. args: ["aBlock"],
  8966. 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",
  8967. referencedClasses: ["OrderedCollection"],
  8968. //>>excludeEnd("ide");
  8969. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  8970. }),
  8971. $globals.Queue);
  8972. $core.addMethod(
  8973. $core.method({
  8974. selector: "nextPut:",
  8975. protocol: "accessing",
  8976. fn: function (anObject){
  8977. var self=this,$self=this;
  8978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8979. return $core.withContext(function($ctx1) {
  8980. //>>excludeEnd("ctx");
  8981. $recv($self.write)._add_(anObject);
  8982. return self;
  8983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8984. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  8985. //>>excludeEnd("ctx");
  8986. },
  8987. //>>excludeStart("ide", pragmas.excludeIdeData);
  8988. args: ["anObject"],
  8989. source: "nextPut: anObject\x0a\x09write add: anObject",
  8990. referencedClasses: [],
  8991. //>>excludeEnd("ide");
  8992. messageSends: ["add:"]
  8993. }),
  8994. $globals.Queue);
  8995. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  8996. //>>excludeStart("ide", pragmas.excludeIdeData);
  8997. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  8998. //>>excludeEnd("ide");
  8999. $core.addMethod(
  9000. $core.method({
  9001. selector: "compile:",
  9002. protocol: "evaluating",
  9003. fn: function (aString){
  9004. var self=this,$self=this;
  9005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9006. return $core.withContext(function($ctx1) {
  9007. //>>excludeEnd("ctx");
  9008. return self.compile(aString);
  9009. return self;
  9010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9011. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  9012. //>>excludeEnd("ctx");
  9013. },
  9014. //>>excludeStart("ide", pragmas.excludeIdeData);
  9015. args: ["aString"],
  9016. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  9017. referencedClasses: [],
  9018. //>>excludeEnd("ide");
  9019. messageSends: []
  9020. }),
  9021. $globals.RegularExpression);
  9022. $core.addMethod(
  9023. $core.method({
  9024. selector: "exec:",
  9025. protocol: "evaluating",
  9026. fn: function (aString){
  9027. var self=this,$self=this;
  9028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9029. return $core.withContext(function($ctx1) {
  9030. //>>excludeEnd("ctx");
  9031. return self.exec(aString) || nil;
  9032. return self;
  9033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9034. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  9035. //>>excludeEnd("ctx");
  9036. },
  9037. //>>excludeStart("ide", pragmas.excludeIdeData);
  9038. args: ["aString"],
  9039. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  9040. referencedClasses: [],
  9041. //>>excludeEnd("ide");
  9042. messageSends: []
  9043. }),
  9044. $globals.RegularExpression);
  9045. $core.addMethod(
  9046. $core.method({
  9047. selector: "test:",
  9048. protocol: "evaluating",
  9049. fn: function (aString){
  9050. var self=this,$self=this;
  9051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9052. return $core.withContext(function($ctx1) {
  9053. //>>excludeEnd("ctx");
  9054. return self.test(aString);
  9055. return self;
  9056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9057. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  9058. //>>excludeEnd("ctx");
  9059. },
  9060. //>>excludeStart("ide", pragmas.excludeIdeData);
  9061. args: ["aString"],
  9062. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  9063. referencedClasses: [],
  9064. //>>excludeEnd("ide");
  9065. messageSends: []
  9066. }),
  9067. $globals.RegularExpression);
  9068. $core.addMethod(
  9069. $core.method({
  9070. selector: "fromString:",
  9071. protocol: "instance creation",
  9072. fn: function (aString){
  9073. var self=this,$self=this;
  9074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9075. return $core.withContext(function($ctx1) {
  9076. //>>excludeEnd("ctx");
  9077. return $self._fromString_flag_(aString,"");
  9078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9079. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.a$cls)});
  9080. //>>excludeEnd("ctx");
  9081. },
  9082. //>>excludeStart("ide", pragmas.excludeIdeData);
  9083. args: ["aString"],
  9084. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9085. referencedClasses: [],
  9086. //>>excludeEnd("ide");
  9087. messageSends: ["fromString:flag:"]
  9088. }),
  9089. $globals.RegularExpression.a$cls);
  9090. $core.addMethod(
  9091. $core.method({
  9092. selector: "fromString:flag:",
  9093. protocol: "instance creation",
  9094. fn: function (aString,anotherString){
  9095. var self=this,$self=this;
  9096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9097. return $core.withContext(function($ctx1) {
  9098. //>>excludeEnd("ctx");
  9099. return new RegExp(aString, anotherString);
  9100. return self;
  9101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9102. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.a$cls)});
  9103. //>>excludeEnd("ctx");
  9104. },
  9105. //>>excludeStart("ide", pragmas.excludeIdeData);
  9106. args: ["aString", "anotherString"],
  9107. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  9108. referencedClasses: [],
  9109. //>>excludeEnd("ide");
  9110. messageSends: []
  9111. }),
  9112. $globals.RegularExpression.a$cls);
  9113. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  9114. $core.addMethod(
  9115. $core.method({
  9116. selector: "at:",
  9117. protocol: "accessing",
  9118. fn: function (anIndex){
  9119. var self=this,$self=this;
  9120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9121. return $core.withContext(function($ctx1) {
  9122. //>>excludeEnd("ctx");
  9123. return $self._at_ifAbsent_(anIndex,(function(){
  9124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9125. return $core.withContext(function($ctx2) {
  9126. //>>excludeEnd("ctx");
  9127. return $self._errorNotFound();
  9128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9130. //>>excludeEnd("ctx");
  9131. }));
  9132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9133. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.TKeyValueCollection)});
  9134. //>>excludeEnd("ctx");
  9135. },
  9136. //>>excludeStart("ide", pragmas.excludeIdeData);
  9137. args: ["anIndex"],
  9138. 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 ]",
  9139. referencedClasses: [],
  9140. //>>excludeEnd("ide");
  9141. messageSends: ["at:ifAbsent:", "errorNotFound"]
  9142. }),
  9143. $globals.TKeyValueCollection);
  9144. $core.addMethod(
  9145. $core.method({
  9146. selector: "at:ifAbsent:",
  9147. protocol: "accessing",
  9148. fn: function (anIndex,aBlock){
  9149. var self=this,$self=this;
  9150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9151. return $core.withContext(function($ctx1) {
  9152. //>>excludeEnd("ctx");
  9153. $self._subclassResponsibility();
  9154. return self;
  9155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9156. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.TKeyValueCollection)});
  9157. //>>excludeEnd("ctx");
  9158. },
  9159. //>>excludeStart("ide", pragmas.excludeIdeData);
  9160. args: ["anIndex", "aBlock"],
  9161. 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",
  9162. referencedClasses: [],
  9163. //>>excludeEnd("ide");
  9164. messageSends: ["subclassResponsibility"]
  9165. }),
  9166. $globals.TKeyValueCollection);
  9167. $core.addMethod(
  9168. $core.method({
  9169. selector: "at:ifAbsentPut:",
  9170. protocol: "accessing",
  9171. fn: function (aKey,aBlock){
  9172. var self=this,$self=this;
  9173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9174. return $core.withContext(function($ctx1) {
  9175. //>>excludeEnd("ctx");
  9176. return $self._at_ifAbsent_(aKey,(function(){
  9177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9178. return $core.withContext(function($ctx2) {
  9179. //>>excludeEnd("ctx");
  9180. return $self._at_put_(aKey,$recv(aBlock)._value());
  9181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9182. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9183. //>>excludeEnd("ctx");
  9184. }));
  9185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9186. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.TKeyValueCollection)});
  9187. //>>excludeEnd("ctx");
  9188. },
  9189. //>>excludeStart("ide", pragmas.excludeIdeData);
  9190. args: ["aKey", "aBlock"],
  9191. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  9192. referencedClasses: [],
  9193. //>>excludeEnd("ide");
  9194. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  9195. }),
  9196. $globals.TKeyValueCollection);
  9197. $core.addMethod(
  9198. $core.method({
  9199. selector: "at:ifPresent:",
  9200. protocol: "accessing",
  9201. fn: function (anIndex,aBlock){
  9202. var self=this,$self=this;
  9203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9204. return $core.withContext(function($ctx1) {
  9205. //>>excludeEnd("ctx");
  9206. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  9207. return nil;
  9208. }));
  9209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9210. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.TKeyValueCollection)});
  9211. //>>excludeEnd("ctx");
  9212. },
  9213. //>>excludeStart("ide", pragmas.excludeIdeData);
  9214. args: ["anIndex", "aBlock"],
  9215. 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 ]",
  9216. referencedClasses: [],
  9217. //>>excludeEnd("ide");
  9218. messageSends: ["at:ifPresent:ifAbsent:"]
  9219. }),
  9220. $globals.TKeyValueCollection);
  9221. $core.addMethod(
  9222. $core.method({
  9223. selector: "at:ifPresent:ifAbsent:",
  9224. protocol: "accessing",
  9225. fn: function (anIndex,aBlock,anotherBlock){
  9226. var self=this,$self=this;
  9227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9228. return $core.withContext(function($ctx1) {
  9229. //>>excludeEnd("ctx");
  9230. $self._subclassResponsibility();
  9231. return self;
  9232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9233. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TKeyValueCollection)});
  9234. //>>excludeEnd("ctx");
  9235. },
  9236. //>>excludeStart("ide", pragmas.excludeIdeData);
  9237. args: ["anIndex", "aBlock", "anotherBlock"],
  9238. 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",
  9239. referencedClasses: [],
  9240. //>>excludeEnd("ide");
  9241. messageSends: ["subclassResponsibility"]
  9242. }),
  9243. $globals.TKeyValueCollection);
  9244. $core.addMethod(
  9245. $core.method({
  9246. selector: "at:put:",
  9247. protocol: "accessing",
  9248. fn: function (anIndex,anObject){
  9249. var self=this,$self=this;
  9250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9251. return $core.withContext(function($ctx1) {
  9252. //>>excludeEnd("ctx");
  9253. $self._subclassResponsibility();
  9254. return self;
  9255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9256. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.TKeyValueCollection)});
  9257. //>>excludeEnd("ctx");
  9258. },
  9259. //>>excludeStart("ide", pragmas.excludeIdeData);
  9260. args: ["anIndex", "anObject"],
  9261. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  9262. referencedClasses: [],
  9263. //>>excludeEnd("ide");
  9264. messageSends: ["subclassResponsibility"]
  9265. }),
  9266. $globals.TKeyValueCollection);
  9267. $core.addMethod(
  9268. $core.method({
  9269. selector: "indexOf:",
  9270. protocol: "accessing",
  9271. fn: function (anObject){
  9272. var self=this,$self=this;
  9273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9274. return $core.withContext(function($ctx1) {
  9275. //>>excludeEnd("ctx");
  9276. return $self._indexOf_ifAbsent_(anObject,(function(){
  9277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9278. return $core.withContext(function($ctx2) {
  9279. //>>excludeEnd("ctx");
  9280. return $self._errorNotFound();
  9281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9283. //>>excludeEnd("ctx");
  9284. }));
  9285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9286. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.TKeyValueCollection)});
  9287. //>>excludeEnd("ctx");
  9288. },
  9289. //>>excludeStart("ide", pragmas.excludeIdeData);
  9290. args: ["anObject"],
  9291. 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 ]",
  9292. referencedClasses: [],
  9293. //>>excludeEnd("ide");
  9294. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  9295. }),
  9296. $globals.TKeyValueCollection);
  9297. $core.addMethod(
  9298. $core.method({
  9299. selector: "indexOf:ifAbsent:",
  9300. protocol: "accessing",
  9301. fn: function (anObject,aBlock){
  9302. var self=this,$self=this;
  9303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9304. return $core.withContext(function($ctx1) {
  9305. //>>excludeEnd("ctx");
  9306. $self._subclassResponsibility();
  9307. return self;
  9308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9309. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.TKeyValueCollection)});
  9310. //>>excludeEnd("ctx");
  9311. },
  9312. //>>excludeStart("ide", pragmas.excludeIdeData);
  9313. args: ["anObject", "aBlock"],
  9314. 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",
  9315. referencedClasses: [],
  9316. //>>excludeEnd("ide");
  9317. messageSends: ["subclassResponsibility"]
  9318. }),
  9319. $globals.TKeyValueCollection);
  9320. $core.addMethod(
  9321. $core.method({
  9322. selector: "with:do:",
  9323. protocol: "enumerating",
  9324. fn: function (anotherCollection,aBlock){
  9325. var self=this,$self=this;
  9326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9327. return $core.withContext(function($ctx1) {
  9328. //>>excludeEnd("ctx");
  9329. $self._withIndexDo_((function(each,index){
  9330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9331. return $core.withContext(function($ctx2) {
  9332. //>>excludeEnd("ctx");
  9333. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  9334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9335. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  9336. //>>excludeEnd("ctx");
  9337. }));
  9338. return self;
  9339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9340. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.TKeyValueCollection)});
  9341. //>>excludeEnd("ctx");
  9342. },
  9343. //>>excludeStart("ide", pragmas.excludeIdeData);
  9344. args: ["anotherCollection", "aBlock"],
  9345. 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) ]",
  9346. referencedClasses: [],
  9347. //>>excludeEnd("ide");
  9348. messageSends: ["withIndexDo:", "value:value:", "at:"]
  9349. }),
  9350. $globals.TKeyValueCollection);
  9351. $core.addMethod(
  9352. $core.method({
  9353. selector: "withIndexDo:",
  9354. protocol: "enumerating",
  9355. fn: function (aBlock){
  9356. var self=this,$self=this;
  9357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9358. return $core.withContext(function($ctx1) {
  9359. //>>excludeEnd("ctx");
  9360. $self._subclassResponsibility();
  9361. return self;
  9362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9363. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.TKeyValueCollection)});
  9364. //>>excludeEnd("ctx");
  9365. },
  9366. //>>excludeStart("ide", pragmas.excludeIdeData);
  9367. args: ["aBlock"],
  9368. 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",
  9369. referencedClasses: [],
  9370. //>>excludeEnd("ide");
  9371. messageSends: ["subclassResponsibility"]
  9372. }),
  9373. $globals.TKeyValueCollection);
  9374. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  9375. $core.addMethod(
  9376. $core.method({
  9377. selector: "at:ifAbsent:",
  9378. protocol: "accessing",
  9379. fn: function (anIndex,aBlock){
  9380. var self=this,$self=this;
  9381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9382. return $core.withContext(function($ctx1) {
  9383. //>>excludeEnd("ctx");
  9384. return anIndex >= 1 && anIndex <= self.length
  9385. ? self[anIndex - 1]
  9386. : aBlock._value()
  9387. ;
  9388. return self;
  9389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9390. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9391. //>>excludeEnd("ctx");
  9392. },
  9393. //>>excludeStart("ide", pragmas.excludeIdeData);
  9394. args: ["anIndex", "aBlock"],
  9395. 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'>",
  9396. referencedClasses: [],
  9397. //>>excludeEnd("ide");
  9398. messageSends: []
  9399. }),
  9400. $globals.TNativeZeroBasedCollection);
  9401. $core.addMethod(
  9402. $core.method({
  9403. selector: "at:ifPresent:ifAbsent:",
  9404. protocol: "accessing",
  9405. fn: function (anIndex,aBlock,anotherBlock){
  9406. var self=this,$self=this;
  9407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9408. return $core.withContext(function($ctx1) {
  9409. //>>excludeEnd("ctx");
  9410. return anIndex >= 1 && anIndex <= self.length
  9411. ? aBlock._value_(self[anIndex - 1])
  9412. : anotherBlock._value()
  9413. ;
  9414. return self;
  9415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9416. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TNativeZeroBasedCollection)});
  9417. //>>excludeEnd("ctx");
  9418. },
  9419. //>>excludeStart("ide", pragmas.excludeIdeData);
  9420. args: ["anIndex", "aBlock", "anotherBlock"],
  9421. 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'>",
  9422. referencedClasses: [],
  9423. //>>excludeEnd("ide");
  9424. messageSends: []
  9425. }),
  9426. $globals.TNativeZeroBasedCollection);
  9427. $core.addMethod(
  9428. $core.method({
  9429. selector: "detect:ifNone:",
  9430. protocol: "enumerating",
  9431. fn: function (aBlock,anotherBlock){
  9432. var self=this,$self=this;
  9433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9434. return $core.withContext(function($ctx1) {
  9435. //>>excludeEnd("ctx");
  9436. for(var i = 0; i < self.length; i++)
  9437. if(aBlock._value_(self[i]))
  9438. return self[i];
  9439. return anotherBlock._value();
  9440. ;
  9441. return self;
  9442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9443. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.TNativeZeroBasedCollection)});
  9444. //>>excludeEnd("ctx");
  9445. },
  9446. //>>excludeStart("ide", pragmas.excludeIdeData);
  9447. args: ["aBlock", "anotherBlock"],
  9448. 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'>",
  9449. referencedClasses: [],
  9450. //>>excludeEnd("ide");
  9451. messageSends: []
  9452. }),
  9453. $globals.TNativeZeroBasedCollection);
  9454. $core.addMethod(
  9455. $core.method({
  9456. selector: "do:",
  9457. protocol: "enumerating",
  9458. fn: function (aBlock){
  9459. var self=this,$self=this;
  9460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9461. return $core.withContext(function($ctx1) {
  9462. //>>excludeEnd("ctx");
  9463. for(var i=0; i < self.length; i++) {
  9464. aBlock._value_(self[i]);
  9465. }
  9466. ;
  9467. return self;
  9468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9469. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9470. //>>excludeEnd("ctx");
  9471. },
  9472. //>>excludeStart("ide", pragmas.excludeIdeData);
  9473. args: ["aBlock"],
  9474. 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'>",
  9475. referencedClasses: [],
  9476. //>>excludeEnd("ide");
  9477. messageSends: []
  9478. }),
  9479. $globals.TNativeZeroBasedCollection);
  9480. $core.addMethod(
  9481. $core.method({
  9482. selector: "indexOf:ifAbsent:",
  9483. protocol: "accessing",
  9484. fn: function (anObject,aBlock){
  9485. var self=this,$self=this;
  9486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9487. return $core.withContext(function($ctx1) {
  9488. //>>excludeEnd("ctx");
  9489. for(var i=0; i < self.length; i++) {
  9490. if($recv(self[i]).__eq(anObject)) {return i+1}
  9491. };
  9492. return aBlock._value();
  9493. ;
  9494. return self;
  9495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9496. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9497. //>>excludeEnd("ctx");
  9498. },
  9499. //>>excludeStart("ide", pragmas.excludeIdeData);
  9500. args: ["anObject", "aBlock"],
  9501. 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'>",
  9502. referencedClasses: [],
  9503. //>>excludeEnd("ide");
  9504. messageSends: []
  9505. }),
  9506. $globals.TNativeZeroBasedCollection);
  9507. $core.addMethod(
  9508. $core.method({
  9509. selector: "indexOf:startingAt:ifAbsent:",
  9510. protocol: "accessing",
  9511. fn: function (anObject,start,aBlock){
  9512. var self=this,$self=this;
  9513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9514. return $core.withContext(function($ctx1) {
  9515. //>>excludeEnd("ctx");
  9516. for(var i=start - 1; i < self.length; i++){
  9517. if($recv(self[i]).__eq(anObject)) {return i+1}
  9518. }
  9519. return aBlock._value();
  9520. ;
  9521. return self;
  9522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9523. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9524. //>>excludeEnd("ctx");
  9525. },
  9526. //>>excludeStart("ide", pragmas.excludeIdeData);
  9527. args: ["anObject", "start", "aBlock"],
  9528. 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'>",
  9529. referencedClasses: [],
  9530. //>>excludeEnd("ide");
  9531. messageSends: []
  9532. }),
  9533. $globals.TNativeZeroBasedCollection);
  9534. $core.addMethod(
  9535. $core.method({
  9536. selector: "single",
  9537. protocol: "accessing",
  9538. fn: function (){
  9539. var self=this,$self=this;
  9540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9541. return $core.withContext(function($ctx1) {
  9542. //>>excludeEnd("ctx");
  9543. if (self.length == 0) throw new Error("Collection is empty");
  9544. if (self.length > 1) throw new Error("Collection holds more than one element.");
  9545. return self[0];;
  9546. return self;
  9547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9548. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.TNativeZeroBasedCollection)});
  9549. //>>excludeEnd("ctx");
  9550. },
  9551. //>>excludeStart("ide", pragmas.excludeIdeData);
  9552. args: [],
  9553. 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'>",
  9554. referencedClasses: [],
  9555. //>>excludeEnd("ide");
  9556. messageSends: []
  9557. }),
  9558. $globals.TNativeZeroBasedCollection);
  9559. $core.addMethod(
  9560. $core.method({
  9561. selector: "size",
  9562. protocol: "accessing",
  9563. fn: function (){
  9564. var self=this,$self=this;
  9565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9566. return $core.withContext(function($ctx1) {
  9567. //>>excludeEnd("ctx");
  9568. return self.length;
  9569. return self;
  9570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9571. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.TNativeZeroBasedCollection)});
  9572. //>>excludeEnd("ctx");
  9573. },
  9574. //>>excludeStart("ide", pragmas.excludeIdeData);
  9575. args: [],
  9576. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  9577. referencedClasses: [],
  9578. //>>excludeEnd("ide");
  9579. messageSends: []
  9580. }),
  9581. $globals.TNativeZeroBasedCollection);
  9582. $core.addMethod(
  9583. $core.method({
  9584. selector: "with:do:",
  9585. protocol: "enumerating",
  9586. fn: function (anotherCollection,aBlock){
  9587. var self=this,$self=this;
  9588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9589. return $core.withContext(function($ctx1) {
  9590. //>>excludeEnd("ctx");
  9591. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  9592. for(var i=0; i<self.length; i++) {
  9593. aBlock._value_value_(self[i], anotherCollection[i]);
  9594. }
  9595. ;
  9596. return self;
  9597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9598. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9599. //>>excludeEnd("ctx");
  9600. },
  9601. //>>excludeStart("ide", pragmas.excludeIdeData);
  9602. args: ["anotherCollection", "aBlock"],
  9603. 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'>",
  9604. referencedClasses: [],
  9605. //>>excludeEnd("ide");
  9606. messageSends: []
  9607. }),
  9608. $globals.TNativeZeroBasedCollection);
  9609. $core.addMethod(
  9610. $core.method({
  9611. selector: "withIndexDo:",
  9612. protocol: "enumerating",
  9613. fn: function (aBlock){
  9614. var self=this,$self=this;
  9615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9616. return $core.withContext(function($ctx1) {
  9617. //>>excludeEnd("ctx");
  9618. for(var i=0; i < self.length; i++) {
  9619. aBlock._value_value_(self[i], i+1);
  9620. }
  9621. ;
  9622. return self;
  9623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9624. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  9625. //>>excludeEnd("ctx");
  9626. },
  9627. //>>excludeStart("ide", pragmas.excludeIdeData);
  9628. args: ["aBlock"],
  9629. 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'>",
  9630. referencedClasses: [],
  9631. //>>excludeEnd("ide");
  9632. messageSends: []
  9633. }),
  9634. $globals.TNativeZeroBasedCollection);
  9635. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  9636. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  9637. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  9638. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  9639. });